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>
This commit is contained in:
Jorijn van der Graaf 2026-10-31 07:32:14 +01:00
commit 8ffbd6cf5d
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
9 changed files with 1764 additions and 3 deletions

View file

@ -0,0 +1,44 @@
// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
module Crafter.Review:Mcp_impl;
import :Mcp;
import :Json;
import :Text;
import :Tools;
import std;
namespace fs = std::filesystem;
namespace Crafter::Review::Mcp {
std::vector<std::string> DefaultArgs() {
return {"-y", std::format("@playwright/mcp@{}", PlaywrightMcpVersion), "--headless", "--isolated", "--browser", "chromium"};
}
Json PlaywrightConfig(const Json& functional, const std::string& outputDir) {
const Json& mcp = Dyn::Or(Dyn::Get(Dyn::Or(functional, Dyn::EmptyDict()), "mcp"), Dyn::EmptyDict());
Json args = Json::array();
const Json& configured = Dyn::Get(mcp, "args");
if (!configured.is_null()) {
for (const Json& arg : configured) args.push_back(arg);
} else {
for (const std::string& arg : DefaultArgs()) args.push_back(arg);
}
if (!Dyn::In(Json("--output-dir"), args)) {
args.push_back("--output-dir");
args.push_back(outputDir);
}
const Json& command = Dyn::Get(mcp, "command");
return {{"mcpServers", {{std::string(Tools::McpServer), {{"command", Dyn::Truthy(command) ? command : Json("npx")}, {"args", std::move(args)}}}}}};
}
std::string ConfigJson(const Json& config) {
return config.dump(-1, ' ', true, Json::error_handler_t::replace);
}
fs::path OutputDir(const fs::path& scratch, std::string_view label) {
const fs::path dir = scratch / "playwright" / Dyn::Replace(Dyn::Replace(label, "/", "_"), " ", "_");
fs::create_directories(dir);
return dir;
}
}