// scan-49.mjs — every served document sentence that offers the fixed-endpoint absolute // statement (4.9) as a sufficient input, with whether that sentence restricts it to the // band piece. Deterministic: fetches the served documents listed below, prints in the // order given. No timing or rate on stdout. // // Method: paragraphs are unwrapped, split into sentences at ". " (and end of paragraph), // and the sentence containing "(4.9)" is tested for a band restriction. The earlier // version of this script tested a three-line window and misclassified // research/RESEARCH-EXECUTION.md, whose preceding line contains "Type II/band // coefficients" — a different sentence. Fixed scope: one sentence. import crypto from 'node:crypto'; const HEAD = { Authorization: `Bearer ${process.env.SAH_TOKEN}`, 'X-Session': '8937f38dd920d6b4780eaa59', 'X-Model': 'deepseek-v4.1-flash', 'User-Agent': 'buffy-agent (freebuff)' }; const DOCS = [ 'research/fixed-endpoint-discrepancy.md', 'research/QUESTIONS.md', 'research/OUTCOMES.md', 'research/RESEARCH-EXECUTION.md', 'research/research-round-validation.md', 'research/SEARCH-CONVENTIONS.md', 'research/history/CHANGELOG.md', 'research/joint-factor-estimate.md', 'research/README.md', ]; const TARGET = '(4.9)'; const sentences = (para) => { const out = []; let start = 0; for (let i = 0; i < para.length; i++) { if (para[i] === '.' && (i + 1 === para.length || para[i + 1] === ' ')) { out.push(para.slice(start, i + 1)); start = i + 1; } } if (start < para.length) out.push(para.slice(start)); return out; }; const out = []; let band = 0; let unq = 0; for (const p of DOCS) { const r = await fetch(`https://solveathome.org/projects/twin-primes/docs/${p}`, { headers: { ...HEAD, Accept: 'text/plain' } }); const t = await r.text(); if (r.status !== 200) { out.push(`## ${p} -- HTTP ${r.status}`); continue; } const sha = crypto.createHash('sha256').update(t).digest('hex'); out.push(`## ${p} -- ${t.length} bytes -- sha256 ${sha}`); const lines = t.replace(/\r\n/g, '\n').split('\n'); // paragraphs: consecutive non-empty lines let i = 0; const found = []; while (i < lines.length) { if (lines[i].trim() === '') { i++; continue; } const start = i; const buf = []; while (i < lines.length && lines[i].trim() !== '') { buf.push(lines[i].trim()); i++; } const para = buf.join(' '); if (!para.includes(TARGET)) continue; for (const s of sentences(para)) { if (!s.includes(TARGET)) continue; found.push({ line: start + 1, s: s.trim() }); } } for (const f of found) { const isSuff = /sufficient/i.test(f.s); const hasBand = /band/i.test(f.s); if (isSuff) { if (hasBand) band++; else unq++; } const verdict = !isSuff ? 'NOT-SUFFICIENCY ' : hasBand ? 'BAND-QUALIFIED ' : 'UNQUALIFIED '; out.push(` line ${String(f.line).padStart(4)} ${verdict} ${f.s.slice(0, 240)}`); } out.push(` -> sentences naming (4.9): ${found.length}`); } out.push(''); out.push('SUMMARY band-qualified sufficiency sentences: ' + band + '; unqualified: ' + unq); const text = out.join('\n') + '\n'; process.stdout.write(text); process.stderr.write(`scan-49 sha256 ${crypto.createHash('sha256').update(text).digest('hex')}\n`);