|
| 1 | +/** Offline evidence extraction. Does not execute the client bundles or contact upstream. */ |
| 2 | +import { readFileSync } from "node:fs"; |
| 3 | +import { createHash } from "node:crypto"; |
| 4 | + |
| 5 | +const targets = [ |
| 6 | + { path: "_reverse/glm/zcode.cjs", anchors: ["function HUs(", "function DGs(", "function s5s(", "WD_CLIENT_SIGN_KDF_SALT", "account_uuid", "disable_parallel_tool_use", "budget_tokens", "oauth/cli/init", "off-peak"] }, |
| 7 | + { path: "_reverse/app/out/host/index.js", anchors: ["Bh=class", "function vee(", "function oN(", "foreign-card", "next_draw_at", "/billing/claim"] }, |
| 8 | + { path: "_reverse/app/out/host/chunk-XLKRUNM2.js", anchors: ["requestVerificationClaimHeaders", "access_tokens", "off-peak"] }, |
| 9 | +]; |
| 10 | +for (const target of targets) { |
| 11 | + const source = readFileSync(target.path, "utf8"); |
| 12 | + console.log(JSON.stringify({ path: target.path, bytes: Buffer.byteLength(source), sha256: createHash("sha256").update(source).digest("hex") })); |
| 13 | + for (const anchor of target.anchors) { |
| 14 | + const offset = source.indexOf(anchor); |
| 15 | + console.log(JSON.stringify({ anchor, offset, excerpt: offset < 0 ? null : source.slice(Math.max(0, offset - 100), offset + 1600) })); |
| 16 | + } |
| 17 | +} |
| 18 | + |
| 19 | +// Literal presence is a drift signal, not a substitute for reconstructing the |
| 20 | +// client's dynamic section selection and joins. Keep failures visible. |
| 21 | +const bundle = readFileSync("_reverse/glm/zcode.cjs", "utf8"); |
| 22 | +const literalView = bundle.replace(/\\u([\da-f]{4})/gi, (_, hex) => String.fromCharCode(parseInt(hex, 16))) |
| 23 | + .replace(/\\`/g, "`"); |
| 24 | +const sidecar = JSON.parse(readFileSync("src/proxy/zcode_system.json", "utf8")); |
| 25 | +function strings(value: unknown): string[] { |
| 26 | + if (typeof value === "string") return [value]; |
| 27 | + if (value && typeof value === "object") return Object.values(value).flatMap(strings); |
| 28 | + return []; |
| 29 | +} |
| 30 | +const promptLines = [...new Set(strings(sidecar).flatMap(s => s.split("\n")).filter(s => s.length > 30))]; |
| 31 | +const missing = promptLines.filter(s => !literalView.includes(s) && !literalView.includes(JSON.stringify(s).slice(1, -1))); |
| 32 | +console.log(JSON.stringify({ check: "prompt-literal-presence", checked: promptLines.length, missing })); |
| 33 | +const poweredBy = literalView.indexOf("You are powered by the model named"); |
| 34 | +console.log(JSON.stringify({ check: "dynamic-model-line", offset: poweredBy, excerpt: poweredBy < 0 ? null : literalView.slice(Math.max(0, poweredBy - 100), poweredBy + 220) })); |
0 commit comments