In this section
- Test Lead 2152 test · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-4/tester/test.lead-2152.cjs lines 1–214
- Prep automation · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-5/builder/prep.sh lines 1–21
- Section C render · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-6/builder/section-c.js lines 1–214
- Stub B render · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-6/builder/stub-b.cjs lines 1–64
- Shift storage · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-6/evidence/shift.py lines 1–34
- Test Section C test · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-7/builder/test_sectionC.cjs lines 1–37
- Mksite storage · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-7/tester/mksite.py lines 1–42
Test Lead 2152
A JavaScript module in the tester folder of Neural Link Between Agents that works with same order (`sameOrder`) and draws on a canvas, using SHA-256.
testneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-4/tester/test.lead-2152.cjs · lines 1–214 of 214 · Entry point · pattern sameOrder (shared by 3 files)
- What it does
- It tests its inputs. Defines 15 functions or classes, including flag, sleep, sha, probe, rec. Uses libraries playwright, fs, path, crypto, child_process. Side effects: changes the web page (DOM); reads or writes files; starts processes.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'agents'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- In: JSON file modules.json; JSON file keys.json; command-line arguments. Out: JSON file report.json; JSON file modules.json; canvas drawing.
- Downstream impact
- It is itself an entry point (JavaScript module); no other file was found loading it.
- What it achieves
- It is built from the probe step (`probe`), the rec step (`rec`) and the manifest step (`manifest`). Defines `flag`, `sleep`, `sha` and 11 more.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- neural-link-between-agents · FIXES/NL-010/tools/evidence/nl010-opus/team-4/tester · JavaScript module
- Uses
- playwright, fs, path, crypto, child_process, os
- Used by
- none found
- Produces
- flag, sleep, sha, probe, rec, manifest, run, sameOrder, why, net404, add, test8
- Defines here
- flag, sleep, sha, probe, rec, manifest, run, sameOrder, why, net404, add, test8, mk, proof, check
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- neural-link-between-agents@598eff3f59afe11738d64cb14cb8befe5e37cdc2 FIXES/NL-010/tools/evidence/nl010-opus/team-4/tester/test.lead-2152.cjs:1-214 · blob 7ac9830f36ef569c8875bcf4bfee6a265dc636d6 · GitHub at these lines
- State
- achieves: name · context: auto · stage: output · effects: dom, filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: unknown
#!/usr/bin/env node
// test.cjs: NL-010 step 4 "the Kuiper cartridge law", tests 1-9 (ROADMAP.md step 4; team-2/STEPS.md step 4 acceptance).
//
// node test.cjs <edition-url> <outdir> [--page <patched index.html>] [--devices "Pixel 7,Galaxy S24"]
//
// <edition-url> is http://127.0.0.1:<port>/editions/202611012135/ served from the kuiper-belt root. Until the
// integrator applies handoff/04-loader/index.html.patch, pass --page with the patched file and the test serves it in
// place of index.html (served, not committed). The manifests and every mutated module are served by the test through
// page.route, never written into the repository. Pixel 7 and Galaxy S24 (360 px), real touch (page.touchscreen.tap),
// pageerror 0 in every case; console errors 0 except the browser's own "Failed to load resource" line in the cases that
// serve a 404 on purpose (6 and 7b), which is counted and reported. Test 8 runs tools/edition_check.py (from
// handoff/04-loader/edition_check.py.patch when the tool is not in the repository yet) on a copy. Exit 0 when all pass.
'use strict';
const { chromium, devices } = require('playwright');
const fs = require('fs'), path = require('path'), crypto = require('crypto'), cp = require('child_process'), os = require('os');
const argv = process.argv.slice(2), pos = argv.filter((a, i) => !a.startsWith('--') && !(i && argv[i - 1].startsWith('--')));
const flag = n => { const i = argv.indexOf(n); return i >= 0 ? argv[i + 1] : null; };
if (pos.length < 2) { console.error('usage: node test.cjs <edition-url> <outdir> [--page file] [--devices A,B]'); process.exit(2); }
const BASE = pos[0].replace(/\/?$/, '/'), OUT = path.resolve(pos[1]), PAGE = flag('--page');
const DEVICES = (flag('--devices') || 'Pixel 7,Galaxy S24').split(',').map(s => s.trim());
const HERE = __dirname, ED = path.resolve(HERE, '../..'), REPO = path.resolve(ED, '../..');
const sleep = ms => new Promise(r => setTimeout(r, ms));
const sha = b => crypto.createHash('sha256').update(b).digest('hex');
fs.mkdirSync(OUT, { recursive: true });
// ------------------------------------------------------------------------------------------- fixtures
const FIRST = JSON.parse(fs.readFileSync(path.join(HERE, 'modules.json'), 'utf8'));
const HELLO = fs.readFileSync(path.join(ED, FIRST.modules[0].path));
const STAMP = '202611012145';
const HOOKS28 = ['keyPlace', 'address', 'describe', 'findBy', 'flyTo', 'home', 'homeCamera', 'safeBox', 'lightTime', 'showNew',
'goKey', 'fmt', 'words', 'esc', 'cv', 'ov', 'o2', 'hud', 'big', 'sub', 'card', 'gbox', 'gin', 'SPACE', 'N', 'repos', 'commits', 'wafer'];
function probe(id, requires, body) { // a test-only module, served by the test, never committed
return Buffer.from(`/* kuiper module ${id}, generation ${STAMP} (UTC), Apache-2.0 (kuiper-belt) */
// test-only probe of handoff/04-loader/test.cjs; served by the test, never committed
(function () {
'use strict';
KY.register({ schema: 'kuiper.module.v1', id: '${id}', generation: '${STAMP}', requires: ${JSON.stringify(requires)}, provides: ['${id}'],
install(KY) { const h = document.createElement('div'); h.id = 'ky-${id}'; h.hidden = true; document.body.appendChild(h); ${body || 'return { ok: true };'} },
inspect() { return { id: '${id}' }; } });
})();
`);
}
function rec(id, file, buf, requires, extra) {
return Object.assign({ id, generation: STAMP, path: 'modules/' + file, sha256: sha(buf), bytes: buf.length, byte_budget: 4096,
requires, provides: [id], reads: [], writes: ['window.KY.modules.' + id, '#ky-' + id], creates_controls: 'none',
licence: 'Apache-2.0', team: '04', step: 4, proof: 'handoff/04-loader/' }, extra || {});
}
const PA = probe('probe-a', ['keyPlace', 'cam']), PB = probe('probe-b', ['keyPlace', 'probe-a']);
const PW = probe('probe-w', ['wafer', 'N'], `window.__probeW = { installed_ms: performance.now(), N_at_install: KY.hooks.N };
return KY.hooks.wafer.then(w => { window.__probeW.resolved_ms = performance.now(); window.__probeW.N = w.N; return { N: w.N }; },
e => { window.__probeW.rejected = String(e && e.message || e); throw e; });`);
function manifest(mods) { return Object.assign({}, FIRST, { order: mods.map(m => m.id), modules: mods }); }
const R_HELLO = FIRST.modules[0];
const R_PA = rec('probe-a', STAMP + '-probe-a.js', PA, ['keyPlace', 'cam']);
const R_PB = rec('probe-b', STAMP + '-probe-b.js', PB, ['keyPlace', 'probe-a']);
const R_PW = rec('probe-w', STAMP + '-probe-w.js', PW, ['wafer', 'N']);
const THREE = manifest([R_HELLO, R_PA, R_PB]);
const files = { [R_PA.path]: PA, [R_PB.path]: PB, [R_PW.path]: PW };
// ------------------------------------------------------------------------------------------- one run
async function run(browser, dev, name, o) {
const ctx = await browser.newContext({ ...devices[dev] }), page = await ctx.newPage();
const errors = [], consoleErr = [];
page.on('pageerror', e => errors.push(String(e && e.message || e)));
page.on('console', m => { if (m.type() === 'error') consoleErr.push(m.text()); });
if (PAGE) await page.route(u => u.href === BASE || u.href === BASE + 'index.html', r => r.fulfill({ status: 200, contentType: 'text/html; charset=utf-8', body: fs.readFileSync(PAGE) }));
await page.route(BASE + 'modules.json', r => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(o.manifest) }));
const served = Object.assign({}, files, o.files || {});
await page.route(u => u.href.startsWith(BASE + 'modules/'), r => { const p = r.request().url().slice(BASE.length);
if (served[p] === 404) return r.fulfill({ status: 404, body: 'not found' });
if (served[p]) return r.fulfill({ status: 200, contentType: 'text/javascript', body: served[p] });
return r.continue(); });
let waferAt = null;
if (o.wafer === '404') await page.route(/cosmos\/wafer\.tsv$/, r => r.fulfill({ status: 404, body: 'not found' }));
if (o.wafer === 'delay') await page.route(/cosmos\/wafer\.tsv$/, async r => { await sleep(o.delay || 12000); waferAt = Date.now(); await r.continue(); });
const t0 = Date.now();
await page.goto(BASE, { waitUntil: 'load', timeout: 120000 });
await page.waitForFunction(() => window.__KUIPER_EDITION__ && window.__KUIPER_EDITION__.done, null, { timeout: 90000 });
await sleep(o.settle || 7000);
const st = await page.evaluate(() => {
const E = window.__KUIPER_EDITION__, nav = performance.getEntriesByType('navigation')[0], rf = document.getElementById('refuse');
const rr = rf && rf.getBoundingClientRect();
return { admitted: E.admitted, refused: E.refused, failures: E.failures, whole: E.whole || null, order: E.order, timings: E.timings,
bytes: E.bytes, byte_budget: E.byte_budget, load_event_ms: Math.round(nav.loadEventStart), dcl_ms: Math.round(nav.domContentLoadedEventStart),
refuse: rf ? { text: rf.textContent, role: rf.getAttribute('role'), rect: { left: rr.left, top: rr.top, right: rr.right, bottom: rr.bottom },
visible: getComputedStyle(rf).display !== 'none' && rr.height > 0, inViewport: rr.left >= 0 && rr.top >= 0 && rr.right <= innerWidth && rr.bottom <= innerHeight } : null,
hud: document.getElementById('hud').textContent, bar: !!document.getElementById('bar'), vw: innerWidth, vh: innerHeight,
hosts: [...document.querySelectorAll('[id^="ky-"]')].map(e => e.id), scripts: [...document.querySelectorAll('script[data-ky-module]')].map(s => s.dataset.kyModule),
N: window.KY ? window.KY.hooks.N : null, probeW: window.__probeW || null,
frozen: window.KY ? { KY: Object.isFrozen(window.KY), hooks: Object.isFrozen(KY.hooks), names: Object.isFrozen(KY.names), cam: Object.isFrozen(KY.cam),
lit: Object.isFrozen(KY.lit), sel: Object.isFrozen(KY.sel), draw: Object.isFrozen(KY.draw), panels: Object.isFrozen(KY.panels) } : null,
hookKeys: window.KY ? Object.keys(KY.hooks) : null, alias: window.KY ? window.__KUIPER_MODULES__ === KY.modules : null,
writeThrows: (() => { try { 'use strict'; window.KY.hooks.flyTo = null; return false; } catch (e) { return e instanceof TypeError; } })(),
helloInspect: window.KY && KY.modules.hello ? KY.modules.hello.inspect() : null };
});
// the wafer is drawn: non-black pixels of a CSS-px screenshot, outside the bar and the refusal strip
const shot = await page.screenshot({ scale: 'css', timeout: 180000 });
st.wafer = await page.evaluate(async ({ b64, skip }) => { const img = new Image(); img.src = 'data:image/png;base64,' + b64; await img.decode();
const c = document.createElement('canvas'); c.width = img.width; c.height = img.height; const x = c.getContext('2d', { willReadFrequently: true }); x.drawImage(img, 0, 0);
const d = x.getImageData(0, 0, c.width, c.height).data, bar = document.getElementById('bar').getBoundingClientRect(); let lit = 0, n = 0;
for (let y = Math.ceil(bar.bottom) + 2; y < c.height; y += 2) for (let X = 0; X < c.width; X += 2) {
if (skip && X >= skip.left && X <= skip.right && y >= skip.top && y <= skip.bottom) continue;
const i = (y * c.width + X) * 4; n++; if (d[i] + d[i + 1] + d[i + 2] > 60) lit++; }
return { lit_fraction: +(lit / n).toFixed(4), sampled: n }; }, { b64: shot.toString('base64'), skip: st.refuse && st.refuse.rect });
st.waferDrawn = st.wafer.lit_fraction > 0.01;
if (o.shot) fs.writeFileSync(path.join(OUT, `${o.shot}-${dev.replace(/ /g, '_')}.png`), shot);
if (o.touch) st.touch = await o.touch(page);
st.pageerror = errors; st.console_errors = consoleErr; st.wall_ms = Date.now() - t0; st.wafer_delayed_until_ms = waferAt ? waferAt - t0 : null;
await ctx.close();
return st;
}
const sameOrder = (st, ids, m) => st.admitted.length === ids.length && st.admitted.every((a, i) => a.id === ids[i] && a.sha256 === m.modules.find(x => x.id === a.id).sha256);
const why = (st, id) => (st.refused.find(r => r.id === id) || {}).why || '';
const net404 = s => s.every(t => /Failed to load resource.*404/.test(t));
(async () => {
const browser = await chromium.launch({ args: ['--use-gl=angle', '--use-angle=swiftshader', '--enable-unsafe-swiftshader', '--ignore-gpu-blocklist'] });
const report = { url: BASE, page: PAGE || 'served index.html', started: new Date().toISOString(), devices: {}, test8: null };
let allPass = true;
for (const dev of DEVICES) {
const T = {}; report.devices[dev] = T;
const add = (k, pass, data) => { T[k] = Object.assign({ PASS: !!pass }, data); if (!pass) allPass = false; console.log(dev, k, pass ? 'PASS' : 'FAIL'); };
let s;
// 1 every order entry admitted in order with the manifest's sha256; readout lines; real touch opens READOUT
s = await run(browser, dev, 't1', { manifest: THREE, shot: '1-admitted', touch: async page => {
const b = await page.$('#bar .gm-title[data-panel="hud"]'); const r = await b.boundingBox();
await page.touchscreen.tap(r.x + r.width / 2, r.y + r.height / 2); await sleep(1500);
return page.evaluate(() => ({ open: document.getElementById('hud').classList.contains('gm-open'), lines: document.getElementById('hud').textContent.split('\n').filter(l => / admitted · [0-9a-f]{12}$/.test(l)) })); } });
add('1', sameOrder(s, ['hello', 'probe-a', 'probe-b'], THREE) && !s.refused.length && !s.refuse && s.touch.open && s.touch.lines.length === 3
&& s.helloInspect && s.helloInspect.frames_drawn > 0 && !s.pageerror.length && !s.console_errors.length, s);
// 2 one byte changed in a served module: sha256 mismatch, the rest admitted, alert inside the viewport, wafer drawn
const bad = Buffer.from(HELLO); bad[bad.length - 2] ^= 1;
s = await run(browser, dev, 't2', { manifest: THREE, files: { [R_HELLO.path]: bad }, shot: '2-sha-mismatch' });
add('2', why(s, 'hello') === 'sha256 mismatch' && s.admitted.map(a => a.id).join() === 'probe-a,probe-b' && s.refuse && s.refuse.role === 'alert'
&& s.refuse.visible && s.refuse.inViewport && s.waferDrawn && s.bar && !s.hosts.includes('ky-hello') && !s.scripts.includes('hello') && !s.pageerror.length && !s.console_errors.length, s);
// 3 requires noSuchHook: missing hook; host absent; the module that requires its provides refused too
s = await run(browser, dev, 't3', { manifest: manifest([R_HELLO, Object.assign({}, R_PA, { requires: ['noSuchHook'] }), R_PB]) });
add('3', why(s, 'probe-a') === 'missing hook noSuchHook' && why(s, 'probe-b') === 'missing hook probe-a' && s.admitted.map(a => a.id).join() === 'hello'
&& !s.hosts.includes('ky-probe-a') && !s.pageerror.length && !s.console_errors.length, s);
// 4 renamed stamp: refused in words; renamed without leading digits: admitted (identity is generation + sha256)
s = await run(browser, dev, 't4a', { manifest: manifest([R_HELLO, Object.assign({}, R_PA, { path: 'modules/202611012146-probe-a.js' })]), files: { 'modules/202611012146-probe-a.js': PA } });
const s4b = await run(browser, dev, 't4b', { manifest: manifest([R_HELLO, Object.assign({}, R_PA, { path: 'modules/probe-a.js' })]), files: { 'modules/probe-a.js': PA } });
add('4', why(s, 'probe-a') === 'stamp mismatch: generation 202611012145, file name 202611012146' && s.admitted.map(a => a.id).join() === 'hello'
&& s4b.admitted.map(a => a.id).join() === 'hello,probe-a' && !s.pageerror.length && !s4b.pageerror.length && !s.console_errors.length && !s4b.console_errors.length, { renamed: s, no_digits: s4b });
// 5 install throws: install threw test, the rest admitted
const thr = Buffer.from(HELLO.toString().replace('install(KY) {', "install(KY) { throw new Error('test');"));
s = await run(browser, dev, 't5', { manifest: manifest([Object.assign({}, R_HELLO, { sha256: sha(thr), bytes: thr.length }), R_PA, R_PB]), files: { [R_HELLO.path]: thr } });
add('5', why(s, 'hello') === 'install threw test' && s.admitted.map(a => a.id).join() === 'probe-a,probe-b' && !s.pageerror.length && !s.console_errors.length, s);
// 6 file deleted: HTTP 404
s = await run(browser, dev, 't6', { manifest: THREE, files: { [R_HELLO.path]: 404 } });
add('6', why(s, 'hello') === 'HTTP 404' && s.admitted.map(a => a.id).join() === 'probe-a,probe-b' && !s.pageerror.length && net404(s.console_errors), s);
// 7 empty manifest: whole wafer and bar, admitted [], no alert, KY frozen, the 28 hooks, the alias
s = await run(browser, dev, 't7', { manifest: manifest([]), shot: '7-empty' });
add('7', s.waferDrawn && s.bar && !s.admitted.length && !s.refused.length && !s.refuse && s.frozen && Object.values(s.frozen).every(Boolean) && s.writeThrows
&& JSON.stringify(s.hookKeys) === JSON.stringify(HOOKS28) && s.alias && !s.pageerror.length && !s.console_errors.length, s);
// 7b wafer.tsv 404: modules that do not require the wafer admitted, the engine's words in the strip, the wafer module's install rejects in words
s = await run(browser, dev, 't7b', { manifest: manifest([R_HELLO, R_PA, R_PW]), wafer: '404' });
add('7b', s.admitted.map(a => a.id).join() === 'hello,probe-a,probe-w' && s.refuse && /did not load\. The wafer will not invent its keys\./.test(s.refuse.text)
&& s.probeW && /did not load/.test(s.probeW.rejected || '') && s.failures.some(f => f.id === 'probe-w') && !s.pageerror.length && net404(s.console_errors), s);
// 7c wafer.tsv held back 12 s: hello is admitted while the 535,037-byte fetch is still pending
s = await run(browser, dev, 't7c', { manifest: manifest([R_HELLO, R_PW]), wafer: 'delay', delay: 12000, settle: 16000 });
const hAd = (s.admitted.find(a => a.id === 'hello') || {}).t_ms;
add('7c', hAd != null && s.probeW && s.probeW.N_at_install === 0 && s.probeW.resolved_ms > hAd + 5000 && s.N > 0 && !s.pageerror.length && !s.console_errors.length,
Object.assign(s, { hello_admitted_ms: hAd, wafer_resolved_ms: s.probeW && Math.round(s.probeW.resolved_ms) }));
// 9 measured, no threshold: load to last admitted; sum of bytes against sum of byte_budget (from test 1's manifest)
const t1 = T['1'];
add('9', t1.timings.last_admitted_ms != null, { nav_to_last_admitted_ms: t1.timings.last_admitted_ms, load_event_ms: t1.load_event_ms,
load_to_last_admitted_ms: t1.timings.last_admitted_ms - t1.load_event_ms, loader_start_ms: t1.timings.loader_start_ms,
bytes: t1.bytes, byte_budget: t1.byte_budget, modules: t1.admitted.length, note: 'SwiftShader in Playwright, served from 127.0.0.1; negative load_to_last_admitted means the last module was admitted before the load event' });
}
// 8 edition_check.py E1-E8 PASS on the integrated copy, FAIL on each mutation applied to a copy
report.test8 = test8(); if (!report.test8.PASS) allPass = false; console.log('test 8', report.test8.PASS ? 'PASS' : 'FAIL');
report.PASS = allPass; report.finished = new Date().toISOString();
fs.writeFileSync(path.join(OUT, 'report.json'), JSON.stringify(report, null, 1));
await browser.close();
console.log('RESULT:', allPass ? 'PASS' : 'FAIL'); process.exit(allPass ? 0 : 1);
})().catch(e => { console.error(e); process.exit(2); });
function test8() {
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'ky-t8-')), out = {};
const mk = name => { const d = path.join(tmp, name), e = path.join(d, 'editions', '202611012135');
fs.mkdirSync(path.join(e, 'modules'), { recursive: true }); fs.mkdirSync(path.join(d, 'tools'));
fs.copyFileSync(path.join(REPO, 'editions', 'index.html'), path.join(d, 'editions', 'index.html'));
fs.cpSync(path.join(REPO, 'editions', '202611012027'), path.join(d, 'editions', '202611012027'), { recursive: true });
for (const f of ['index.html', 'keys.json', 'README.md']) fs.copyFileSync(path.join(ED, f), path.join(e, f));
for (const f of [R_HELLO.path, FIRST.references[0].file]) fs.copyFileSync(path.join(ED, f), path.join(e, f));
fs.writeFileSync(path.join(e, 'modules.json'), JSON.stringify(FIRST, null, 1));
if (!fs.readFileSync(path.join(e, 'index.html'), 'utf8').includes('KUIPER HOOK TABLE AND LOADER'))
cp.execFileSync('patch', ['-p1', '-s', '-i', path.join(HERE, 'index.html.patch')], { cwd: d });
const tool = path.join(REPO, 'tools', 'edition_check.py');
if (fs.existsSync(tool)) fs.copyFileSync(tool, path.join(d, 'tools', 'edition_check.py'));
else cp.execFileSync('patch', ['-p1', '-s', '-i', path.join(HERE, 'edition_check.py.patch')], { cwd: d });
return { d, e }; };
const proof = e => { const lines = []; const walk = p => { for (const f of fs.readdirSync(p).sort()) { const q = path.join(p, f);
if (fs.statSync(q).isDirectory()) { if (f !== 'handoff') walk(q); } else if (!q.endsWith('edition-sha256.txt')) lines.push(sha(fs.readFileSync(q)) + ' ./' + path.relative(e, q)); } };
walk(e); fs.mkdirSync(path.join(e, 'proof'), { recursive: true }); fs.writeFileSync(path.join(e, 'proof', 'edition-sha256.txt'), lines.join('\n') + '\n'); };
const check = d => { const r = cp.spawnSync('python3', ['tools/edition_check.py', 'editions/202611012135'], { cwd: d, encoding: 'utf8' }); return { rc: r.status, out: r.stdout.trim().split('\n') }; };
const mut = {
hash: e => { const p = path.join(e, R_HELLO.path), b = fs.readFileSync(p); b[b.length - 2] ^= 1; fs.writeFileSync(p, b); },
stamp: e => { fs.renameSync(path.join(e, R_HELLO.path), path.join(e, 'modules/202611012146-hello.js'));
const m = JSON.parse(fs.readFileSync(path.join(e, 'modules.json'))); m.modules[0].path = 'modules/202611012146-hello.js'; fs.writeFileSync(path.join(e, 'modules.json'), JSON.stringify(m)); },
requires: e => { const m = JSON.parse(fs.readFileSync(path.join(e, 'modules.json'))); m.modules[0].requires = ['noSuchHook']; fs.writeFileSync(path.join(e, 'modules.json'), JSON.stringify(m)); },
stray: e => fs.writeFileSync(path.join(e, 'modules/202611012150-stray.js'), '/* stray */\n'),
writes: e => { const m = JSON.parse(fs.readFileSync(path.join(e, 'modules.json'))); m.modules[0].writes.push('#ky-nowhere'); fs.writeFileSync(path.join(e, 'modules.json'), JSON.stringify(m)); },
register_twice: e => { const p = path.join(e, R_HELLO.path), t = fs.readFileSync(p, 'utf8') + '// KY.register( again\n'; fs.writeFileSync(p, t);
const m = JSON.parse(fs.readFileSync(path.join(e, 'modules.json'))); m.modules[0].sha256 = sha(Buffer.from(t)); m.modules[0].bytes = Buffer.byteLength(t); fs.writeFileSync(path.join(e, 'modules.json'), JSON.stringify(m)); },
no_licence: e => { const m = JSON.parse(fs.readFileSync(path.join(e, 'modules.json'))); m.modules[0].licence = ''; fs.writeFileSync(path.join(e, 'modules.json'), JSON.stringify(m)); } };
const c0 = mk('committed'); proof(c0.e); out.integrated = check(c0.d);
let pass = out.integrated.rc === 0 && ['E1', 'E2', 'E3', 'E4', 'E5', 'E6', 'E7', 'E8'].every(k => out.integrated.out.some(l => l.startsWith(k + ' PASS')));
out.mutations = {};
for (const [k, f] of Object.entries(mut)) { const c = mk(k); f(c.e); proof(c.e); const r = check(c.d); out.mutations[k] = r; if (r.rc !== 1) pass = false; }
out.PASS = pass; fs.rmSync(tmp, { recursive: true, force: true });
return out;
}Prep
A shell script in the builder folder of Neural Link Between Agents that uses SHA-256.
automationneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-5/builder/prep.sh · lines 1–21 of 21 · Entry point
- What it does
- It loads data. Side effects: reads or writes files; starts processes.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'agents'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- In: command-line arguments. Out: JSON file modules.json.
- Downstream impact
- It is itself an entry point (shell script); no other file was found loading it.
- What it achieves
- It writes `/modules.json`.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- neural-link-between-agents · FIXES/NL-010/tools/evidence/nl010-opus/team-5/builder · shell script
- Uses
- none found
- Used by
- none found
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- neural-link-between-agents@598eff3f59afe11738d64cb14cb8befe5e37cdc2 FIXES/NL-010/tools/evidence/nl010-opus/team-5/builder/prep.sh:1-21 · blob bb8e1442f32da496d3b80c833507e101cdb4cd86 · GitHub at these lines
- State
- achieves: name · context: auto · stage: output · effects: filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: unknown
#!/bin/bash
# rebuild the scratch edition: live modules + data, patched index.html, manifest with fresh sha256s
B=/tmp/nl010-opus/team-5/builder; KB=/home/user/estate/kuiper-belt; E=$B/site/editions/202611012135
rm -rf $E; mkdir -p $E; cp -r $KB/editions/202611012135/{index.html,keys.json,data,modules} $E/
cd $E && patch -s -p3 < $KB/editions/202611012135/handoff/04-loader/index.html.patch || exit 1
python3 - "$E" "$@" <<'PY'
import sys, json, hashlib, os
E = sys.argv[1]; ids = sys.argv[2:] or ['line-card', 'see-through']
mods = []
for f in sorted(os.listdir(E + '/modules')):
stamp, name = f[:12], f[13:-3]
if name not in ids: continue
b = open(E + '/modules/' + f, 'rb').read()
import subprocess
reg = json.loads(subprocess.check_output(['node', '-e', 'let r;global.window={KY:{register:x=>r=x}};global.document={};require(process.argv[1]);console.log(JSON.stringify({q:r.requires,p:r.provides}))', E + '/modules/' + f]))
mods.append({'id': name, 'generation': stamp, 'path': 'modules/' + f, 'sha256': hashlib.sha256(b).hexdigest(), 'bytes': len(b),
'byte_budget': 65536, 'requires': reg['q'], 'provides': reg['p'], 'reads': [], 'writes': [], 'creates_controls': 'none', 'licence': 'Apache-2.0'})
order = [i for i in ids if any(m['id'] == i for m in mods)]
json.dump({'schema': 'kuiper.modules.v1', 'edition': '202611012135', 'hooks': 'kuiper.hooks.v1', 'order': order, 'modules': mods}, open(E + '/modules.json', 'w'), indent=1)
print('order', order)
PYSection C
A JavaScript file in the builder folder of Neural Link Between Agents that shows payload (`showPayload`), exports image (`exportImage`), prints view (`printView`) and draws on a canvas.
renderneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-6/builder/section-c.js · lines 1–214 of 214 · Not reached from any entry point (candidate for review) · pattern capturePainter (shared by 2 files)
- What it does
- It draws its content. Defines 25 functions or classes, including mk, payloadField, payloadStyle, showPayload, copyText. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'agents'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- Out: canvas drawing.
- What it achieves
- It shows payload (`showPayload`), copies text (`copyText`) and exports image (`exportImage`). SECTION C begin (OPUS-6 builder): EXPORT, the EDIT paste field, the Backspace rule, copy-or-show. It responds to click, focus and keydown events.
- Why it matters
- No other file in the estate was found to import it.
- Application
- neural-link-between-agents · FIXES/NL-010/tools/evidence/nl010-opus/team-6/builder · script
- Uses
- none found
- Used by
- none found
- Produces
- mk, payloadField, payloadStyle, showPayload, copyText, looksBlank, utcStamp, editionName, viewLink, footLines, capturePainter, capture
- Defines here
- mk, payloadField, payloadStyle, showPayload, copyText, looksBlank, utcStamp, editionName, viewLink, footLines, capturePainter, capture, stamped, say, fileName, exportImage, printView, go, exportRows, looksLikeLink, takePaste, wireFind, openPaste, pasteRow, wireBackspace
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- neural-link-between-agents@598eff3f59afe11738d64cb14cb8befe5e37cdc2 FIXES/NL-010/tools/evidence/nl010-opus/team-6/builder/section-c.js:1-214 · blob b93e72db38326b53e115429c7c69154373120211 · GitHub at these lines
- State
- achieves: comment · context: auto · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
// ==== SECTION C begin (OPUS-6 builder): EXPORT, the EDIT paste field, the Backspace rule, copy-or-show
// Keys: GridAtlas's export and clipboard method, gridatlas@5ec7f62 atlas/modules/202609031958-menu-bar.js:707-733
// (copy, else show the payload in full), :794-811 (export this view; the image is checked before it is offered),
// :813-816 exportStamp (UTC to the minute), :1082-1097 looksBlank (sample a 40x40 probe), :1120-1137 capture INSIDE a
// render frame, :1354-1365 every export control named by id and data-*-export. The Kuiper's WebGL context is
// {antialias:false, alpha:false} with no preserveDrawingBuffer (editions/202611012135/index.html:122), so a read outside
// the frame is opaque black, not transparent: the blank test here is "every probe pixel one colour" (alpha 0 included),
// GridAtlas's sample taken one step further for an opaque canvas. The capture runs as the last painter of KY.draw.add,
// after the engine's wafer (index.html:332-363) and overlay (:384 ff.) in the same task.
var C = (function () {
var KYc = null, Hc = null, Lk = null, st = { exports: [], copies: [], pastes: [], backspace: 0, capture: null };
var COPIED_MS = 4000, CAPTURE_ORDER = 1e9, CAPTURE_WAIT_MS = 4000;
var LICENCE_LINE = 'code Apache-2.0, text and data CC BY 4.0'; // editions/README.md:27
var BLANK_WORDS = 'the image came back blank; try again after the wafer has drawn';
function mk(tag, cls, text) { var e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; }
// ---- copy, never silent (6.1 LINK; 6.L1). rowEl: the row that asked; text: the payload.
function payloadField(rowEl) { return rowEl.parentNode ? rowEl.parentNode.querySelector('input.ky-file-payload[data-for="' + rowEl.id + '"]') : null; }
var PAYLOAD_CSS = 'ky-file-payload-css';
function payloadStyle() { // a 44 px field in the shell's face (MB:221 rows >= 44 px)
if (document.getElementById(PAYLOAD_CSS)) return; var c = mk('style'); c.id = PAYLOAD_CSS;
c.textContent = 'input.ky-file-payload{display:block;box-sizing:border-box;width:100%;min-height:44px;margin:0;padding:10px 12px;'
+ 'font:12px/1.4 ui-monospace,Menlo,Consolas,monospace;color:#fff;background:#05070c;border:1px solid #2ee6e6;border-radius:0;'
+ '-webkit-user-select:text;user-select:text}';
document.head.appendChild(c);
}
function showPayload(rowEl, text, why) {
payloadStyle();
var f = payloadField(rowEl);
if (!f) { f = mk('input', 'ky-file-payload'); f.type = 'text'; f.readOnly = true; f.setAttribute('data-for', rowEl.id);
f.setAttribute('aria-label', 'the clipboard is not available here: select and copy this by hand');
f.addEventListener('click', function (e) { e.stopPropagation(); f.select(); });
f.addEventListener('focus', function () { f.select(); });
rowEl.parentNode.insertBefore(f, rowEl.nextSibling); }
f.value = text; f.title = why;
try { f.focus({ preventScroll: true }); } catch (e) { try { f.focus(); } catch (e2) {} }
try { f.select(); f.setSelectionRange(0, text.length); } catch (e) {}
st.copies.push({ row: rowEl.id, ok: false, why: why, text: text });
return false;
}
function copyText(rowEl, text) {
var label = rowEl.querySelector('.ky-file-label') || rowEl.firstChild || rowEl;
if (!rowEl.hasAttribute('data-label')) rowEl.setAttribute('data-label', label.textContent);
var was = rowEl.getAttribute('data-label'), clip = navigator.clipboard;
if (!clip || typeof clip.writeText !== 'function') return Promise.resolve(showPayload(rowEl, text, 'navigator.clipboard is not available on this page'));
var p; try { p = clip.writeText(text); } catch (e) { return Promise.resolve(showPayload(rowEl, text, 'the clipboard refused: ' + (e && e.message || e))); }
return Promise.resolve(p).then(function () {
var f = payloadField(rowEl); if (f) f.remove();
label.textContent = '✓ Copied'; st.copies.push({ row: rowEl.id, ok: true, text: text });
clearTimeout(rowEl._kyCopied); rowEl._kyCopied = setTimeout(function () { label.textContent = was; }, COPIED_MS);
return true;
}, function (e) { return showPayload(rowEl, text, 'the clipboard refused: ' + (e && e.message || e)); });
}
// ---- EXPORT (6.1): the capture, the blank test, the stamp
function looksBlank(canvas) { // GridAtlas :1082 generalised for an opaque canvas
try {
var probe = mk('canvas'); probe.width = 40; probe.height = 40;
var c = probe.getContext('2d'); c.drawImage(canvas, 0, 0, 40, 40);
var d = c.getImageData(0, 0, 40, 40).data, r = d[0], g = d[1], b = d[2], a = d[3], anyAlpha = false;
for (var i = 0; i < d.length; i += 4) { if (d[i + 3] !== 0) anyAlpha = true; if (d[i] !== r || d[i + 1] !== g || d[i + 2] !== b || d[i + 3] !== a) return false; }
return true; // one colour (or wholly transparent)
} catch (e) { return false; } // a tainted canvas is not blank (GridAtlas :1090-1094)
}
function utcStamp(now) { return now.toISOString().replace('T', ' ').slice(0, 16) + ' UTC'; } // GridAtlas :813-816
function editionName() {
var m = String(Hc.big && Hc.big.textContent || '').match(/Kuiper Edition \d+/i);
return (m ? m[0] : 'Kuiper edition') + ' · ' + KYc.edition;
}
function viewLink() {
try { if (Lk && typeof Lk.hashText === 'function') { var h = Lk.hashText(); return location.origin + location.pathname + (h ? '#' + h : ''); } } catch (e) {}
return location.origin + location.pathname + location.hash;
}
// the foot every exported artefact carries: edition, stamp, UTC time, licence, and the link that reopens the view
function footLines(now) { return [editionName() + ' · ' + utcStamp(now), LICENCE_LINE, viewLink()]; }
var pending = null;
function capturePainter() { // runs inside draw(), after the wafer and the overlay
if (!pending) return; var p = pending; pending = null; clearTimeout(p.timer);
try {
var cv = Hc.cv, ov = Hc.ov, W = cv.width, Hh = cv.height;
if (!W || !Hh) { p.done(null, 'the wafer has no size to capture'); return; }
var view = mk('canvas'); view.width = W; view.height = Hh;
var v = view.getContext('2d'); v.drawImage(cv, 0, 0); v.drawImage(ov, 0, 0, W, Hh);
p.done(view, null);
} catch (e) { p.done(null, 'the capture failed: ' + (e && e.message || e)); }
}
function capture() { // -> Promise<{view} | {refused}>
return new Promise(function (res) {
if (pending) { clearTimeout(pending.timer); pending.done(null, 'a newer capture was asked for'); }
pending = { done: function (view, why) { res(view ? { view: view } : { refused: why }); },
timer: setTimeout(function () { if (pending) { pending = null; res({ refused: BLANK_WORDS }); } }, CAPTURE_WAIT_MS) };
KYc.redraw();
});
}
function stamped(view, now) { // innerWidth x min(dpr, 2) wide, the foot below the view
var s = Math.min(window.devicePixelRatio || 1, 2), W = Math.round(innerWidth * s), Hv = Math.round(innerHeight * s);
var lines = footLines(now), fs = Math.round(11 * s), lh = Math.round(16 * s), pad = Math.round(8 * s), footH = pad * 2 + lh * lines.length;
var out = mk('canvas'); out.width = W; out.height = Hv + footH;
var o = out.getContext('2d'); o.imageSmoothingEnabled = true;
o.fillStyle = '#000'; o.fillRect(0, 0, W, Hv); o.drawImage(view, 0, 0, W, Hv);
o.fillStyle = '#05070c'; o.fillRect(0, Hv, W, footH);
o.fillStyle = '#2ee6e6'; o.fillRect(0, Hv, W, Math.max(1, Math.round(s))); // the instrument's line (PALETTE.md)
o.font = fs + 'px ui-monospace, Menlo, Consolas, monospace'; o.textBaseline = 'top'; o.fillStyle = '#c9d3e6';
lines.forEach(function (t, i) { o.fillText(t, pad, Hv + pad + i * lh, W - 2 * pad); });
return { canvas: out, foot: { lines: lines, height: footH, scale: s } };
}
function say(rowEl, words) { // the row's own second line says what happened
var h = rowEl.querySelector('.ky-file-why'); if (!h) { h = mk('span', 'gm-hint ky-file-why'); rowEl.appendChild(h); }
h.textContent = words; rowEl.setAttribute('data-ky-state', words === '' ? '' : words.slice(0, 40));
}
function fileName(now) { return 'kuiper-' + KYc.edition + '-' + now.toISOString().slice(0, 16).replace(/[-:]/g, '') + 'Z.png'; }
function exportImage(rowEl) {
var now = new Date(); say(rowEl, 'capturing inside the next frame…');
return capture().then(function (r) {
if (r.refused) { st.exports.push({ kind: 'image', ok: false, why: r.refused, at: now.toISOString() }); say(rowEl, r.refused); return null; }
if (looksBlank(r.view)) { st.exports.push({ kind: 'image', ok: false, why: BLANK_WORDS, at: now.toISOString() }); say(rowEl, BLANK_WORDS); return null; }
var s = stamped(r.view, now);
return new Promise(function (res) {
s.canvas.toBlob(function (blob) {
if (!blob) { say(rowEl, BLANK_WORDS); st.exports.push({ kind: 'image', ok: false, why: 'toBlob returned nothing' }); res(null); return; }
var url = URL.createObjectURL(blob), a = mk('a'); a.href = url; a.download = fileName(now); a.style.display = 'none';
document.body.appendChild(a); a.click(); a.remove(); setTimeout(function () { URL.revokeObjectURL(url); }, 60000);
var rec = { kind: 'image', ok: true, file: a.download, bytes: blob.size, width: s.canvas.width, height: s.canvas.height,
view_height: s.canvas.height - s.foot.height, foot: s.foot.lines, at: now.toISOString() };
st.exports.push(rec); say(rowEl, '✓ saved ' + a.download + ' · ' + blob.size + ' bytes'); res(rec);
}, 'image/png');
});
});
}
// Print: the same image and foot in a print stylesheet; the browser's print-to-PDF is the PDF (no PDF writer copied)
var PRINT_ID = 'ky-file-print', PRINT_CSS = 'ky-file-print-css';
function printView(rowEl) {
var now = new Date(); say(rowEl, 'capturing inside the next frame…');
return capture().then(function (r) {
var why = r.refused || (looksBlank(r.view) ? BLANK_WORDS : null);
if (why) { st.exports.push({ kind: 'print', ok: false, why: why, at: now.toISOString() }); say(rowEl, why); return null; }
var s = stamped(r.view, now), old = document.getElementById(PRINT_ID); if (old) old.remove();
if (!document.getElementById(PRINT_CSS)) { var css = mk('style'); css.id = PRINT_CSS;
css.textContent = '#' + PRINT_ID + '{display:none}@media print{body>*:not(#' + PRINT_ID + '){display:none!important}'
+ '#' + PRINT_ID + '{display:block!important;position:static;background:#fff;color:#000}#' + PRINT_ID + ' img{width:100%;height:auto;display:block}'
+ '@page{margin:10mm}}'; document.head.appendChild(css); }
var box = mk('div'); box.id = PRINT_ID; box.setAttribute('aria-hidden', 'true');
var img = mk('img'); img.alt = s.foot.lines[0]; img.src = s.canvas.toDataURL('image/png'); box.appendChild(img);
document.body.appendChild(box);
var rec = { kind: 'print', ok: true, width: s.canvas.width, height: s.canvas.height, foot: s.foot.lines, at: now.toISOString() };
st.exports.push(rec); say(rowEl, '✓ sent to the browser’s print · ' + s.foot.lines[0]);
var go = function () { try { window.print(); } catch (e) { say(rowEl, 'this browser refused to print: ' + (e && e.message || e)); } };
if (img.complete) go(); else img.onload = go;
return rec;
});
}
function exportRows(group, row) { // row(label, onTap, id): the lead's row factory
var img = row('⤓ Save an image of this view', function (el) { exportImage(el); return true; }, 'kuiper-export-image');
img.setAttribute('data-ky-export', 'image');
var pr = row('⎙ Print', function (el) { printView(el); return true; }, 'kuiper-export-print');
pr.setAttribute('data-ky-export', 'print');
group.appendChild(img); group.appendChild(pr); return [img, pr];
}
// ---- EDIT (6.5): the find box also takes a pasted Kuiper or See Through link; `Paste a link…` opens the same field
var PLACEHOLDER_LINK = 'a key, a repository, a period, or a pasted link';
function looksLikeLink(t) { return /^(https?:\/\/|\.{0,2}\/|[#?])/i.test(t) || /^(key|line|repo|period|layers|edition|app|sub|space)=/.test(t); }
function takePaste(text) { // true when the text was a link and was handled
var t = String(text || '').trim(); if (!t || !looksLikeLink(t) || !Lk || typeof Lk.read !== 'function') return false;
var r = Lk.read(t);
if (!r) { st.pastes.push({ text: t, ok: false, why: 'not a link' }); return false; }
st.pastes.push({ text: t, ok: true, target: r.target || 'kuiper', fields: r.fields, refused: r.refused });
if (r.target === 'see-through' || r.target === 'other') { location.href = r.url; return true; } // navigation, same tab
if (typeof Lk.apply === 'function') Lk.apply(r.fields, { from: 'paste' });
return true;
}
function wireFind() {
var gin = Hc.gin, gbox = Hc.gbox;
// capture phase on #goto runs before the engine's own keydown on #gotoin (index.html:605)
gbox.addEventListener('keydown', function (e) {
if (e.key !== 'Enter' || e.target !== gin) return;
var t = gin.value.trim(); if (!looksLikeLink(t)) return; // the find grammar (index.html:606-613) stays the engine's
e.preventDefault(); e.stopImmediatePropagation(); e.stopPropagation();
gbox.style.display = 'none'; takePaste(t);
}, true);
if (gin.placeholder !== PLACEHOLDER_LINK) { st.placeholder_was = gin.placeholder; gin.placeholder = PLACEHOLDER_LINK; }
}
function openPaste() { // `Paste a link…`: the find box, named for a link
var gbox = Hc.gbox, gin = Hc.gin;
try { var sh = KYc.modules && KYc.modules['kuiper-shell'] && KYc.modules['kuiper-shell'].api; if (sh && sh.close) sh.close(); } catch (e) {}
gbox.style.display = 'block'; gin.value = ''; gin.setAttribute('enterkeyhint', 'go');
try { gin.focus(); } catch (e) {}
}
function pasteRow(editPanel, row) {
if (!editPanel) return null;
var r = row('Paste a link…', function () { openPaste(); return true; }, 'ky-edit-paste');
r.setAttribute('data-ky-edit', 'paste');
editPanel.appendChild(r); return r;
}
// ---- Backspace (whole wafer) clears every field but `layers` (6.3, 6.5)
function wireBackspace() {
addEventListener('keydown', function (e) {
if (e.key !== 'Backspace' || Hc.gbox.style.display === 'block') return;
var t = e.target; if (t && (t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName))) return;
st.backspace++;
if (Lk && typeof Lk.clear === 'function') Lk.clear(['layers']);
});
}
return {
install: function (K, link) { KYc = K; Hc = K.hooks; Lk = link; K.draw.add(capturePainter, CAPTURE_ORDER); wireFind(); wireBackspace(); },
exportRows: exportRows, pasteRow: pasteRow, copyText: copyText, exportImage: exportImage, printView: printView,
takePaste: takePaste, looksBlank: looksBlank, footLines: footLines,
inspect: function () { return JSON.parse(JSON.stringify(st)); },
strings: { blank: BLANK_WORDS, licence: LICENCE_LINE, placeholder: PLACEHOLDER_LINK }
};
})();
// ==== SECTION C endStub B
A JavaScript module in the builder folder of Neural Link Between Agents that lists lit (`listLit`), using SHA-256.
Set aside from the main view: 93% of its lines are the same as editions/202611012135/handoff/00-stub/stub-serve.cjs (kuiper-belt), which stays. (near-copy-of, proposed by families.py). 93% of lines shared with Stub Serve; read that one first. All set-aside files, with reasons. Nothing was deleted.
Evidence
- line-jaccard 0.9344 to kuiper-belt@26fba12ab1b5bab8e71934ab86c58273e5f32682 editions/202611012135/handoff/00-stub/stub-serve.cjs:1-64 3a9828f4e84bd1ad3b777b7727851728a8479e46
- sha256 192957c16836df827471ecfef263f12f7a71ba1846a1728448614b870715a715
- target sha256 ff0a5d0f4f67d01dac2262f88522aa73880e72528df6c67685cdf0fac7f090fe
- group of 2 (identity.json near-copy edges >= 0.9)
- canonical rule: reachable, newest stamp, core repo, most lines
renderneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-6/builder/stub-b.cjs · lines 1–64 of 64 · Entry point · pattern recordFor (shared by 2 files)
- What it does
- It loads data. Defines page, listLit, recordFor, manifest. Uses libraries http, fs, path, crypto, os. Side effects: changes the web page (DOM); reads or writes files; starts processes.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'agents'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- In: JSON file MODULE.json; JSON file modules.json; command-line arguments.
- Downstream impact
- It is itself an entry point (JavaScript module); no other file was found loading it.
- What it achieves
- It lists lit (`listLit`) and is built from the record for helper (`recordFor`) and the manifest step (`manifest`). Defines `page`, `listLit`, `recordFor` and 1 more.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- neural-link-between-agents · FIXES/NL-010/tools/evidence/nl010-opus/team-6/builder · JavaScript module
- Uses
- http, fs, path, crypto, os, child_process
- Used by
- none found
- Produces
- page, listLit, recordFor, manifest
- Defines here
- page, listLit, recordFor, manifest
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- neural-link-between-agents@598eff3f59afe11738d64cb14cb8befe5e37cdc2 FIXES/NL-010/tools/evidence/nl010-opus/team-6/builder/stub-b.cjs:1-64 · blob 731d43ffd0628922cd44665e30376ae67e1ae9e6 · GitHub at these lines
- State
- achieves: name · context: auto · stage: output · effects: dom, filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: duplicate_candidate
#!/usr/bin/env node
// handoff/00-stub/stub-serve.cjs: the integrator's loader stub (Opus team 10, NL-010 step 10). Apache-2.0 (kuiper-belt).
//
// node stub-serve.cjs <port> [--add modules/<stamp>-<name>.js ...] [--only]
//
// Serves the kuiper-belt root (two folders up from editions/202611012135/) on 127.0.0.1:<port>, exactly as the
// integrator's journey does, with two substitutions so a team can test its module against the page AS INTEGRATED NOW:
// 1. editions/202611012135/index.html is the integrated page on disk. If the page on disk does not yet build
// window.KY (Opus 4 not yet admitted), it is served with handoff/04-loader/index.html.patch applied in memory.
// 2. editions/202611012135/modules.json is the integrated manifest on disk (or handoff/04-loader/modules.json when
// the disk one has no "hooks" field), plus one record per --add, built from the file AT EACH REQUEST: sha256,
// bytes, generation and id from line 1 of the module, requires/provides from handoff/*/MODULE.json when a record
// there names the same path, else from the first `requires: [...]` / `provides: [...]` literal in the file.
// --only drops every record already in the manifest except hello and the --add ones.
// Nothing on disk is written. A pass under the stub is a pre-admission pass, never the admission: the integrator
// admits only what is in modules.json and runs the journey on the page as served without this script.
'use strict';
const http = require('http'), fs = require('fs'), path = require('path'), crypto = require('crypto'), os = require('os');
const { execFileSync } = require('child_process');
const ED = '/home/user/estate/kuiper-belt/editions/202611012135', ROOT = path.resolve(ED, '..', '..'), STAMP = path.basename(ED);
const argv = process.argv.slice(2), port = +argv[0];
if (!port) { console.error('usage: node stub-serve.cjs <port> [--add modules/<file>.js ...] [--only]'); process.exit(2); }
const adds = []; argv.forEach((a, i) => { if (a === '--add' && argv[i + 1]) adds.push(argv[i + 1]); });
const only = argv.includes('--only');
const TYPES = { '.html': 'text/html; charset=utf-8', '.js': 'text/javascript', '.cjs': 'text/javascript', '.json': 'application/json',
'.tsv': 'text/tab-separated-values', '.png': 'image/png', '.svg': 'image/svg+xml', '.css': 'text/css', '.md': 'text/markdown', '.txt': 'text/plain' };
function page() {
const disk = fs.readFileSync(path.join(ED, 'index.html'), 'utf8');
if (disk.includes('window.KY = KY')) return disk;
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'ky-stub-')), d = path.join(tmp, 'editions', STAMP);
fs.mkdirSync(d, { recursive: true }); fs.writeFileSync(path.join(d, 'index.html'), disk);
try { execFileSync('patch', ['-p1', '-s', '-f', '-i', path.join(ED, 'handoff/04-loader/index.html.patch')], { cwd: tmp, stdio: 'ignore' }); } catch (e) { /* builder copy: a rejected hunk the base already carries is skipped */ }
const out = fs.readFileSync(path.join(d, 'index.html'), 'utf8'); fs.rmSync(tmp, { recursive: true, force: true }); return out;
}
function listLit(src, name) { const m = src.match(new RegExp(name + "\\s*:\\s*\\[([^\\]]*)\\]")); return m ? (m[1].match(/'([^']+)'|"([^"]+)"/g) || []).map(s => s.slice(1, -1)) : []; }
function recordFor(rel) {
const buf = fs.readFileSync(path.join(ED, rel)), src = buf.toString('utf8');
const head = src.split('\n')[0].match(/^\/\* kuiper module ([a-z0-9-]+), generation (\d{12}) \(UTC\), ([^*]*)/);
if (!head) throw new Error(rel + ': line 1 is not "/* kuiper module <id>, generation <stamp> (UTC), <licence>"');
let given = null;
for (const dir of fs.readdirSync(path.join(ED, 'handoff'))) { const f = path.join(ED, 'handoff', dir, 'MODULE.json');
if (fs.existsSync(f)) { try { const j = JSON.parse(fs.readFileSync(f, 'utf8')); if (j.path === rel) given = j; } catch (e) { /* not JSON yet */ } } }
return Object.assign({ id: head[1], generation: head[2], path: rel, requires: listLit(src, 'requires'), provides: listLit(src, 'provides'),
licence: head[3].trim() || 'Apache-2.0', reads: [], writes: [], creates_controls: 'stub', team: 'stub', step: 0, proof: 'stub' }, given || {},
{ sha256: crypto.createHash('sha256').update(buf).digest('hex'), bytes: buf.length, byte_budget: Math.max((given && given.byte_budget) || 0, buf.length) });
}
function manifest() {
let m = JSON.parse(fs.readFileSync(path.join(ED, 'modules.json'), 'utf8'));
if (!m.hooks) m = JSON.parse(fs.readFileSync(path.join(ED, 'handoff/04-loader/modules.json'), 'utf8'));
if (only) { m.order = m.order.filter(id => id === 'hello'); m.modules = m.modules.filter(r => r.id === 'hello'); }
for (const rel of adds) { const r = recordFor(rel); m.modules = m.modules.filter(x => x.id !== r.id).concat([r]); if (!m.order.includes(r.id)) m.order.push(r.id); }
return JSON.stringify(m, null, 1) + '\n';
}
http.createServer((req, res) => {
const u = decodeURIComponent(req.url.split('?')[0].split('#')[0]);
try {
if (u === '/editions/' + STAMP + '/' || u === '/editions/' + STAMP + '/index.html') { res.writeHead(200, { 'content-type': TYPES['.html'], 'cache-control': 'no-store' }); return res.end(page()); }
if (u === '/editions/' + STAMP + '/modules.json') { res.writeHead(200, { 'content-type': TYPES['.json'], 'cache-control': 'no-store' }); return res.end(manifest()); }
let f = path.join(ROOT, path.normalize(u)); if (!f.startsWith(ROOT)) { res.writeHead(403); return res.end(); }
if (fs.existsSync(f) && fs.statSync(f).isDirectory()) f = path.join(f, 'index.html');
if (!fs.existsSync(f)) { res.writeHead(404); return res.end('404'); }
res.writeHead(200, { 'content-type': TYPES[path.extname(f)] || 'application/octet-stream' }); fs.createReadStream(f).pipe(res);
} catch (e) { res.writeHead(500, { 'content-type': 'text/plain' }); res.end(String(e && e.message || e)); }
}).listen(port, '127.0.0.1', () => console.log('stub: http://127.0.0.1:' + port + '/editions/' + STAMP + '/ (adds: ' + (adds.join(', ') || 'none') + (only ? ', --only' : '') + ')'));Shift
A Python module in the evidence folder of Neural Link Between Agents. It is built from the shift text helper (`shift_text`).
storageneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-6/evidence/shift.py · lines 1–34 of 34 · Not reached from any entry point (candidate for review)
- What it does
- It loads data. Defines sh, shift_text. Uses libraries re, sys. Side effects: reads or writes files.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'agents'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- In: command-line arguments.
- What it achieves
- Shift module line refs >= START by D in `EVIDENCE.md` (module-context only).
- Why it matters
- No other file in the estate was found to import it.
- Application
- neural-link-between-agents · FIXES/NL-010/tools/evidence/nl010-opus/team-6/evidence · Python module
- Uses
- re, sys
- Used by
- none found
- Produces
- sh, shift_text
- Defines here
- sh, shift_text
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- neural-link-between-agents@598eff3f59afe11738d64cb14cb8befe5e37cdc2 FIXES/NL-010/tools/evidence/nl010-opus/team-6/evidence/shift.py:1-34 · blob 72670c5ebde155667dac8ea61f1ba63899b2d4b0 · GitHub at these lines
- State
- achieves: comment · context: auto · stage: output · effects: filesystem · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
# shift module line refs >= START by D in EVIDENCE.md (module-context only)
import re, sys
p, START, D = sys.argv[1], int(sys.argv[2]), int(sys.argv[3])
L = open(p).read().split('\n')
def sh(m):
a = int(m.group(2)); b = m.group(4)
na = a + D if a >= START else a
nb = (int(b) + D if int(b) >= START else int(b)) if b else None
return m.group(1) + str(na) + ('-' + str(nb) if b else '')
NUM = re.compile(r'(:)(\d{2,3})((?:-)(\d{2,3}))?\b')
PROTECT = re.compile(r'(kuiper-shell\.js:\d+|index\.html:\d+|README\.md:\d+|layers\.js:\d+(?:-\d+)?|ED5 :\d+(?:-\d+)?|live :\d+(?:-\d+)?|:710 PANELS)')
def shift_text(t):
parts = PROTECT.split(t)
return ''.join(x if PROTECT.fullmatch(x or '') else NUM.sub(sh, x) for x in parts)
# section 1 table rows: last cell only
start1 = next(i for i,l in enumerate(L) if l.startswith('## 1.'))
end1 = next(i for i,l in enumerate(L) if l.startswith('## 2.'))
for i in range(start1, end1):
l = L[i]
if l.startswith('|') and l.count('|') >= 4 and not l.startswith('|---') and 'In the Kuiper module' not in l:
cells = l.split('|'); cells[-2] = shift_text(cells[-2]); L[i] = '|'.join(cells)
# explicit module-context fragments elsewhere
FRAG = [r'resolves \(:\d+\)', r'\(module :\d+-\d+, :\d+\)', r'vs module :\d+', r'pasted link", :\d+, :\d+\)',
r'module :\d+-\d+ header, :\d+-\d+ registration', r'`wireFind` :\d+-\d+, `openPaste` :\d+-\d+',
r'`H\.wafer\.then\(readLocation\)` :\d+', r'`Hc\.ov` :\d+-\d+', r'`readout\(\)` :\d+', r'`editionName\(\)` :\d+-\d+',
r'no shell :\d+', r'\(order 1e9\) :\d+, the readout \(order 40\) :\d+', r'\| :138, :259, :\d+ \|', r'\(:\d+\)\. It is in the 28-hook',
r"`GEN = '202611012231'` \(:28, :\d+\)", r'module :1, :28, :\d+', r'module :\d+-\d+ \|', r'module :29, :\d+',
r'module :161, :\d+, :\d+', r'comment at :\d+ and the `utcStamp` comment at :\d+', r'and in the registration \(:\d+\)',
r'`writeNow` :\d+-\d+', r'hook table; `fmt\(\)` \(:\d+\)']
for i in range(len(L)):
if start1 <= i < end1: continue
for f in FRAG:
L[i] = re.sub(f, lambda m: NUM.sub(sh, m.group(0)), L[i])
open(p, 'w').write('\n'.join(L))Test Section C
A test in the builder folder of Neural Link Between Agents. It loads elements (`loadElements`) and is built from the rows step (`rows`).
testneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-7/builder/test_sectionC.cjs · lines 1–37 of 37 · Not reached from any entry point (candidate for review) · pattern loadElements (shared by 2 files)
- What it does
- It tests its inputs. Defines rows, loadElements. Uses libraries fs, path. Side effects: reads or writes files.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'agents'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- In: JSON file elements.json; command-line arguments.
- What it achieves
- Unit test of SECTION C (builder) outside the browser: stubs for KY/H, real files, Node webcrypto. It reads `/data/elements.json`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- neural-link-between-agents · FIXES/NL-010/tools/evidence/nl010-opus/team-7/builder · test
- Uses
- fs, path
- Used by
- none found
- Produces
- rows, loadElements
- Defines here
- rows, loadElements
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- neural-link-between-agents@598eff3f59afe11738d64cb14cb8befe5e37cdc2 FIXES/NL-010/tools/evidence/nl010-opus/team-7/builder/test_sectionC.cjs:1-37 · blob 7a8688d2ebf390e97c4f8d8a774a56b2abc69db6 · GitHub at these lines
- State
- achieves: comment · context: auto · stage: ingest · effects: filesystem · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
// Unit test of SECTION C (builder) outside the browser: stubs for KY/H, real files, Node webcrypto. No Playwright.
'use strict';
const fs = require('fs'), path = require('path');
const ROOT = '/home/user/estate/kuiper-belt', ED = ROOT + '/editions/202611012135';
const src = fs.readFileSync(ED + '/modules/202611012309-apps.js', 'utf8');
const C0 = src.indexOf('// ======================================================================== SECTION C'), D0 = src.indexOf('// ======================================================================== SECTION D');
const sec = src.slice(C0, D0);
const removeGraphs = process.argv.includes('--no-graphs');
// the wafer, as index.html builds it
const rows = f => fs.readFileSync(ROOT + '/cosmos/' + f, 'utf8').split('\n').filter(l => l && l[0] !== '#').map(l => l.split('\t'));
const repos = rows('repos.tsv').map(p => ({ i: +p[0], name: p[1], lines: +p[2] }));
let k = 0; const commits = rows('wafer.tsv').map(p => { k += +p[4]; const c = { repo: +p[2], sha: p[3], k0: k, lines: +p[1] }; k += c.lines; return c; });
const SPACE = k, R = Math.sqrt(SPACE);
global.fetch = async (file) => { const p = path.join(ED, file); if (removeGraphs && /graphs/.test(file) || !fs.existsSync(p)) return { ok: false, status: 404 };
const b = fs.readFileSync(p); return { ok: true, status: 200, arrayBuffer: async () => b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength), json: async () => JSON.parse(b) }; };
global.window = { crypto: globalThis.crypto };
global.addEventListener = () => {};
const H = { SPACE, repos, commits, keyPlace: kk => [kk / SPACE * R, 0], fmt: n => n.toLocaleString('en-GB'), o2: { canvas: { width: 400, height: 800 } }, cv: {} };
const regs = [];
const L = { get: id => ({ id, status: id === 'elements' ? 'REFUSED' : 'EMPTY' }), register: l => { regs.push(l); } };
const st = { said: [], spider: { status: 'WAIT', why: '', graphs: {} }, card: null };
let EL = null;
const loadElements = () => Promise.resolve().then(() => { EL = JSON.parse(fs.readFileSync(ED + '/data/elements.json')); return EL; });
const fn = new Function('KY', 'H', 'st', 'loadElements', 'getEL', 'mod', 'fmt', 'openElement', 'ID', 'C_RECORD', 'C_SEL', 'setTimeout',
sec.replace(/\bEL\b/g, 'getEL()') + '\nreturn { registerLayers, loadSpider, nodeKey, C, GRAPHS };');
const KY = { draw: { add() {} }, redraw() {}, cam: { x: 0, y: 0, zoom: 1 } };
const X = fn(KY, H, st, loadElements, () => EL, () => L, H.fmt, () => true, 'apps', '#c9d3e6', '#ff2bd6', setTimeout);
X.registerLayers();
setTimeout(async () => {
console.log('registered', regs.map(r => r.id));
const sp = regs.find(r => r.id === 'spider'), el = regs.find(r => r.id === 'elements');
try { console.log('elements load', await el.load()); } catch (e) { console.log('elements load FAIL', e.message); }
try { console.log('spider load', await sp.load()); } catch (e) { console.log('spider load FAIL', e.message); }
console.log(JSON.stringify(st.spider.graphs, null, 0).slice(0, 900));
console.log('readout:', st.said);
console.log('segs', X.C.segs.length, 'rings', X.C.rings.length, 'dots', X.C.dots.length);
}, 400);Mksite
A Python module in the tester folder of Neural Link Between Agents that uses SHA-256.
storageneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-7/tester/mksite.py · lines 1–42 of 42 · Not reached from any entry point (candidate for review)
- What it does
- It loads data. Uses libraries os, re, json, hashlib, subprocess. Side effects: reads or writes files; starts processes.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'agents'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- In: JSON file modules.json; command-line arguments. Out: JSON file modules.json.
- What it achieves
- Scratch site for OPUS-6: the edition as it will stand at admission 6 (loader 04 patch + layers 03 patch applied in a copy; modules kuiper-shell, line-card, layers, file). It reads `/handoff/04-loader/modules.json` and writes `/modules.json`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- neural-link-between-agents · FIXES/NL-010/tools/evidence/nl010-opus/team-7/tester · Python module
- Uses
- os, re, json, hashlib, subprocess, shutil, sys
- Used by
- none found
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- neural-link-between-agents@598eff3f59afe11738d64cb14cb8befe5e37cdc2 FIXES/NL-010/tools/evidence/nl010-opus/team-7/tester/mksite.py:1-42 · blob 662b4104cb6ca89310134ac277f96c75ddbc3d39 · GitHub at these lines
- State
- achieves: comment · context: auto · stage: output · effects: filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
# scratch site for OPUS-6: the edition as it will stand at admission 6 (loader 04 patch + layers 03 patch applied in a copy;
# modules kuiper-shell, line-card, layers, file). Nothing in the repository is written.
import os, re, json, hashlib, subprocess, shutil, sys
KB='/home/user/estate/kuiper-belt'; ED=KB+'/editions/202611012135'; S='/tmp/nl010-opus/team-7/tester/site'
mods=sys.argv[1:] or ['modules/202611012143-kuiper-shell.js','modules/202611012143-line-card.js','modules/202611012141-layers.js','modules/202611012231-file.js','modules/202611012141-see-through.js','modules/202611012309-apps.js']
if not os.path.isdir(S):
os.makedirs(S+'/editions/202611012135')
for n in os.listdir(KB):
if n not in ('editions','.git'): os.symlink(KB+'/'+n, S+'/'+n)
for n in os.listdir(KB+'/editions'):
if n!='202611012135': os.symlink(KB+'/editions/'+n, S+'/editions/'+n)
d=S+'/editions/202611012135'
for n in os.listdir(ED):
if n in ('index.html','modules.json','modules'): continue
if not os.path.lexists(d+'/'+n): os.symlink(ED+'/'+n, d+'/'+n)
if os.path.isdir(d+'/modules'): shutil.rmtree(d+'/modules')
shutil.copytree(ED+'/modules', d+'/modules')
shutil.copy(os.environ.get('KYPAGE','/tmp/nl010-opus/team-7/tester/index.base.html'), d+'/index.html')
for p in ['handoff/04-loader/index.html.patch','handoff/03-layers/index.html.after-04-loader.patch']:
subprocess.run(['patch','-p3','-s','-d',d,'-i',ED+'/'+p],check=True) if False else None
# patches are written against a/editions/202611012135/index.html: apply from S with -p1
for p in []:
r=subprocess.run(['patch','-p1','-s','-d',S,'--follow-symlinks','-i',ED+'/'+p],capture_output=True,text=True)
print(p, 'rc', r.returncode, r.stdout[-300:], r.stderr[-300:])
m=json.load(open(ED+'/handoff/04-loader/modules.json'))
for rel in mods:
src=open(d+'/'+rel,'rb').read(); t=src.decode()
h=re.match(r'/\* kuiper module ([a-z0-9-]+), generation (\d{12}) \(UTC\), ([^*\n]*)', t)
reg=re.search(r"KY\.register\(\{[\s\S]*?requires:\s*(\[[^\]]*\]|REQUIRES)", t)
lit=reg.group(1)
if lit=='REQUIRES': lit=re.search(r"var REQUIRES = (\[[^\]]*\])", t).group(1)
req=re.findall(r"'([^']+)'", lit)
prov=re.findall(r"'([^']+)'", re.search(r"provides:\s*(\[[^\]]*\])", t[reg.start():]).group(1))
prov=[x if x!="' + ID + '" else h.group(1) for x in prov]
if 'ID' in re.search(r"provides:\s*(\[[^\]]*\])", t[reg.start():]).group(1): prov=[h.group(1)]+[p for p in prov]
rec={'id':h.group(1),'generation':h.group(2),'path':rel,'sha256':hashlib.sha256(src).hexdigest(),'bytes':len(src),'byte_budget':max(len(src),65536),
'requires':req,'provides':sorted(set(prov+[h.group(1)]),key=lambda x:(x!=h.group(1),x)),'reads':[],'writes':[],'creates_controls':'scratch','licence':h.group(3).strip(),'team':'scratch','step':0,'proof':'scratch'}
m['modules']=[x for x in m['modules'] if x['id']!=rec['id']]+[rec]
if rec['id'] not in m['order']: m['order'].append(rec['id'])
m['order']=[x for x in m['order'] if x!='hello']; m['modules']=[x for x in m['modules'] if x['id']!='hello']
json.dump(m, open(d+'/modules.json','w'), indent=1)
print([(x['id'],x['provides'],len(x['requires'])) for x in m['modules']])