Skip to content

Commit 7faec44

Browse files
start v9
1 parent cc7a763 commit 7faec44

9 files changed

Lines changed: 3967 additions & 396 deletions

File tree

ENGI_SPEC_V9.md

Lines changed: 702 additions & 0 deletions
Large diffs are not rendered by default.

engi-demo/SPEC_V9_IMPLEMENTATION_MATRIX.md

Lines changed: 582 additions & 0 deletions
Large diffs are not rendered by default.

engi-demo/public/app.js

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ function renderEvaluationVisual(item) {
535535
const verification = item.verification || {};
536536
const sufficiency = verification.verificationSufficiency || {};
537537
const rights = item.rights || {};
538-
const strongestSignals = item.ranking?.explainability?.strongestSignals || [];
538+
const strongestScoreDrivers = item.ranking?.explainability?.strongestScoreDrivers || [];
539539
const penalties = item.ranking?.rankingPenalties || [];
540540

541541
return `
@@ -551,7 +551,7 @@ function renderEvaluationVisual(item) {
551551
<span class="badge">score ${escapeHtml(item.ranking.finalRankingScore)}</span>
552552
</div>
553553
</div>
554-
<p>${escapeHtml((strongestSignals[0]?.label || 'Top signal') + (strongestSignals[0] ? `: ${strongestSignals[0].value}` : ''))}</p>
554+
<p>${escapeHtml((strongestScoreDrivers[0]?.label || 'Top driver') + (strongestScoreDrivers[0] ? `: ${strongestScoreDrivers[0].value}` : ''))}</p>
555555
</div>
556556
<div class="mini-grid four-up compact-metrics">
557557
${metricTile('Need match', scoreBar(item.ranking.needMatch.finalScore), 'metric', { html: true })}
@@ -568,7 +568,7 @@ function renderEvaluationVisual(item) {
568568
${kvRow('Recall channels', formatList((item.recall?.fusion?.contributingChannels || []).map((entry) => entry.channelId || entry)), { html: true })}
569569
${kvRow('Artifact type', item.uploadSurface?.artifactType || item.artifactType || '—')}
570570
</div>
571-
<div class="badge-row">${strongestSignals.map((signal) => `<span class="badge">${escapeHtml(signal.label)} ${escapeHtml(signal.value)}</span>`).join(' ') || '<span class="meta">No strongest signals recorded.</span>'}</div>
571+
<div class="badge-row">${strongestScoreDrivers.map((signal) => `<span class="badge">${escapeHtml(signal.label)} ${escapeHtml(signal.value)}</span>`).join(' ') || '<span class="meta">No strongest score drivers recorded.</span>'}</div>
572572
</div>
573573
<div class="section-card">
574574
<div class="section-head"><h4>Verification + rights</h4><span class="badge">Use-tier gate</span></div>
@@ -613,6 +613,8 @@ function renderVerificationReportVisual(report) {
613613
${kvRow('Issuance verification', entry.issuanceVerification?.status || entry.issuanceVerification?.testsPassed || 'see raw')}
614614
${kvRow('Provenance verification', entry.provenanceVerification?.status || 'see raw')}
615615
${kvRow('Recommended use tier', statusBadge(entry.verificationSufficiency?.recommendedUseTier), { html: true })}
616+
${kvRow('Verification receipts', formatCount((entry.receiptRefs || []).length, 'receipt'))}
617+
${kvRow('Policy tier cap', statusBadge(entry.policyRestrictions?.policyTierCap || entry.issuerPolicyStatus?.policyTierCap), { html: true })}
616618
${kvRow('Settlement allowed', boolBadge(entry.rights?.settlementAllowed, 'Allowed', 'Blocked'), { html: true })}
617619
</div>
618620
<div class="badge-row">${chipList(entry.verificationSufficiency?.reasons || [], 'warn')}</div>
@@ -1080,12 +1082,12 @@ function renderScenario(state) {
10801082
</div>
10811083
</div>
10821084
<p>${escapeHtml(source.task || source.taskSeed || '')}</p>
1083-
<p class="meta">V8 keeps the visual read first, but now also makes profile composition, recall-channel hand-offs, and GitHub/Profile-B boundaries explicit without hiding raw JSON.</p>
1085+
<p class="meta">V9 keeps the visual read first, but now also proves prompt completeness, static measurement receipts, and projection enforcement without hiding the buyer-safe JSON view.</p>
10841086
</div>
10851087
${renderJsonSurface({
10861088
title: latestNeed ? 'Measured need' : 'Seed need scenario',
10871089
subtitle: 'Need / measurement / benchmark target surface',
1088-
eyebrow: 'V8 artifact',
1090+
eyebrow: 'V9 artifact',
10891091
help: 'Visual groups the GitHub-bound need into task, parser, failure-mode, and derivation sections. Raw shows the exact pretty-printed object.',
10901092
data: source,
10911093
visual: renderNeedVisual,
@@ -1094,7 +1096,7 @@ function renderScenario(state) {
10941096
${renderJsonSurface({
10951097
title: 'Profile composition + demo semantics',
10961098
subtitle: 'Why Profile A is live here and Profile B is not switchable in-demo',
1097-
eyebrow: 'V8 artifact',
1099+
eyebrow: 'V9 artifact',
10981100
help: 'Profile A is implemented locally in this repo. Profile B is specified as an external boundary and intentionally not faked.',
10991101
data: state.profileCompositions || state.conformanceProfiles?.profileCompositions || {},
11001102
visual: renderProfileCompositionVisual,
@@ -1104,7 +1106,7 @@ function renderScenario(state) {
11041106
title: 'Prompt surfaces + lineage',
11051107
subtitle: 'Templates, interpolated context, and downstream derivation bindings',
11061108
eyebrow: 'Prompt artifact',
1107-
help: 'V8 makes prompts first-class: the operator can inspect the template, the exact interpolated context, and which artifacts consume each output.',
1109+
help: 'V9 keeps prompts first-class and now adds explicit completeness proofing, contract hashes, and downstream artifact bindings.',
11081110
data: source.promptSurfaces,
11091111
visual: renderPromptSurfaceCollectionVisual,
11101112
accent: 'accent-purple'
@@ -1153,7 +1155,7 @@ function renderEvaluations(state) {
11531155
${verificationReport ? renderJsonSurface({
11541156
title: 'Verification report',
11551157
subtitle: 'Ranking is separate from verification and rights propagation',
1156-
eyebrow: 'V8 artifact',
1158+
eyebrow: 'V9 artifact',
11571159
help: 'Visual mode emphasizes allowed downstream use rather than making you read a wall of nested booleans.',
11581160
data: verificationReport,
11591161
visual: renderVerificationReportVisual,
@@ -1251,6 +1253,38 @@ function renderBranchArtifacts(state) {
12511253
visual: renderPromptSurfaceCollectionVisual,
12521254
accent: 'accent-purple'
12531255
},
1256+
{
1257+
title: 'Code analysis fact registry',
1258+
subtitle: '.engi/code-analysis-fact-registry.json',
1259+
data: run.codeAnalysisFactRegistry,
1260+
raw: branchFiles['.engi/code-analysis-fact-registry.json'],
1261+
visual: surfaceVisualFallback,
1262+
accent: 'accent-blue'
1263+
},
1264+
{
1265+
title: 'Verification receipts',
1266+
subtitle: '.engi/verification-receipts.json',
1267+
data: run.verificationReceipts,
1268+
raw: branchFiles['.engi/verification-receipts.json'],
1269+
visual: surfaceVisualFallback,
1270+
accent: 'accent-orange'
1271+
},
1272+
{
1273+
title: 'Static measurement proof',
1274+
subtitle: '.engi/static-measurement-proof.json',
1275+
data: run.staticMeasurementProof,
1276+
raw: branchFiles['.engi/static-measurement-proof.json'],
1277+
visual: surfaceVisualFallback,
1278+
accent: 'accent-purple'
1279+
},
1280+
{
1281+
title: 'Proof witness manifest',
1282+
subtitle: '.engi/proof-witness-manifest.json',
1283+
data: run.proofWitnessManifest,
1284+
raw: branchFiles['.engi/proof-witness-manifest.json'],
1285+
visual: surfaceVisualFallback,
1286+
accent: 'accent-purple'
1287+
},
12541288
{
12551289
title: 'External boundary manifest',
12561290
subtitle: '.engi/external-boundary-manifest.json',
@@ -1308,7 +1342,7 @@ function renderBranchArtifacts(state) {
13081342
<span class="badge private">${escapeHtml(run.branchArtifacts.confidentiality)}</span>
13091343
</div>
13101344
</div>
1311-
<p class="meta">This is the artifact-heavy heart of the V8 demo. Identity/signer, GitHub boundary, artifact-upload, policy, and settlement surfaces are now deliberately separated for legibility.</p>
1345+
<p class="meta">This is the artifact-heavy heart of the V9 demo. The buyer projection can inspect rich private-safe artifacts, but raw source material and unrestricted branch files remain withheld by projection policy.</p>
13121346
</div>
13131347
${artifactDefs.map((artifact) => renderJsonSurface({
13141348
title: artifact.title,
@@ -1411,7 +1445,7 @@ function renderLedger(state) {
14111445

14121446
async function refresh() {
14131447
surfaceCounter = 0;
1414-
const state = await api('/api/state');
1448+
const state = await api('/api/state?principal=buyer');
14151449
renderSummary(state);
14161450
renderScenario(state);
14171451
renderAssets(state);
@@ -1440,9 +1474,9 @@ document.addEventListener('click', (event) => {
14401474
document.getElementById('makeBranchButton').addEventListener('click', async () => {
14411475
try {
14421476
setStatus('Measuring need, ranking candidates, staging branch artifacts, and settling journal diff…');
1443-
const result = await api('/api/make-engi-branch', { method: 'POST', body: '{}' });
1477+
const result = await api('/api/make-engi-branch', { method: 'POST', body: JSON.stringify({ principal: 'buyer' }) });
14441478
await refresh();
1445-
setStatus(`Created ${result.latestRun.branchArtifacts.branchName} and settled bundle ${result.latestRun.journalDiff.bundleId}.`);
1479+
setStatus(`Created ${result.latestRun.branchName || result.latestRun.branchArtifacts?.branchName} and settled bundle ${result.latestRun.boundedPublicProof?.bundleId || result.latestRun.journalDiff?.bundleId}.`);
14461480
} catch (error) {
14471481
setStatus(error.message);
14481482
}
@@ -1452,7 +1486,7 @@ document.getElementById('resetButton').addEventListener('click', async () => {
14521486
try {
14531487
await api('/api/reset', { method: 'POST', body: '{}' });
14541488
await refresh();
1455-
setStatus('Demo reset to seeded Spec V8 scenario.');
1489+
setStatus('Demo reset to seeded Spec V9 scenario.');
14561490
} catch (error) {
14571491
setStatus(error.message);
14581492
}
@@ -1487,7 +1521,7 @@ document.getElementById('depositForm').addEventListener('submit', async (event)
14871521
});
14881522

14891523
refresh().then(() => {
1490-
setStatus('Ready. Run “Make ENGI branch” to execute the full Spec V8 prototype flow. Artifact surfaces default to Visual mode and can flip to Raw JSON at any time.');
1524+
setStatus('Ready. Run “Make ENGI branch” to execute the full Spec V9 closure flow. Artifact surfaces default to Visual mode and can flip to Raw JSON at any time.');
14911525
}).catch((error) => {
14921526
document.body.innerHTML = `<pre>${escapeHtml(error.message)}</pre>`;
14931527
});

engi-demo/public/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>ENGI Demo — Spec V8</title>
6+
<title>ENGI Demo — Spec V9</title>
77
<link rel="stylesheet" href="/styles.css" />
88
</head>
99
<body>
1010
<div class="page">
1111
<header class="hero">
1212
<p class="eyebrow">ENGI deterministic local prototype</p>
1313
<h1>Make ENGI branch from GitHub benchmark evidence.</h1>
14-
<p class="lede">This prototype now follows the finalized Spec V8 story: recall channels and signal hand-offs are explicit, prompt templates and prompt lineage are first-class, proof closure and theorem checks are inspectable, candidate assets are ranked and verified with clearer score-group explainability, and the branch artifacts separate Profile A’s real local implementation from Profile B’s concrete but external GitHub/App, model, vector, signer, and settlement boundaries.</p>
14+
<p class="lede">This prototype now follows the Spec V9 closure pass: recall channels and signal hand-offs remain explicit, prompt templates now carry completeness contracts, static local measurement stages emit receipts, bounded public proof is materialized as its own artifact, and branch/API projections enforce disclosure policy instead of exposing raw run internals by convention.</p>
1515
<div class="hero-actions">
1616
<button id="makeBranchButton">Make ENGI branch</button>
1717
<button id="resetButton" class="ghost">Reset demo</button>

engi-demo/server.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ export function createAppContext({
107107

108108
async function handle(req, res) {
109109
try {
110-
if (req.method === 'GET' && req.url === '/api/state') {
111-
return sendJson(res, 200, buildPublicState(readState()));
110+
if (req.method === 'GET' && req.url?.startsWith('/api/state')) {
111+
const url = new URL(req.url, 'http://127.0.0.1');
112+
const principal = url.searchParams.get('principal') || undefined;
113+
return sendJson(res, 200, buildPublicState(readState(), principal));
112114
}
113115

114116
if (req.method === 'POST' && req.url === '/api/deposits') {
@@ -156,10 +158,11 @@ export function createAppContext({
156158
branchMode: body.branchMode
157159
});
158160
writeState(nextState);
161+
const principal = body.principal || undefined;
159162
return sendJson(res, 200, {
160163
ok: true,
161164
specVersion: SPEC_VERSION,
162-
latestRun,
165+
latestRun: buildPublicState({ ...nextState, latestRun }, principal).latestRun,
163166
ledger: nextState.ledger,
164167
runHistory: nextState.runHistory
165168
});

0 commit comments

Comments
 (0)