fix(03-04): on-screen diagnostic probe — WA version/platform, initData char-count, session + location categories

This commit is contained in:
araharah-executor
2026-10-23 01:24:52 +08:00
parent de07c99e8a
commit f4453996ac
3 changed files with 60 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
/*
* probe.ts — DEBUG-ROUND diagnostic line (phase 3 device-matrix troubleshooting).
* ----------------------------------------------------------------------------
* One category-only instrument line, fixed bottom-left: which WebApp the app
* sees (version/platform), the character-count of the raw initData (a COUNT,
* never its content), the last session-gate category, and the location-chain
* category. No coordinates, no payload, no ids — same law as the Worker's
* category-only logs (D-14), only surfaced on-screen because a phone
* webview has no dev-tools access during the device-matrix pass.
*
* Rendering uses only machine tokens (letters, digits, separators) — no
* human copy, so no strings-module entry and no COPY5 concern. The probe is
* expected to be REMOVED or reduced at the device-matrix exit.
*/
export interface ProbeParts {
wa: string;
initDataChars: number | null;
session: string;
location: string;
}
export interface Probe {
el: HTMLElement;
set(parts: Partial<ProbeParts>): void;
}
export function createProbe(parent: HTMLElement): Probe {
const el = document.createElement("div");
el.className = "diag-probe";
el.setAttribute("aria-hidden", "true");
const parts: ProbeParts = { wa: "-", initDataChars: null, session: "-", location: "-" };
const state = { parts };
function render(): void {
const p = state.parts;
const q = p.initDataChars === null ? "-" : `${p.initDataChars}ch`;
el.textContent = `WA ${p.wa} · q ${q} · s ${p.session} · loc ${p.location}`;
}
parent.appendChild(el);
render();
return {
el,
set(delta: Partial<ProbeParts>): void {
Object.assign(state.parts, delta);
render();
},
};
}