Craft Anything: understand how any software works, and craft your own.
Rust
Keep system tools and media players on the app build path (R2.7) (#1093)
Afloat23000e314a68
diff --git a/crates/ai/src/rebuild/kinds/game.rs b/crates/ai/src/rebuild/kinds/game.rsindex 54c76460..df258132 100644--- a/crates/ai/src/rebuild/kinds/game.rs+++ b/crates/ai/src/rebuild/kinds/game.rs@@ -17,17 +17,38 @@ fn starts_word(request: &str, at: usize) -> bool {/// A number of players as its own words: "2-player", "(four players)", but not "MPEG-2 player",/// "mp2 player", "12 player" or "two playerctl".fn says_player_count(request: &str) -> bool {- // Any run of spaces or line breaks counts as one space: "2 player".- let request = request.split_whitespace().collect::<Vec<_>>().join(" ");let ends_word = |rest: &str| rest.strip_prefix('s').unwrap_or(rest).chars().next().is_none_or(|c| !c.is_alphanumeric());["2", "3", "4", "two", "three", "four"].iter().any(|n| {["-player", " player"].iter().any(|player| {let phrase = format!("{n}{player}");- request.match_indices(&phrase).any(|(at, _)| starts_word(&request, at) && request.get(at + phrase.len()..).is_some_and(ends_word))+ request.match_indices(&phrase).any(|(at, _)| {+ starts_word(request, at)+ && request.get(..at).and_then(|before| before.split_whitespace().next_back()) != Some("mpeg")+ && request.get(at + phrase.len()..).is_some_and(ends_word)+ })})})}+/// Read weaker game cues in their own phrase. A later game cue can still win.+fn says_play(request: &str) -> bool {+ let request = request.split_whitespace().collect::<Vec<_>>().join(" ");+ says_player_count(&request)+ || request+ .match_indices("level")+ .any(|(at, _)| starts_word(&request, at) && !matches!(request.get(..at).and_then(|s| s.split_whitespace().next_back()), Some("low" | "high")))+ || ["single player", "single-player", "singleplayer"].iter().any(|phrase| {+ request.match_indices(phrase).any(|(at, _)| {+ let rest = request.get(at + phrase.len()..).unwrap_or_default();+ let subject = rest.strip_prefix(" app for ").or_else(|| rest.strip_prefix(" application for "));+ let medium = subject.and_then(|s| s.split(|c: char| !c.is_alphanumeric()).next());+ starts_word(&request, at)+ && rest.chars().next().is_none_or(|c| !c.is_alphanumeric())+ && !matches!(medium, Some("audio" | "video" | "videos" | "music" | "movies" | "films"))+ })+ })+}+pub struct GameKind;impl GameKind {@@ -56,8 +77,7 @@ impl TargetKind for GameKind {if game::Builder::from_stack(cx.stack).is_some() {Some(200)// Not plain "player": a video or music player is an app (#953).- } else if says_player_count(&cx.request)- || cx.request.match_indices("level").any(|(at, _)| starts_word(&cx.request, at))+ } else if says_play(&cx.request)|| cx.says(&["game","gameplay",@@ -65,9 +85,6 @@ impl TargetKind for GameKind {"multiplayer","multi-player","multi player",- "singleplayer",- "single-player",- "single player","游戏","遊戲","玩法",diff --git a/crates/ai/src/rebuild/tests.rs b/crates/ai/src/rebuild/tests.rsindex 4ab3354f..7f37c575 100644--- a/crates/ai/src/rebuild/tests.rs+++ b/crates/ai/src/rebuild/tests.rs@@ -75,6 +75,13 @@ fn the_word_player_alone_is_not_a_game() {"a 12 player scoreboard","a music app with two playerctl shortcuts","a low-level disk tool",+ "a low level disk tool",+ "a high level system monitor",+ "An MPEG 2 player",+ "An MPEG 2-player",+ "a single player app for movies",+ "a single-player application for music",+ "a single playerctl shortcut","a multilevel menu",] {assert_eq!(choose(request, &TargetRef::None).0, "app", "{request}");@@ -96,6 +103,9 @@ fn the_word_player_alone_is_not_a_game() {"A game with one player","A level editor","Build a (level editor)",+ "a low level tool with a level editor",+ "a game with an MPEG 2 player",+ "a single player app for chess","Make this:\nlevel editor",] {assert_eq!(choose(request, &TargetRef::None).0, "game", "{request}");diff --git a/docs/ROADMAP.md b/docs/ROADMAP.mdindex 930c0b3b..801c6271 100644--- a/docs/ROADMAP.md+++ b/docs/ROADMAP.md@@ -880,8 +880,9 @@ Owner: open · Status: in progresscapture now normalizes its request paths, but earlier runner paths can still be relative- [x] "player" alone doesn't make a request a game: a video or music player is an app (#953)— claimed: justinjohn0306, branch bugfix/953-player-not-a-game-- [ ] Game words can't tell these apart from games: "a low level disk tool", "an MPEG 2 player",- "a single player app for movies". Telling them apart needs more than a list of words+- [x] System-tool and media-player phrases keep the app target: "a low level disk tool",+ "an MPEG 2 player" and "a single player app for movies". Independent game cues still apply+ — claimed: Afloat16, branch bugfix/r2.7-media-and-system-apps### R2.8 Clean room means clean roomOwner: maintainers · Status: in progressdiff --git a/docs/STATUS.md b/docs/STATUS.mdindex cb9ae2b8..e58eaaf9 100644--- a/docs/STATUS.md+++ b/docs/STATUS.md@@ -10,6 +10,7 @@ workspace clippy, layers, fmt and the secret scan of all history were clean. Chi|---|---|---|| Watched descendant regression | A guarded Rust parent starts the heartbeat child in its inherited process group/job. No shell quoting is involved. The watched launch is stopped before missing startup markers can fail an assertion | macOS regressions pass for descendant shutdown, startup-timeout cleanup and direct ignored-fixture runs without guards. Windows execution of this replacement remains pending; the prior shell fixture failed there. The platform suite still has the separately tracked preview-connection fixture failure || Disabled chat backends | Naming a backend that is off refuses chat and either side of compare with a settings error and guidance, before API or coding-agent setup | Isolated hub regressions for disabled API and agent backends, both compare positions, and enabled/automatic controls. Invalid tunnel settings detect API setup before the guard. No live provider or agent was used |+| Request-based project kinds | Low-level tools and media players keep the app target when “level” or “player” describes the tool. Explicit game requests and game engines still select the game target | Request-classification regression cases || Runner-owned app windows | Runtime capture tries the launched process and its descendants; the captured window owner's PID is also used for the UI tree. Unrelated processes with matching names are excluded. Process discovery has a deadline, output cap and candidate limit | Hermetic regressions cover runner/child/grandchild ownership, unrelated windows, direct launches, cycles, malformed rows, caps and errors. A macOS process snapshot finds an owned child without opening a window. Windows and real Go GUI capture have not been run || New-project toolchains | New Python, Go, .NET, Maven, Gradle and Make projects use the same build catalogue as existing projects (`engine/src/toolchains.toml`). Shared launch recipes let screenshots, self-tests and Play start Python `main.py`, `app.py` or `__main__.py`, Go with a root `main.go`, and one root `.csproj`. Python uses a project-local virtual environment when present, resolves its executable to an absolute path even for relative project folders, and forces fresh syntax compilation; .NET passes app options after `--`. Manifest markers take priority over standalone Python files. Runtime window-capture requests normalize relative project and runner paths to absolute paths. Existing packaged programs, Rust, Electron and Godot keep launch priority. Multiple `.csproj` matches or a capped scan do not choose a project. Other layouts still need a packaged program or another launch recipe | Catalogue and launch regressions cover argv boundaries, ambiguous entrypoints, scan limits and Windows/local interpreter selection, including relative project folders and unchanged argument boundaries. Capture-request tests cover relative placements and PATH results, local interpreters and optional UI-tree output without opening a window. An owned interpreter stand-in runs the full new-project build/screenshot path, rejects failed builds, and verifies a failed screenshot cannot reuse an old PNG. An opt-in real Python 3.15.2 fixture on macOS passes build/screenshot checks, ignores invalid virtualenv code, and rejects a syntax error even when its mtime matches the cached version. Without `compileall -f` that same syntax-error probe incorrectly exits zero. Real Go/.NET/Maven/Gradle runs, Windows and GUI apps have not been verified for this change || macOS optional UI tree and screenshots | `runtime_ui_read` with `accessibility: false` skips the tree and its permission check, returns empty nodes without truncation, and records the skipped read (#307). Walkthroughs still require Accessibility. With `screenshot: true`, macOS 14+ returns one owned-by-pid window as PNG/base64, restricted by `window_id` when supplied; without it, the first matching on-screen window. Images are limited to 2048 px per side and 6 MiB PNG. Combined JSON stays within the 16 MiB helper output cap; oversized trees retain a prefix with explicit truncation and partial coverage while preserving the image. Missing Screen Recording permission, a missing window or a capture failure is an explicit screenshot limitation with partial coverage (#248). Denied Accessibility permission returns a tool error before capture when the tree is enabled (the default); set `accessibility: false` to skip the tree. Permission dialogs are never opened | Synthetic Swift serializer regression covers combined tree/image overflow, escaped Unicode values, a single oversized node, an oversized image, and unchanged small/skipped trees. Engine regressions compile/run the real Swift helper: skipped trees at node limits 0/1, screenshot-off control, and impossible-window screenshot errors propagated to evidence. Live helper probe on macOS 27.2 captured only an owned AppKit fixture: valid 320 × 192 PNG (14,400 bytes), matching window id; screenshot-off returned no image/error. No granted-permission tree read, walkthrough, macOS 14 run or MCP transport run |