import assert from 'node:assert/strict'; import {readFile, stat} from 'node:fs/promises'; import test from 'node:test'; const root = new URL('../', import.meta.url); test('manifest points only to files present in the starter', async () => { const manifest = JSON.parse(await readFile(new URL('starter-manifest.json', root), 'utf8')); const paths = [ manifest.readFirst, manifest.protocol, manifest.client, ...manifest.additionalProtocols, ...manifest.executableExamples, ...manifest.samples ]; for (const relative of paths) { assert.ok((await stat(new URL(relative, root))).isFile(), `${relative} is missing`); } assert.equal(manifest.starterRevision, '4'); assert.equal(manifest.status, 'production'); assert.equal(manifest.availability, 'production-public-v1'); }); test('public contracts contain the exact current capability and mode markers', async () => { const [main, run, abi, capabilities] = await Promise.all([ readFile(new URL('protocol/machine10-main-contract-v1.md', root), 'utf8'), readFile(new URL('protocol/machine10-run-now-v1.md', root), 'utf8'), readFile(new URL('protocol/machine10-guest-abi-v1.md', root), 'utf8'), readFile(new URL('protocol/machine10-capabilities-v1.md', root), 'utf8') ]); assert.match(main, /q:prune/); assert.match(main, /path:owner/); assert.doesNotMatch(main, /optional initial memory/); assert.match(run, /machine10\/run/); assert.match(abi, /0x4d10/); assert.match(capabilities, /\/status/); assert.match(capabilities, /through=/); assert.match(capabilities, /recursive=true/); }); test('assembly constants agree with the documented retained ABI', async () => { const include = await readFile(new URL('include/machine10-main.inc', root), 'utf8'); assert.match(include, /M10_ABI_VERSION_MAINBOARD,\s+3/); assert.match(include, /M10_EVENT_VERSION_PAYLOAD,\s+2/); assert.match(include, /M10_ABI_V3_COMPLETION_SEQUENCE,\s+88/); assert.match(include, /M10_RETAINED_START,\s+0x02000000/); assert.match(include, /M10_RETAINED_END,\s+0x04000000/); });