// 精确判断:preset 条目中段(避开样板头)是否出现在 tool description 里 import { readFileSync } from "node:fs"; const body = JSON.parse(JSON.parse(readFileSync(process.argv[2], "utf8")).body); const d = (body.tools || []).map((t) => String((t.function || t).description || "")).join("\n") + "\n" + JSON.stringify((body.tools || []).map((t) => (t.function || t).parameters || {})); const norm = (s) => String(s || "").replace(/\s+/g, " ").trim(); const pool = norm(d); const preset = JSON.parse(readFileSync(process.argv[3], "utf8")); for (const p of preset.prompts || []) { const c = norm(p.content); if (c.length < 200) continue; const mid = c.slice(Math.floor(c.length / 2), Math.floor(c.length / 2) + 60); const hit = pool.includes(mid); if (!hit) continue; console.log("✅ " + String(p.name || p.identifier).slice(0, 40) + " (" + String(p.content).length + " 字)"); }