GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / AI agents and coordination / neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-2/evidence

Test Other 2152 and 12 more files

A JavaScript module in the tester folder of Neural Link Between Agents that runs device (`runDevice`), calculates planar distances and draws on a canvas, using SHA-256.

634 lines of JavaScript and Python from neural-link-between-agents, in 13 files. Topic: AI agents and coordination. Section 1631 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Measure ingest · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-2/evidence/measure.py lines 1–21
  2. Rekey storage · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-2/evidence/rekey.py lines 1–18
  3. Roundtrip ingest · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-2/evidence/roundtrip.py lines 1–18
  4. Bigline render · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-2/evidence/t/bigline.cjs lines 1–37
  5. Rowtap interaction · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-2/tester/probe/rowtap.cjs lines 1–34
  6. Test Other 2152 test · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-2/tester/test.other-2152.cjs lines 1–297
  7. Probe render · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-3/builder/probe.cjs lines 1–28
  8. Check Keys ingest · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-3/evidence/check_keys.py lines 1–45
  9. Mkpre storage · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-3/lead/gen/mkpre.py lines 1–42
  10. Mkpre6 storage · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-3/lead/gen/mkpre6.py lines 1–14
  11. Build Pre storage · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-3/tester/build-pre.cjs lines 1–23
  12. Check Keys ingest · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-4/evidence/check_keys.py lines 1–34
  13. Smoke test · neural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-4/evidence/js/smoke.cjs lines 1–23

Measure

A Python module in the evidence folder of Neural Link Between Agents.

ingestneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-2/evidence/measure.py · lines 1–21 of 21 · Not reached from any entry point (candidate for review)

What it does
It loads data. Uses libraries json, sys, collections. 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
No statement of purpose was found in the file, a README line naming it, or its name.
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-2/evidence · Python module
Uses
json, sys, collections
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-2/evidence/measure.py:1-21 · blob 879188ad410e8264eab5c095ef2945b10dcdc462 · GitHub at these lines
State
achieves: name · context: auto · stage: ingest · effects: filesystem · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
import json, sys, collections
d = json.load(open(sys.argv[1]))
B = d['bodies']
placed = [b for b in B if b.get('on_wafer')]
print('bodies', len(B), 'placed', len(placed))
print('placed with line_text field', sum('line_text' in b and b['line_text'] is not None for b in placed))
print('unplaced with line_text', [(b['repo'], b['id'], 'line_text' in b) for b in B if not b.get('on_wafer')])
empty = [b for b in placed if b['line_text'] == '']
nonempty = [b for b in placed if b['line_text'] != '']
print('empty line_text', len(empty), 'nonempty', len(nonempty))
eq = [b for b in nonempty if b['quote'] == b['line_text']]
print('nonempty quote==line_text', len(eq), 'differ', len(nonempty) - len(eq))
print('all placed quote==line_text', sum(b['quote'] == b['line_text'] for b in placed), 'differ (incl empty)', sum(b['quote'] != b['line_text'] for b in placed))
print('quote_check counts (placed):', dict(collections.Counter(b['quote_check'] for b in placed)))
print('quote_check by empty:', dict(collections.Counter(b['quote_check'] for b in empty)))
ws = [b for b in nonempty if b['quote'] != b['line_text'] and b['quote'].strip() == b['line_text'].strip()]
print('differ only by surrounding whitespace (strip)', len(ws))
ws2 = [b for b in nonempty if b['quote'] != b['line_text'] and b['quote'] == b['line_text'].lstrip()]
print('quote == line_text.lstrip()', len(ws2))
print('quote_key present', sum('quote_key' in b for b in placed))
for b in empty: print(' EMPTY', b['repo'], b['path'], b['line'], b['key'], b['quote_check'])

Rekey

A Python module in the evidence folder of Neural Link Between Agents.

storageneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-2/evidence/rekey.py · lines 1–18 of 18 · Not reached from any entry point (candidate for review)

What it does
It loads data. 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
For WT rows whose fragment moved: find the unique line now holding the fragment and rewrite the key's line number.
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-2/evidence · Python module
Uses
re, 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-2/evidence/rekey.py:1-18 · blob 0261adaeb88da1fefcaa3bab59dedefa55101135 · GitHub at these lines
State
achieves: comment · context: auto · stage: output · effects: filesystem · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
# For WT rows whose fragment moved: find the unique line now holding the fragment and rewrite the key's line number.
import re, sys
p = sys.argv[1]; R = {'kuiper-belt': '/home/user/estate/kuiper-belt'}
out = []; changed = []
for ln in open(p, encoding='utf-8'):
    cells = re.split(r'(?<!\\)\|', ln.strip().strip('|')) if ln.startswith('|') else []
    if len(cells) >= 4:
        key = cells[2].strip(); frag = cells[3].strip().strip('`').replace('\\|', '|')
        m = re.fullmatch(r'kuiper-belt@WT ([^:]+):(\d+)', key)
        if m:
            L = open(R['kuiper-belt'] + '/' + m.group(1), encoding='utf-8').read().split('\n'); n = int(m.group(2))
            if not (n <= len(L) and frag in L[n - 1]):
                hits = [i + 1 for i, l in enumerate(L) if frag in l]
                if len(hits) == 1:
                    ln = ln.replace(key, 'kuiper-belt@WT %s:%d' % (m.group(1), hits[0]), 1); changed.append((cells[0].strip(), n, hits[0]))
                else: changed.append((cells[0].strip(), n, 'hits=%s' % hits))
    out.append(ln)
open(p, 'w', encoding='utf-8').write(''.join(out)); print(changed)

Roundtrip

A Python module in the evidence folder of Neural Link Between Agents.

ingestneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-2/evidence/roundtrip.py · lines 1–18 of 18 · Not reached from any entry point (candidate for review)

What it does
It loads data. Defines text. Uses libraries json, subprocess, sys, random. 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.
What it achieves
Defines `text`.
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-2/evidence · Python module
Uses
json, subprocess, sys, random
Used by
none found
Produces
text
Defines here
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-2/evidence/roundtrip.py:1-18 · blob be650e8745901623d645a520e9bd96cf5bece907 · GitHub at these lines
State
achieves: name · context: auto · stage: ingest · effects: filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
import json, subprocess, sys, random
d = json.load(open(sys.argv[1])); kp = sys.argv[2]
P = [b for b in d['bodies'] if b.get('on_wafer')]
seven = [b for b in P if 'quote_key' in b]
random.seed(20261101); extra = random.sample([b for b in P if 'quote_key' not in b], 5)
def text(k):
    o = subprocess.run([sys.executable, '-I', kp, str(k)], capture_output=True, text=True, timeout=300).stdout
    ls = [l for l in o.split('\n') if l.startswith('  | ')]
    return ls[0][4:] if ls else ('<<' + o.strip().split('\n')[-1] + '>>')
rows = []
for b in seven + extra:
    t = text(b['key']); ok = t == b['line_text']
    r = {'repo': b['repo'], 'path': b['path'], 'line': b['line'], 'key': b['key'], 'key_py': t, 'line_text_equal': ok}
    if 'quote_key' in b:
        q = text(b['quote_key']); qf = b['quote'].split('\n')[0]
        r.update({'quote_key': b['quote_key'], 'quote_key_py': q, 'quote_check_at_quote_key': q == qf or q.strip() == qf.strip()})
    rows.append(r); print(json.dumps(r, ensure_ascii=False))
print('line_text equal', sum(r['line_text_equal'] for r in rows), 'of', len(rows))

Bigline

A JavaScript module in the evidence folder of Neural Link Between Agents that uses SHA-256. It is built from the sleep step (`sleep`) and the time step (`time`).

renderneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-2/evidence/t/bigline.cjs · lines 1–37 of 37 · Not reached from any entry point (candidate for review)

