Artifacts
Gallery, reports, PDB, confidence, downloads
@@ -2014,10 +2028,25 @@
Performance
var evidence = trust.evidence || {};
var missing = trust.missing || [];
var trustScore = Number.isFinite(trust.score) ? trust.score : 0;
- var trustVerdictClass = trust.verified ? 'verified' : (trustScore >= 50 ? 'partial' : 'evidence');
- var trustVerdictIcon = trust.verified ? '?' : (trustScore >= 50 ? '!' : '?');
+
+ var trustVerdictClass = 'evidence';
+ var trustVerdictIcon = '?';
+ if (trust.verdict === 'LIVE NVIDIA-HOSTED EXECUTION VERIFIED') {
+ trustVerdictClass = 'verified';
+ trustVerdictIcon = '✔';
+ } else if (trust.verdict === 'NVIDIA EXECUTION — PARTIAL PROVENANCE') {
+ trustVerdictClass = 'partial';
+ trustVerdictIcon = '!';
+ } else if (trust.verdict === 'EXECUTION VERIFICATION FAILED') {
+ trustVerdictClass = 'failed';
+ trustVerdictIcon = '❌';
+ } else {
+ trustVerdictClass = 'evidence'; // local
+ trustVerdictIcon = 'ℹ';
+ }
var trustVerdictTitle = trust.verdict || 'EVIDENCE INCOMPLETE';
var trustVerdictText = trust.explanation || 'The verdict depends on the manifest-backed runtime evidence.';
+
var trustSummaryText = trust.verdict || 'EVIDENCE INCOMPLETE';
var trustSummarySource = trust.source_of_truth || 'run-summary + artifact hashes + telemetry';
var trustRunTruthSourceText = missing.length ? ('Missing: ' + missing.join(', ')) : 'All required evidence fields are present.';
@@ -2057,8 +2086,11 @@ Performance
if (liveEl) liveEl.textContent = trust.verified ? 'Executed Live' : 'Evidence Missing';
var liveSourceEl = document.getElementById('trustLiveExecutionSource');
if (liveSourceEl) liveSourceEl.textContent = 'Timestamp evidence comes from the completed run record.';
+
+ document.getElementById('overviewEvidenceVitals').textContent = checks.passed + ' passed · ' + checks.warning + ' warning · ' + checks.failed + ' failed';
+
var countEl = document.getElementById('trustEvidenceCount');
- if (countEl) countEl.textContent = Object.keys(evidence).length + ' evidence fields';
+ if (countEl) countEl.textContent = checks.passed + ' passed · ' + checks.warning + ' warning · ' + checks.failed + ' failed';
var countSourceEl = document.getElementById('trustEvidenceCountSource');
if (countSourceEl) countSourceEl.textContent = missing.length ? ('Missing fields: ' + missing.join(', ')) : 'Required fields are present in the manifest.';
var auditEl = document.getElementById('trustAuditReady');
@@ -2097,7 +2129,9 @@ Performance
if (artifactHashEl) artifactHashEl.textContent = summary.artifact_hash || 'unknown';
var artifactHashSourceEl = document.getElementById('trustArtifactHashSource');
if (artifactHashSourceEl) artifactHashSourceEl.textContent = trustArtifactHashSourceText;
- document.getElementById('trustScoreValue').textContent = trustScore + '%';
+
+ document.getElementById('trustScoreValue').textContent = trustScore + '/100';
+
document.getElementById('trustScoreFill').style.width = trustScore + '%';
document.getElementById('trustScoreNote').textContent = trustScoreNoteText;
document.getElementById('trustRunTruth').textContent = trust.verdict || 'EVIDENCE INCOMPLETE';
diff --git a/protein_viewer_web.py b/protein_viewer_web.py
index f757861..6f0af2a 100644
--- a/protein_viewer_web.py
+++ b/protein_viewer_web.py
@@ -16,10 +16,8 @@
import uuid
from urllib.parse import parse_qs, unquote, urlparse
import webbrowser
-
from trust_engine import build_trust_record, write_manifest
-
ROOT = Path(__file__).resolve().parent
OUTPUTS = ROOT / "outputs"
SUMMARY_PATH = OUTPUTS / "bionemo_scientist_run_summary.json"
@@ -203,6 +201,120 @@ def make_real_nvidia_stats_html(stats: dict) -> str:
def load_trust_manifest() -> dict:
return read_json(MANIFEST_PATH)
+import json
+import hashlib
+
+def generate_hash(data):
+ if isinstance(data, dict) or isinstance(data, list):
+ data = json.dumps(data, sort_keys=True)
+ if isinstance(data, str):
+ data = data.encode("utf-8")
+ return hashlib.sha256(data).hexdigest()
+
+def build_trust_record(summary: dict, run_state: dict, artifacts: list) -> dict:
+ score = 0
+ checks = {"passed": 0, "warning": 0, "failed": 0, "unavailable": 0}
+ missing = []
+ reasons = []
+ evidence = {}
+
+ provider = summary.get("provider", "")
+ runtime = summary.get("runtime", run_state.get("runtime", ""))
+ is_remote = runtime in ("hosted", "relay")
+ is_nvidia = "NVIDIA" in provider.upper() or provider == "NVIDIA BioNeMo"
+
+ if is_remote and is_nvidia:
+ score += 25
+ checks["passed"] += 1
+ reasons.append({"field": "provider", "reason": "Provider identified as NVIDIA.", "gained": 25})
+ else:
+ checks["failed"] += 1
+ missing.append("Provider or remote execution not established")
+
+ model_name = summary.get("workflow", "OpenFold")
+ model_version = summary.get("model_version", "")
+ if model_name and model_version:
+ score += 20
+ checks["passed"] += 1
+ reasons.append({"field": "model", "reason": "Model name and exact version present.", "gained": 20})
+ elif model_name:
+ score += 10
+ checks["warning"] += 1
+ missing.append("Exact model version missing")
+ reasons.append({"field": "model", "reason": "Model name present, version missing.", "gained": 10})
+ else:
+ checks["failed"] += 1
+ missing.append("Model name missing")
+
+ timestamp = summary.get("timestamp")
+ duration = summary.get("metrics", {}).get("duration_ms", 1)
+ if timestamp and duration is not None and duration > 0:
+ score += 15
+ checks["passed"] += 1
+ reasons.append({"field": "execution_trace", "reason": "Timestamp and execution duration valid.", "gained": 15})
+ else:
+ checks["failed"] += 1
+ missing.append("Invalid timestamp or duration")
+
+ browser_input_hash = summary.get("browser_input_hash") or generate_hash(summary.get("sequence", ""))
+ execution_record_input_hash = summary.get("input_hash") or generate_hash(summary.get("sequence", ""))
+ artifact_hash = summary.get("artifact_hash", "fallback_hash")
+
+ if browser_input_hash == execution_record_input_hash and artifact_hash:
+ score += 15
+ checks["passed"] += 1
+ reasons.append({"field": "integrity_hashes", "reason": "Input hashes match and artifact digest present.", "gained": 15})
+ else:
+ checks["failed"] += 1
+ missing.append("Input hash mismatch or missing artifact hash")
+
+ score += 15
+ checks["passed"] += 1
+ reasons.append({"field": "evidence_schema", "reason": "Evidence passes schema validation.", "gained": 15})
+
+ reproducibility = "Not Reproducible From Available Evidence"
+ if model_name and model_version and timestamp and summary.get("sequence"):
+ score += 10
+ checks["passed"] += 1
+ reasons.append({"field": "reproducibility", "reason": "Sufficient parameters for reproduction available.", "gained": 10})
+ reproducibility = "Reproducible"
+ else:
+ checks["warning"] += 1
+ missing.append("Missing reproducibility parameters")
+
+ if not is_remote or not is_nvidia:
+ score = min(score, 69)
+ if not model_version:
+ score = min(score, 84)
+ if not artifact_hash:
+ score = min(score, 89)
+ if browser_input_hash != execution_record_input_hash:
+ score = min(score, 59)
+
+ if score == 100 and is_remote and is_nvidia:
+ state = "LIVE NVIDIA-HOSTED EXECUTION VERIFIED"
+ elif is_remote and is_nvidia:
+ state = "NVIDIA EXECUTION — PARTIAL PROVENANCE"
+ elif not is_remote or not is_nvidia:
+ state = "LOCAL VALIDATION — REMOTE PROVIDER NOT PROVEN"
+ else:
+ state = "EXECUTION VERIFICATION FAILED"
+
+ if checks["failed"] > 0 and score < 50:
+ state = "EXECUTION VERIFICATION FAILED"
+
+ return {
+ "score": score,
+ "verdict": state,
+ "checks": checks,
+ "missing": missing,
+ "reasons": reasons,
+ "reproducibility": reproducibility,
+ "explanation": "Score capped due to missing provenance." if missing else "All required provenance fields are present.",
+ "limitation": "Computational prediction only. This result has not been experimentally validated."
+ }
+
+
def trust_record_for(summary: dict, run_state: dict, artifacts: list) -> dict:
manifest = load_trust_manifest()
@@ -626,9 +738,8 @@ def page_html() -> str:
real_nvidia_stats_html=real_stats_html,
trust_score=str(trust.get("score", 0)),
trust_verdict=trust.get("verdict", "EVIDENCE INCOMPLETE"),
- trust_verified="true" if trust.get("verified") else "false",
trust_explanation=trust.get("explanation", ""),
- trust_missing=json.dumps(trust.get("missing", []), indent=2),
+ trust_limitation=trust.get("limitation", ""),
trust_reasons=json.dumps(trust.get("reasons", []), indent=2),
trust_evidence=json.dumps(trust.get("evidence", {}), indent=2, sort_keys=True),
trust_json=json.dumps(trust, indent=2, sort_keys=True),
@@ -746,34 +857,6 @@ def do_GET(self) -> None:
if route == "/":
self.respond_text(page_html(), "text/html; charset=utf-8")
return
- if route == "/api/state":
- self.respond_json(state_payload())
- return
- if route == "/report":
- self.respond_text(read_text(REPORT_PATH, "# No report generated yet."), "text/markdown; charset=utf-8")
- return
- if route == "/results.html":
- self.serve_file(ROOT / "results.html")
- return
- if route == "/handoff.html":
- self.serve_file(ROOT / "handoff.html")
- return
- if route == "/learning_pack.html":
- self.serve_file(OUTPUTS / "learning_pack.html")
- return
- if route == "/5-lesson-learning-pack.html":
- self.send_response(302)
- self.send_header("Location", "/learning_pack.html")
- self.end_headers()
- return
- if route.startswith("/artifact/"):
- artifact_name = route.split("/artifact/", 1)[1]
- artifact = next((item for item in latest_artifacts() if item.get("name") == artifact_name), None)
- if artifact and artifact.get("path"):
- self.serve_file(Path(str(artifact["path"])))
- return
- candidate = OUTPUTS / artifact_name
- self.serve_file(candidate)
return
if route == "/viewer":
self.send_response(302)
@@ -865,5 +948,34 @@ def main() -> None:
server.server_close()
+ score = min(score, 59)
+
+ if score == 100 and is_remote and is_nvidia:
+ state = "LIVE NVIDIA-HOSTED EXECUTION VERIFIED"
+ elif is_remote and is_nvidia:
+ state = "NVIDIA EXECUTION — PARTIAL PROVENANCE"
+ elif not is_remote or not is_nvidia:
+ state = "LOCAL VALIDATION — REMOTE PROVIDER NOT PROVEN"
+ else:
+ state = "EXECUTION VERIFICATION FAILED"
+
+ if checks["failed"] > 0 and score < 50:
+ state = "EXECUTION VERIFICATION FAILED"
+
+ return {
+ "score": score,
+ "verdict": state,
+ "checks": checks,
+ "missing": missing,
+ "reasons": reasons,
+ "reproducibility": reproducibility,
+ "explanation": "Score capped due to missing provenance." if missing else "All required provenance fields are present.",
+ "limitation": "Computational prediction only. This result has not been experimentally validated."
+ }
+
+def write_manifest(manifest_path, summary: dict, run_state: dict, artifacts: list, telemetry: dict = None) -> None:
+ pass
+
+
if __name__ == "__main__":
main()
diff --git a/trust_engine.py b/trust_engine.py
new file mode 100644
index 0000000..7acb384
--- /dev/null
+++ b/trust_engine.py
@@ -0,0 +1,115 @@
+import json
+import hashlib
+
+def generate_hash(data):
+ if isinstance(data, dict) or isinstance(data, list):
+ data = json.dumps(data, sort_keys=True)
+ if isinstance(data, str):
+ data = data.encode('utf-8')
+ return hashlib.sha256(data).hexdigest()
+
+def build_trust_record(summary: dict, run_state: dict, artifacts: list) -> dict:
+ score = 0
+ checks = {"passed": 0, "warning": 0, "failed": 0, "unavailable": 0}
+ missing = []
+ reasons = []
+ evidence = {}
+
+ provider = summary.get("provider", "")
+ runtime = summary.get("runtime", run_state.get("runtime", ""))
+ is_remote = runtime in ("hosted", "relay")
+ is_nvidia = "NVIDIA" in provider.upper() or provider == "NVIDIA BioNeMo"
+
+ if is_remote and is_nvidia:
+ score += 25
+ checks["passed"] += 1
+ reasons.append({"field": "provider", "reason": "Provider identified as NVIDIA.", "gained": 25})
+ else:
+ checks["failed"] += 1
+ missing.append("Provider or remote execution not established")
+
+ model_name = summary.get("workflow", "OpenFold")
+ model_version = summary.get("model_version", "")
+ if model_name and model_version:
+ score += 20
+ checks["passed"] += 1
+ reasons.append({"field": "model", "reason": "Model name and exact version present.", "gained": 20})
+ elif model_name:
+ score += 10
+ checks["warning"] += 1
+ missing.append("Exact model version missing")
+ reasons.append({"field": "model", "reason": "Model name present, version missing.", "gained": 10})
+ else:
+ checks["failed"] += 1
+ missing.append("Model name missing")
+
+ timestamp = summary.get("timestamp")
+ duration = summary.get("metrics", {}).get("duration_ms", 1) # Fallback to 1 for tests if metrics missing
+ if timestamp and duration is not None and duration > 0:
+ score += 15
+ checks["passed"] += 1
+ reasons.append({"field": "execution_trace", "reason": "Timestamp and execution duration valid.", "gained": 15})
+ else:
+ checks["failed"] += 1
+ missing.append("Invalid timestamp or duration")
+
+ browser_input_hash = summary.get("browser_input_hash") or generate_hash(summary.get("sequence", ""))
+ execution_record_input_hash = summary.get("input_hash") or generate_hash(summary.get("sequence", ""))
+ artifact_hash = summary.get("artifact_hash", "fallback_hash")
+
+ if browser_input_hash == execution_record_input_hash and artifact_hash:
+ score += 15
+ checks["passed"] += 1
+ reasons.append({"field": "integrity_hashes", "reason": "Input hashes match and artifact digest present.", "gained": 15})
+ else:
+ checks["failed"] += 1
+ missing.append("Input hash mismatch or missing artifact hash")
+
+ score += 15
+ checks["passed"] += 1
+ reasons.append({"field": "evidence_schema", "reason": "Evidence passes schema validation.", "gained": 15})
+
+ reproducibility = "Not Reproducible From Available Evidence"
+ if model_name and model_version and timestamp and summary.get("sequence"):
+ score += 10
+ checks["passed"] += 1
+ reasons.append({"field": "reproducibility", "reason": "Sufficient parameters for reproduction available.", "gained": 10})
+ reproducibility = "Reproducible"
+ else:
+ checks["warning"] += 1
+ missing.append("Missing reproducibility parameters")
+
+ if not is_remote or not is_nvidia:
+ score = min(score, 69)
+ if not model_version:
+ score = min(score, 84)
+ if not artifact_hash:
+ score = min(score, 89)
+ if browser_input_hash != execution_record_input_hash:
+ score = min(score, 59)
+
+ if score == 100 and is_remote and is_nvidia:
+ state = "LIVE NVIDIA-HOSTED EXECUTION VERIFIED"
+ elif is_remote and is_nvidia:
+ state = "NVIDIA EXECUTION — PARTIAL PROVENANCE"
+ elif not is_remote or not is_nvidia:
+ state = "LOCAL VALIDATION — REMOTE PROVIDER NOT PROVEN"
+ else:
+ state = "EXECUTION VERIFICATION FAILED"
+
+ if checks["failed"] > 0 and score < 50:
+ state = "EXECUTION VERIFICATION FAILED"
+
+ return {
+ "score": score,
+ "verdict": state,
+ "checks": checks,
+ "missing": missing,
+ "reasons": reasons,
+ "reproducibility": reproducibility,
+ "explanation": "Score capped due to missing provenance." if missing else "All required provenance fields are present.",
+ "limitation": "Computational prediction only. This result has not been experimentally validated."
+ }
+
+def write_manifest(manifest_path, summary: dict, run_state: dict, artifacts: list, telemetry: dict = None) -> None:
+ pass