From 71e58c60b103f9bce7f83027315662a662435193 Mon Sep 17 00:00:00 2001 From: abhinandanjoshii <113920019+abhinandanjoshii@users.noreply.github.com> Date: Thu, 10 Sep 2026 23:27:58 +0530 Subject: [PATCH 1/2] feat: add copyable no-progress trace Add an illustrative no-progress trace with a copy control and clear Shadow Mode / Earned Enforcement boundary. Closes #38 --- demos/killer-demo/demo.css | 39 ++++ demos/killer-demo/demo.js | 50 ++++- demos/killer-demo/index.html | 57 ++++++ plugins/marginal/runtime/marginal_runtime.pyz | Bin 743367 -> 750206 bytes plugins/marginal/runtime/provenance.json | 2 +- src/marginal/killer_demo.py | 191 +++++++++++++++++- tests/test_killer_demo_interactive.py | 80 ++++++++ 7 files changed, 416 insertions(+), 3 deletions(-) diff --git a/demos/killer-demo/demo.css b/demos/killer-demo/demo.css index 9661abf..ecf3e25 100644 --- a/demos/killer-demo/demo.css +++ b/demos/killer-demo/demo.css @@ -409,6 +409,45 @@ h1 { .proof-card h3 { margin: 0 0 8px; } .proof-card p, .proof-card li { color: var(--muted); font-size: 12px; line-height: 1.55; } .proof-card code { color: #dce6f0; font: 11px var(--mono); } +.pattern { margin: 0 0 42px; } +.snippet { + margin-top: 14px; + border: 1px solid #222d38; + border-radius: 12px; + background: #05080c; + overflow: hidden; +} +.snippet-head { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + gap: 12px; + padding: 10px 13px; + border-bottom: 1px solid #222d38; + color: var(--muted); + font: 800 9px var(--mono); + letter-spacing: .08em; +} +.snippet-copy { padding: 7px 12px; font-size: 9px; } +.snippet-body { + margin: 0; + max-height: 340px; + overflow: auto; + padding: 13px; + color: #9eabb7; + font: 11px/1.55 var(--mono); + white-space: pre; + scrollbar-width: thin; +} +.snippet-body:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; } +.snippet-status { + min-height: 15px; + margin: 0; + padding: 0 13px 11px; + color: var(--lime); + font: 10px var(--mono); +} .legacy-contract { display: none; } .footer { display: flex; diff --git a/demos/killer-demo/demo.js b/demos/killer-demo/demo.js index 70f827a..68ac824 100644 --- a/demos/killer-demo/demo.js +++ b/demos/killer-demo/demo.js @@ -43,6 +43,9 @@ stages: $$('[data-stage]'), baselineLane: $('[data-lane="baseline"]'), marginalLane: $('[data-lane="marginal"]'), + copyTrace: $('[data-action="copy-trace"]'), + trace: $("#no-progress-trace"), + copyStatus: $("#copy-status"), }; function metric(lane, name) { @@ -230,6 +233,51 @@ dom.pause.disabled = true; } + function announceCopy(message) { + if (dom.copyStatus) dom.copyStatus.textContent = message; + } + + function copyWithSelection(text) { + const restore = document.activeElement; + const holder = document.createElement("textarea"); + holder.value = text; + holder.setAttribute("readonly", ""); + holder.setAttribute("aria-hidden", "true"); + holder.style.position = "fixed"; + holder.style.top = "-1000px"; + holder.style.opacity = "0"; + document.body.appendChild(holder); + holder.select(); + let copied = false; + try { + copied = document.execCommand("copy"); + } catch (error) { + copied = false; + } + holder.remove(); + if (restore instanceof HTMLElement) restore.focus(); + return copied; + } + + function copyTrace() { + if (!dom.trace) return; + announceCopy(""); + const text = dom.trace.textContent || ""; + const copied = () => announceCopy("No-progress trace copied."); + const blocked = () => + announceCopy("Copy was blocked. Select the trace and copy it manually."); + if (navigator.clipboard && navigator.clipboard.writeText) { + navigator.clipboard.writeText(text).then(copied, () => { + if (copyWithSelection(text)) copied(); + else blocked(); + }); + return; + } + if (copyWithSelection(text)) copied(); + else blocked(); + } + + dom.copyTrace?.addEventListener("click", copyTrace); dom.run?.addEventListener("click", playRace); dom.pause?.addEventListener("click", pauseRace); dom.step?.addEventListener("click", () => { @@ -244,7 +292,7 @@ document.addEventListener("keydown", (event) => { const tag = document.activeElement?.tagName || ""; - if (["INPUT", "SELECT", "TEXTAREA", "BUTTON"].includes(tag)) return; + if (["INPUT", "SELECT", "TEXTAREA", "BUTTON", "PRE"].includes(tag)) return; if (event.code === "Space") { event.preventDefault(); state.playing ? pauseRace() : playRace(); diff --git a/demos/killer-demo/index.html b/demos/killer-demo/index.html index d156eff..6f02eb8 100644 --- a/demos/killer-demo/index.html +++ b/demos/killer-demo/index.html @@ -42,6 +42,7 @@ @@ -227,6 +228,62 @@

Deterministic replay. No fake telemetry.

+
+
+ QUOTABLE MECHANISM · ILLUSTRATIVE +

The no-progress pattern, in four lines.

+

+ Same semantic action, successful outcome, unchanged workspace state, no new evidence. + That is the sequence MARGINAL treats as a no-progress repetition candidate. The trace + below is replayed from the shipped control over a fixed synthetic observation + sequence, so it is an illustration of the mechanism and not provider telemetry, + a production run, or an enforcement benchmark. +

+
+
+ no-progress-trace.txt + +
+
# MARGINAL no-progress pattern
+# illustrative deterministic sequence, replayed from the shipped control
+# not provider telemetry, not an enforcement benchmark
+# threshold: max_same_evidence_completions=2
+
+t1  patch:apply      outcome=success  state=w#4f2a  evidence=e#91c0  ->  NO_PROGRESS_CLEAR
+      state or completion evidence changed
+t2  verify:targeted  outcome=success  state=w#8b13  evidence=e#2d77  ->  NO_PROGRESS_CLEAR
+      state or completion evidence changed
+t3  verify:targeted  outcome=success  state=w#8b13  evidence=e#2d77  ->  NO_PROGRESS_OBSERVED
+      unchanged completion evidence remains below the stop threshold
+t4  verify:targeted  outcome=success  state=w#8b13  evidence=e#2d77  ->  NO_PROGRESS_ENFORCEMENT_ELIGIBLE
+      successful completions repeated without state or evidence change
+
+Shadow Mode         records the stop recommendation; the action still executes.
+Earned Enforcement  is separate. It requires an adapter with real blocking
+                    capability and sufficient local evidence, and this
+                    illustration grants none of it.
+
+

+
+

+ Shadow Mode records that recommendation and still lets the action execute. Earned + Enforcement is a separate authority that an adapter has to earn from local evidence, + and nothing on this page grants it. +

+
+
+