mirror of
https://github.com/storytold/craft-anything.git
synced 2026-11-21 20:08:24 +00:00
Sign in to a website from Make (R2.9) (#2182)
* Claim R2.9 sign-in button on Make * Sign in to a website from Make (R2.9) A website address typed on Make now offers "Sign in to this site", which runs web_site_sign_in for that address, so a site behind a login can be signed in to from the app, not only from the CLI, MCP or the agent. One window at a time; while it's open the row says so and offers "Stop waiting", and Start (and every other way a start is reached) waits. The result is said in a message: kept, still asking to sign in, check failed, timed out or stopped. * Let the i18n check see the sign-in messages The sign-in toasts and the button's hover text were looked up through a variable or inside format!, so i18n-coverage counted their awaiting.txt entries as unused and the gate failed. Look each one up with tr() on the literal. * Name the site in sign-in messages and wait for project creation The sign-in button stays disabled while a new project is being made, so its build can't study the site before the sign-in ends. Each sign-in message starts with the address the sign-in was started for, which may no longer be the one on Make. A closed window without a password field is reported as closed, not as signed in. The tool is matched by its constant. * Keep credentials out of sign-in toasts and show the i18n check every sign-in string The site named in a sign-in toast drops userinfo, query and fragment, as the engine does for URLs it shows. "Stopped the sign-in." is looked up outside format! and the i18n check now reads Button::new labels, so neither awaiting entry is reported as unshown. * Hold an update's install while a sign-in window is open Installing closes the app, and the sign-in's job is invisible, so jobs.busy() didn't see it: closing then could lose the sign-in before the browser profile is saved. The install gate is now safe_to_install(), which also waits for signing_in. --------- Co-authored-by: Mansur Akhmadi <[email protected]> Co-authored-by: Tanish Manku <[email protected]>
This commit is contained in:
co-authored by
Mansur Akhmadi
Tanish Manku
parent
1c8d406ae7
commit
a14e94fbde
@@ -11,3 +11,17 @@ Auto: building tools only below a 64k window, every tool from there.
|
||||
Auto: every tool, as this AI is a paid service.
|
||||
Change a builder's tools
|
||||
That folder's name has characters Craft Anything can't read. Pick another folder.
|
||||
Does the site show more once you're signed in?
|
||||
Sign in to this site
|
||||
A browser window opens: sign in there yourself, then close it. Craft Anything never sees your password. The sign-in is kept on this computer and used when this site is studied.
|
||||
Sign in in the browser window that opened, then close it.
|
||||
Stop waiting
|
||||
Finish signing in to the site first.
|
||||
Couldn't sign in to the site.
|
||||
The sign-in window was closed. Studies of this site will use what it saved.
|
||||
Your sign-in was saved, but the site still asks you to sign in. Sign in again and choose "remember me" if the site offers it.
|
||||
Your sign-in was saved, but opening the site again to check it didn't work.
|
||||
The sign-in window was open too long, so it was closed. What it had saved is kept.
|
||||
Stopped waiting for the sign-in window. What it had saved is kept.
|
||||
Stopped the sign-in.
|
||||
Wait until the new project is made.
|
||||
|
||||
@@ -47,6 +47,7 @@ pub mod workbench;
|
||||
|
||||
use craft_anything_ai::{AgentEvent, AiHub, BackendConfig, Conversation, Detected};
|
||||
use craft_anything_engine::evidence::{ErrorCode, Evidence, ToolError, Unknown};
|
||||
use craft_anything_engine::tools::site_sign_in::SIGN_IN_TOOL;
|
||||
use craft_anything_engine::{CallOptions, Caller, Consent, Engine, Mode, Settings, TargetKind, ToolOutput, clean_room};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
@@ -585,6 +586,8 @@ pub struct CraftApp {
|
||||
saving: Option<u64>,
|
||||
/// A new project being made (Start waits for it).
|
||||
pub creating: Option<u64>,
|
||||
/// A website sign-in window open from Make (one at a time; Start waits for it).
|
||||
pub signing_in: Option<u64>,
|
||||
/// Tools the UI started that wait for the person's consent, by the id on their card.
|
||||
pending_consent: std::collections::HashMap<u64, (String, Value, Route)>,
|
||||
next_consent: u64,
|
||||
@@ -689,6 +692,7 @@ impl CraftApp {
|
||||
save_due: None,
|
||||
saving: None,
|
||||
creating: None,
|
||||
signing_in: None,
|
||||
chat_jobs: Vec::new(),
|
||||
asking: Default::default(),
|
||||
pausing: Default::default(),
|
||||
@@ -1059,6 +1063,15 @@ impl CraftApp {
|
||||
})
|
||||
}
|
||||
|
||||
/// Open a browser window on a website for the person to sign in to it themselves, so studies
|
||||
/// of that site see it signed in (`web_site_sign_in`). One window at a time, and not while a
|
||||
/// new project is being made: its build would start and study the site before the sign-in ends.
|
||||
pub fn sign_in_to_site(&mut self, url: &str) {
|
||||
if self.signing_in.is_none() && self.creating.is_none() {
|
||||
self.signing_in = Some(self.act(SIGN_IN_TOOL, json!({ "url": url }), tr("Sign in to a website")));
|
||||
}
|
||||
}
|
||||
|
||||
fn acted(&mut self, job: u64, tool: &str, params: &Value, result: Result<Value, ToolError>) {
|
||||
match (tool, result) {
|
||||
("project_preview", Ok(v)) => {
|
||||
@@ -1117,6 +1130,20 @@ impl CraftApp {
|
||||
self.toast(format!("{} {}", tr("Some plugins couldn't be read:"), failed.join("; ")), true);
|
||||
}
|
||||
}
|
||||
// Each message names the site it was for: the address on Make may have changed since.
|
||||
(SIGN_IN_TOOL, Ok(v)) => {
|
||||
let (words, warn) = make::sign_in_words(&v);
|
||||
self.toast(format!("{}: {words}", make::site_name(params)), warn);
|
||||
}
|
||||
// "Stop waiting" before the window was up (or while another tool held the session).
|
||||
(SIGN_IN_TOOL, Err(e)) if e.code == ErrorCode::Cancelled => {
|
||||
let stopped = tr("Stopped the sign-in.");
|
||||
self.toast(format!("{}: {stopped}", make::site_name(params)), false)
|
||||
}
|
||||
(SIGN_IN_TOOL, Err(e)) if !clean_room::is_refusal(&e) => {
|
||||
let failed = tr("Couldn't sign in to the site.");
|
||||
self.toast(format!("{}: {failed} {}", make::site_name(params), e.for_people()), true);
|
||||
}
|
||||
("project_open_folder", Err(e)) => self.toast(format!("{} {}", tr("Couldn't open the folder."), e.message), true),
|
||||
(
|
||||
"game_archives_list"
|
||||
@@ -1556,6 +1583,9 @@ impl CraftApp {
|
||||
if self.creating == Some(job) {
|
||||
self.creating = None;
|
||||
}
|
||||
if self.signing_in == Some(job) {
|
||||
self.signing_in = None;
|
||||
}
|
||||
// The form's own request: a newer Add replaces it, and an older answer is then stale.
|
||||
let form_request = self.server_form.connecting.as_ref().is_some_and(|(id, ..)| *id == job);
|
||||
if form_request {
|
||||
@@ -1994,17 +2024,26 @@ impl CraftApp {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether an update may install now: it closes the app, so not while work is running or
|
||||
/// unsaved, nor while a sign-in window is open (its job is invisible, and closing would lose
|
||||
/// the sign-in before the browser profile is saved).
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub(crate) fn safe_to_install(&self) -> bool {
|
||||
!self.jobs.busy()
|
||||
&& !self.runs.any_busy()
|
||||
&& !self.conversation.as_ref().is_some_and(|c| c.is_busy())
|
||||
&& !self.settings_dirty
|
||||
&& self.save_due.is_none()
|
||||
&& self.saving.is_none()
|
||||
&& self.signing_in.is_none()
|
||||
}
|
||||
|
||||
/// Draw the whole interface.
|
||||
pub fn show(&mut self, ui: &mut egui::Ui) {
|
||||
let ctx = ui.ctx().clone();
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
let safe = !self.jobs.busy()
|
||||
&& !self.runs.any_busy()
|
||||
&& !self.conversation.as_ref().is_some_and(|c| c.is_busy())
|
||||
&& !self.settings_dirty
|
||||
&& self.save_due.is_none()
|
||||
&& self.saving.is_none();
|
||||
let safe = self.safe_to_install();
|
||||
if self.updates.show(&ctx, safe) {
|
||||
return;
|
||||
}
|
||||
|
||||
+106
-2
@@ -7,6 +7,7 @@ use crate::state::{MakeDraft, Screen};
|
||||
use crate::theme::{self, Tokens};
|
||||
use crate::{CraftApp, Pick, icons, widgets};
|
||||
use craft_anything_engine::Mode;
|
||||
use craft_anything_engine::tools::web_common;
|
||||
use craft_anything_engine::workspace::{ExistingFiles, Status, TargetRef};
|
||||
use egui::{RichText, Sense, Ui, Vec2};
|
||||
|
||||
@@ -158,10 +159,14 @@ pub fn hero(app: &mut CraftApp, ui: &mut Ui, w: f32) {
|
||||
ui.horizontal(|ui| {
|
||||
crate::builders::built_by(app, ui);
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
let ready = !app.state.make.request.trim().is_empty() && url_problem(&app.state.make.url).is_none() && app.creating.is_none();
|
||||
let ready = !app.state.make.request.trim().is_empty()
|
||||
&& url_problem(&app.state.make.url).is_none()
|
||||
&& app.creating.is_none()
|
||||
&& app.signing_in.is_none();
|
||||
let start =
|
||||
ui.add(widgets::Button::new(widgets::ButtonKind::Primary, "Start").icon(Some("sparkles")).size(theme::ControlSize::Hero).enabled(ready));
|
||||
let start = if ready { start } else { start.on_disabled_hover_text(tr("Say what you want first.")) };
|
||||
let wait = if app.signing_in.is_some() { "Finish signing in to the site first." } else { "Say what you want first." };
|
||||
let start = if ready { start } else { start.on_disabled_hover_text(tr(wait)) };
|
||||
if (start.clicked() || submit) && ready {
|
||||
app.start_make();
|
||||
}
|
||||
@@ -409,6 +414,63 @@ fn choose_target(app: &mut CraftApp, ui: &mut Ui) {
|
||||
});
|
||||
}
|
||||
}
|
||||
let m = &app.state.make;
|
||||
let url = (website && !m.url.trim().is_empty() && url_problem(&m.url).is_none()).then(|| normalize_url(&m.url));
|
||||
// A window already open stays in view (with its way out) whatever is picked meanwhile.
|
||||
if url.is_some() || app.signing_in.is_some() {
|
||||
sign_in(app, ui, url.as_deref());
|
||||
}
|
||||
}
|
||||
|
||||
/// A site that shows more to someone signed in: the person signs in to it in a browser window
|
||||
/// of its own, and studies of the site then see what they see (`web_site_sign_in`).
|
||||
fn sign_in(app: &mut CraftApp, ui: &mut Ui, url: Option<&str>) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
ui.add_space(theme::space::SM);
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
icons::show(ui, "key-round", theme::icon::MD, t.icon);
|
||||
if let Some(job) = app.signing_in {
|
||||
ui.label(RichText::new(tr("Sign in in the browser window that opened, then close it.")).size(theme::SMALL).color(t.text_dim));
|
||||
if widgets::link(ui, "Stop waiting").clicked() {
|
||||
app.jobs.cancel(job);
|
||||
}
|
||||
} else if let Some(url) = url {
|
||||
ui.label(RichText::new(tr("Does the site show more once you're signed in?")).size(theme::SMALL).color(t.text_dim));
|
||||
let hint = tr("A browser window opens: sign in there yourself, then close it. Craft Anything never sees your password. The sign-in is kept on this computer and used when this site is studied.");
|
||||
let free = app.creating.is_none();
|
||||
let button = ui.add(widgets::Button::new(widgets::ButtonKind::Secondary, "Sign in to this site").enabled(free));
|
||||
let button = if free { button.on_hover_text(hint) } else { button.on_disabled_hover_text(tr("Wait until the new project is made.")) };
|
||||
if button.clicked() && free {
|
||||
app.sign_in_to_site(url);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// What to tell the person once a sign-in window has closed, from `web_site_sign_in`'s result,
|
||||
/// and whether it's a warning.
|
||||
pub fn sign_in_words(result: &serde_json::Value) -> (String, bool) {
|
||||
let check = &result["check"];
|
||||
match result["ended"].as_str() {
|
||||
Some("timed_out") => (tr("The sign-in window was open too long, so it was closed. What it had saved is kept."), true),
|
||||
Some("cancelled") => (tr("Stopped waiting for the sign-in window. What it had saved is kept."), false),
|
||||
_ if check["sign_in_page"].as_bool() == Some(true) => {
|
||||
(tr("Your sign-in was saved, but the site still asks you to sign in. Sign in again and choose \"remember me\" if the site offers it."), true)
|
||||
}
|
||||
_ if check["done"].as_bool() != Some(true) => (tr("Your sign-in was saved, but opening the site again to check it didn't work."), true),
|
||||
// No password field after the window closed doesn't prove a sign-in (a public page, a
|
||||
// passwordless flow): say what happened, not what it may mean.
|
||||
_ => (tr("The sign-in window was closed. Studies of this site will use what it saved."), false),
|
||||
}
|
||||
}
|
||||
|
||||
/// The site a `web_site_sign_in` call was for, as the person typed it (without `https://`), less
|
||||
/// any credentials, query or fragment: it's shown in a toast.
|
||||
pub fn site_name(params: &serde_json::Value) -> String {
|
||||
let url = web_common::sanitize_url(params["url"].as_str().unwrap_or_default());
|
||||
let url = url.split(['?', '#']).next().unwrap_or_default();
|
||||
let host = url.split_once("://").map_or(url, |(_, rest)| rest);
|
||||
host.strip_suffix('/').unwrap_or(host).to_string()
|
||||
}
|
||||
|
||||
/// Clean room or Deep for what is recreated: the title bar's switch, as a plain choice.
|
||||
@@ -581,6 +643,17 @@ pub fn project_icon(m: &craft_anything_engine::workspace::Manifest) -> &'static
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[test]
|
||||
fn no_update_installs_while_a_sign_in_window_is_open() {
|
||||
let mut app = crate::demo::app(crate::demo::engine(craft_anything_engine::Mode::Beginner, true));
|
||||
assert!(app.safe_to_install());
|
||||
app.signing_in = Some(1);
|
||||
assert!(!app.safe_to_install(), "installing closes the app before the sign-in is saved");
|
||||
app.signing_in = None;
|
||||
assert!(app.safe_to_install(), "and is fine again once it ends");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn web_addresses_are_checked_inline() {
|
||||
for ok in ["", "example.com", "https://a.b/c?d", "http://localhost:5173", "sub.example.co.uk/page"] {
|
||||
@@ -612,6 +685,37 @@ mod tests {
|
||||
assert!(is_game(&kinds, &start_from), "material to start from doesn't decide");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_closed_sign_in_window_says_what_was_kept() {
|
||||
use serde_json::json;
|
||||
let checked = |sign_in_page: bool| json!({"done": true, "sign_in_page": sign_in_page, "error": null});
|
||||
let words = |ended: &str, check: serde_json::Value| sign_in_words(&json!({"saved": true, "ended": ended, "check": check}));
|
||||
assert_eq!(words("closed", checked(false)), ("The sign-in window was closed. Studies of this site will use what it saved.".to_string(), false));
|
||||
let (still_asks, warn) = words("closed", checked(true));
|
||||
assert!(warn && still_asks.contains("still asks you to sign in"), "{still_asks}");
|
||||
let (unchecked, warn) = words("closed", json!({"done": false, "sign_in_page": null, "error": "the browser closed"}));
|
||||
assert!(warn && unchecked.contains("didn't work"), "{unchecked}");
|
||||
let (late, warn) = words("timed_out", checked(false));
|
||||
assert!(warn && late.contains("open too long"), "{late}");
|
||||
let (stopped, warn) = words("cancelled", checked(false));
|
||||
assert!(!warn && stopped.starts_with("Stopped waiting"), "{stopped}");
|
||||
// A result without a check (an older or a changed tool) isn't taken for a good sign-in.
|
||||
assert!(sign_in_words(&json!({"saved": true})).1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_sign_in_names_the_site_as_typed() {
|
||||
use serde_json::json;
|
||||
assert_eq!(site_name(&json!({"url": "https://example.com"})), "example.com");
|
||||
assert_eq!(site_name(&json!({"url": "https://example.com/"})), "example.com");
|
||||
assert_eq!(site_name(&json!({"url": "http://example.com:8080/app"})), "example.com:8080/app");
|
||||
assert_eq!(site_name(&json!({})), "");
|
||||
// A toast never shows credentials, a query or a fragment.
|
||||
assert_eq!(site_name(&json!({"url": "https://alice:[email protected]/app?token=abc#k"})), "example.com/app");
|
||||
assert_eq!(site_name(&json!({"url": "https://example.com/?token=abc"})), "example.com");
|
||||
assert_eq!(site_name(&json!({"url": "https://example.com/@profile"})), "example.com/@profile");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn targets_from_the_draft() {
|
||||
let mut d = MakeDraft { request: "Please recreate https://example.com/pricing.".into(), ..Default::default() };
|
||||
|
||||
@@ -63,6 +63,10 @@ impl CraftApp {
|
||||
if request.is_empty() {
|
||||
return;
|
||||
}
|
||||
// A study started now would open the site signed out, or find its sign-in busy.
|
||||
if self.signing_in.is_some() {
|
||||
return self.toast(tr("Finish signing in to the site first."), true);
|
||||
}
|
||||
let Some(backend) = self.builder_backend(draft.ai.as_deref()) else { return self.need_builder(true) };
|
||||
// Make's pictures are still being checked: start once they are in.
|
||||
if self.pending_make_checks > 0 {
|
||||
|
||||
@@ -132,6 +132,7 @@ const ACTIONS: &[Action] = &[
|
||||
a("open_path", "open an app or file as the target", Tool(&["core_target_open"])),
|
||||
a("first_look", "a first look at the target", Tool(&["core_target_triage"])),
|
||||
a("Home › Open a website", "open a web page as the target", Tool(&["web_site_open"])),
|
||||
a("sign_in_to_site", "sign in to a website so studies see it signed in", Tool(&["web_site_sign_in"])),
|
||||
a("Workbench › Targets", "switch between open targets", Tool(&["core_target_select", "core_targets_list"])),
|
||||
a("send", "ask about the target", Cli("chat <question> --target")),
|
||||
a("answer_consent", "allow or refuse running a program", Cli("tool <id> --allow-run")),
|
||||
|
||||
@@ -968,6 +968,80 @@ fn website_choice_stays_picked_while_the_address_is_empty() {
|
||||
assert!(h.query_by_label("Type the website's address:").is_none());
|
||||
}
|
||||
|
||||
/// A website typed on Make can be signed in to from there (`web_site_sign_in`), one sign-in at a
|
||||
/// time, and Start waits until it's over.
|
||||
#[test]
|
||||
fn a_website_is_signed_in_to_from_make() {
|
||||
let store = tempfile::tempdir().unwrap();
|
||||
let store_dir = store.path().to_path_buf();
|
||||
let mut h = harness(move || {
|
||||
let mut a = demo::app(demo::engine(Mode::Beginner, true));
|
||||
// No browser here: only the path set (not there) and an empty engine store are looked at,
|
||||
// so the sign-in fails at once, as on a computer without one, and no window opens. The
|
||||
// app hands its settings to the session, so both get them.
|
||||
let engines = &mut a.settings.engines;
|
||||
engines.only_configured = true;
|
||||
engines.store_dir = Some(store_dir);
|
||||
engines.tools.chromium = Some("/nowhere/chromium".into());
|
||||
a.engine.session().settings.engines = a.settings.engines.clone();
|
||||
a
|
||||
});
|
||||
h.run_steps(3);
|
||||
h.get_by_label("A website").click();
|
||||
h.run_steps(2);
|
||||
assert!(h.query_by_label("Sign in to this site").is_none(), "no address yet");
|
||||
h.state_mut().state.make.url = "two words.com".into();
|
||||
h.run_steps(2);
|
||||
assert!(h.query_by_label("Sign in to this site").is_none(), "not an address a sign-in can be saved for");
|
||||
h.state_mut().state.make.url = "example.com".into();
|
||||
h.state_mut().state.make.request = "Recreate this website".into();
|
||||
h.run_steps(2);
|
||||
h.get_by_label("Sign in to this site").click();
|
||||
h.run_steps(1);
|
||||
assert!(h.state().signing_in.is_some(), "the sign-in started");
|
||||
assert!(wait(&mut h, |a| a.signing_in.is_none()), "and ended");
|
||||
assert!(
|
||||
h.state().state.toasts.iter().any(|(t, err)| *err && t.starts_with("example.com: Couldn't sign in to the site.") && t.contains("chromium")),
|
||||
"{:?}",
|
||||
h.state().state.toasts
|
||||
);
|
||||
h.run_steps(2);
|
||||
h.get_by_label("Sign in to this site");
|
||||
|
||||
// Not while a new project is being made: its build would study the site before the sign-in ends.
|
||||
h.state_mut().creating = Some(u64::MAX);
|
||||
h.run_steps(2);
|
||||
h.get_by_label("Sign in to this site").click();
|
||||
h.run_steps(1);
|
||||
assert!(h.state().signing_in.is_none(), "no sign-in while a project is made");
|
||||
h.state_mut().sign_in_to_site("https://example.com");
|
||||
assert!(h.state().signing_in.is_none(), "nor from elsewhere");
|
||||
h.state_mut().creating = None;
|
||||
|
||||
// While a sign-in window is open: no second one, a way to stop waiting, and Start waits.
|
||||
h.state_mut().signing_in = Some(u64::MAX);
|
||||
h.run_steps(2);
|
||||
assert!(h.query_by_label("Sign in to this site").is_none());
|
||||
h.get_by_label("Stop waiting");
|
||||
h.get_by_label("Start").click();
|
||||
h.run_steps(2);
|
||||
assert!(h.state().creating.is_none(), "nothing starts before the sign-in is over");
|
||||
assert_eq!(h.state().state.screen, Screen::Home);
|
||||
// Nor from the other ways a start is reached (a builder picked, an engine got).
|
||||
h.state_mut().start_make();
|
||||
h.run_steps(1);
|
||||
assert!(h.state().creating.is_none());
|
||||
assert!(h.state().state.toasts.iter().any(|(t, _)| t == "Finish signing in to the site first."), "{:?}", h.state().state.toasts);
|
||||
// The way out stays while the address changes or another kind of original is picked.
|
||||
h.state_mut().state.make.url.clear();
|
||||
h.run_steps(2);
|
||||
h.get_by_label("Stop waiting");
|
||||
h.get_by_label("Nothing — start fresh").click();
|
||||
h.run_steps(2);
|
||||
h.get_by_label("Stop waiting");
|
||||
assert!(h.query_by_label("Sign in to this site").is_none());
|
||||
}
|
||||
|
||||
/// Make's Simple / Advanced switch changes the app's mode and keeps the screen and the draft (#1286).
|
||||
#[test]
|
||||
fn the_make_card_switches_simple_and_advanced_and_keeps_the_draft() {
|
||||
|
||||
+7
-2
@@ -2054,8 +2054,13 @@ Gaps found while using the app for real projects.
|
||||
guidance treats saved-profile use as unverified authentication, even without a password page.
|
||||
The interactive sign-in runs without holding the engine session lock; same-site profile
|
||||
operations fail fast while reserved, without blocking other sites or explicitly fresh opens.
|
||||
- [ ] A "Sign in to this site" button in the Make screen for website targets (`web_site_sign_in`
|
||||
is reachable only as a tool, from the CLI, MCP or the agent, today)
|
||||
- [x] A "Sign in to this site" button in the Make screen for website targets: a typed address
|
||||
offers it, it runs `web_site_sign_in` for that site (one window at a time, "Stop waiting"
|
||||
cancels the wait), Start waits until it's over, and a message says what was kept. Not run
|
||||
with a real browser window from the app
|
||||
— claimed: mansur-akhmadi, branch feature/r2.9-make-site-sign-in
|
||||
- [ ] Make doesn't say whether a sign-in is already saved for the typed site, nor offer to forget
|
||||
it (`web_site_sign_out`); an address found only in the request has no sign-in button
|
||||
- [ ] Study with the person's own already-running browser through its debugging endpoint, as an
|
||||
alternative to a saved sign-in
|
||||
- [ ] Sign in once with `web_site_sign_in` on a real site behind a login (and with the Ubuntu
|
||||
|
||||
+1
-1
@@ -443,7 +443,7 @@ coverage and secrets passed. The companion CLI was built with locked dependencie
|
||||
| Bogus HTML comments | Unknown declarations and malformed end tags no longer contribute scripts or preloads hidden inside comment text. | Fixtures cover both openers, EOF and resuming at real tags. |
|
||||
| Incomplete HTML start tags | Script, preload, title and CSP evidence comes from complete start tags. Earlier complete tags survive a truncated page ending. | Fixtures cover quoted and unquoted attributes, a quoted greater-than sign, and complete tags. |
|
||||
| HTML meta security policy list | Page evidence retains nonempty meta security policies in document order in the existing string field. | Fixtures cover multiple policies and blank or missing content. |
|
||||
| Websites as targets | `web_site_open` keeps a private browser for the session and deletes its temporary profile when the browser closes or fails to start, and on macOS and Linux a watcher stops the browser and deletes the profile if the app ends without closing it (#810); every browser tool inspects that page; `web_site_capture` records screenshots at each width (desktop, tablet and phone), rendered HTML, design tokens (colours in hex, spacing, content widths), the CSS breakpoints, the layout at each width (page width, heading sizes, each section's padding, gap, content column and items per row), page health (script and console errors, failed requests) and an accessibility outline, layout outline, assets with font files and requests, links and form outlines. In Clean room the capture keeps only what a visitor sees (no HTML, CSS rules, scripts, requests or errors), and opening a site reports no load errors. A JavaScript dialog the page opens by itself no longer stalls the open (#2010): an `alert` or `beforeunload` is accepted so the page can go on, a `confirm` or `prompt` is dismissed so nothing is agreed to for the person, and the result and page health list each dialog with its answer (in Clean room too). A site behind a sign-in can be studied signed in (#1178): `web_site_sign_in` opens a visible window where the person signs in themselves (we never see the password or read cookies; saving passwords, addresses and cards is turned off in those profiles, and the browser's password and card stores are never copied, including from profiles saved before), the profile is copied into Craft Anything's config folder when the window closes, and later opens of that normalized host and effective port use a copy by default (HTTP defaults to 80, HTTPS to 443). The sign-in window waits without holding the engine session lock, so other tools remain usable; overlapping same-site saved-profile operations return a retryable busy error, while other sites and explicitly fresh opens remain available. Replacing the saved profile restarts the study browser; `signed_in: false` always starts fresh, and `web_site_sign_out` forgets it; a restricted MCP server (`--restricted`, even with `--allow-web`) always opens fresh and refuses `signed_in: true`; a sign-in records its evidence and journal entry in the project it started in, and Stop ends its wait for a busy session without losing that record; `capture.json` and the brief say when a capture was signed in, and a signed-out capture of a page with a password field suggests signing in. Sign-ins that last only while the browser is open are kept too (the sign-in profile is set to continue where it left off). Right after saving, the site is opened once more headless to check it: `check.sign_in_page` says whether it still asks for a password, with a picture kept in the site's own owner-only folder. A capture using a saved profile that still asks for a password says the sign-in may have ended. Otherwise the builder is told profile use does not prove authentication (public pages and passwordless sign-in can still be signed out), and to ask the person if the intended view is unclear. The Flatpak build can't start a browser on the computer (#841) | Live runs on example.com and a local page with Chromium on Linux, and on a local page that opens an `alert` on first visit with Chrome 157 on macOS (timed out before #2010, opens after); including profile cleanup after success and failed startup; the sign-in handoff (window under a virtual display, a scripted sign-in, headless capture signed in), overlapping signed-in opens, the timeout and no-desktop paths ran live with Chromium 157 on Linux against a local test site; the window's own report (`chrome://version`, `chrome://prefs-internals`) that it opens the `Default` profile with password and card saving off ran live with Chrome for Testing 156 (`the_sign_in_window_runs_the_prepared_profile_with_saving_off`, with a `--no-sandbox` wrapper because this host's AppArmor refuses an unprofiled Chromium's sandbox); unit tests. Session-lock concurrency, cancellation finalization and same-site reservations have deterministic stand-in regressions; no new live-browser run for that correction. Brave on macOS was not run; a confined Snap or Flatpak browser and a real site's sign-in were not run |
|
||||
| Websites as targets | `web_site_open` keeps a private browser for the session and deletes its temporary profile when the browser closes or fails to start, and on macOS and Linux a watcher stops the browser and deletes the profile if the app ends without closing it (#810); every browser tool inspects that page; `web_site_capture` records screenshots at each width (desktop, tablet and phone), rendered HTML, design tokens (colours in hex, spacing, content widths), the CSS breakpoints, the layout at each width (page width, heading sizes, each section's padding, gap, content column and items per row), page health (script and console errors, failed requests) and an accessibility outline, layout outline, assets with font files and requests, links and form outlines. In Clean room the capture keeps only what a visitor sees (no HTML, CSS rules, scripts, requests or errors), and opening a site reports no load errors. A JavaScript dialog the page opens by itself no longer stalls the open (#2010): an `alert` or `beforeunload` is accepted so the page can go on, a `confirm` or `prompt` is dismissed so nothing is agreed to for the person, and the result and page health list each dialog with its answer (in Clean room too). A site behind a sign-in can be studied signed in (#1178): `web_site_sign_in` opens a visible window where the person signs in themselves (we never see the password or read cookies; saving passwords, addresses and cards is turned off in those profiles, and the browser's password and card stores are never copied, including from profiles saved before), the profile is copied into Craft Anything's config folder when the window closes, and later opens of that normalized host and effective port use a copy by default (HTTP defaults to 80, HTTPS to 443). The sign-in window waits without holding the engine session lock, so other tools remain usable; overlapping same-site saved-profile operations return a retryable busy error, while other sites and explicitly fresh opens remain available. Replacing the saved profile restarts the study browser; `signed_in: false` always starts fresh, and `web_site_sign_out` forgets it; a restricted MCP server (`--restricted`, even with `--allow-web`) always opens fresh and refuses `signed_in: true`; a sign-in records its evidence and journal entry in the project it started in, and Stop ends its wait for a busy session without losing that record; `capture.json` and the brief say when a capture was signed in, and a signed-out capture of a page with a password field suggests signing in. Sign-ins that last only while the browser is open are kept too (the sign-in profile is set to continue where it left off). Right after saving, the site is opened once more headless to check it: `check.sign_in_page` says whether it still asks for a password, with a picture kept in the site's own owner-only folder. A capture using a saved profile that still asks for a password says the sign-in may have ended. Otherwise the builder is told profile use does not prove authentication (public pages and passwordless sign-in can still be signed out), and to ask the person if the intended view is unclear. In the app, a website address typed on Make offers "Sign in to this site", which runs `web_site_sign_in` for it: one window at a time, Start waits until it's closed (or "Stop waiting"), and a message says whether the sign-in was kept, the site still asks to sign in, or the check didn't work. The Flatpak build can't start a browser on the computer (#841) | Live runs on example.com and a local page with Chromium on Linux, and on a local page that opens an `alert` on first visit with Chrome 157 on macOS (timed out before #2010, opens after); including profile cleanup after success and failed startup; the sign-in handoff (window under a virtual display, a scripted sign-in, headless capture signed in), overlapping signed-in opens, the timeout and no-desktop paths ran live with Chromium 157 on Linux against a local test site; the window's own report (`chrome://version`, `chrome://prefs-internals`) that it opens the `Default` profile with password and card saving off ran live with Chrome for Testing 156 (`the_sign_in_window_runs_the_prepared_profile_with_saving_off`, with a `--no-sandbox` wrapper because this host's AppArmor refuses an unprofiled Chromium's sandbox); unit tests. Session-lock concurrency, cancellation finalization and same-site reservations have deterministic stand-in regressions; no new live-browser run for that correction. Brave on macOS was not run; a confined Snap or Flatpak browser and a real site's sign-in were not run. Make's button: a UI smoke test with no browser (the failure message, one window at a time, Start held) and unit tests of each message; not run with a real browser window from the app |
|
||||
| Page dialogs in inspection tools | The page tools that attach on their own (`web_page_show`, `web_walkthrough_record`, `web_page_js_analyze`, `web_page_watch`, `web_coverage_measure`, `web_listeners_list`, `web_modules_trace`, `web_mcp_tools_list`, `web_page_screenshot_take`, `js_electron_page_show` and `js_electron_walkthrough_record`) answer a JavaScript dialog the page opens mid-run (alerts and leave-page questions accepted, confirm and prompt dismissed) and list each one with its answer in the result and summary, with declared secrets in the message redacted where the tool has them, so the page can't stall them. The shared answering connect enables Page, which is what delivers Page.javascriptDialogOpening. | Fake-CDP engine regressions answer and report a page confirm through nine of them: `web_page_show`, a walkthrough, `web_page_js_analyze`, `web_page_watch`, `web_coverage_measure`, `web_listeners_list`, `web_modules_trace`, `web_mcp_tools_list` and `web_page_screenshot_take`; a unit test covers the dialog report, summary and redaction of a declared secret. Not run against a real browser for these tools; the Electron tools use the same code but have no fake-CDP test. |
|
||||
| Live browser and Electron secret redaction | `web_common::Secrets` delegates to `analysis::web_har::{encode_query, contains_ascii_ci, replace_needles_with}` to redact declared secrets across `application/x-www-form-urlencoded` (`+` with `%XX`, `*` literal, `~` as `%7E`), general percent-encoding (`~` literal, `*` as `%2A`), `encodeURIComponent` spellings, ASCII case variants and mixed-case percent-hex escapes, merging overlapping matches across captured URLs, headers, dialogs and bodies so partially overlapping secrets never leak a suffix. | Unit regressions in `tools::web_common::tests` cover raw, `encodeURIComponent`, form-urlencoded (`*` and `~`), mixed-case `%xx`, JSON-escaped, overlapping, adjacent and same-origin spellings (`secrets_redact_form_urlencoded_asterisk_tilde_and_mixed_case_spellings` and `secrets_redact_overlapping_adjacent_and_same_origin_matches`). Not re-run against a live browser or Electron process. |
|
||||
| macOS signed-in website study | Running-browser markers are excluded before profile metadata is read; session-only cookies are restored without copying old tab files. | Chrome for Testing 157: both live sign-in runs passed on macOS; the Linux-only no-desktop test returns early. Keychain and password-bubble behavior were not observed. |
|
||||
|
||||
@@ -48,6 +48,7 @@ impl<'ast> Visit<'ast> for Lookups {
|
||||
("widgets", "choice_tile" | "big_card") => &[3, 4],
|
||||
("widgets", "empty_state") => &[2, 3],
|
||||
("icons", "button") => &[4],
|
||||
("Button", "new") => &[1],
|
||||
_ => &[],
|
||||
};
|
||||
for &i in positions {
|
||||
@@ -179,6 +180,7 @@ mod tests {
|
||||
fn screen() {
|
||||
tr(if mode == "internal" { "Simple" } else { "Advanced" });
|
||||
widgets::primary_icon(ui, Some("play"), "Start", true);
|
||||
ui.add(widgets::Button::new(widgets::ButtonKind::Secondary, "Sign in").enabled(free));
|
||||
icons::button(ui, "x", 20.0, false, "Close");
|
||||
widgets::segmented(ui, &["One", "Two"], 0, 30.0);
|
||||
widgets::named(resp, &trf("Open {name}", &[("name", "sample.exe")]));
|
||||
@@ -189,7 +191,7 @@ mod tests {
|
||||
.unwrap();
|
||||
let mut lookups = Lookups::default();
|
||||
lookups.visit_file(&file);
|
||||
assert_eq!(lookups.0.0, ["Advanced", "Close", "One", "Open {name}", "Simple", "Start", "Two"].into_iter().map(str::to_string).collect());
|
||||
assert_eq!(lookups.0.0, ["Advanced", "Close", "One", "Open {name}", "Sign in", "Simple", "Start", "Two"].into_iter().map(str::to_string).collect());
|
||||
}
|
||||
|
||||
fn set(keys: &[&str]) -> BTreeSet<String> {
|
||||
|
||||
Reference in New Issue
Block a user