solsticestudioai's picture
Add launch reviewer CTAs
39e9e3c verified
Raw
History Blame Contribute Delete
5.73 kB
(function(){
const launchLinks=window.MNEMOSYNE_LAUNCH_LINKS||{};
const labels={collection_url:'View the Solstice Agent Reliability Lab',dataset_url:'Open benchmark dataset',space_repository_url:'Space repository',direct_space_url:'Open direct application',show_and_tell_url:'Show and Tell',community_call_url:'Community Calls',technical_feedback_url:'Technical feedback'};
const nav=document.querySelector('#launch-links');
if(nav) nav.innerHTML='<b>Review the project</b> <span class="muted">Run a scenario or compare your memory system locally.</span> '+Object.entries(labels).filter(([key])=>launchLinks[key]).map(([key,label])=>`<a href="${launchLinks[key]}" target="_blank" rel="noreferrer">${label}</a>`).join(' 路 ');
const scenarios=window.MNEMOSYNE_SCENARIOS;
const scenarioEl=document.querySelector('#scenario');
const strategyEl=document.querySelector('#strategy');
let externalResult=null;
for(const s of scenarios){const o=document.createElement('option');o.value=s.scenario_id;o.textContent=s.title;scenarioEl.append(o)}
for(const s of MnemosyneCore.strategies){const o=document.createElement('option');o.value=s;o.textContent=s;strategyEl.append(o)}
scenarioEl.value='mnemo-belief_revision-01';
function render(){
const s=scenarios.find(x=>x.scenario_id===scenarioEl.value)||scenarios[0];
const r=MnemosyneCore.run(strategyEl.value,s);
document.querySelector('#validity').innerHTML=`<b>Validity view</b><p class="muted">Revision ${MNEMOSYNE_VALIDITY.revision}${MNEMOSYNE_VALIDITY.scenarios} scenarios 路 ${MNEMOSYNE_VALIDITY.categories} categories 路 ${MNEMOSYNE_VALIDITY.strategies} strategies 路 ${MNEMOSYNE_VALIDITY.nonDiscriminating} scenarios currently tied. Metrics use explicit denominators and may be not_applicable.</p><p>Metric groups: current-belief accuracy 路 historical reconstruction 路 lifecycle correctness 路 privacy and promotion 路 temporal validity 路 duplicate evidence 路 authority resolution 路 erasure and revocation.</p>`;
document.querySelector('#summary').innerHTML=`<strong>${s.title}</strong><p class="muted">${s.description} Query time: ${s.query_time}</p><p>Expected current answer: <b>${s.expected_current_answer}</b></p>`;
document.querySelector('#timeline').innerHTML=s.observations.map(o=>`<div class="event"><b>${o.observation_id}</b> 路 ${o.timestamp}<br>${o.content}<br><span class="muted">authority ${o.authority} 路 evidence family ${o.evidence_family_id}</span></div>`).join('');
document.querySelector('#output').innerHTML=`<p><b>${r.strategy}</b></p><p>Current answer: ${r.current||'none'}</p><p>Active records: ${r.records.filter(x=>x.status==='active').length} 路 Superseded: ${r.superseded.length}</p><p>Evidence families counted: ${r.evidence.join(', ')}</p>`;
document.querySelector('#comparison').innerHTML='<table><tr><th>Strategy</th><th>Current answer</th><th>Superseded</th></tr>'+MnemosyneCore.strategies.map(x=>{const q=MnemosyneCore.run(x,s);return `<tr><td>${x}</td><td>${q.current||'none'}</td><td>${q.superseded.length}</td></tr>`}).join('')+'</table>';
document.querySelector('#external').innerHTML=externalResult ? `<b>External strategy: ${externalResult.strategy_manifest?.display_name||externalResult.strategy?.display_name||'manual_unverified'}</b><p class="muted">${externalResult.tooling_version?'Bundle validated locally.':'manual_unverified result.'} Benchmark: ${externalResult.benchmark_version||'unknown'} 脗路 Fixture: ${externalResult.fixture_hash||'unknown'}</p><p>Current metric: ${externalResult.aggregate_metrics?.current_belief_accuracy ?? 'not_applicable'} 脗路 Historical: ${externalResult.aggregate_metrics?.historical_reconstruction_accuracy ?? 'not_applicable'}</p><button id="remove-external">Remove external result</button>` : '<b>External strategy</b><p class="muted">No external result loaded. Bundles are validated and compared locally; nothing is uploaded or persisted.</p>';
const remove=document.querySelector('#remove-external'); if(remove) remove.onclick=()=>{externalResult=null; render()};
}
document.querySelector('#download').onclick=()=>{
const s=scenarios.find(x=>x.scenario_id===scenarioEl.value)||scenarios[0];
const result={benchmark_version:MNEMOSYNE_VALIDITY.revision,scenario_id:s.scenario_id,strategy:strategyEl.value,output:MnemosyneCore.run(strategyEl.value,s)};
const a=document.createElement('a');a.href=URL.createObjectURL(new Blob([JSON.stringify(result,null,2)],{type:'application/json'}));a.download=`mnemosyne-${s.scenario_id}-${strategyEl.value}.json`;a.click();URL.revokeObjectURL(a.href);
};
document.querySelector('#demo').onclick=()=>{scenarioEl.value='mnemo-belief_revision-01';strategyEl.value='typed_lifecycle_lineage';render()};
scenarioEl.onchange=render; strategyEl.onchange=render;
document.querySelector('#file').onchange=e=>{const f=e.target.files[0];if(!f)return;const reader=new FileReader();reader.onload=()=>{try{const data=JSON.parse(reader.result);if(data.scenario_id){scenarios.push(data);scenarioEl.value=data.scenario_id;render()}}catch{alert('Invalid local scenario')}};reader.readAsText(f)};
document.querySelector('#external-file').onchange=e=>{const f=e.target.files[0];if(!f)return;const reader=new FileReader();reader.onload=()=>{try{const data=JSON.parse(reader.result);const valid=(data.bundle_version==='mnemosyne-external-strategy-bundle/v1'&&data.benchmark_version==='v0.2.0'&&Array.isArray(data.scenario_level_outcomes))||(data.format_version==='mnemosyne-manual-result/v1'&&Array.isArray(data.results));if(!valid)throw new Error('invalid external result');externalResult=data;render()}catch{alert('Invalid external result bundle')}};reader.readAsText(f)};
render();
})();