skalpel 4.0.53 → 4.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skalpel-statusline.mjs +29 -5
package/package.json
CHANGED
package/skalpel-statusline.mjs
CHANGED
|
@@ -345,10 +345,10 @@ function compactMeasured(ms) {
|
|
|
345
345
|
// This always-on aggregate counter is an EXPLICIT PRODUCT DECISION by the owner: it is skalpel's terminal
|
|
346
346
|
// presence and must never be gated/hidden ("never remove it from the terminal otherwise skalpel is
|
|
347
347
|
// invisible"). Aggregate-only + no fabrication is what keeps that always-on surface honest.
|
|
348
|
-
function
|
|
348
|
+
function shadowTally() {
|
|
349
349
|
try {
|
|
350
350
|
const lines = tailLines(VERIFY_LOG_PATH, SHADOW_READ_BYTES);
|
|
351
|
-
if (!lines.length) return 0;
|
|
351
|
+
if (!lines.length) return { totalMs: 0, checked: 0, lies: 0 };
|
|
352
352
|
const rows = [];
|
|
353
353
|
for (const l of lines) {
|
|
354
354
|
try {
|
|
@@ -362,14 +362,25 @@ function measuredCaughtTotalMs() {
|
|
|
362
362
|
// O(falseCount × rows) that re-scanned every row for each catch on EVERY bar render.
|
|
363
363
|
const fixDeltaFor = buildFixDeltas(rows);
|
|
364
364
|
let total = 0;
|
|
365
|
+
// The HEARTBEAT counts (same single pass — zero extra I/O on the bar's hot path):
|
|
366
|
+
// checked — claims the shadow got a GENUINE verdict for (its own proof/probe really ran: PASS /
|
|
367
|
+
// GENUINE_FAIL / SHIP_OK / SHIP_FAIL). HARNESS_ERROR rows are logged but NOT counted —
|
|
368
|
+
// identical to the ledger's "unverifiable" rule: we never claim a check we can't stand
|
|
369
|
+
// behind. So a fresh install (or harness-noise-only log) keeps checked = 0.
|
|
370
|
+
// lies — the caught-false subset (mismatch === true), the money metric.
|
|
371
|
+
const CHECKED = new Set(["PASS", "GENUINE_FAIL", "SHIP_OK", "SHIP_FAIL"]);
|
|
372
|
+
let checked = 0;
|
|
373
|
+
let lies = 0;
|
|
365
374
|
for (const r of rows) {
|
|
375
|
+
if (CHECKED.has(r.outcome)) checked += 1;
|
|
366
376
|
if (r.mismatch !== true) continue; // only a caught false "done" (verify-shadow's money metric)
|
|
377
|
+
lies += 1;
|
|
367
378
|
const d = fixDeltaFor(r); // exact ledger.mjs logic; null-session rows excluded (Finding 3)
|
|
368
379
|
if (d && Number.isFinite(d.ms) && d.ms > 0) total += d.ms; // real measured delta only; else +0
|
|
369
380
|
}
|
|
370
|
-
return total;
|
|
381
|
+
return { totalMs: total, checked, lies };
|
|
371
382
|
} catch {
|
|
372
|
-
return 0
|
|
383
|
+
return { totalMs: 0, checked: 0, lies: 0 }; // fail-open: never break or slow the bar
|
|
373
384
|
}
|
|
374
385
|
}
|
|
375
386
|
|
|
@@ -435,10 +446,23 @@ function main() {
|
|
|
435
446
|
// • Raahil's `~`-prefixed saved ESTIMATE ("· ~7m saved") — shown only when saved_min > 0 (its data is
|
|
436
447
|
// the user's own steers.ndjson credit, not the shadow log, so it keeps his always-on #609 behavior).
|
|
437
448
|
const { steers, savedMin } = readState();
|
|
449
|
+
const tally = SHOW_MEASURED ? shadowTally() : { totalMs: 0, checked: 0, lies: 0 };
|
|
438
450
|
let line = `${BOLD}skalpel${RESET} · ${CYAN}${steers} steers${RESET}`;
|
|
439
451
|
if (SHOW_MEASURED) {
|
|
440
|
-
const caught = compactMeasured(
|
|
452
|
+
const caught = compactMeasured(tally.totalMs); // null when < 1s of real measured catches
|
|
441
453
|
if (caught) line += ` · ${CYAN}${caught} caught${RESET}`;
|
|
454
|
+
// THE HEARTBEAT (founder: "I only see 0 steers — the product is invisible while it works").
|
|
455
|
+
// Once the armed shadow has genuinely CHECKED at least one claim, the line SHOWS the work:
|
|
456
|
+
// clean so far → "· 3 claims verified" (the earned-silence receipt — real verdicts only)
|
|
457
|
+
// lies caught → "· 31 checked · 2 false" (the honest split; the measured clause carries the time)
|
|
458
|
+
// Real counts from the same single log pass. A fresh install (checked = 0) emits EXACTLY the
|
|
459
|
+
// baseline line — byte-identical, nothing invented.
|
|
460
|
+
if (tally.checked > 0) {
|
|
461
|
+
line +=
|
|
462
|
+
tally.lies > 0
|
|
463
|
+
? ` · ${CYAN}${tally.checked} checked · ${tally.lies} false${RESET}`
|
|
464
|
+
: ` · ${CYAN}${tally.checked} claim${tally.checked === 1 ? "" : "s"} verified${RESET}`;
|
|
465
|
+
}
|
|
442
466
|
}
|
|
443
467
|
if (SHOW_SAVED) {
|
|
444
468
|
const phrase = savedPhrase(savedMin);
|