From d9562636eb95e2f3ba6c64ce7e7f84588bd59d21 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 03:20:05 +0000 Subject: [PATCH 1/2] build-set: write the set's product page and the lock that binds it When the set has a product record (prism/product.json), build-set writes site/product/index.html, a page generated from the set, its prompts and the record, whose every answer comes from the verified holo the Pages workflow publishes beside it, and prism/builder.lock, naming this builder as the source and the page's sha256, so an instance's only-Prism audit can count the page as Prism output. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013Asa3Ns5C7CRWRVtEQBxEq --- builder/cli.mjs | 3 + builder/ui.mjs | 38 +++ builder/ui/product.html | 552 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 593 insertions(+) create mode 100644 builder/ui.mjs create mode 100644 builder/ui/product.html diff --git a/builder/cli.mjs b/builder/cli.mjs index 82e3c49..244439f 100644 --- a/builder/cli.mjs +++ b/builder/cli.mjs @@ -31,6 +31,7 @@ import { basename, dirname, join, resolve } from 'node:path'; import { fileURLToPath } from 'node:url'; import { buildApp, claimLines } from './build.mjs'; import { buildSet } from './set.mjs'; +import { productUi } from './ui.mjs'; import { TOOL } from './tool.mjs'; import { SpecError } from './vendor/prism-code/src/journey/spec.mjs'; @@ -100,6 +101,8 @@ try { // The newest commit of the set or any of its prompts dates the threat model. const lastModified = flag('--last-modified') ?? [file, ...set.prompts.map((p) => join(dirname(file), p))].map(committed).sort().pop(); const built = await buildSet(set, prompts, { lastModified, current }); + const product = current('prism/product.json'); + if (product) Object.assign(built.files, productUi(set, prompts, JSON.parse(product))); if (rest.includes('--check')) { const stale = [...Object.entries(built.files).filter(([path, text]) => current(path) !== text).map(([path]) => path), ...built.remove.filter((path) => current(path) !== undefined)]; for (const path of stale) console.error(`stale: ${path}`); diff --git a/builder/ui.mjs b/builder/ui.mjs new file mode 100644 index 0000000..b979e52 --- /dev/null +++ b/builder/ui.mjs @@ -0,0 +1,38 @@ +/** + * The product page of a prompt set: `site/product/index.html`, written from the + * set, its prompts and the product record (`prism/product.json`), and the lock + * that binds it, `prism/builder.lock`. The page decides nothing: every answer is + * the verified holo's, run in the reader's browser after its archive identities + * verify and its acceptance vectors replay. The page loads the holo and the + * prism-code runtime the Pages workflow publishes beside it. + */ +import { createHash } from 'node:crypto'; +import { readFileSync } from 'node:fs'; + +const PAGE = readFileSync(new URL('./ui/product.html', import.meta.url), 'utf8'); +const LOADER = `import { parseArchive, resolveArchive, asBytes } from "../vendor/prism-code/src/archive.mjs"; +import { compileGuest, runGuest, runAcceptance } from "../vendor/prism-code/src/core.mjs"; +import { blake3Hex } from "../vendor/prism-code/src/blake3.mjs"; +async function openHolo() { + const resolved = resolveArchive(parseArchive(new Uint8Array(await (await fetch("../app.holo")).arrayBuffer()))); + const a = resolved.modelDocument.application; + const module = await compileGuest(resolved.guest.content); + const limits = { request: a.request_maximum, response: a.response_maximum, guestAllocation: a.guest_allocation_maximum }; + const vectors = (a.acceptance_vectors ?? []).map((v) => ({ request: Uint8Array.from(v.request), response: Uint8Array.from(v.response) })); + const dispatch = async (request) => runGuest(module, asBytes(request), limits); + return { identities: resolved.identities, vectors, dispatch, acceptance: () => runAcceptance(vectors, dispatch) }; +}`; + +export function productUi(set, prompts, product) { + const model = { set, prompts: Object.fromEntries(prompts.map((p) => [p.app.name, p])), product }; + const page = PAGE.replace('/*LOADER*/', () => LOADER) + .replace('/*MODEL*/', () => JSON.stringify(model).replace(/ ({ path, sha256: createHash('sha256').update(text).digest('hex') })), + }; + return { ...files, 'prism/builder.lock': `${JSON.stringify(lock, null, 2)}\n` }; +} diff --git a/builder/ui/product.html b/builder/ui/product.html new file mode 100644 index 0000000..0ddea1f --- /dev/null +++ b/builder/ui/product.html @@ -0,0 +1,552 @@ + + + + +{{TITLE}} + + + + + +
+
+
+
+ +
+
+ +
+
+
+
+ + From 13ac9a7b0055fe24f2b5bb3f72d0ea51a10e6a68 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 03:34:26 +0000 Subject: [PATCH 2/2] Product page: answer first, one design system, every view from its modelled UX Each view renders the product record's persona, jobs to be done, primary question (answered first, with only its inputs), journey stages and information architecture, whose disclosure levels decide what is open, summarised or closed. The CSS tokens come from the record's design system (type, spacing, radius, light and dark colour, WCAG 2.2 AA), and only its five components are drawn. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013Asa3Ns5C7CRWRVtEQBxEq --- builder/ui.mjs | 17 + builder/ui/product.html | 780 ++++++++++++++++------------------------ 2 files changed, 326 insertions(+), 471 deletions(-) diff --git a/builder/ui.mjs b/builder/ui.mjs index b979e52..e13d5af 100644 --- a/builder/ui.mjs +++ b/builder/ui.mjs @@ -23,9 +23,26 @@ async function openHolo() { return { identities: resolved.identities, vectors, dispatch, acceptance: () => runAcceptance(vectors, dispatch) }; }`; +/** The design system's tokens as CSS custom properties, light and dark, from `product.design`. */ +function tokens(d) { + const kebab = (k) => k.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`); + const colors = (c) => Object.entries(c).map(([k, v]) => `--${kebab(k)}: ${v};`).join(' '); + const fixed = [ + `--f-display: "${d.type.display}", system-ui, sans-serif; --f-body: "${d.type.body}", system-ui, sans-serif; --f-mono: "${d.type.mono}", ui-monospace, monospace;`, + Object.entries(d.type.scale).map(([k, v]) => `--t-${k}: ${v};`).join(' '), + Object.entries(d.space).map(([k, v]) => `--s-${k}: ${v};`).join(' '), + Object.entries(d.radius).map(([k, v]) => `--r-${k}: ${v};`).join(' '), + ].join('\n '); + return `/* Design system: ${d.accessibility.standard} ${d.accessibility.level}. Generated from prism/product.json. */ +:root {\n ${fixed}\n ${colors(d.color.light)} color-scheme: light;\n} +@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { ${colors(d.color.dark)} color-scheme: dark; } } +:root[data-theme="dark"] { ${colors(d.color.dark)} color-scheme: dark; }`; +} + export function productUi(set, prompts, product) { const model = { set, prompts: Object.fromEntries(prompts.map((p) => [p.app.name, p])), product }; const page = PAGE.replace('/*LOADER*/', () => LOADER) + .replace('/*TOKENS*/', () => tokens(product.design)) .replace('/*MODEL*/', () => JSON.stringify(model).replace(/ {{TITLE}} - - + -
+
-
- -
+ + Checking the seal… +
- +
-
-
-
+ +
+
+