Oregami
Repositories/oxedyne/daimond

oxedyne/daimond/dev/probe_skillsau2.mjs

3.2 KiB, 1 run

created by r2519314175:79, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1// probe_skillsau2.mjs — the daimon's half, and the chip once the rules are gone.
2import { open, mockLog, clearMockLog, contentText, connectMock, steerDiamond } from './harness.mjs';
3
4const s = await open({ name: 'skillsau2', defaults: true });
5const { page } = s;
6await page.waitForTimeout(2500);
7await connectMock(s);
8const out = {};
9
10await page.evaluate(() => DaimondPanels.show('ai'));
11await page.waitForTimeout(1200);
12out.boxes = await page.$$eval('.diamond-box', els => els.length);
13await page.$$eval('.diamond-box', els => els[0] && els[0].click());
14await page.waitForTimeout(1500);
15
16clearMockLog();
17try { await steerDiamond(s, 'Say in one line what skills you have.'); }
18catch (e) { out.steerErr = String(e).slice(0, 90); }
19await page.waitForTimeout(9000);
20
21const sysOf = (r) => contentText((r.messages || []).find(m => m.role === 'system')?.content || '');
22const log = mockLog();
23const daimonSys = (() => {
24 for (let i = log.length - 1; i >= 0; i--) {
25 const t = sysOf(log[i]);
26 if (/daimon of this Diamond/i.test(t)) return t;
27 }
28 return '';
29})();
30out.daimon = {
31 requests: log.length,
32 found: !!daimonSys,
33 skillsNote: /## Skills/.test(daimonSys),
34 named: /handover, pickup, status/.test(daimonSys),
35 seedOnWire: /How to answer me/.test(daimonSys),
36 ownFolder: /This Diamond's own folder is/.test(daimonSys),
37 chars: daimonSys.length,
38};
39
40// ── The chip once the rules are gone ─────────────────────────────
41out.afterDelete = await page.evaluate(async () => {
42 const m = await import('/pkg/oxedyne_daimond.js');
43 try { await m.store_write('DAIMOND.md', ''); } catch (e) { return 'write failed: ' + e; }
44 return 'wrote empty';
45});
46// Through a RELOAD, which is the page's own boot path and the door a root switch
47// uses -- and which also proves the seed is once: the flag is set, so an empty
48// DAIMOND.md must stay empty rather than being written again.
49await page.reload();
50await page.waitForTimeout(3000);
51await page.evaluate(() => DaimondPanels.show('work'));
52await page.waitForTimeout(1200);
53out.reseeded = await page.evaluate(async () => {
54 const m = await import('/pkg/oxedyne_daimond.js');
55 try { return String(await m.store_read('DAIMOND.md') || '').length; } catch (e) { return 'gone'; }
56});
57out.chipAfter = await page.evaluate(() => {
58 const el = document.getElementById('instructions-chip');
59 return el ? { display: el.style.display, text: el.textContent, title: el.title,
60 empty: el.getAttribute('data-empty') } : null;
61});
62
63// ── One tap writes it back ───────────────────────────────────────
64await page.click('#instructions-chip', { force: true });
65await page.waitForTimeout(2500);
66out.afterTap = await page.evaluate(async () => {
67 const m = await import('/pkg/oxedyne_daimond.js');
68 let bytes = 0;
69 try { bytes = String(await m.store_read('DAIMOND.md') || '').length; } catch (e) { bytes = 'gone'; }
70 const el = document.getElementById('instructions-chip');
71 return { bytes, empty: el && el.getAttribute('data-empty'), title: el && el.title,
72 editorHas: /How to answer me/.test(document.body.innerText) };
73});
74
75console.log(JSON.stringify(out, null, 1));
76await s.browser.close();