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. |
| 2 | import { open, mockLog, clearMockLog, contentText, connectMock, steerDiamond } from './harness.mjs'; |
| 3 | |
| 4 | const s = await open({ name: 'skillsau2', defaults: true }); |
| 5 | const { page } = s; |
| 6 | await page.waitForTimeout(2500); |
| 7 | await connectMock(s); |
| 8 | const out = {}; |
| 9 | |
| 10 | await page.evaluate(() => DaimondPanels.show('ai')); |
| 11 | await page.waitForTimeout(1200); |
| 12 | out.boxes = await page.$$eval('.diamond-box', els => els.length); |
| 13 | await page.$$eval('.diamond-box', els => els[0] && els[0].click()); |
| 14 | await page.waitForTimeout(1500); |
| 15 | |
| 16 | clearMockLog(); |
| 17 | try { await steerDiamond(s, 'Say in one line what skills you have.'); } |
| 18 | catch (e) { out.steerErr = String(e).slice(0, 90); } |
| 19 | await page.waitForTimeout(9000); |
| 20 | |
| 21 | const sysOf = (r) => contentText((r.messages || []).find(m => m.role === 'system')?.content || ''); |
| 22 | const log = mockLog(); |
| 23 | const 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 | })(); |
| 30 | out.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 ───────────────────────────── |
| 41 | out.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. |
| 49 | await page.reload(); |
| 50 | await page.waitForTimeout(3000); |
| 51 | await page.evaluate(() => DaimondPanels.show('work')); |
| 52 | await page.waitForTimeout(1200); |
| 53 | out.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 | }); |
| 57 | out.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 ─────────────────────────────────────── |
| 64 | await page.click('#instructions-chip', { force: true }); |
| 65 | await page.waitForTimeout(2500); |
| 66 | out.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 | |
| 75 | console.log(JSON.stringify(out, null, 1)); |
| 76 | await s.browser.close(); |