What it does
It fetches data. Defines sleep, time. Uses libraries playwright, fs, crypto. Side effects: changes the web page (DOM); reads or writes files; makes network requests; 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. Out: JSON file bigline.json.
What it achieves
OPUS-2 evidence: the cost of the 1,240,449-character header (kuiper-belt `estate-network.json`:1, key 63013167769). It reads `keys.json` and writes `/tmp/nl010-opus/team-2/evidence/t/bigline.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-2/evidence/t · JavaScript module
Uses
playwright, fs, crypto
Used by
none found
Produces
sleep, time
Defines here
sleep, time
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-2/evidence/t/bigline.cjs:1-37 · blob 80b0212eb5b92e5f3653c359f24aaafad5b0c0d5 · GitHub at these lines
State
achieves: comment · context: auto · stage: output · effects: dom, filesystem, network, process · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
// OPUS-2 evidence: the cost of the 1,240,449-character header (kuiper-belt estate-network.json:1, key 63013167769)
const { chromium, devices } = require('playwright'); const fs = require('fs'), crypto = require('crypto');
const sleep = ms => new Promise(r => setTimeout(r, ms));
const U = 'http://127.0.0.1:8423/editions/202611012135/', ED = '/home/user/estate/kuiper-belt/editions/202611012135';
const IDX = '/tmp/nl010-opus/team-2/evidence/apply/editions/202611012135/index.html';
const MOD = fs.readdirSync(ED + '/modules').find(f => /^\d{12}-line-card\.js$/.test(f));
(async () => {
  const bytes = fs.readFileSync(ED + '/modules/' + MOD), sha = crypto.createHash('sha256').update(bytes).digest('hex');
  const manifest = { schema:'kuiper.modules.v1', edition:'202611012135', hooks:'kuiper.hooks.v1', order:['line-card'], modules:[{ id:'line-card',
    generation: MOD.slice(0,12), path:'modules/' + MOD, sha256: sha, bytes: bytes.length, byte_budget: 32768,
    requires:['card','esc','fmt','address','describe','sel','lit','redraw','gbox'], provides:['line-card'], reads:[], writes:['#card'],
    creates_controls:'none', licence:'Apache-2.0', team:'02', step:2, proof:'handoff/02-card/' }], contracts:{} };
  const browser = await chromium.launch({ args:['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] });
  const out = { module: MOD, sha256: sha, devices: {} };
  for (const name of ["Pixel 7", "Galaxy S24"]) {
    const ctx = await browser.newContext({ ...devices[name] });
    await ctx.route(U, r => r.fulfill({ body: fs.readFileSync(IDX), contentType:'text/html' }));
    await ctx.route(U + 'modules.json', r => r.fulfill({ body: JSON.stringify(manifest), contentType:'application/json' }));
    const page = await ctx.newPage(); const errs = [];
    page.on('pageerror', e => errs.push('pageerror ' + e.message)); page.on('console', m => { if (m.type() === 'error') errs.push('console ' + m.text()); });
    await page.goto(U, { waitUntil:'load' }); await sleep(8000);
    const r = await page.evaluate(async () => {
      const j = await (await fetch('keys.json')).json(), api = KY.modules['line-card'].api, card = KY.hooks.card;
      const time = async (b) => { const t0 = performance.now(); api.show(b, { index:0, of:344 }); const rc = card.getBoundingClientRect();
        const t1 = performance.now(); await new Promise(res => requestAnimationFrame(() => requestAnimationFrame(res))); const t2 = performance.now();
        const code = card.querySelector('header.lc-h > code'), h = card.querySelector('header.lc-h').getBoundingClientRect();
        return { show_layout_ms: +(t1 - t0).toFixed(1), to_second_frame_ms: +(t2 - t0).toFixed(1), header_equal: code.textContent === b.line_text,
          chars: b.line_text.length, card_share: +(rc.height / innerHeight).toFixed(3), header_h: Math.round(h.height), code_scrollH: code.scrollHeight, code_rect_h: Math.round(code.getBoundingClientRect().height), code_w: Math.round(code.getBoundingClientRect().width), hdr_scrollW: card.querySelector("header.lc-h").scrollWidth, hdr_scrollH: card.querySelector("header.lc-h").scrollHeight }; };
      const big = j.bodies.find(b => b.key === 63013167769), small = j.bodies.find(b => b.key === 36064705400);
      const res = { small: await time(small), big: await time(big), small2: await time(small), big2: await time(big), sha: 0 }; return res; });
    await page.screenshot({ path: "/tmp/nl010-opus/team-2/evidence/t/big-" + name.replace(/ /g, "-") + ".png", timeout: 180000 });
    const _x = await page.evaluate(() => { KY.modules["line-card"].api.close(); return 1;
      api.close(); return res; });
    out.devices[name] = { ...r, errors: errs }; console.error(name, JSON.stringify(out.devices[name])); await ctx.close();
  }
  await browser.close(); fs.writeFileSync('/tmp/nl010-opus/team-2/evidence/t/bigline.json', JSON.stringify(out, null, 1));
})().catch(e => { console.error(e); process.exit(1); });

Rowtap

A JavaScript module in the probe folder of Neural Link Between Agents that uses SHA-256.

interactionneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-2/tester/probe/rowtap.cjs · lines 1–34 of 34 · Not reached from any entry point (candidate for review)

What it does
It loads data. Uses libraries playwright, fs, path, child_process, crypto. 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 report.json; JSON file MODULE.json; JSON file modules.json.
What it achieves
Probe: with shell + line-card, tap a LINES row and log what happens to #card. It reads `/tmp/nl010-opus/team-2/tester/run-shell/report.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-2/tester/probe · JavaScript module
Uses
playwright, fs, path, child_process, crypto
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-2/tester/probe/rowtap.cjs:1-34 · blob 4d0a071ad52c24b1c6de120f46e881cc61cc4919 · GitHub at these lines
State
achieves: comment · context: auto · stage: output · effects: dom, filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
// probe: with shell + line-card, tap a LINES row and log what happens to #card
const { chromium, devices } = require('playwright'); const fs = require('fs'); const path = require('path');
const T = '/home/user/estate/kuiper-belt/editions/202611012135/handoff/02-card/test.cjs';
(async () => {
  const report = JSON.parse(fs.readFileSync('/tmp/nl010-opus/team-2/tester/run-shell/report.json', 'utf8'));
  const b = await chromium.launch({ args: ['--use-gl=angle', '--use-angle=swiftshader', '--enable-unsafe-swiftshader', '--ignore-gpu-blocklist'] });
  const ctx = await b.newContext({ ...devices['Pixel 7'] });
  // reuse the served html/manifest the test builds: run the test's builder by requiring it is not possible; rebuild here
  const { execFileSync } = require('child_process');
  const ED = '/home/user/estate/kuiper-belt/editions/202611012135';
  const tmp = fs.mkdtempSync('/tmp/nl010-opus/team-2/tester/probe/s-'); fs.mkdirSync(tmp + '/editions/202611012135', { recursive: true });
  fs.copyFileSync(ED + '/index.html', tmp + '/editions/202611012135/index.html'); execFileSync('git', ['init', '-q'], { cwd: tmp });
  execFileSync('git', ['apply', ED + '/handoff/04-loader/index.html.patch'], { cwd: tmp }); execFileSync('git', ['apply', ED + '/handoff/02-card/index.patch'], { cwd: tmp });
  const html = fs.readFileSync(tmp + '/editions/202611012135/index.html', 'utf8');
  const crypto = require('crypto'); const rec = (id, f) => { const buf = fs.readFileSync(ED + '/modules/' + f); return { id, generation: f.slice(0, 12), path: 'modules/' + f, sha256: crypto.createHash('sha256').update(buf).digest('hex'), bytes: buf.length, byte_budget: 131072, requires: (buf.toString().match(/requires\s*:\s*\[([^\]]*)\]/)[1].match(/['"]([^'"]+)['"]/g) || []).map(s => s.slice(1, -1  … [line shortened here: 447 characters; full line on GitHub]
  const man = { schema: 'kuiper.modules.v1', edition: '202611012135', hooks: 'kuiper.hooks.v1', order: ['kuiper-shell', 'line-card'], modules: [rec('kuiper-shell', '202611012143-kuiper-shell.js'), JSON.parse(fs.readFileSync(ED + '/handoff/02-card/MODULE.json'))] };
  const U = 'http://127.0.0.1:8422/editions/202611012135/';
  await ctx.route(u => u.href === U || u.href === U + 'index.html', r => r.fulfill({ body: html, contentType: 'text/html' }));
  await ctx.route(u => u.href === U + 'modules.json', r => r.fulfill({ body: JSON.stringify(man), contentType: 'application/json' }));
  const p = await ctx.newPage(); const log = []; p.on('console', m => log.push('console ' + m.type() + ' ' + m.text())); p.on('pageerror', e => log.push('pageerror ' + e.message));
  await p.goto(U); await p.waitForFunction(() => window.KY && KY.modules['line-card'] && KY.modules['kuiper-shell'], null, { timeout: 120000 }); await new Promise(r => setTimeout(r, 7000));
  await p.evaluate(() => { window.__log = []; const c = document.getElementById('card');
    new MutationObserver(ms => ms.forEach(m => window.__log.push([Math.round(performance.now()), 'card ' + m.attributeName + '=' + c.getAttribute(m.attributeName), new Error().stack.split('\n').slice(2, 5).join(' | ')]))).observe(c, { attributes: true });
    for (const t of ['pointerdown', 'pointerup', 'click', 'popstate', 'keydown']) addEventListener(t, e => window.__log.push([Math.round(performance.now()), t, (e.target && (e.target.id || e.target.className || e.target.tagName)) + '']), true);
    const lc = KY.modules['line-card'].api; });
  const wafer = await p.evaluate(() => { const t = document.querySelector('[data-menu="wafer"] > .gm-title'); const r = t.getBoundingClientRect(); return { x: r.x + r.width / 2, y: r.y + r.height / 2 }; });
  await p.touchscreen.tap(wafer.x, wafer.y); await new Promise(r => setTimeout(r, 1000));
  const row = await p.evaluate(() => { const e = document.querySelector('#lineslist [data-i]'); const b = e.getBoundingClientRect(); const x = b.left + b.width / 2, y = b.top + Math.min(b.height / 2, 10); const h = document.elementFromPoint(x, y); return { x, y, hit: h && (h.className || h.tagName), inRow: e.contains(h), cls: e.className }; });
  console.log('row', JSON.stringify(row));
  await p.touchscreen.tap(row.x, row.y); await new Promise(r => setTimeout(r, 3000));
  const out = await p.evaluate(() => ({ log: window.__log, card: getComputedStyle(document.getElementById('card')).display, inspect: KY.modules['line-card'].api.inspect ? KY.modules['line-card'].api.inspect() : null, hist: history.length }));
  console.log(JSON.stringify(out, null, 1).slice(0, 4000)); console.log(log.join('\n'));
  await b.close();
})().catch(e => { console.error(e); process.exit(2); });

Test Other 2152

A JavaScript module in the tester folder of Neural Link Between Agents that runs device (`runDevice`), calculates planar distances and draws on a canvas, using SHA-256.

testneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-2/tester/test.other-2152.cjs · lines 1–297 of 297 · Entry point · pattern tapEl (shared by 5 files)

What it does
It tests its inputs. Defines 20 functions or classes, including flag, sleep, sha, servedIndex, record. Uses libraries playwright, fs, path, os, crypto. 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 keys.json; JSON file modules.json; command-line arguments. Out: JSON file report.json; canvas drawing.
Downstream impact
It is itself an entry point (JavaScript module); no other file was found loading it.
What it achieves
It runs device (`runDevice`) and is built from the served index helper (`servedIndex`) and the record step (`record`). Defines `flag`, `sleep`, `sha` and 16 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-2/tester · JavaScript module
Uses
playwright, fs, path, os, crypto, child_process
Used by
none found
Produces
flag, sleep, sha, servedIndex, record, moduleRequires, servedManifest, overlayProbe, cardProbe, R, runDevice, shot
Defines here
flag, sleep, sha, servedIndex, record, moduleRequires, servedManifest, overlayProbe, cardProbe, R, runDevice, shot, tap, tapEl, touch, visible, reveal, settleSpark, clearSpace, fileOf
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-2/tester/test.other-2152.cjs:1-297 · blob d5874b6064165e87c6b758967024ee4dfbbf0abb · 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 — Opus team 2, roadmap step 2 "the card law: the line of code is the header", acceptance B1–B7 on Android.
// In the form of neural-link FIXES/NL-009/android-journey.cjs: Playwright, devices['Pixel 7'] and devices['Galaxy S24'],
// real touch (page.touchscreen.tap; CDP Input.dispatchTouchEvent for the swipe), zero console errors, JSON report.
//
//   node test.cjs <edition-url> <outdir> [--devices "Pixel 7,Galaxy S24"] [--with-shell] [--before]
//
// <edition-url> is http://127.0.0.1:<port>/editions/202611012135/ served from the kuiper-belt root. Until the integrator
// (Opus 10) has applied them, the page is served with Opus 4's handoff/04-loader/index.html.patch and our
// handoff/02-card/index.patch applied (page.route, the file on disk is never edited) and a modules.json whose `order` is
// [kuiper-shell (with --with-shell)], line-card, each record carrying the sha256 of the file on disk. When the page on
// disk already carries the hook table and the delegation, it is served as it is. --before also screenshots Edition 4's
// card from the unpatched page. Exit 0 when every check on every device passed, 1 otherwise, 2 on a harness error.
//
// B1 the card's first visible text node equals keys.json bodies[i].line_text byte for byte, for all 344 placed bodies
//    (expected values read from keys.json on disk by this script, not from the page); empty lines carry
//    "empty line at key"; aria-label = the header (K2); a "register quote" row for every quote ≠ line_text.
// B2 the second row is the key: repo, 7-character commit, path:line, key number; its href equals destination.
// B3 the title appears only after the key row; after a touch tap on "next verified line", on a spark and on a LINES row,
//    the card is ≤ 34 % of the viewport (closed and with details open) and the selected spark is in the clear space
//    (under the bar, ≥ 14 px above the card's top); NL-009 02-card: × and details ≥ 44 px, swipe-down closes and
//    un-targets, Escape closes, the card steps behind an open panel, the gesture-bar inset is paid, the link opens a
//    new tab with the card kept.
// B4 the K3 sentence is byte-identical in api.law, the module's header comment, handoff/02-card/LAWS-L11.patch,
//    handoff/02-card/README-card-law.md, the edition README.md, and (with --with-shell, when the shell has the slot)
//    the first paragraph of the ABOUT panel.
// B5 a body without line_text refuses with "no text at key" (never the title, never the quote).
// B6 every LINES row reads line text, key, title, in that order (all rows).
// B7 zero page errors and console errors; python3 tools/ci_check.py prints RESULT: PASS.
'use strict';
const { chromium, devices } = require('playwright');
const fs = require('fs'), path = require('path'), os = require('os'), crypto = require('crypto'), cp = require('child_process');

const argv = process.argv.slice(2);
const positional = argv.filter((a, i) => !a.startsWith('--') && !(i > 0 && argv[i - 1] === '--devices'));
const flag = n => { const i = argv.indexOf(n); return i >= 0 ? (argv[i + 1] && !argv[i + 1].startsWith('--') ? argv[i + 1] : true) : null; };
if (positional.length < 2) { console.error('usage: node test.cjs <edition-url> <outdir> [--devices A,B] [--with-shell] [--before]'); process.exit(2); }
const URL0 = positional[0].replace(/\/?$/, '/'), OUT = path.resolve(positional[1]);
const DEVICES = flag('--devices') ? String(flag('--devices')).split(',').map(s => s.trim()) : ['Pixel 7', 'Galaxy S24'];
const WITH_SHELL = !!flag('--with-shell'), BEFORE = !!flag('--before');
const ED = path.resolve(__dirname, '..', '..');                  // editions/202611012135
const ROOT = path.resolve(ED, '..', '..');                       // kuiper-belt
const HO = __dirname;
const MODULE = 'modules/202611012143-line-card.js', SHELL = 'modules/202611012143-kuiper-shell.js';
const LAW = 'The line of code is the header. Every card opens with the line itself, verbatim from the key; the key is the second row; every name a person gave the line comes after.';
const sleep = ms => new Promise(r => setTimeout(r, ms));
const LAUNCH = { args: ['--use-gl=angle', '--use-angle=swiftshader', '--enable-unsafe-swiftshader', '--ignore-gpu-blocklist'] };
fs.mkdirSync(OUT, { recursive: true });

// ------------------------------------------------------------------ the expected values, from disk
const KEYS = JSON.parse(fs.readFileSync(path.join(ED, 'keys.json'), 'utf8'));
const BODIES = KEYS.bodies || KEYS;
const EXPECT = {};                                               // key -> {line_text, destination, quote, quote_key, title}
for (const b of BODIES) if (b.on_wafer && b.verified && Number.isFinite(b.key)) EXPECT[b.key] = { t: b.line_text, d: b.destination, q: b.quote || '', qk: b.quote_key || null, title: b.title };
const sha = buf => crypto.createHash('sha256').update(buf).digest('hex');

// ------------------------------------------------------------------ the page as it will be integrated
function servedIndex() {
  let html = fs.readFileSync(path.join(ED, 'index.html'), 'utf8'); const applied = [];
  if (!/window\.KY\s*=/.test(html)) {
    const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'nl010-t2-')); const d = path.join(tmp, 'editions', '202611012135'); fs.mkdirSync(d, { recursive: true });
    fs.writeFileSync(path.join(d, 'index.html'), html);
    cp.execFileSync('patch', ['-s', '-p1', '-i', path.join(ED, 'handoff', '04-loader', 'index.html.patch')], { cwd: tmp });
    html = fs.readFileSync(path.join(d, 'index.html'), 'utf8'); applied.push('handoff/04-loader/index.html.patch');
  }
  if (!/KY\.modules\['line-card'\]/.test(html)) {
    const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'nl010-t2-')); const d = path.join(tmp, 'editions', '202611012135'); fs.mkdirSync(d, { recursive: true });
    fs.writeFileSync(path.join(d, 'index.html'), html);
    cp.execFileSync('patch', ['-s', '-p1', '-i', path.join(HO, 'index.patch')], { cwd: tmp });
    html = fs.readFileSync(path.join(d, 'index.html'), 'utf8'); applied.push('handoff/02-card/index.patch');
  }
  return { html, applied };
}
function record(id, file, requires, provides, extra) {
  const buf = fs.readFileSync(path.join(ED, file)); const gen = path.basename(file).slice(0, 12);
  return Object.assign({ id, generation: gen, path: file, sha256: sha(buf), bytes: buf.length, byte_budget: 65536, requires, provides,
    reads: [], writes: [], creates_controls: 'none', licence: 'Apache-2.0' }, extra || {});
}
function moduleRequires(file) {   // the registration's own requires, read from the file (the manifest must list them all)
  const s = fs.readFileSync(path.join(ED, file), 'utf8'); const m = s.match(/requires:\s*\[([^\]]*)\]/); if (!m) return [];
  return m[1].split(',').map(x => x.trim().replace(/^['"]|['"]$/g, '')).filter(Boolean);
}
function servedManifest() {
  const disk = JSON.parse(fs.readFileSync(path.join(ED, 'modules.json'), 'utf8'));
  if ((disk.order || []).includes('line-card')) return { json: disk, from: 'modules.json on disk' };
  const order = [], modules = [];
  if (WITH_SHELL && fs.existsSync(path.join(ED, SHELL))) { order.push('kuiper-shell'); modules.push(record('kuiper-shell', SHELL, moduleRequires(SHELL), ['kuiper-shell'])); }
  order.push('line-card'); modules.push(record('line-card', MODULE, moduleRequires(MODULE), ['line-card'], { team: '02', step: 2 }));
  return { json: { schema: 'kuiper.modules.v1', edition: '202611012135', hooks: 'kuiper.hooks.v1', order, modules }, from: 'test manifest (order ' + order.join(', ') + ')' };
}

// ------------------------------------------------------------------ in-page probes
function overlayProbe() {
  const o = document.getElementById('o'); const W = o.width, H = o.height, k = W / innerWidth; const d = o.getContext('2d').getImageData(0, 0, W, H).data;
  let sx = 0, sy = 0, n = 0; const gp = [];
  for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) { const i = (y * W + x) * 4, r = d[i], g = d[i + 1], b = d[i + 2], a = d[i + 3]; if (a < 60) continue;
    if (r > 180 && g < 110 && b > 140) { sx += x; sy += y; n++; } else if (g > 150 && r < 120 && b < 170 && a > 120) gp.push([x, y]); }
  const cl = [];
  for (const [x, y] of gp) { let hit = null; for (const c of cl) if (Math.abs(c.cx - x) <= 7 && Math.abs(c.cy - y) <= 7) { hit = c; break; }
    if (hit) { hit.sx += x; hit.sy += y; hit.n++; hit.cx = hit.sx / hit.n; hit.cy = hit.sy / hit.n; } else cl.push({ sx: x, sy: y, n: 1, cx: x, cy: y }); }
  return { magenta: n ? { x: sx / n / k, y: sy / n / k, px: n } : null, greens: cl.filter(c => c.n >= 4).map(c => ({ x: c.cx / k, y: c.cy / k, px: c.n })) };
}
function cardProbe() {
  const card = document.getElementById('card'), bar = document.getElementById('bar');
  const R = el => { if (!el) return null; const r = el.getBoundingClientRect(); return { left: r.left, top: r.top, right: r.right, bottom: r.bottom, width: r.width, height: r.height }; };
  const open = getComputedStyle(card).display !== 'none';
  return { open, rect: R(card), bar: R(bar), vh: innerHeight, vw: innerWidth, header: card.querySelector('.lc-h code') ? card.querySelector('.lc-h code').textContent : null,
    behind: getComputedStyle(card).visibility === 'hidden', details: card.classList.contains('lc-open'), x: R(card.querySelector('.lc-x')), t: R(card.querySelector('.lc-t')),
    a: R(card.querySelector('.lc-a a')), fontSize: getComputedStyle(card).fontSize, padBottom: getComputedStyle(card.querySelector('.lc-in') || card).paddingBottom };
}

// ------------------------------------------------------------------ one device
async function runDevice(browser, name) {
  const dev = devices[name]; if (!dev) throw new Error('unknown device ' + name);
  const dir = path.join(OUT, name.toLowerCase().replace(/[^a-z0-9]+/g, '-')); fs.mkdirSync(dir, { recursive: true });
  const ctx = await browser.newContext({ ...dev, locale: 'en-GB' });
  await ctx.route(/^https:\/\/github\.com\//, r => r.fulfill({ status: 200, contentType: 'text/plain', body: 'ok' }));
  const S = servedIndex(), M = servedManifest();
  await ctx.route(u => u.href.replace(/[?#].*$/, '') === URL0 || u.href.replace(/[?#].*$/, '') === URL0 + 'index.html',
    r => r.fulfill({ status: 200, contentType: 'text/html; charset=utf-8', body: S.html }));
  await ctx.route(u => u.href.replace(/[?#].*$/, '') === URL0 + 'modules.json', r => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(M.json) }));
  const page = await ctx.newPage(); page.setDefaultTimeout(180000);
  const cdp = await ctx.newCDPSession(page);
  const errors = [];
  page.on('console', m => { if (m.type() === 'error') errors.push('console: ' + m.text().slice(0, 300)); });
  page.on('pageerror', e => errors.push('pageerror: ' + String(e.message || e).slice(0, 300)));
  const checks = []; const rec = (id, pass, measured, note) => { checks.push({ id, pass: !!pass, measured, note: note || '' }); process.stderr.write(`[${name}] ${pass ? 'PASS' : 'FAIL'} ${id}${note ? ' — ' + note : ''}\n`); };
  const shot = async f => { try { await page.screenshot({ path: path.join(dir, f), scale: 'css', timeout: 180000 }); return f; } catch (e) { return 'FAILED ' + String(e.message).split('\n')[0]; } };
  const tap = (x, y) => page.touchscreen.tap(Math.round(x), Math.round(y));
  const tapEl = async sel => { const r = await page.evaluate(s => { const e = document.querySelector(s); if (!e) return null; const b = e.getBoundingClientRect(); return b.width && b.height ? { x: b.left + b.width / 2, y: b.top + b.height / 2 } : null; }, sel); if (!r) return false; await tap(r.x, r.y); return true; };
  const touch = (type, pts) => cdp.send('Input.dispatchTouchEvent', { type, touchPoints: pts.map((p, i) => ({ x: p[0], y: p[1], id: i + 1, radiusX: 4, radiusY: 4, force: 1 })) });
  const visible = sel => page.evaluate(s => { const e = document.querySelector(s); if (!e) return false; const r = e.getBoundingClientRect(); return r.width > 0 && r.height > 0 && getComputedStyle(e).visibility !== 'hidden'; }, sel);
  // open whichever bar title shows the element (Edition 4's titles, or the shell's), by touch
  const reveal = async sel => {
    if (await visible(sel)) return true;
    const titles = await page.evaluate(() => [...document.querySelectorAll('#bar .gm-title, #bar [data-panel], #bar [data-menu]')].map((b, i) => { b.setAttribute('data-t2', i); return i; }));
    for (const i of titles) { await tapEl(`[data-t2="${i}"]`); await sleep(500); if (await visible(sel)) return true; await tapEl(`[data-t2="${i}"]`); await sleep(300); }
    return false;
  };
  const settleSpark = async () => { let last = null; for (let t = 0; t < 40; t++) { await sleep(t ? 700 : 6500); const o = await page.evaluate(overlayProbe); if (o.magenta && last && Math.hypot(o.magenta.x - last.x, o.magenta.y - last.y) < 0.6) return o; last = o.magenta; } return page.evaluate(overlayProbe); };
  const clearSpace = async (label) => {
    const o = await settleSpark(), c = await page.evaluate(cardProbe);
    const ok = c.open && !!o.magenta && o.magenta.y >= c.bar.bottom && o.magenta.y <= c.rect.top - 14 && c.rect.height <= 0.34 * c.vh + 0.5;
    rec('B3 ' + label + ': capped and spark in clear space', ok, { spark: o.magenta, cardTop: c.rect && c.rect.top, cardH: c.rect && c.rect.height, share: c.rect && +(c.rect.height / c.vh).toFixed(3), barBottom: c.bar && c.bar.bottom });
    return { o, c };
  };

  const t0 = Date.now();
  await page.goto(URL0, { waitUntil: 'load' });
  await page.waitForFunction(() => /verified lines lit/.test((document.getElementById('big') || {}).textContent || '') && window.KY && window.KY.modules && window.KY.modules['line-card'], null, { timeout: 180000 });
  await sleep(7000);
  const edition = await page.evaluate(() => ({ admitted: window.__KUIPER_EDITION__ && window.__KUIPER_EDITION__.admitted, refused: window.__KUIPER_EDITION__ && window.__KUIPER_EDITION__.refused, placed: edPlaced.length }));
  rec('line-card admitted by the loader', (edition.admitted || []).some(a => a.id === 'line-card') && !(edition.refused || []).length, edition, 'served: ' + S.applied.join(' + ') + ' · ' + M.from);

  // ---- B3 by touch: "next verified line"
  const okE = await reveal('#keys [data-k="e"]') && await tapEl('#keys [data-k="e"]');
  rec('touch: next verified line tapped', okE);
  const e1 = await clearSpace('after next verified line');
  const shotAfter = await shot('after-' + name.toLowerCase().replace(/[^a-z0-9]+/g, '-') + '.png');
  // NL-009 02-card targets and type
  const hit = await page.evaluate(() => { const card = document.getElementById('card'); const out = {};
    for (const [k, s] of [['x', '.lc-x'], ['details', '.lc-t'], ['link', '.lc-a a']]) { const el = card.querySelector(s), r = el.getBoundingClientRect(), cx = r.left + r.width / 2, cy = r.top + r.height / 2; let a = cx, b = cx, c = cy, d = cy;
      for (let dx = -40; dx <= 40; dx++) for (let dy = -40; dy <= 40; dy++) { const t = document.elementFromPoint(cx + dx, cy + dy); if (t && (t === el || el.contains(t))) { a = Math.min(a, cx + dx); b = Math.max(b, cx + dx); c = Math.min(c, cy + dy); d = Math.max(d, cy + dy); } }
      out[k] = [b - a + 1, d - c + 1]; } return out; });
  rec('02-card F1/F2: × ≥ 44×44, details and link ≥ 44 tall', hit.x[0] >= 44 && hit.x[1] >= 44 && hit.details[1] >= 44 && hit.link[1] >= 44, hit);
  rec('02-card F6: 12 px type on a phone', e1.c.fontSize === '12px', e1.c.fontSize);
  // details by touch: names come after, cap holds
  await tapEl('#card .lc-t'); await sleep(800);
  const det = await page.evaluate(() => { const card = document.getElementById('card'), k = card.querySelector('.lc-k'), t = card.querySelector('.lc-title'), r = card.getBoundingClientRect();
    return { open: card.classList.contains('lc-open'), aria: card.querySelector('.lc-t').getAttribute('aria-expanded'), titleAfterKey: !!(k && t && (k.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING)), titleTop: t.getBoundingClientRect().top, keyBottom: k.getBoundingClientRect().bottom, share: r.height / innerHeight }; });
  rec('B3 details open: title only after the key row, aria-expanded, still ≤ 34 %', det.open && det.aria === 'true' && det.titleAfterKey && det.titleTop >= det.keyBottom - 0.5 && det.share <= 0.3405, det);
  // the link: a new tab, the card stays
  await page.evaluate(() => { document.getElementById('card').scrollTop = 0; });
  const np = ctx.waitForEvent('page', { timeout: 8000 }).catch(() => null); await tapEl('#card .lc-a a'); const p2 = await np;
  rec('02-card F8: the link opens a new tab, card kept', !!p2 && (await page.evaluate(cardProbe)).open, { newTab: p2 ? p2.url() : null }); if (p2) await p2.close();
  // a panel over the card: the card steps behind, and returns
  const panelTitle = await page.evaluate(() => { const b = document.querySelector('#bar .gm-title'); if (b) b.setAttribute('data-t2p', '1'); return !!b; });
  if (panelTitle) { await tapEl('[data-t2p="1"]'); await sleep(800); const b1 = (await page.evaluate(cardProbe)).behind; await tapEl('[data-t2p="1"]'); await sleep(800); const b2 = (await page.evaluate(cardProbe)).behind;
    rec('02-card F4: behind an open panel, back when it closes', b1 && !b2, { behindWhileOpen: b1, behindAfter: b2 }); }
  // the gesture-bar inset
  await cdp.send('Emulation.setSafeAreaInsetsOverride', { insets: { bottom: 24 } }).catch(() => null); await sleep(400);
  const pad = (await page.evaluate(cardProbe)).padBottom; await cdp.send('Emulation.setSafeAreaInsetsOverride', { insets: {} }).catch(() => null);
  rec('02-card F5: pays the gesture bar (24 px inset → 32 px padding)', pad === '32px', pad);
  // swipe down closes and un-targets
  await page.evaluate(() => { const c = document.getElementById('card'); c.scrollTop = 0; });
  const c3 = (await page.evaluate(cardProbe)).rect; const sx = c3.left + c3.width / 2;
  await touch('touchStart', [[sx, c3.top + 14]]); for (let i = 1; i <= 10; i++) { await touch('touchMove', [[sx, c3.top + 14 + i * 12]]); await sleep(16); } await touch('touchEnd', []); await sleep(1800);
  const sw = await page.evaluate(cardProbe), swo = await page.evaluate(overlayProbe);
  rec('02-card F7: swipe down closes, spark un-targeted', !sw.open && !swo.magenta, { open: sw.open, magenta: swo.magenta });

  // ---- B3 by touch: a spark
  const greens = (await page.evaluate(overlayProbe)).greens; const bar = (await page.evaluate(cardProbe)).bar;
  const vh = (await page.evaluate(cardProbe)).vh, vw = (await page.evaluate(cardProbe)).vw;
  const spark = greens.filter(g => g.y > bar.bottom + 40 && g.y < vh * 0.6 && g.x > 20 && g.x < vw - 20).sort((a, b) => Math.hypot(a.x - vw / 2, a.y - vh / 3) - Math.hypot(b.x - vw / 2, b.y - vh / 3))[0];
  let spOk = false;
  if (spark) { await tap(spark.x, spark.y); await sleep(1500); spOk = (await page.evaluate(cardProbe)).open; }
  rec('touch: a spark tapped opens its card', spOk, { spark, candidates: greens.length });
  if (spOk) await clearSpace('after a spark');
  // Escape closes when no panel is open
  await page.keyboard.press('Escape'); await sleep(1200);
  rec('02-card F7: Escape closes the card', !(await page.evaluate(cardProbe)).open);

  // ---- B6 and B3 by touch: the LINES rows
  const okL = await reveal('#lineslist .ln[data-i]');
  const rows = await page.evaluate(EX => { const out = { n: 0, bad: [] };
    for (const row of document.querySelectorAll('#lineslist .ln[data-i]')) { out.n++; const b = edPlaced[+row.dataset.i], ex = EX[b.key];
      const kids = [...row.children], code = kids[0], kEl = row.querySelector('.lc-rk'), tEl = row.querySelector('.lc-rn');
      const order = code && kEl && tEl && code.tagName === 'CODE' && (code.compareDocumentPosition(kEl) & 4) && (kEl.compareDocumentPosition(tEl) & 4);
      if (!ex || !order || code.textContent !== ex.t || kEl.textContent.indexOf(b.repo + '@' + String(b.commit).slice(0, 7) + ' ' + b.path + ':' + b.line) !== 0 || tEl.textContent !== (b.title || ''))
        out.bad.push(b.key); }
    return out; }, EXPECT);
  rec('B6 LINES rows read text, key, title (all rows)', okL && rows.n === Object.keys(EXPECT).length && rows.bad.length === 0, { rows: rows.n, mismatches: rows.bad.slice(0, 5) });
  const rowSel = await page.evaluate(() => { const rs = [...document.querySelectorAll('#lineslist .ln[data-i]')]; const r = rs.find(x => { const b = x.getBoundingClientRect(); return b.top > 0 && b.bottom < innerHeight * 0.6; }) || rs[0]; r.setAttribute('data-t2r', '1'); return +r.dataset.i; });
  await tapEl('[data-t2r="1"]'); await sleep(1200);
  const afterRow = await page.evaluate(i => ({ open: getComputedStyle(document.getElementById('card')).display !== 'none', header: document.querySelector('#card .lc-h code').textContent, expect: edPlaced[i].line_text, panel: !!document.querySelector('.gm-open') }), rowSel);
  rec('touch: a LINES row opens its card with its line as the header', afterRow.open && afterRow.header === afterRow.expect && !afterRow.panel, { row: rowSel, panelOpen: afterRow.panel });
  if (afterRow.open) await clearSpace('after a LINES row');

  // ---- B1, B2 over all 344 placed bodies, by calling the page's own edCard(i)
  const all = await page.evaluate(EX => {
    const out = { n: 0, b1: [], b2: [], aria: [], empty: 0, emptyWords: 0, quoteRows: 0, quoteKeyRows: 0, expectQuoteRows: 0, slowest: [0, -1] };
    const card = document.getElementById('card');
    for (let i = 0; i < edPlaced.length; i++) {
      const b = edPlaced[i], ex = EX[b.key]; const t0 = performance.now(); edCard(i); const dt = performance.now() - t0; if (dt > out.slowest[0]) out.slowest = [Math.round(dt), b.key];
      out.n++;
      const inner = card.querySelector('.lc-in'), first = inner && inner.firstElementChild, code = card.querySelector('.lc-h code');
      // the first visible text node of the card
      const w = document.createTreeWalker(card, NodeFilter.SHOW_TEXT, { acceptNode: n => { const el = n.parentElement; if (!n.data.length) return NodeFilter.FILTER_SKIP; for (let p = el; p && p !== card.parentElement; p = p.parentElement) { const cs = getComputedStyle(p); if (cs.display === 'none' || p.getAttribute('aria-hidden') === 'true') return NodeFilter.FILTER_SKIP; } return NodeFilter.FILTE  … [line shortened here: 415 characters; full line on GitHub]
      const ft = w.nextNode(); const firstText = ft ? ft.data : null;
      const okHeader = first && first.tagName === 'HEADER' && first.classList.contains('lc-h') && code && code.textContent === ex.t
        && (ex.t === '' ? (firstText === 'empty line at key') : firstText === ex.t);
      if (ex.t === '') { out.empty++; if (firstText === 'empty line at key') out.emptyWords++; }
      if (!okHeader) out.b1.push({ key: b.key, first: first && first.tagName, firstText: firstText && firstText.slice(0, 60), expect: ex.t.slice(0, 60) });
      if (card.getAttribute('aria-label') !== ex.t || card.getAttribute('aria-live') !== 'polite') out.aria.push(b.key);
      const second = first && first.nextElementSibling;
      const keyStr = b.repo + '@' + String(b.commit).slice(0, 7) + ' ' + b.path + ':' + b.line;
      if (!(second && second.classList.contains('lc-k') && second.tagName === 'A' && second.getAttribute('href') === ex.d && second.textContent.indexOf(keyStr) === 0 && second.textContent.indexOf(fmt(b.key)) > 0))
        out.b2.push({ key: b.key, second: second && second.className, text: second && second.textContent.slice(0, 80) });
      if (ex.q && ex.q !== ex.t) out.expectQuoteRows++;
      const q = card.querySelector('.lc-q'); if (q) { out.quoteRows++; if (/quoted one line below/.test(q.textContent)) out.quoteKeyRows++; }
      // the title is never in the header or the key row
      if (b.title && (code.textContent === b.title && ex.t !== b.title)) out.b1.push({ key: b.key, titleAsHeader: true });
    }
    card.style.display = 'none';
    return out; }, EXPECT);
  rec('B1 first visible text node = line_text, all placed bodies', all.n === Object.keys(EXPECT).length && all.b1.length === 0 && all.empty === all.emptyWords,
    { bodies: all.n, mismatches: all.b1.length, first: all.b1.slice(0, 3), empty: all.empty, emptyWords: all.emptyWords, slowest_ms_key: all.slowest });
  rec('K2 aria-label = header, aria-live polite, all bodies', all.aria.length === 0, { mismatches: all.aria.length });
  rec('B1 register quote row for every quote ≠ line_text', all.quoteRows === all.expectQuoteRows, { quoteRows: all.quoteRows, expected: all.expectQuoteRows, quotedOneLineBelow: all.quoteKeyRows });
  rec('B2 second row = key (repo@commit7 path:line · key N), href = destination, all bodies', all.b2.length === 0, { mismatches: all.b2.length, first: all.b2.slice(0, 3) });

  // ---- B5: a body without line_text refuses
  const b5 = await page.evaluate(() => { const b = Object.assign({}, edPlaced[0]); delete b.line_text; const api = KY.modules['line-card'].api; api.show(b, { index: 0, of: edPlaced.length });
    const card = document.getElementById('card'), h = card.querySelector('.lc-h'); const r = { headerText: h.textContent, code: h.querySelector('code').textContent, title: b.title, quote: b.quote, aria: card.getAttribute('aria-label'), apiHeader: api.header(b) }; api.close(); return r; });
  rec('B5 no line_text → "no text at key", never the title or the quote', b5.headerText === 'no text at key' && b5.code === '' && b5.aria === 'no text at key' && b5.apiHeader === 'no text at key', b5);

  // ---- B4 in the page (api.law and, with the shell, ABOUT's first paragraph)
  const b4 = await page.evaluate(() => { const api = KY.modules['line-card'].api; const slot = document.querySelector('[data-owner="line-card"][data-law="L11"]');
    let about = null; const panels = [...document.querySelectorAll('.gm-panel')]; const ab = panels.find(p => /about/i.test(p.id + ' ' + (p.getAttribute('aria-label') || '') + ' ' + (p.dataset.panel || '') + ' ' + (p.dataset.menu || '')));
    if (ab) { const p = ab.querySelector('p, .gm-prose'); about = p ? p.textContent : null; }
    return { law: api.law, slot: slot ? slot.textContent : null, about }; });
  const fileOf = f => { try { return fs.readFileSync(f, 'utf8'); } catch (e) { return ''; } };
  const srcs = { module: fileOf(path.join(ED, MODULE)), laws: fileOf(path.join(HO, 'LAWS-L11.patch')), readmeSection: fileOf(path.join(HO, 'README-card-law.md')), editionReadme: fileOf(path.join(ED, 'README.md')) };
  const has = Object.fromEntries(Object.entries(srcs).map(([k, v]) => [k, v.includes(LAW)]));
  const pageOk = b4.law === LAW && (!WITH_SHELL || b4.slot === LAW || b4.about === LAW);
  rec('B4 the K3 sentence identical in page, README, LAWS patch, module', pageOk && Object.values(has).every(Boolean), { apiLaw: b4.law === LAW, aboutSlot: b4.slot === null ? 'absent (shell not in this run or no slot yet)' : b4.slot === LAW, aboutFirst: b4.about === null ? null : b4.about === LAW, files: has });

  // ---- B7
  rec('B7 zero page errors and console errors', errors.length === 0, errors.slice(0, 5));
  const report = { device: name, viewport: dev.viewport, ms: Date.now() - t0, served: S.applied, manifest: M.from, screenshot: shotAfter, checks };
  await ctx.close();
  return report;
}

(async () => {
  const browser = await chromium.launch(LAUNCH); const reports = [];
  try {
    if (BEFORE) {   // Edition 4's card on the unpatched page, for the before/after pair
      const ctx = await browser.newContext({ ...devices['Pixel 7'], locale: 'en-GB' }); const p = await ctx.newPage(); p.setDefaultTimeout(180000);
      await p.goto(URL0, { waitUntil: 'load' }); await p.waitForFunction(() => /verified lines lit/.test(document.getElementById('big').textContent), null, { timeout: 180000 }); await sleep(7000);
      await p.evaluate(() => { const t = document.querySelector('#bar [data-panel="foot"]'); if (t) t.click(); }); await sleep(500);
      const r = await p.evaluate(() => { const b = document.querySelector('#keys [data-k="e"]').getBoundingClientRect(); return { x: b.left + b.width / 2, y: b.top + b.height / 2 }; });
      await p.touchscreen.tap(r.x, r.y); await sleep(8000);
      fs.mkdirSync(path.join(OUT, 'pixel-7'), { recursive: true }); await p.screenshot({ path: path.join(OUT, 'pixel-7', 'before-pixel-7.png'), scale: 'css', timeout: 180000 }); await ctx.close();
    }
    for (const d of DEVICES) reports.push(await runDevice(browser, d));
  } catch (e) { console.error('HARNESS ERROR', e); await browser.close(); process.exit(2); }
  await browser.close();
  let ci = null; try { ci = cp.execFileSync('python3', ['tools/ci_check.py'], { cwd: ROOT, encoding: 'utf8' }); } catch (e) { ci = String(e.stdout || '') + String(e.stderr || ''); }
  const ciPass = /RESULT: PASS/.test(ci || '');
  const pass = reports.every(r => r.checks.every(c => c.pass)) && ciPass;
  const out = { schema: 'kuiper.card.accept.v1', step: 2, url: URL0, utc: new Date().toISOString(), module: MODULE, module_sha256: sha(fs.readFileSync(path.join(ED, MODULE))),
    ci_check: { pass: ciPass, tail: (ci || '').trim().split('\n').slice(-2) }, devices: reports, RESULT: pass ? 'PASS' : 'FAIL' };
  fs.writeFileSync(path.join(OUT, 'report.json'), JSON.stringify(out, null, 1));
  console.log(JSON.stringify({ RESULT: out.RESULT, ci_check: out.ci_check, devices: reports.map(r => ({ device: r.device, failed: r.checks.filter(c => !c.pass).map(c => c.id) })) }, null, 1));
  process.exit(pass ? 0 : 1);
})();

Probe

A JavaScript module in the builder folder of Neural Link Between Agents that uses SHA-256.

renderneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-3/builder/probe.cjs · lines 1–28 of 28 · Not reached from any entry point (candidate for review)

What it does
It fetches data. Uses libraries playwright, fs. Side effects: changes the web page (DOM); reads or writes files; makes network requests; 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.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
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-3/builder · JavaScript module
Uses
playwright, fs
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-3/builder/probe.cjs:1-28 · blob 4c1660e1f543b00c5cffdec7ec0c6bc727ba3b1c · GitHub at these lines
State
achieves: name · context: auto · stage: output · effects: dom, filesystem, network, process · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
const { chromium, devices } = require('playwright');
const fs = require('fs');
const ED = 'http://127.0.0.1:8431/editions/202611012135/';
const SHIM = fs.readFileSync('/tmp/nl010-opus/team-3/builder/shim/index.html');
const scen = process.argv[2] || 'ok', dev = process.argv[3] || 'Galaxy S24';
(async () => {
  const b = await chromium.launch({ args: ['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] });
  const d = dev === 'landscape' ? devices['Pixel 7 landscape'] : devices[dev];
  const ctx = await b.newContext({ ...d }); const page = await ctx.newPage();
  const errs = []; page.on('pageerror', e => errs.push('pageerror ' + e.message)); page.on('console', m => { if (m.type() === 'error') errs.push('console ' + m.text()); });
  await page.route(/\/editions\/202611012135\/(index\.html)?(\?[^#]*)?$/, r => r.fulfill({ status: 200, contentType: 'text/html', body: SHIM }));
  if (scen === '404') await page.route(/\/editions\/202611012135\/keys\.json/, r => r.fulfill({ status: 404, body: 'no' }));
  if (scen === 'tamper') await page.route(/\/editions\/202611012135\/keys\.json/, async r => { const res = await r.fetch(); const buf = Buffer.from(await res.body()); buf[100] = buf[100] === 0x41 ? 0x42 : 0x41; r.fulfill({ status: 200, contentType: 'application/json', body: buf }); });
  if (scen === 'nosha') await page.route(/\/data\/layers\.json/, async r => { const res = await r.fetch(); const j = JSON.parse(await res.text()); j.layers.forEach(l => { if (l.id === 'lines') delete l.source.sha256; }); r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(j) }); });
  if (scen === 'nowafer') await page.route(/\/cosmos\/wafer\.tsv/, r => r.fulfill({ status: 404, body: 'no' }));
  await page.goto(ED, { waitUntil: 'load' }); await page.waitForTimeout(+(process.env.WAITMS||8000));
  const before = await page.evaluate(() => { const L = KY.modules.layers && KY.modules.layers.api; return { inspect: L && L.inspect(), big: document.getElementById('big').textContent, refuse: (document.getElementById('refuse') || {}).textContent }; });
  // open the WAFER panel by touch
  const t = await page.locator('#bar [data-panel=wafer]').boundingBox(); await page.touchscreen.tap(t.x + t.width / 2, t.y + t.height / 2); await page.waitForTimeout(800);
  const m = await page.evaluate(() => { const p = document.getElementById('layers'), pr = p.getBoundingClientRect();
    const rows = [...p.querySelectorAll('input[data-ky-layer]')].map(i => { const l = i.closest('label'), r = l.getBoundingClientRect(), ir = i.getBoundingClientRect(), font = getComputedStyle(l.querySelector('.nm') || l).fontSize;
      return { k: i.getAttribute('data-ky-layer'), h: +r.height.toFixed(1), top: +r.top.toFixed(0), bottom: +r.bottom.toFixed(0), covers: ir.left <= r.left + .5 && ir.right >= r.right - .5 && ir.top <= r.top + .5 && ir.bottom >= r.bottom - .5, visibleInPanel: r.bottom <= pr.bottom + .5 && r.top >= pr.top - .5, font, text: l.textContent.trim().replace(/\s+/g,' ') }; });
    const list = document.getElementById('lineslist');
    return { panel: { top: pr.top, bottom: pr.bottom, left: pr.left, right: pr.right, sh: p.scrollHeight, ch: p.clientHeight }, vh: innerHeight, vw: innerWidth, list: list && { sh: list.scrollHeight, ch: list.clientHeight }, count: (document.getElementById('lycount') || {}).textContent, small: [...p.querySelectorAll('button,label,.lg,input#lyFind')].filter(e => e.offsetParent && e.getBoundingClien  … [line shortened here: 534 characters; full line on GitHub]
  console.log(JSON.stringify({ scen, dev, before, m, errs }, null, 1));
  await page.screenshot({ path: '/tmp/nl010-opus/team-3/builder/' + scen + '-' + dev.replace(/ /g, '_') + '.png', timeout: 180000 });
  await b.close();
})().catch(e => { console.error(e); process.exit(2); });

Check Keys

A Python module in the evidence folder of Neural Link Between Agents. It is built from the lines step (`lines`).

ingestneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-3/evidence/check_keys.py · lines 1–45 of 45 · Entry point · pattern lines (shared by 10 files)

What it does
It loads data. Defines lines. Uses libraries re, subprocess, sys, pathlib. 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.
Downstream impact
It is itself an entry point (Python module); no other file was found loading it.
What it achieves
Re-read every key row of an `EVIDENCE.md`: | id | claim | key | `fragment` |. key = repo@sha path:line (estate clone, read with git show sha:path) or kuiper-belt@WORKTREE path:line (the edition branch's uncommitted files).
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-3/evidence · Python module
Uses
re, subprocess, sys, pathlib
Used by
none found
Produces
lines
Defines here
lines
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-3/evidence/check_keys.py:1-45 · blob 91828e9c14cc000a45d68022c3c20e369428f2c1 · GitHub at these lines
State
achieves: comment · context: auto · stage: ingest · effects: filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: unknown
#!/usr/bin/env python3
"""Re-read every key row of an EVIDENCE.md: | id | claim | key | `fragment` |.
key = repo@sha path:line (estate clone, read with git show sha:path) or
      neural-link-between-agents path:line (working tree, not a git repo) or
      kuiper-belt@WORKTREE path:line (the edition branch's uncommitted files).
PASS only if the sha resolves, the line exists, and the fragment is on that line."""
import re, subprocess, sys, pathlib
EST = pathlib.Path('/home/user/estate'); NL = pathlib.Path('/home/user/neural-link-between-agents')
KEY = re.compile(r'([A-Za-z0-9_.-]+)@([0-9a-f]{7,40}|WORKTREE) ([^\s`|]+):(\d+)')
NLK = re.compile(r'neural-link-between-agents ([^\s`|]+):(\d+)')
cache = {}
def lines(repo, sha, path):
    k = (repo, sha, path)
    if k not in cache:
        if repo == 'NL':
            cache[k] = (NL / path).read_text(errors='replace').split('\n')
        elif sha == 'WORKTREE':
            cache[k] = (EST / repo / path).read_text(errors='replace').split('\n')
        else:
            out = subprocess.run(['git', '-C', str(EST / repo), 'show', f'{sha}:{path}'], capture_output=True)
            if out.returncode: raise FileNotFoundError(out.stderr.decode().strip())
            cache[k] = out.stdout.decode(errors='replace').split('\n')
    return cache[k]
ok = bad = 0
for n, row in enumerate(open(sys.argv[1], encoding='utf-8'), 1):
    if not row.startswith('|') or row.startswith('|---') or row.startswith('| #'): continue
    cells = [c.strip() for c in re.split(r'(?<!\\)\|', row.strip())[1:-1]]
    if len(cells) < 4: continue
    keycell, frag = cells[-2], cells[-1]
    m = KEY.search(keycell); mn = NLK.search(keycell)
    if not (m or mn): continue
    fm = re.fullmatch(r'`+ ?(.*?) ?`+', frag)
    if not fm: print(f'NOFRAG  row {n}: {cells[0]}'); bad += 1; continue
    f = fm.group(1).replace('\\|', '|')
    repo, sha, path, ln = (m.groups() if m else ('NL', '', mn.group(1), mn.group(2)))
    try:
        L = lines(repo, sha, path); ln = int(ln)
        line = L[ln - 1] if 0 < ln <= len(L) else None
    except Exception as e:
        print(f'FAIL    row {n}: {cells[0]} {repo}@{sha} {path}: {e}'); bad += 1; continue
    if line is not None and f in line: ok += 1
    else:
        bad += 1; print(f'FAIL    row {n}: {cells[0]} {repo}@{sha} {path}:{ln} fragment not on line: {f!r}\n        line: {(line or "")[:200]!r}')
print(f'checked {ok + bad} keys: {ok} PASS, {bad} FAIL'); print('RESULT:', 'PASS' if bad == 0 and ok else 'FAIL')
sys.exit(0 if bad == 0 and ok else 1)

Mkpre

A Python module in the gen folder of Neural Link Between Agents that uses SHA-256. It is built from the one step (`one`).

storageneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-3/lead/gen/mkpre.py · lines 1–42 of 42 · Not reached from any entry point (candidate for review)

What it does
It loads data. Defines one. Uses libraries re, subprocess, json, hashlib. 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
Out: JSON file modules.json.
What it achieves
PRE-INTEGRATION page for `test.cjs` --index: current base `index.html` + team 3's deletions + team 4's hook table and loader (the reference bytes of `modules/202611012145-loader.js` between its marker lines) + the wafer promise + `refuse`.
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-3/lead/gen · Python module
Uses
re, subprocess, json, hashlib
Used by
none found
Produces
one
Defines here
one
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-3/lead/gen/mkpre.py:1-42 · blob 2bd527c1b0313e59b6f6f7c90048ea753f39761c · GitHub at these lines
State
achieves: comment · context: auto · stage: output · effects: filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
# PRE-INTEGRATION page for test.cjs --index: current base index.html + team 3's deletions + team 4's hook table and
# loader (the reference bytes of modules/202611012145-loader.js between its marker lines) + the wafer promise + refuse().
import re, subprocess
ED='/home/user/estate/kuiper-belt/editions/202611012135/'
OUT='/tmp/nl010-opus/team-3/lead/pre5/'
subprocess.run(['python3','/tmp/nl010-opus/team-3/lead/gen/delete.py',ED+'index.html',OUT+'del.html'],check=True,stderr=subprocess.DEVNULL)
s=open(OUT+'del.html').read()
P=open(ED+'handoff/04-loader/index.html.patch').read().split('\n')
css=[l[1:] for l in P if l.startswith('+  #refuse,noscript .refuse')]
cssmore=[]
for i,l in enumerate(P):
    if l.startswith('+  #refuse,noscript .refuse'):
        j=i+1
        while P[j].startswith('+  ') and not P[j].startswith('+  /*'): cssmore.append(P[j][1:]); j+=1
        break
ref=[]; 
for i,l in enumerate(P):
    if l.startswith('+function refuse(m, slot)'):
        j=i
        while P[j].startswith('+') and not P[j].startswith('+if (!gl)'): ref.append(P[j][1:]); j+=1
        break
assert css and ref, (css, ref)
L=open(ED+'modules/202611012145-loader.js').read().split('\n')
a=[i for i,l in enumerate(L) if 'KUIPER HOOK TABLE AND LOADER kuiper.hooks.v1 · begin' in l][0]
b=[i for i,l in enumerate(L) if 'KUIPER HOOK TABLE AND LOADER kuiper.hooks.v1 · end' in l][0]
loader='\n'.join(L[a:b+1])
def one(old,new):
    global s; assert s.count(old)==1,old; s=s.replace(old,new)
one('</style>','\n'.join(css+cssmore)+'\n</style>')
one("if (!gl) {", '\n'.join(ref)+"\nif (!gl) {")
one("let N = 0, SPACE = 0, repos = [], commits = [];","let N = 0, SPACE = 0, repos = [], commits = [];\nlet kyWaferOk, kyWaferNo; const kyWafer = new Promise((ok, no) => { kyWaferOk = ok; kyWaferNo = no; }); kyWafer.catch(() => {});")
one("the belt says ' + fmt(bad.lines); return; }","the belt says ' + fmt(bad.lines); kyWaferNo(new Error(hud.textContent)); return; }")
one("  N = issued; SPACE = k;","  N = issued; SPACE = k; kyWaferOk({ N, SPACE });")
one("}).catch(() => { hud.textContent = '../../cosmos/wafer.tsv did not load. The wafer will not invent its keys.'; });",
    "}).catch(() => { refuse('../../cosmos/wafer.tsv did not load. The wafer will not invent its keys.'); kyWaferNo(new Error('../../cosmos/wafer.tsv did not load. The wafer will not invent its keys.')); });")
one("\nrequestAnimationFrame(frame);","\n"+loader+"\nrequestAnimationFrame(frame);")
open(OUT+'index.html','w').write(s)
import json, hashlib
f='modules/202611012141-layers.js'; src=open(ED+f).read()
req=[x.strip().strip("'") for x in re.search(r"REQUIRES = \[([^\]]*)\]",src).group(1).split(',')]
json.dump({"schema":"kuiper.modules.v1","edition":"202611012135","hooks":"kuiper.hooks.v1","order":["layers"],"modules":[{"id":"layers","generation":"202611012141","path":f,"sha256":"live","bytes":0,"byte_budget":98304,"requires":req,"provides":["layers"],"licence":"Apache-2.0"}]},open(OUT+'modules.json','w'),indent=1)
print('ok', len(s))

Mkpre6

A Python module in the gen folder of Neural Link Between Agents that uses SHA-256.

storageneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-3/lead/gen/mkpre6.py · lines 1–14 of 14 · Not reached from any entry point (candidate for review)

What it does
It loads data. Uses libraries json, subprocess, sys. 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; JSON file MODULE.json; command-line arguments. Out: JSON file modules.json.
What it achieves
PRE-INTEGRATION on the integrator's base (hook table + loader already in `index.html`): our deletions by content, and the integrator's `modules.json` with layers appended. kuiper-shell is left out.
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-3/lead/gen · Python module
Uses
json, subprocess, 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-3/lead/gen/mkpre6.py:1-14 · blob 926fd1a730a06069e7d9e134adab678e1c87aaa6 · GitHub at these lines
State
achieves: comment · context: auto · stage: output · effects: filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
# PRE-INTEGRATION on the integrator's base (hook table + loader already in index.html): our deletions by content, and
# the integrator's modules.json with layers appended. kuiper-shell is left out: it still REQUIREs #lines #lyAll
# #lyFocus #lyFind, which step 3 deletes (REQUEST to Opus 1, issue #10).
import json, subprocess
ED='/home/user/estate/kuiper-belt/editions/202611012135/'; OUT='/tmp/nl010-opus/team-3/lead/pre6/'
subprocess.run(['python3', ED+'handoff/03-layers/delete-moved.py', ED+'index.html', OUT+'index.html'], check=True, stderr=subprocess.DEVNULL)
import sys
SKIP=('layers',) + tuple(sys.argv[1:])
m=json.load(open(ED+'modules.json')); rec=json.load(open(ED+'handoff/03-layers/MODULE.json'))
m['modules']=[x for x in m['modules'] if x['id'] not in SKIP]
m['order']=[x for x in m['order'] if x not in SKIP]
rec=dict(rec); rec['sha256']='live'
m['modules'].append(rec); m['order'].append('layers')
json.dump(m, open(OUT+'modules.json','w'), indent=1); print(m['order'])

Build Pre

A JavaScript module in the tester folder of Neural Link Between Agents that uses SHA-256. It is built from the arr step (`arr`).

storageneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-3/tester/build-pre.cjs · lines 1–23 of 23 · Not reached from any entry point (candidate for review)

What it does
It loads data. Defines arr. Uses libraries fs, path, child_process, crypto. 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.
What it achieves
PRE-INTEGRATION shim for `test.cjs` `--index/`--manifest. Edition 4 copy + team 4's `index.html`.patch (+ team 3's `index.html`.patch when it exists), and a manifest listing the named modules in order.
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-3/tester · JavaScript module
Uses
fs, path, child_process, crypto
Used by
none found
Produces
arr
Defines here
arr
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-3/tester/build-pre.cjs:1-23 · blob 79abb6108691cd5963d06abf2d1047fbc101f272 · GitHub at these lines
State
achieves: comment · context: auto · stage: output · effects: filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
// build-pre.cjs: PRE-INTEGRATION shim for test.cjs --index/--manifest. Edition 4 copy + team 4's index.html.patch
// (+ team 3's index.html.patch when it exists), and a manifest listing the named modules in order.
//   node build-pre.cjs layers [kuiper-shell line-card ...]
const fs = require('fs'), path = require('path'), cp = require('child_process'), crypto = require('crypto');
const ED = '/home/user/estate/kuiper-belt/editions/202611012135', OUT = '/tmp/nl010-opus/team-3/tester/pre';
const ids = process.argv.slice(2).length ? process.argv.slice(2) : ['layers'];
const work = path.join(OUT, 'tree'); fs.rmSync(work, { recursive: true, force: true }); fs.mkdirSync(path.join(work, 'editions/202611012135'), { recursive: true });
fs.copyFileSync(path.join(ED, 'index.html'), path.join(work, 'editions/202611012135/index.html'));
const log = [];
const PATCHES = (process.env.PATCHES || '04-loader/index.html.patch,03-layers/index.html.after-04-loader.patch').split(',').map(x => x.split('/'));
for (const [p, name] of PATCHES) { const f = path.join(ED, 'handoff', p, name); if (!fs.existsSync(f)) { log.push(p + ': no ' + name); continue; }
  try { cp.execFileSync('patch', ['-p1', '--dry-run', '-i', f], { cwd: work, encoding: 'utf8' }); log.push(p + ' ' + name + ': ' + cp.execFileSync('patch', ['-p1', '--no-backup-if-mismatch', '-i', f], { cwd: work, encoding: 'utf8' }).trim().replace(/\n/g, ' / ')); }
  catch (e) { log.push(p + ' ' + name + ': DOES NOT APPLY, skipped: ' + String(e.stdout || e.message).replace(/\n/g, ' / ')); } }
fs.copyFileSync(path.join(work, 'editions/202611012135/index.html'), path.join(OUT, 'index.html'));
const files = fs.readdirSync(path.join(ED, 'modules'));
const modules = ids.map(id => { const f = files.filter(x => new RegExp('^\\d{12}-' + id + '\\.js$').test(x)).sort().pop(); if (!f) throw new Error('no module ' + id);
  const b = fs.readFileSync(path.join(ED, 'modules', f)), s = b.toString('utf8');
  const arr = k => { const m = s.match(new RegExp('(?:' + k + '|' + k.toUpperCase() + ')\\s*[:=]\\s*\\[([^\\]]*)\\]')); return m ? m[1].split(',').map(x => x.trim().replace(/^['"]|['"]$/g, '')).filter(Boolean) : []; };
  return { id, generation: f.slice(0, 12), path: 'modules/' + f, sha256: 'live', bytes: b.length, byte_budget: Math.max(65536, b.length * 2),
    requires: arr('requires'), provides: arr('provides').length ? arr('provides') : [id], reads: [], writes: [], creates_controls: 'see module', licence: 'Apache-2.0', team: 'pre', step: 0, proof: 'pre-integration shim' }; });
const man = { schema: 'kuiper.modules.v1', edition: '202611012135', hooks: 'kuiper.hooks.v1', order: ids, modules };
fs.writeFileSync(path.join(OUT, 'modules.json'), JSON.stringify(man, null, 1));
console.log(log.join('\n')); console.log(JSON.stringify(modules.map(m => [m.id, m.path, m.sha256, m.requires.join(' ')])));

Check Keys

A Python module in the evidence folder of Neural Link Between Agents. It is built from the text step (`text`).

ingestneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-4/evidence/check_keys.py · lines 1–34 of 34 · Not reached from any entry point (candidate for review)

What it does
It loads data. Defines text. Uses libraries re, subprocess, sys, os. 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.
What it achieves
Re-read every key row of an `EVIDENCE.md`: | id | claim | key | `fragment` |. key = repo@sha path:line[-line].
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-4/evidence · Python module
Uses
re, subprocess, sys, os
Used by
none found
Produces
text
Defines here
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-4/evidence/check_keys.py:1-34 · blob ff5d0ebe9e91ea2afd06344e7a374ce229b31db6 · GitHub at these lines
State
achieves: comment · context: auto · stage: ingest · effects: filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
"""Re-read every key row of an EVIDENCE.md: | id | claim | key | `fragment` |.
key = repo@sha path:line[-line]. PASS only if sha is a prefix of a commit that resolves, the path exists at that
commit (or, for sha 'WT', in the working tree), the first line of the range exists and the fragment is on a line
of the range. Usage: python3 -I check_keys.py EVIDENCE.md"""
import re, subprocess, sys, os
EST = '/home/user/estate'
ROW = re.compile(r'^\|\s*([A-Z]+\d+(?:\.\d+)?)\s*\|(.*)\|\s*([\w.-]+)@([0-9a-fA-FWT]+)\s+([^\s:|]+):(\d+)(?:-(\d+))?\s*\|\s*`(.+)`\s*\|\s*$')
ok = bad = 0
cache = {}
def text(repo, sha, path):
    k = (repo, sha, path)
    if k in cache: return cache[k]
    if sha == 'WT':
        p = os.path.join(EST, repo, path)
        t = open(p, encoding='utf-8').read() if os.path.exists(p) else None
    else:
        r = subprocess.run(['git', '-C', os.path.join(EST, repo), 'show', f'{sha}:{path}'], capture_output=True, text=True)
        t = r.stdout if r.returncode == 0 else None
    cache[k] = t
    return t
for n, line in enumerate(open(sys.argv[1], encoding='utf-8'), 1):
    m = ROW.match(line.rstrip('\n'))
    if not m: continue
    rid, _, repo, sha, path, a, b, frag = m.groups()
    frag = frag.replace('\\|', '|')
    t = text(repo, sha, path)
    a = int(a); b = int(b) if b else a
    if t is None: print(f'FAIL {rid} {repo}@{sha} {path}: no such file'); bad += 1; continue
    L = t.split('\n')
    if b > len(L): print(f'FAIL {rid} {path}:{a}-{b}: past end ({len(L)})'); bad += 1; continue
    if any(frag in L[i-1] for i in range(a, b+1)): ok += 1
    else: print(f'FAIL {rid} {path}:{a}-{b}: fragment not found: {frag!r}'); bad += 1
print(f'rows checked {ok+bad}, PASS {ok}, FAIL {bad}')
print('RESULT: ' + ('PASS' if bad == 0 and ok else 'FAIL'))

Smoke

A JavaScript module in the evidence folder of Neural Link Between Agents.

testneural-link-between-agents / FIXES/NL-010/tools/evidence/nl010-opus/team-4/evidence/js/smoke.cjs · lines 1–23 of 23 · Not reached from any entry point (candidate for review)

What it does
It tests its inputs. Uses libraries playwright. 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).
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
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-4/evidence/js · JavaScript module
Uses
playwright
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-4/evidence/js/smoke.cjs:1-23 · blob b3d8bdf0cac7201e828d15fa900c946f79474040 · GitHub at these lines
State
achieves: name · context: auto · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
const { chromium, devices } = require('playwright');
const URL = 'http://127.0.0.1:8443/editions/202611012135/';
(async () => {
  const b = await chromium.launch({ args: ['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] });
  for (const dev of ['Pixel 7', 'Galaxy S24']) {
    const ctx = await b.newContext({ ...devices[dev] }); const p = await ctx.newPage();
    const errs = [], cons = [];
    p.on('pageerror', e => errs.push(String(e))); p.on('console', m => { if (m.type() === 'error') cons.push(m.text()); });
    await p.goto(URL); await p.waitForTimeout(7000);
    const r = await p.evaluate(() => {
      const KY = window.KY, E = window.__KUIPER_EDITION__;
      let writeThrows = null; try { KY.x = 1; writeThrows = false; } catch (e) { writeThrows = e.constructor.name; }
      return { frozen: Object.isFrozen(KY), hooks: Object.keys(KY.hooks), hooksFrozen: Object.isFrozen(KY.hooks), names: KY.names.length,
        alias: window.__KUIPER_MODULES__ === KY.modules, admitted: E.admitted, refused: E.refused, failures: E.failures, timings: E.timings,
        bytes: E.bytes, budget: E.byte_budget, refuse: !!document.getElementById('refuse'), hello: KY.modules.hello && KY.modules.hello.inspect(),
        scripts: [...document.querySelectorAll('script[data-ky-module]')].map(s => s.dataset.kyModule), N: KY.hooks.N, SPACE: KY.hooks.SPACE,
        writeFromPage: writeThrows };
    });
    console.log(dev, JSON.stringify(r)); console.log(dev, 'pageerror', errs.length, errs.slice(0,3), 'console.error', cons.length, cons.slice(0,3));
    await ctx.close();
  }
  await b.close();
})();