// Diagnostic only: exercises the real installed extension with the sibling repo's // isolated harness. No real processes, live endpoints, or messaging are invoked. import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import { pathToFileURL } from 'node:url'; const installed = 'C:/Users/decid/AppData/Local/spt-core/adapters/_github/BigscreenVR-omp-spt/strings/omp-spt.mjs'; const harnessPath = 'C:/Users/decid/Documents/projects/omp-spt/tests/omp-extension.mjs'; const source = await readFile(harnessPath, 'utf8'); const end = source.indexOf('\nfunction commandCalls('); assert.ok(end > 0, 'harness definition boundary exists'); const definitions = source.slice(0, end) .replaceAll('../adapter/strings/omp-spt.mjs', pathToFileURL(installed).href) + '\nexport { createHarness, assistantMessage, flush };'; const { createHarness, assistantMessage, flush } = await import( 'data:text/javascript;base64,' + Buffer.from(definitions).toString('base64') ); const old = assistantMessage([{ type: 'text', text: 'OLD_SENTINEL' }], { timestamp: 10, responseId: 'historical', }); const current = assistantMessage([{ type: 'text', text: 'NEW_SENTINEL' }], { timestamp: 20, responseId: 'current', }); async function probe(firstContext) { const rig = createHarness(); await rig.emit('session_start'); await rig.emit('context', { messages: [old] }); await rig.emit('before_agent_start', { prompt: 'continue' }); await rig.emit('agent_start'); await rig.emit('context', { messages: firstContext }); await rig.emit('context', { messages: [old, current] }); await flush(); const mids = rig.calls.filter(call => call.args.includes('--mid')).map(call => call.input); await rig.emit('session_shutdown'); return mids; } const stableHistory = await probe([old]); const narrowedThenExpanded = await probe([]); assert.deepEqual(stableHistory, ['NEW_SENTINEL']); assert.deepEqual(narrowedThenExpanded, ['OLD_SENTINEL', 'NEW_SENTINEL']); console.log(JSON.stringify({ stableHistory, narrowedThenExpanded }, null, 2)); console.log('PROVEN: a narrower first context forgets historical output; later expansion re-reports it.'); console.log('NOT PROVEN: this snapshot sequence occurred during the live checkpoint replay.');