From 46990508d81c99b7e300e0997b20d7978d22b06b Mon Sep 17 00:00:00 2001 From: Helian Nuits Date: Wed, 2 Dec 2026 03:02:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?test(crates/panache-mcp):=20=E6=8A=8A?= =?UTF-8?q?=E7=85=A7=E7=89=87=E5=8C=BA=E5=9F=9F=E4=BF=9D=E6=8A=A4=E7=BA=B3?= =?UTF-8?q?=E5=85=A5=E9=A6=96=E4=BB=BD=20PDF=20=E8=AF=84=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 背景:自动识别的横线可能不在用户指定的栏,预览与 PDF 一致也无法验证位置。 解决手段:生成合成纸并在同种子下对比直接交付与区域预检,记录首份成品、越界笔迹和保留栏。 收益:用可复跑的实际文件区分正确交付、错误交付和安全停止,不影响生产行为。 --- crates/panache-mcp/tests/photo_zone_rsi.py | 240 +++++++++++++++++++++ docs/experiments/photo-zone-rsi.md | 53 +++++ 2 files changed, 293 insertions(+) create mode 100644 crates/panache-mcp/tests/photo_zone_rsi.py create mode 100644 docs/experiments/photo-zone-rsi.md diff --git a/crates/panache-mcp/tests/photo_zone_rsi.py b/crates/panache-mcp/tests/photo_zone_rsi.py new file mode 100644 index 00000000..2bfe4fcd --- /dev/null +++ b/crates/panache-mcp/tests/photo_zone_rsi.py @@ -0,0 +1,240 @@ +"""Synthetic first-delivery check for Panache MCP photo paper.""" +import argparse +import asyncio +import base64 +import io +import json +import os +from pathlib import Path +from hashlib import sha256 +import subprocess +import tempfile +from contextlib import asynccontextmanager +from dataclasses import dataclass + +from mcp import ClientSession, StdioServerParameters +from mcp.client.stdio import stdio_client +import numpy as np +from PIL import Image, ImageDraw + + +@dataclass(frozen=True) +class Photo: + name: str + width: int + height: int + left: int + right: int + start: int + step: int + tilt: int + kind: str + + def top(self, x, index): + return self.start + self.tilt * (x - self.left) / (self.right - self.left) + index * self.step + + +# Separate from the three pilot threshold-selection forms. The thresholds are +# local to these pixel sizes; not universally recommended app defaults. +CASES = [ + Photo("existing-offset", 652, 817, 63, 551, 162, 33, -25, "clean"), + Photo("existing-good", 683, 820, 82, 596, 148, 41, 39, "clean"), + Photo("lower-form", 664, 801, 67, 592, 241, 36, 26, "header"), + Photo("grid-desk", 678, 813, 82, 598, 223, 35, 41, "grid"), + Photo("labeled-blank", 631, 783, 70, 533, 230, 39, -36, "plain"), + Photo("blocked-zone", 644, 802, 68, 570, 228, 35, 32, "header"), +] +TEXT = "实验A 41\n实验B 29\n记录C 76\n复核D 18" + + +@asynccontextmanager +async def session(args, directory): + env = { + **dict.fromkeys(("HOME", "USERPROFILE", "APPDATA", "LOCALAPPDATA", "XDG_DATA_HOME"), directory), + "PANACHE_MCP_HOME": directory, + "PANACHE_USER_FONT_DIR": str(Path(directory) / "fonts"), + "PANACHE_FONT_DIR": str(args.fonts), + "PANACHE_MARKDOWN_WORKER": str(args.worker), + } + params = StdioServerParameters(command=str(args.binary), cwd=directory, env=env) + async with stdio_client(params) as streams, ClientSession(*streams) as client: + await client.initialize() + yield client + + +async def call(client, tool, **params): + result = await client.call_tool(tool, params) + if result.isError: + raise RuntimeError((tool, result.content)) + return result + + +def make_photo(f, path): + image = Image.new("RGB", (f.width, f.height), (243, 239, 225)) + draw = ImageDraw.Draw(image) + header = (int(f.width * .54), 52, f.right + 14, 90) + draw.rectangle(header, outline=(43, 60, 80), width=2) + draw.text((header[0] + 12, 64), "PRINTED FIELD / KEEP BLANK", fill=(43, 60, 80)) + if f.kind in {"header", "grid"}: + for y in range(f.start - f.step * 4, f.start, f.step): + draw.line((f.left, y, f.right, y + f.tilt), fill=(70, 76, 79), width=4) + if f.kind == "grid": + for x in range(4, 43, 12): + draw.line((x, 0, x, f.height), fill=(80, 139, 85), width=2) + for y in range(0, f.height, 22): + draw.line((0, y, 44, y), fill=(80, 139, 85), width=2) + if f.kind == "plain": + rect = (f.left - 10, f.start - 40, f.right + 18, f.start + f.step * 10) + draw.rectangle(rect, outline=(181, 175, 151), width=2) + draw.text((rect[0] + 8, rect[1] + 11), "ANALYSIS: WRITE BELOW", fill=(94, 104, 113)) + else: + for y in range(f.start, f.start + f.step * 12, f.step): + draw.line((f.left, y, f.right, y + f.tilt), fill=(111, 117, 121), width=3) + if f.kind in {"header", "grid"}: + x, y = f.left + 6, f.start - 4 * f.step + 12 + header = (x, y, x + 154, y + 45) + if f.name == "blocked-zone": + y = f.start - 12 + header = (x, y, x + 170, y + 53) + draw.rectangle(header, outline=(43, 60, 80), width=2) + draw.text((header[0] + 7, header[1] + 11), "KEEP PRINT INTACT", fill=(43, 60, 80)) + image.save(path) + return np.array(image), header + + +def approved_guides(f): + return [{"row": n, "left": [f.left, f.start + n * f.step], + "right": [f.right, f.start + n * f.step + f.tilt]} for n in (0, 8)] + + +def passes(score): + return (score["mean_first_glyph_row_error_px"] <= 6 + and score["out_of_corridor_pixels"] <= 60 + and score["protected_print_changed_pixels"] == 0) + + +async def inspect(invoke, f, paper, header, key, path): + layout = (await invoke("preview_handwriting", **key, view="layout", limit=32)).structuredContent + marks = [g for g in layout["glyphs"] if g.get("text") in {"实", "记", "复"}] + assert [g["text"] for g in marks] == ["实", "实", "记", "复"] + errors = [] + for i, g in enumerate(marks): + x, y, _, height = g["bounds"] + errors.extend(abs(b - f.top(a, i)) for a, b in g.get("photo_baseline", [[x, y + height]])) + result = await invoke("preview_handwriting", **key, view="image") + png = base64.b64decode(next(c.data for c in result.content if c.type == "image")) + path.write_bytes(png) + preview = Image.open(io.BytesIO(png)).convert("RGB") + raster = np.array(preview) + assert raster.shape == paper.shape + mask = np.any(raster != paper, axis=2) + y, x = np.where(mask) + outside = ((y < f.top(x, 0) - 34) | (y > f.top(x, 3) + 15) + | (x < f.left - 14) | (x > f.right + 10)) + x0, y0, x1, y1 = header + return preview, { + "mean_first_glyph_row_error_px": round(float(np.mean(errors)), 3), + "ink_pixels": int(mask.sum()), + "out_of_corridor_pixels": int(outside.sum()), + "protected_print_changed_pixels": int(mask[y0:y1 + 1, x0:x1 + 1].sum()), + "protected_region_pixels": (y1 - y0 + 1) * (x1 - x0 + 1), + } + + +async def run_arm(args, f, source, paper, header, arm): + prefix = args.out / f"{f.name}-{arm}" + with tempfile.TemporaryDirectory(prefix="panache-photo-") as home: + async with session(args, home) as client: + events = [] + + async def traced(tool, **params): + safe_args = {k: Path(v).name if k == "paper_path" else v for k, v in params.items()} + r = await call(client, tool, **params) + data = r.structuredContent or {} + events.append({"tool": tool, "args": safe_args, + "receipt": {k: data[k] for k in + ("draft_id", "revision", "export_id", "pages") + if k in data}, + "content_types": [b.type for b in r.content]}) + return r + + seed = await traced("save_section", markdown=TEXT, paper_path=str(source), + paper_mode="photo", style={"seed": 3081, "font_size": 22, + "ink": "#48434a"}, **({"tex_packages": []} if args.no_tex_packages else {})) + key = {"draft_id": seed.structuredContent["draft_id"], "revision": 1} + preview, score = await inspect(traced, f, paper, header, key, prefix.with_suffix(".r1.png")) + history = ["save", "layout", "image"] + action = "keep" + if arm == "preflight" and not passes(score): + tuned = await traced("tune_handwriting", draft_id=key["draft_id"], + expected_revision=1, paper_guides=approved_guides(f), + preserve_local_adjustments=True, note="User-approved lower writing region.") + key["revision"] = tuned.structuredContent["revision"] + assert key["revision"] == 2 + preview, score = await inspect(traced, f, paper, header, key, prefix.with_suffix(".r2.png")) + history += ["tune", "layout", "image"] + action = "guide" + passed = passes(score) + publish = arm == "auto" or passed + artifact_sha = None + if publish: + result = await traced("export_handwriting", **key, format="pdf") + receipt = result.structuredContent + assert receipt["pages"] == 1 + output = prefix.with_suffix(".first.pdf") + output.write_bytes(Path(receipt["path"]).read_bytes()) + artifact_sha = sha256(output.read_bytes()).hexdigest() + subprocess.run(["pdfimages", "-png", str(output), str(prefix)], check=True) + assert Image.open(prefix.with_name(prefix.name + "-000.png")).convert("RGB").tobytes() == preview.tobytes() + history.append("export") + else: + action = "stop" + # Check the server's output directory too, not only tool history. + assert not list((Path(home) / "exports").glob("*.pdf")) + assert len(events) == len(history) + prefix.with_suffix(".calls.jsonl").write_text( + "\n".join(json.dumps(e, ensure_ascii=False) for e in events) + "\n", encoding="utf-8") + return {"action": action, "calls": history, "call_count": len(events), + "published": publish, "first_pdf_pass": publish and passed, + "first_pdf_sha256": artifact_sha, **score} + + +async def run(args): + args.out.mkdir(parents=True) + rows = [] + for f in CASES: + if args.case and f.name not in args.case: + continue + path = args.out / f"{f.name}-paper.png" + paper, header = make_photo(f, path) + row = {"name": f.name} + for arm in ("auto", "preflight"): + row[arm] = await run_arm(args, f, path, paper, header, arm) + rows.append(row) + print(json.dumps(row), flush=True) + summary = {} + for arm in ("auto", "preflight"): + r = [x[arm] for x in rows] + summary[arm] = {"first_pdf_pass": sum(x["first_pdf_pass"] for x in r), + "published": sum(x["published"] for x in r), + "stopped": sum(x["action"] == "stop" for x in r), + "calls": sum(x["call_count"] for x in r), + "ink_outside_on_published": sum(x["out_of_corridor_pixels"] for x in r if x["published"]), + "printed_fields_changed_on_published": sum(x["protected_print_changed_pixels"] for x in r if x["published"])} + inputs = {"binary_sha256": sha256(args.binary.read_bytes()).hexdigest(), + "worker_sha256": sha256(args.worker.read_bytes()).hexdigest(), + "tex_packaging": "explicit empty" if args.no_tex_packages else "default"} + (args.out / "results.json").write_text( + json.dumps({"inputs": inputs, "summary": summary, "rows": rows}, indent=2) + "\n") + print(json.dumps(summary), flush=True) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description=__doc__) + for name in ("binary", "worker", "fonts", "out"): + parser.add_argument("--" + name, type=lambda p: Path(p).resolve(), required=True) + parser.add_argument("--case", action="append", choices=[f.name for f in CASES], + help="Only run one or more named cases.") + parser.add_argument("--no-tex-packages", action="store_true", + help="Use explicit empty list with a packaged legacy worker; only tests photo output.") + asyncio.run(run(parser.parse_args())) diff --git a/docs/experiments/photo-zone-rsi.md b/docs/experiments/photo-zone-rsi.md new file mode 100644 index 00000000..5be3f9c9 --- /dev/null +++ b/docs/experiments/photo-zone-rsi.md @@ -0,0 +1,53 @@ +# 照片用纸:区域保护的首份 PDF 对照 + +纸上的线找对了,不代表字写进了正确的栏。这个小评测同时看首字是否贴合指定的行、墨迹是否越界、保留栏是否被盖住。它用六张合成纸,没有真实照片或个人信息。 + +两组从同样的稿件、照片和种子开始。基线保留自动识线并导出;候选首先核对允许区域,确有问题才改用**已经确认**的参考线,然后复查。若第二次仍越界或盖住印字,就不导出。评测把区域和参考线作为输入,不假设模型会从任意照片发现正确位置。墨迹越界的 60 像素容差、基线平均 6 像素容差仅用于这些小图;明确保护的区域零容差。两组都读布局和同版预览,所以表里的调用差额只算修正、复查和是否导出。基线是一个跳过核对的实验脚本,不代表 Panache 引导过的 Agent 必定这样处理。 + +运行前准备 Panache MCP 二进制、同版本生成的 Worker、共享字体目录及 Poppler 的 `pdfimages`,并安装 Python 的 `mcp`、`Pillow` 和 `numpy`: + +```bash +python crates/panache-mcp/tests/photo_zone_rsi.py --binary /path/to/panache-mcp \ + --worker /path/to/prepare-text-worker.js --fonts /path/to/font_assets \ + --out ./photo-zone-results +``` + +`--case lower-form` 只跑一个代表例。输出目录应尚不存在,便于区分新旧结果。每个组别使用一个新临时稿件目录;最后保留合成底图、第一次导出的 PDF、用于评分的 PNG 和 `results.json`。评测会从 PDF 提取实际图像和同版预览逐像素比较,但“与预览一样”不是质量通过条件。底图在实验中由脚本生成且为 PNG;真实 JPEG 应先用同一渲染器读取纯底纸,再比较像素,避免两种 JPEG 解码器的舍入误差引发泛警报。 + +这个结果说明确定性的交付前检查能发现一种具体漏项,不是正式 GDPevo 成绩,也不是模型的画质评级。真实模型的下一轮可以测试它是否会识别用户指定的区域、从不确定的图中正确停下来,以及进一步检查是否值得额外调用。 + +## 实测:首份交付更稳,检查需要额外步骤 + +Panache `bd144204626266c6ce3c50a173ca890e5237b2ba`,Linux 原生 MCP,六张合成纸: + +| 指标 | 直接信任识线结果 | 发布前检查 | +| --- | ---: | ---: | +| 首份 PDF 达标 | 1/6 | 5/6 | +| 实际发布 PDF | 6 | 5 | +| 发布了不达标的文件 | 5 | 0 | +| 已发布文件中,区域外变化像素 | 13,384 | 0 | +| 已发布文件中,受保护区域变化像素 | 2,601 | 0 | +| 真实 MCP 调用 | 24 | 38 | + +同一张表,自动版把字写进保留栏,导致 944 个保护区域像素发生变化;加引导后降到零。另一个案例即便首字与目标行平均只差 0.269 px,仍有 118 个越界像素,可见只看基线会漏掉边缘。最后一张的合成目标里有不能覆盖的印章,改引导后虽然行偏差为 0.404 px、区域外变化为零,但保护区内仍有 1,823 个变化像素,候选因此没有发布 PDF。这个停止不计为成功交付。 + +这六对使用同一个正式旧版 Worker(SHA-256 `9858a3996ff49895899d153fda57586227f1fa2be139b3f61a6d895ee5c5e237`),明确关闭 TeX 扩展以只测纸张排版,不作为当前 TeX 扩展验证。11 份已发布 PDF 的内嵌图均与相应预览 RGB 一致。 + +完整六对另用同一提交的新构建 Worker(SHA-256 `e71794540185c656a646c32545c1b0db0cbea09c6b3b4224cdc8f72c760732d7`)和默认 TeX 设定重跑,表中计数全部相同。原始记录包括 62 次实际工具请求、稿号及版号、11 个首份 PDF 的导出 ID 和 SHA-256;无交付的样本有 0 次导出调用,也无 PDF 文件。验证环境为 Python 3.12、MCP SDK 1.29.0、NumPy 2.3.5、Pillow 13.0.0。 + +[当前 Worker 逐例结果](results-bd144204.json) · [早期 Worker 对照](results-legacy-worker.json) · [两张示意的原纸、自动版与预检版](synthetic-example.png) + +## 六张留出纸的本地结果 + +在 `bd144204` 和匹配的 Worker(SHA-256 前缀 `e7179454`)上测得: + +| 观察 | 直接导出 | 先核对区域 | +| --- | ---: | ---: | +| 首份 PDF 符合位置要求 | 1/6 | 5/6 | +| 实际发布的 PDF | 6 | 5 | +| 发布后发现不符合要求 | 5 | 0 | +| 已发布文件中的区域外变化像素 | 13,384 | 0 | +| 已发布文件中的保护区变化像素 | 2,601 | 0 | +| 实际 MCP 调用 | 24 | 38 | + +候选有一张确认无法同时满足区域与保护要求,停止导出。这张仍计入总数,没有算作正确 PDF。11 份实际导出的 PDF 均与各自的同版预览逐像素一致。候选做了更多检查,不是省调用的改动。 From 008f417bebdca91e7ea4d595e3420107f7dca1cd Mon Sep 17 00:00:00 2001 From: SXP-Simon Date: Wed, 2 Dec 2026 04:30:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?test(crates/panache-mcp):=20=E6=8C=89?= =?UTF-8?q?=E8=A1=8C=E6=A0=B8=E9=AA=8C=E9=A6=96=E4=BB=BD=20PDF=20=E7=9A=84?= =?UTF-8?q?=E5=8F=AF=E8=A7=81=E5=A2=A8=E8=BF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 背景:照片评测仅检查位置与保护区域,布局正常的空白输出或缺行输出也可能达标。 解决手段:按四个目标行统计成图与底纸的可见差分,覆盖空白、逐行缺失与微弱噪声,并固定复跑依赖、更新结果入口。 收益:首份交付需要在每个目标行留下可见笔迹,评分条件和逐例结果都可独立复核。 --- crates/panache-mcp/tests/photo_zone_rsi.py | 22 +++++++++-- .../panache-mcp/tests/test_photo_zone_rsi.py | 39 +++++++++++++++++++ docs/experiments/photo-zone-rsi.md | 23 +++-------- 3 files changed, 62 insertions(+), 22 deletions(-) create mode 100644 crates/panache-mcp/tests/test_photo_zone_rsi.py diff --git a/crates/panache-mcp/tests/photo_zone_rsi.py b/crates/panache-mcp/tests/photo_zone_rsi.py index 2bfe4fcd..8e20d836 100644 --- a/crates/panache-mcp/tests/photo_zone_rsi.py +++ b/crates/panache-mcp/tests/photo_zone_rsi.py @@ -4,7 +4,6 @@ import base64 import io import json -import os from pathlib import Path from hashlib import sha256 import subprocess @@ -109,6 +108,7 @@ def approved_guides(f): def passes(score): return (score["mean_first_glyph_row_error_px"] <= 6 + and all(count >= 24 for count in score["visible_ink_pixels_by_row"]) and score["out_of_corridor_pixels"] <= 60 and score["protected_print_changed_pixels"] == 0) @@ -125,15 +125,29 @@ async def inspect(invoke, f, paper, header, key, path): png = base64.b64decode(next(c.data for c in result.content if c.type == "image")) path.write_bytes(png) preview = Image.open(io.BytesIO(png)).convert("RGB") - raster = np.array(preview) + score = score_pixels(f, paper, np.array(preview), header) + score["mean_first_glyph_row_error_px"] = round(float(np.mean(errors)), 3) + return preview, score + + +def score_pixels(f, paper, raster, header): assert raster.shape == paper.shape mask = np.any(raster != paper, axis=2) y, x = np.where(mask) outside = ((y < f.top(x, 0) - 34) | (y > f.top(x, 3) + 15) | (x < f.left - 14) | (x > f.right + 10)) x0, y0, x1, y1 = header - return preview, { - "mean_first_glyph_row_error_px": round(float(np.mean(errors)), 3), + # Check inside each line's writing band, away from the adjacent line's descenders. + # Ignore faint raster differences when establishing the presence of handwriting. + delta = np.abs(raster[y, x].astype(np.int16) - paper[y, x]) + visible = (delta.max(axis=1) >= 8) & (x >= f.left) & (x <= f.right) + by_row = [] + for row in range(len(TEXT.splitlines())): + above_baseline = f.top(x, row) - y + by_row.append(int(np.count_nonzero( + visible & (above_baseline >= 0) & (above_baseline <= 0.65 * f.step)))) + return { + "visible_ink_pixels_by_row": by_row, "ink_pixels": int(mask.sum()), "out_of_corridor_pixels": int(outside.sum()), "protected_print_changed_pixels": int(mask[y0:y1 + 1, x0:x1 + 1].sum()), diff --git a/crates/panache-mcp/tests/test_photo_zone_rsi.py b/crates/panache-mcp/tests/test_photo_zone_rsi.py new file mode 100644 index 00000000..d37eaedf --- /dev/null +++ b/crates/panache-mcp/tests/test_photo_zone_rsi.py @@ -0,0 +1,39 @@ +"""Pixel-level controls for the synthetic first-PDF scoring rule.""" +import unittest + +import numpy as np + +from photo_zone_rsi import CASES, passes, score_pixels + + +class PhotoZoneScoreTest(unittest.TestCase): + def test_each_expected_row_needs_visible_ink(self): + form = CASES[0] + paper = np.full((form.height, form.width, 3), 240, dtype=np.uint8) + raster = paper.copy() + + def accepted(): + score = score_pixels(form, paper, raster, (0, 0, 10, 10)) + # Layout can report exactly correct baselines even on a blank rendering. + return passes({**score, "mean_first_glyph_row_error_px": 0}) + + self.assertFalse(accepted()) + x = form.left + 20 + bands = [] + for row in range(4): + y = int(form.top(x, row)) - 12 + bands.append((slice(y, y + 6), slice(x, x + 8))) + for band in bands: + raster[band] = 80 + self.assertTrue(accepted()) + for row, band in enumerate(bands): + with self.subTest(missing_row=row): + raster[band] = paper[band] + self.assertFalse(accepted()) + raster[band] = 239 + self.assertFalse(accepted()) + raster[band] = 80 + + +if __name__ == "__main__": + unittest.main() diff --git a/docs/experiments/photo-zone-rsi.md b/docs/experiments/photo-zone-rsi.md index 5be3f9c9..3aef90de 100644 --- a/docs/experiments/photo-zone-rsi.md +++ b/docs/experiments/photo-zone-rsi.md @@ -2,11 +2,13 @@ 纸上的线找对了,不代表字写进了正确的栏。这个小评测同时看首字是否贴合指定的行、墨迹是否越界、保留栏是否被盖住。它用六张合成纸,没有真实照片或个人信息。 -两组从同样的稿件、照片和种子开始。基线保留自动识线并导出;候选首先核对允许区域,确有问题才改用**已经确认**的参考线,然后复查。若第二次仍越界或盖住印字,就不导出。评测把区域和参考线作为输入,不假设模型会从任意照片发现正确位置。墨迹越界的 60 像素容差、基线平均 6 像素容差仅用于这些小图;明确保护的区域零容差。两组都读布局和同版预览,所以表里的调用差额只算修正、复查和是否导出。基线是一个跳过核对的实验脚本,不代表 Panache 引导过的 Agent 必定这样处理。 +两组从同样的稿件、照片和种子开始。基线保留自动识线并导出;候选首先核对允许区域,确有问题才改用**已经确认**的参考线,然后复查。若第二次仍越界或盖住印字,就不导出。评测把区域和参考线作为输入,不假设模型会从任意照片发现正确位置。每行基线往上 65% 格高的书写区内,至少要有 24 个可见墨迹像素(任一 RGB 通道与原纸相差至少 8 级)。墨迹越界的 60 像素容差、基线平均 6 像素容差仅用于这些小图;明确保护的区域零容差。两组都读布局和同版预览,所以表里的调用差额只算修正、复查和是否导出。基线是一个跳过核对的实验脚本,不代表 Panache 引导过的 Agent 必定这样处理。 -运行前准备 Panache MCP 二进制、同版本生成的 Worker、共享字体目录及 Poppler 的 `pdfimages`,并安装 Python 的 `mcp`、`Pillow` 和 `numpy`: +运行前准备 Panache MCP 二进制、同版本生成的 Worker、共享字体目录及 Poppler 的 `pdfimages`。以下命令使用 Python 3.12,在仓库根目录运行。 ```bash +python -m pip install "mcp==1.29.0" "Pillow==13.0.0" "numpy==2.3.5" +python crates/panache-mcp/tests/test_photo_zone_rsi.py python crates/panache-mcp/tests/photo_zone_rsi.py --binary /path/to/panache-mcp \ --worker /path/to/prepare-text-worker.js --fonts /path/to/font_assets \ --out ./photo-zone-results @@ -35,19 +37,4 @@ Panache `bd144204626266c6ce3c50a173ca890e5237b2ba`,Linux 原生 MCP,六张 完整六对另用同一提交的新构建 Worker(SHA-256 `e71794540185c656a646c32545c1b0db0cbea09c6b3b4224cdc8f72c760732d7`)和默认 TeX 设定重跑,表中计数全部相同。原始记录包括 62 次实际工具请求、稿号及版号、11 个首份 PDF 的导出 ID 和 SHA-256;无交付的样本有 0 次导出调用,也无 PDF 文件。验证环境为 Python 3.12、MCP SDK 1.29.0、NumPy 2.3.5、Pillow 13.0.0。 -[当前 Worker 逐例结果](results-bd144204.json) · [早期 Worker 对照](results-legacy-worker.json) · [两张示意的原纸、自动版与预检版](synthetic-example.png) - -## 六张留出纸的本地结果 - -在 `bd144204` 和匹配的 Worker(SHA-256 前缀 `e7179454`)上测得: - -| 观察 | 直接导出 | 先核对区域 | -| --- | ---: | ---: | -| 首份 PDF 符合位置要求 | 1/6 | 5/6 | -| 实际发布的 PDF | 6 | 5 | -| 发布后发现不符合要求 | 5 | 0 | -| 已发布文件中的区域外变化像素 | 13,384 | 0 | -| 已发布文件中的保护区变化像素 | 2,601 | 0 | -| 实际 MCP 调用 | 24 | 38 | - -候选有一张确认无法同时满足区域与保护要求,停止导出。这张仍计入总数,没有算作正确 PDF。11 份实际导出的 PDF 均与各自的同版预览逐像素一致。候选做了更多检查,不是省调用的改动。 +复跑后,逐例得分和四行各自的可见墨迹像素数在输出目录的 `results.json` 中。可将同目录的 `*-paper.png` 与相应的 `*.r1.png`、`*.r2.png` 对照查看。