feat(seats): memory, the Playwright MCP config, and the seats library
:Memory: MemAvailable and the reserve policy, the sampler of a pass's peak
tree PSS (one sweep, a pause of three sweeps at least, stopped with the
driver), and the calibration file every driver on the machine shares,
re-read and written under its lock.
:Mcp: the pinned @playwright/mcp 0.0.83 arguments and the --mcp-config of
one pass, compact and in a fixed key order.
:Seats: the dotenv loader (token lines only, TOKEN7 inert), the one-word
probe (run under the supervisor, a missing binary reported with its errno
text), the window maths, the ranking, the Fable merge, the editor-bundle
lookup of the claude binary, the redaction of anything token-shaped, and
the report. This libc++ has no tzdb, so a zone by name converts through
the C library with TZ set, reading the system's zoneinfo.
tests/Seats: 92 checks against reference vectors, numbered in order, all
green.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 07:32:14 +01:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
|
|
|
|
|
|
|
|
|
export module Crafter.Review:Mcp;
|
|
|
|
|
import std;
|
|
|
|
|
import :Json;
|
|
|
|
|
|
|
|
|
|
// The Playwright MCP server a lens with the browser environment drives the
|
|
|
|
|
// application with (2026-10-15): one server per pass, launched by the CLI
|
|
|
|
|
// from --mcp-config (never from the lens's Bash), headless, an in-memory
|
|
|
|
|
// profile, its screenshots under the pass's own output dir in the scratch
|
|
|
|
|
// tree. The tools are allowlisted by name (:Tools); browser_run_code_unsafe
|
|
|
|
|
// runs arbitrary Node code in the server's process and is denied.
|
|
|
|
|
export namespace Crafter::Review::Mcp {
|
|
|
|
|
// @playwright/mcp, verified 2026-10-15 with CLI 2.1.300.
|
|
|
|
|
constexpr std::string_view PlaywrightMcpVersion = "0.0.83";
|
feat(cli): seats, init, doc, browser install and stop
- `seats` reports every seat probed (Fable first, Haiku for a seat that
needs it), the API seats beside the driver's ledger, the drivers on the
board, or all of it as JSON. In the sandbox a last line names `stop`,
since the pids above cannot be signalled from there.
- `init` sets a repository up: the config from the template, the artifact
and worktree dirs ignored, the prepush skill with a marker that lets a
later init refresh it. The old link into the review-gates submodule is
replaced by a real directory, never written through. A foreign link, a
subdirectory, the home directory and a dir outside git are refused before
anything is written.
- `doc [--path] prepush|manifest|config` prints a shipped text, or where
the host sees it (the deployment's `active` link in the Flatpak).
- `browser install` runs the installer of the Playwright the pinned MCP
server depends on, and checks the Chromium revision landed.
- `stop <scratch>` and `stop --hash <hash8>` write the stop file a running
driver checks every 2 s, for live drivers only; the board is read, never
written.
The option parser takes positionals, in the usage line, the help and the
errors. The Commands test runs all of them through this binary, seats on a
claude stand-in.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 15:45:36 +01:00
|
|
|
// The playwright that version depends on, exactly (its package.json):
|
|
|
|
|
// `crafter-review browser install` runs its installer.
|
|
|
|
|
constexpr std::string_view PlaywrightVersion = "1.64.0-alpha-1790635538000";
|
feat(seats): memory, the Playwright MCP config, and the seats library
:Memory: MemAvailable and the reserve policy, the sampler of a pass's peak
tree PSS (one sweep, a pause of three sweeps at least, stopped with the
driver), and the calibration file every driver on the machine shares,
re-read and written under its lock.
:Mcp: the pinned @playwright/mcp 0.0.83 arguments and the --mcp-config of
one pass, compact and in a fixed key order.
:Seats: the dotenv loader (token lines only, TOKEN7 inert), the one-word
probe (run under the supervisor, a missing binary reported with its errno
text), the window maths, the ranking, the Fable merge, the editor-bundle
lookup of the claude binary, the redaction of anything token-shaped, and
the report. This libc++ has no tzdb, so a zone by name converts through
the C library with TZ set, reading the system's zoneinfo.
tests/Seats: 92 checks against reference vectors, numbered in order, all
green.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 07:32:14 +01:00
|
|
|
// The Chromium build that version's Playwright drives, as `npx playwright
|
|
|
|
|
// install chromium` puts it under ~/.cache/ms-playwright: what
|
|
|
|
|
// `crafter-review browser install` provides.
|
|
|
|
|
constexpr std::string_view ChromiumRevision = "1247";
|
|
|
|
|
// --browser chromium: Playwright's own Chromium; without it the server
|
|
|
|
|
// wants the `chrome` channel, Google Chrome at /opt/google/chrome
|
|
|
|
|
// (2026-10-15: every navigate of the second firing run failed on it).
|
|
|
|
|
std::vector<std::string> DefaultArgs();
|
|
|
|
|
|
|
|
|
|
// The --mcp-config value for one pass: the consumer's command and args (the
|
|
|
|
|
// pipeline's pinned default when the config names none) plus this pass's
|
|
|
|
|
// output dir.
|
|
|
|
|
Json PlaywrightConfig(const Json& functional, const std::string& outputDir);
|
|
|
|
|
// The config as compact JSON (DumpCompact), keys in their order.
|
|
|
|
|
std::string ConfigJson(const Json& config);
|
|
|
|
|
// <scratch>/playwright/<label with / and spaces as _>, made.
|
|
|
|
|
std::filesystem::path OutputDir(const std::filesystem::path& scratch, std::string_view label);
|
|
|
|
|
}
|