oxedyne/daimond/dev/probe_skillsau.mjs
3.2 KiB, 1 run
created by r2519314175:77, 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_skillsau.mjs — the three pieces of lane AU, walked in the real page. |
| 2 | // |
| 3 | // 1. A fresh store gets a seeded `DAIMOND.md`, the chip says so, and the text |
| 4 | // reaches the model as the user's standing instructions. |
| 5 | // 2. Every chat and daimon request carries the skills note. |
| 6 | // 3. `/status` and `/decisions` resolve in a workspace with no skills file, and |
| 7 | // the shipped text reaches the provider named as shipped. |
| 8 | import { open, chat, mockLog, clearMockLog, contentText, connectMock } from './harness.mjs'; |
| 9 | |
| 10 | const s = await open({ name: 'skillsau', defaults: false }); |
| 11 | const { page } = s; |
| 12 | await page.waitForTimeout(1500); |
| 13 | |
| 14 | const out = {}; |
| 15 | |
| 16 | // ── 1. DAIMOND.md ──────────────────────────────────────────────── |
| 17 | out.seeded = await page.evaluate(async () => { |
| 18 | const m = await import('/pkg/oxedyne_daimond.js'); |
| 19 | let stored = null; |
| 20 | try { stored = await m.store_read('DAIMOND.md'); } catch (e) { stored = 'ERR ' + e; } |
| 21 | return { |
| 22 | flag: (() => { try { return localStorage.getItem('daimond.instructions.seeded'); } catch (e) { return 'no-storage'; } })(), |
| 23 | bytes: typeof stored === 'string' ? stored.length : null, |
| 24 | head: typeof stored === 'string' ? stored.slice(0, 60) : String(stored), |
| 25 | names: typeof stored === 'string' ? /\/status/.test(stored) && /\/handover/.test(stored) : false, |
| 26 | }; |
| 27 | }); |
| 28 | // The chip: open the Workspace panel so it is drawn, then read it. |
| 29 | out.chip = await page.evaluate(() => { |
| 30 | const el = document.getElementById('instructions-chip'); |
| 31 | if (!el) return { there: false }; |
| 32 | return { there: true, display: el.style.display, text: el.textContent, title: el.title, |
| 33 | empty: el.getAttribute('data-empty') }; |
| 34 | }); |
| 35 | |
| 36 | await connectMock(s); |
| 37 | clearMockLog(); |
| 38 | |
| 39 | // ── 2 and 3. The wire ──────────────────────────────────────────── |
| 40 | await chat(s, '/status'); |
| 41 | let log = mockLog(); |
| 42 | const sys = (r) => contentText((r.messages || []).find(m => m.role === 'system')?.content || ''); |
| 43 | const usr = (r) => (r.messages || []).filter(m => m.role === 'user').map(m => contentText(m.content)).join('\n'); |
| 44 | out.status = log.length ? { |
| 45 | requests: log.length, |
| 46 | skillsNote: /## Skills/.test(sys(log[0])), |
| 47 | notesNamed: /handover, pickup, status/.test(sys(log[0])), |
| 48 | standing: /Standing instructions from the user/.test(sys(log[0])), |
| 49 | seedOnWire: /How to answer me/.test(sys(log[0])), |
| 50 | shippedPath: /daimond:skills\/status\.md/.test(usr(log[0])), |
| 51 | fiveLines: /five lines or fewer/.test(usr(log[0])), |
| 52 | required: /Required from you:/.test(usr(log[0])), |
| 53 | } : { requests: 0 }; |
| 54 | |
| 55 | clearMockLog(); |
| 56 | await chat(s, '/decisions'); |
| 57 | log = mockLog(); |
| 58 | out.decisions = log.length ? { |
| 59 | requests: log.length, |
| 60 | shippedPath: /daimond:skills\/decisions\.md/.test(usr(log[0])), |
| 61 | oneAtATime: /ONE AT A TIME/.test(usr(log[0])), |
| 62 | recommend: /Your recommendation/.test(usr(log[0])), |
| 63 | count: /Decision 1 of N/.test(usr(log[0])), |
| 64 | } : { requests: 0 }; |
| 65 | |
| 66 | clearMockLog(); |
| 67 | const said = await chat(s, '/pickpu'); |
| 68 | out.mistyped = { refused: /no skill called/i.test(said), reachedModel: mockLog().length }; |
| 69 | |
| 70 | console.log(JSON.stringify(out, null, 1)); |
| 71 | await s.browser.close(); |