bareloop 0.56.0 → 0.58.0

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +3 -3
  3. package/bareloop.context.md +75 -214
  4. package/package.json +2 -2
  5. package/src/authorflow.js +71 -136
  6. package/src/authoring.js +5 -124
  7. package/src/authorjob.js +125 -417
  8. package/src/authorreadout.js +105 -355
  9. package/src/authorrun.js +70 -234
  10. package/src/authorscout.js +9 -1
  11. package/src/blockasks.js +12 -17
  12. package/src/bundlerun.js +4 -1
  13. package/src/checkblock.js +297 -75
  14. package/src/checklist.js +1 -1
  15. package/src/checkpick.js +9 -5
  16. package/src/cli.js +3 -3
  17. package/src/declaredclose.js +45 -112
  18. package/src/destpoint.js +1 -1
  19. package/src/draftspend.js +20 -4
  20. package/src/fencepointcall.js +76 -0
  21. package/src/guarddescriptions.js +14 -0
  22. package/src/index.js +3 -43
  23. package/src/interviewrun.js +13 -8
  24. package/src/job.js +20 -1
  25. package/src/jobblock.js +11 -46
  26. package/src/judged.js +13 -1229
  27. package/src/kinds.js +10 -348
  28. package/src/noteask.js +124 -0
  29. package/src/pagedry.js +27 -5
  30. package/src/pagemap.js +7 -29
  31. package/src/pagerules.js +18 -3
  32. package/src/panel/authorroutes.js +15 -4
  33. package/src/panel/authorsession.js +201 -167
  34. package/src/panel/importrun.js +0 -1
  35. package/src/panel/index.html +43 -18
  36. package/src/panel/jobplan.js +54 -19
  37. package/src/panel/server.js +90 -69
  38. package/src/panel/status.js +3 -0
  39. package/src/pickrecord.js +15 -54
  40. package/src/planrun.js +4 -48
  41. package/src/promptregisters.js +7 -17
  42. package/src/providerrows.js +0 -36
  43. package/src/providers.js +4 -25
  44. package/src/questionbox.js +34 -30
  45. package/src/reviewdoor.js +1 -1
  46. package/src/rowresults.js +69 -0
  47. package/src/rubricstep.js +136 -28
  48. package/src/run.js +2 -15
  49. package/src/stagewords.js +24 -0
  50. package/src/userrun.js +14 -111
  51. package/types/authorflow.d.ts +51 -137
  52. package/types/authoring.d.ts +1 -14
  53. package/types/authorjob.d.ts +14 -55
  54. package/types/authorreadout.d.ts +52 -80
  55. package/types/authorrun.d.ts +20 -0
  56. package/types/blockasks.d.ts +5 -11
  57. package/types/checkblock.d.ts +147 -28
  58. package/types/checklist.d.ts +2 -2
  59. package/types/checkpick.d.ts +5 -3
  60. package/types/cli.d.ts +1 -3
  61. package/types/declaredclose.d.ts +5 -33
  62. package/types/draftspend.d.ts +16 -2
  63. package/types/fencepointcall.d.ts +68 -0
  64. package/types/guarddescriptions.d.ts +7 -0
  65. package/types/index.d.ts +2 -4
  66. package/types/job.d.ts +8 -0
  67. package/types/jobblock.d.ts +8 -38
  68. package/types/judged.d.ts +7 -357
  69. package/types/kinds.d.ts +4 -104
  70. package/types/noteask.d.ts +76 -0
  71. package/types/pagedry.d.ts +13 -0
  72. package/types/pagemap.d.ts +2 -5
  73. package/types/pagerules.d.ts +7 -0
  74. package/types/panel/authorsession.d.ts +37 -5
  75. package/types/panel/jobplan.d.ts +15 -3
  76. package/types/panel/server.d.ts +46 -13
  77. package/types/panel/status.d.ts +5 -0
  78. package/types/pickrecord.d.ts +8 -13
  79. package/types/planrun.d.ts +1 -22
  80. package/types/providerrows.d.ts +0 -31
  81. package/types/providers.d.ts +3 -19
  82. package/types/questionbox.d.ts +20 -6
  83. package/types/rowresults.d.ts +23 -0
  84. package/types/rubricstep.d.ts +43 -7
  85. package/types/run.d.ts +1 -20
  86. package/types/stagewords.d.ts +11 -0
  87. package/types/userrun.d.ts +0 -1
  88. package/src/calibrate.js +0 -702
  89. package/src/cardauthor.js +0 -502
  90. package/src/fitcheck.js +0 -168
  91. package/types/calibrate.d.ts +0 -201
  92. package/types/cardauthor.d.ts +0 -358
  93. package/types/fitcheck.d.ts +0 -119
@@ -160,7 +160,6 @@ export function bridgeRunDetail(g, facts) {
160
160
  checkTypeTitle: facts.checkTypeTitle,
161
161
  model: facts.model,
162
162
  provider: null,
163
- judgeModel: null,
164
163
  budgetUsd: facts.budgetUsd,
165
164
  glyph: '✓',
166
165
  status: statusFor({ outcome: 'green' }),
@@ -196,6 +196,7 @@
196
196
  .rp-status{font-size:13px;color:var(--text-dim);min-width:0;overflow-wrap:anywhere;}
197
197
  .rp-sep{color:var(--text-faint);margin-right:6px;}
198
198
  .st-word{font-weight:700;color:var(--text);}
199
+ .audit-checks-label{font-size:12px;}
199
200
  .wf-ended-inline{flex:1 1 auto;white-space:normal;}
200
201
  .wf-compact{flex-wrap:wrap;}
201
202
  .wf-runno{color:var(--accent);flex:none;}
@@ -479,6 +480,7 @@
479
480
  /* PRD v1.107 Part 6: the Result tab. Boxes are the Job tab's own (.job-card, .field, .ro-value, .field-row); text wraps, nothing scrolls the page. */
480
481
  #result-body{min-width:0;overflow-wrap:anywhere;}
481
482
  .rs-ok{color:var(--green);font-weight:700;}
483
+ .rs-bad{color:var(--red);font-weight:700;}
482
484
  #result-body mark{background:var(--rl-accent-bg-strong);color:var(--text);border-radius:2px;padding:0 1px;}
483
485
  #result-door-card{border-color:var(--amber);}
484
486
  #result-door-card .st-word{color:var(--amber);}
@@ -706,6 +708,9 @@
706
708
  .jp-qs .lbl{display:inline-block;color:var(--text-faint);margin-right:8px;}
707
709
  .jp-qs ul{margin:4px 0;padding-left:26px;}
708
710
  .jp-goal{font-size:12px;color:var(--text-faint);margin-top:8px;}
711
+ /* the draft readout above the signed-ready card: plain text, wrapped, the server names the heading lines (bold) */
712
+ .jp-readout{white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;margin:0 0 12px;padding-bottom:10px;border-bottom:1px solid var(--border);}
713
+ .jp-readout b{font-weight:700;}
709
714
  /* hamr 2026-10-05: the focused/selected Chat-card field gets a blue border (the accent), no outline ring */
710
715
  #panel-chat :is(input,select,textarea):focus{border-color:var(--accent);outline:none;}
711
716
  /* hamr 2026-10-05: the ask box is dimmed until something asks for a reply (placeholder stays readable) */
@@ -1057,13 +1062,13 @@
1057
1062
  <button class="btn primary wide" type="button" id="chat-q-send" data-testid="chat-q-send">Send</button>
1058
1063
  </div>
1059
1064
 
1060
- <div class="chat-input-row">
1065
+ <div class="chat-input-row" hidden>
1061
1066
  <label for="chat-msg" style="display:none">Message</label>
1062
1067
  <textarea id="chat-msg" rows="2" placeholder="Answer here when the draft asks you a question…" data-testid="chat-msg"></textarea>
1063
1068
  </div>
1064
1069
  <button class="btn primary wide" type="button" id="chat-main-btn" data-testid="chat-main" disabled>Start drafting</button>
1065
1070
  <div class="hint" id="chat-main-hint" data-testid="chat-main-hint"></div>
1066
- <!-- hamr 2026-10-09: Revise = reopen the boxes, filled as drafted, and draft again. Shown only while a plan waits for the OK. -->
1071
+ <!-- hamr 2026-10-09: Revise = reopen the boxes, filled as drafted, and draft again. Shown while a plan waits for the OK and on the final card (phase prepared). -->
1067
1072
  <button class="btn wide" type="button" id="chat-reopen-btn" data-testid="chat-reopen" hidden>Revise</button>
1068
1073
  <!-- fwd M4e am14 item 3: "N revises left"; after the second revise this same button reads Start over (a fresh draft, its own 2 revises) -->
1069
1074
  <span id="chat-left-count" data-testid="revises-left" class="hint" hidden></span>
@@ -3024,7 +3029,6 @@
3024
3029
  '<div class="summary-headline"><span class="dot ' + glyphClass(detail.glyph) + '"></span>' + (detail.status && detail.status.word ? '<b class="st-word" data-testid="summary-status">' + escapeXml(detail.status.word) + '</b> &middot; ' : '') + '<b>' + escapeXml(detail.checkType) + '</b> &middot; ' +
3025
3030
  '<span class="num">' + spendText + '</span> &middot; <span class="num">' + wallText + '</span></div>' +
3026
3031
  '<div class="summary-row" data-testid="summary-model"><span class="sum-label">model:</span><span class="sum-val">' + escapeXml(modelLine(detail)) + '</span></div>' +
3027
- (detail.judgeModel ? '<div class="summary-row" data-testid="summary-judge"><span class="sum-label">judge:</span><span class="sum-val">' + escapeXml(detail.judgeModel) + '</span></div>' : '') +
3028
3032
  '<div class="summary-row"><span class="sum-label">steps:</span><span class="sum-val">' + stepsText +
3029
3033
  (detail.replans ? ' &middot; ' + detail.replans + ' replan' + (detail.replans === 1 ? '' : 's') : '') + '</span></div>' +
3030
3034
  '<div class="summary-row"><span class="sum-label">why:</span><span class="sum-val">' + escapeXml(detail.stopReason || (detail.glyph === "✓" ? "run ended clean" : "not recorded")) + '</span></div>' +
@@ -3672,7 +3676,7 @@
3672
3676
  });
3673
3677
  // PRD v1.106 Part 5 Q1: each question the person answered, under its step, in the server's own words (asked, then said); wraps
3674
3678
  (Array.isArray(st.humans) ? st.humans : []).forEach(function(h){
3675
- rows += '<tr class="human-row" data-testid="drafting-human"><td colspan="5" style="overflow-wrap:anywhere;white-space:pre-wrap">' + escapeXml(h.askedText) + "<br>" + escapeXml(h.saidText) + "</td></tr>";
3679
+ rows += '<tr class="human-row" data-testid="drafting-human"><td colspan="5" style="overflow-wrap:anywhere;white-space:pre-wrap">' + escapeXml(h.askedText) + (h.saidText ? "<br>" + escapeXml(h.saidText) : "") + "</td></tr>";
3676
3680
  });
3677
3681
  });
3678
3682
  rows += '<tr class="drafting-total"><td><b>total</b></td><td>' + (part.wallMs === null || part.wallMs === undefined ? "–" : duration(part.wallMs)) +
@@ -3845,8 +3849,8 @@
3845
3849
  }
3846
3850
  // one row of the Audit's check list: its words, its tag, its result in the one state sign+word markup (a row with no recorded verdict says so, never "passed")
3847
3851
  function auditCheckRowHtml(r){
3848
- var res = r.result === "held" ? ["green", r.word || "held"] : r.result === "record-missing" ? ["grey", r.word || "the gate's record for this run is missing"] : r.result === "passed" ? ["green", "passed"] : r.result === "failed" ? ["red", "failed"] : r.result === "not-checked" ? ["grey", "not checked"] : ["grey", "no result recorded"];
3849
- return '<div class="audit-check-row" data-testid="audit-check-row" data-result="' + escapeXml(r.result) + '" style="overflow-wrap:anywhere">' + escapeXml(r.text) + byTagOf(r.by) + " " + stateDotHTML(res[0], res[1], "audit-check-state") + "</div>";
3852
+ var res = r.result === "held" ? ["green", r.word || "held"] : r.result === "record-missing" ? ["grey", r.word || "the gate's record for this run is missing"] : r.result === "passed" ? ["green", "passed"] : r.result === "failed" ? ["red", "failed"] : r.result === "not-checked" ? ["grey", "not checked"] : r.result === "not-reached" ? ["grey", r.word || "not reached"] : ["grey", "no result recorded"];
3853
+ return '<div class="audit-check-row" data-testid="audit-check-row" data-result="' + escapeXml(r.result) + '" style="overflow-wrap:anywhere">' + escapeXml(r.text) + byTagOf(r.by) + " " + stateDotHTML(res[0], res[1], "audit-check-state") + (r.result === "failed" && r.why ? ' <span class="hint" data-testid="audit-check-why">\u2014 ' + escapeXml(r.why) + "</span>" : "") + "</div>";
3850
3854
  }
3851
3855
  // the Checks fold's one state sign (code-owned, one place): any row failed = [✗]; else any row with no recorded result / no gate record = [·]; else [✓] ("held" is passed, "not checked" rows never move it)
3852
3856
  function auditChecksSignClass(rows){
@@ -3861,7 +3865,8 @@
3861
3865
  var all = (ac.checks || []).concat(ac.always || []);
3862
3866
  var nPass = all.filter(function(r){ return r.result === "passed" || r.result === "held"; }).length;
3863
3867
  var nFail = all.filter(function(r){ return r.result === "failed"; }).length;
3864
- var head = "Checks &middot; " + nPass + " passed" + (nFail ? " &middot; " + nFail + " failed" : "") + ((ac.notChecked || []).length ? " &middot; " + ac.notChecked.length + " not checked" : "");
3868
+ var nUnreached = all.filter(function(r){ return r.result === "not-reached"; }).length;
3869
+ var head = '<b class="st-word audit-checks-label">checks</b>' + " &middot; " + nPass + " passed" + (nFail ? " &middot; " + nFail + " failed" : "") + (nUnreached ? " &middot; " + nUnreached + " not reached" : "") + ((ac.notChecked || []).length ? " &middot; " + ac.notChecked.length + " not checked" : "");
3865
3870
  var btn = document.createElement("button");
3866
3871
  btn.type = "button";
3867
3872
  btn.className = "btn audit-part-toggle";
@@ -4153,7 +4158,7 @@
4153
4158
  // (src/panel/jobplan.js): numbered lines with their rule, the checks under the line each serves (folded), the AI's own
4154
4159
  // "Not checked", the always-on guards. Only the marker is blue (--plan). Returns HTML (every text is escaped).
4155
4160
  // the tag of a row by its kind (F-c, code-owned): `~` rows [you], `!` rows [agent], `$` rows [default]; one spelling for the confirm card, the signed card, the Job tab and the Result tab
4156
- function byTagOf(by){ return by === "you" ? ' <span class="by" data-testid="plan-by" data-by="you">[you]</span>' : by === "agent" ? ' <span class="by" data-testid="plan-by" data-by="agent">[agent]</span>' : by === "default" ? ' <span class="by" data-testid="plan-by" data-by="default">[default]</span>' : ""; }
4161
+ function byTagOf(by){ return by === "you" ? ' <span class="by" data-testid="plan-by" data-by="you">~ [you]</span>' : by === "agent" ? ' <span class="by" data-testid="plan-by" data-by="agent">! [agent]</span>' : by === "default" ? ' <span class="by" data-testid="plan-by" data-by="default">$ [default]</span>' : ""; }
4157
4162
  function renderJobPlan(plan, ctl){
4158
4163
  // the legend promises \u203A checks, so it shows only when the plan has one to show (the goal-only confirm card has none yet)
4159
4164
  var hasCheck = (plan.loose || []).length > 0 || (plan.lines || []).some(function(l){ return (l.checks || []).length || (l.picked || []).length || (l.always || []).length; });
@@ -4343,6 +4348,15 @@
4343
4348
  }
4344
4349
  return h;
4345
4350
  }
4351
+ // each row of the line with its OWN mark (Addendum 2026-11-14 (c) piece 4): \u2713 passed, \u2717 failed (with the check's reason), \u00B7 no result; a gap no row owns is its own failed item. The server decides every mark and word
4352
+ function resultCheckRowsHtml(line){
4353
+ var rows = line.checkRows || [], gaps = line.unclaimed || [];
4354
+ if(!rows.length && !gaps.length) return "";
4355
+ var mark = function(res){ return res === "passed" ? '<span class="rs-ok">\u2713</span>' : res === "failed" ? '<span class="rs-bad">\u2717</span>' : '<span class="hint">\u00B7</span>'; };
4356
+ return resultField("Each check", '<div class="ro-value" data-testid="result-checkrows">' + rows.map(function(r){
4357
+ return '<div data-testid="result-checkrow" data-result="' + escapeXml(r.result) + '">' + mark(r.result) + " " + escapeXml(r.text) + byTagOf(r.by) + (r.result === "failed" && r.why ? ' <span class="hint">\u2014 ' + escapeXml(r.why) + "</span>" : "") + "</div>";
4358
+ }).join("") + gaps.map(function(g){ return '<div data-testid="result-checkrow" data-result="failed"><span class="rs-bad">\u2717</span> ' + escapeXml(g) + "</div>"; }).join("") + "</div>");
4359
+ }
4346
4360
  function resultTextLine(line){
4347
4361
  var h = resultFileWords(line.file);
4348
4362
  if(typeof line.answer === "string") h += resultField("Answer", '<div class="ro-value" data-testid="result-answer" style="color:var(--text);white-space:pre-wrap">' + escapeXml(line.answer) + '</div>');
@@ -4369,7 +4383,7 @@
4369
4383
  function resultLineCard(line, own, note){
4370
4384
  return '<div class="job-card" data-testid="result-line"><h4>Line ' + escapeXml(String(line.n)) + '</h4>' + resultLineBox(line) +
4371
4385
  (own ? resultPageLink(line.page, note, "result-page-line") : "") +
4372
- (line.kind === "facts" ? resultFactsLine(line) : resultTextLine(line)) +
4386
+ (line.kind === "facts" ? resultFactsLine(line) : resultTextLine(line)) + resultCheckRowsHtml(line) +
4373
4387
  resultNotChecked("Not checked", line.notChecked, "result-line-notchecked", line.notCheckedBy) + '</div>';
4374
4388
  }
4375
4389
  // ---- the generic Result tab (R7b item 4): every ended non-rubric run. The server sends the facts and the words (`kind: "generic"`); the page only draws.
@@ -4413,7 +4427,7 @@
4413
4427
  var rows = k.stages.map(function(s){
4414
4428
  var num = stageNumberText(s);
4415
4429
  return '<div class="rs-check" data-testid="result-check"><span class="rs-q">' + escapeXml(stageQuestionText(s)) + '</span><span class="rs-num hint" data-testid="result-check-num">' +
4416
- (num ? escapeXml(num) : "") + escapeXml(stageTriedText(s)) + '</span><span class="rs-sign">' + stateDotHTML(s.passed ? "green" : "red", s.status.word, "result-check-state") + '</span></div>';
4430
+ (num ? escapeXml(num) : "") + escapeXml(stageTriedText(s)) + '</span><span class="rs-sign">' + stateDotHTML(s.passed ? "green" : s.notReached ? "grey" : "red", s.status.word, "result-check-state") + '</span></div>';
4417
4431
  }).join("");
4418
4432
  var notes = k.notes.length ? '<details data-testid="result-close-notes"><summary>the close\'s own notes</summary><div class="ro-value" style="white-space:pre-wrap">' +
4419
4433
  k.notes.map(function(n){ return escapeXml(n.text); }).join("\n") + '</div></details>' : "";
@@ -4498,7 +4512,7 @@
4498
4512
  if(!k) return "checks: the close did not run any check for this run";
4499
4513
  var bits = k.stages.map(function(s){
4500
4514
  var num = stageNumberText(s);
4501
- return s.passed ? escapeXml(stageQuestionText(s)) : gridGlyph("✗") + " " + escapeXml(stageQuestionText(s)) + (num ? " — " + escapeXml(num) : "") + escapeXml(stageTriedText(s));
4515
+ return s.passed ? escapeXml(stageQuestionText(s)) : s.notReached ? gridGlyph("·") + " " + escapeXml(stageQuestionText(s)) + " — " + escapeXml(s.status.word) : gridGlyph("✗") + " " + escapeXml(stageQuestionText(s)) + (num ? " — " + escapeXml(num) : "") + escapeXml(stageTriedText(s));
4502
4516
  });
4503
4517
  return "checks: " + k.passed + " of " + k.total + " " + (k.allPassed ? gridGlyph("✓") : "") + (bits.length ? " &middot; " : "") + bits.join(" &middot; ");
4504
4518
  }
@@ -5458,6 +5472,8 @@
5458
5472
  var mainBtn = document.getElementById("chat-main-btn");
5459
5473
  var mainHint = document.getElementById("chat-main-hint");
5460
5474
  var reopenBtn = document.getElementById("chat-reopen-btn");
5475
+ // hamr 2026-11-15: the chat's typing box is shown only while something asks to be typed (the language, the goal); a check question has buttons and no box (renderQuestionBox), and with no ask the box is not drawn dimmed
5476
+ var chatRowEl = document.querySelector(".chat-input-row");
5461
5477
  var qBox = document.getElementById("chat-question");
5462
5478
  var qHead = document.getElementById("chat-q-head");
5463
5479
  var qLine = document.getElementById("chat-q-line");
@@ -5746,7 +5762,7 @@
5746
5762
  document.getElementById("jf-cap-time").parentNode.hidden = false;
5747
5763
  document.getElementById("chat-clear-btn").hidden = false;
5748
5764
  ["chat-main-btn", "chat-main-hint"].forEach(function(id){ document.getElementById(id).hidden = false; });
5749
- document.querySelector(".chat-input-row").hidden = false;
5765
+ document.querySelector(".chat-input-row").hidden = true;
5750
5766
  }
5751
5767
  function openNewCard(){
5752
5768
  card.hidden = false;
@@ -6071,6 +6087,13 @@
6071
6087
  function planControlHTML(op, key){
6072
6088
  return ' <button type="button" class="btn jp-btn" data-testid="plan-' + op + '" data-rowop="' + op + '" data-rowkey="' + escapeXml(key) + '">' + (op === "add" ? "Add" : "Drop") + "</button>";
6073
6089
  }
6090
+ // the draft readout is plain text; the server names which lines are headings (src/authorreadout.js readoutHeadIndexes), drawn bold
6091
+ function readoutHtml(r){
6092
+ var heads = Array.isArray(r.heads) ? r.heads : [];
6093
+ return r.text.replace(/\s+$/, "").split("\n").map(function(l, i){
6094
+ return heads.indexOf(i) >= 0 ? "<b>" + escapeXml(l) + "</b>" : escapeXml(l);
6095
+ }).join("\n");
6096
+ }
6074
6097
  function renderMessages(state){
6075
6098
  var sig = JSON.stringify(state.messages);
6076
6099
  if(sig === lastMsgSig) return;
@@ -6081,11 +6104,12 @@
6081
6104
  var who = chatWhoLabel(m.role);
6082
6105
  var whoHtml = who ? ('<div class="who">' + escapeXml(who) + '</div>') : "";
6083
6106
  if(m.kind === "plan" && m.plan){
6107
+ var ro = m.readout && typeof m.readout.text === "string" ? '<div class="jp-readout" data-testid="plan-readout">' + readoutHtml(m.readout) + "</div>" : "";
6084
6108
  // P7: the confirm turn's plan is drawn by the one job-plan renderer (the Job tab uses the same)
6085
6109
  var qs = (m.plan.questions || []).length
6086
6110
  ? '<div class="jp-qs" data-testid="plan-questions"><span class="lbl">AI\'s open questions</span><ul>' +
6087
6111
  m.plan.questions.map(function(q){ return "<li>" + escapeXml(q) + "</li>"; }).join("") + "</ul><b>Revise if you need to.</b></div>" : "";
6088
- return '<div class="msg ' + cls + '" data-testid="plan-bubble">' + whoHtml + renderJobPlan(m.plan, m.plan.editable === true ? planControlHTML : null) + qs + '<div class="jp-goal">' + escapeXml(m.text) + "</div></div>";
6112
+ return '<div class="msg ' + cls + '" data-testid="plan-bubble">' + whoHtml + ro + renderJobPlan(m.plan, m.plan.editable === true ? planControlHTML : null) + qs + '<div class="jp-goal">' + escapeXml(m.text) + "</div></div>";
6089
6113
  }
6090
6114
  return '<div class="msg ' + cls + '">' + whoHtml + escapeXml(m.text) + '</div>';
6091
6115
  }).join("");
@@ -6162,7 +6186,8 @@
6162
6186
  if(st.phase === "prepared" && st.signClicked){
6163
6187
  return {text: "Sign " + (st.specHash || "").slice(0, 8) + " & run", action: "sign", disabled: false, hint: hint};
6164
6188
  }
6165
- return {text: "Sign & run", action: "sign-prepare", disabled: false, hint: hint};
6189
+ // at the plan menu this click only confirms the plan and starts drafting the checks (it never signs): it says so. A drafted card's first click (a Reuse) keeps "Sign & run"
6190
+ return {text: atMenu ? "Draft the plan" : "Sign & run", action: "sign-prepare", disabled: false, hint: hint};
6166
6191
  }
6167
6192
  return {text: "Sign & run", action: "none", disabled: true, hint: ""};
6168
6193
  }
@@ -6172,9 +6197,9 @@
6172
6197
  function askBoxOpenFor(st){
6173
6198
  return !!st.session && !!st.pendingAsk && st.pendingAsk.kind !== "install-needed" && st.pendingAsk.kind !== "menu";
6174
6199
  }
6175
- // pure: Revise shows only while a plan waits for the OK
6200
+ // pure: Revise shows while a plan waits for the OK (the plan menu) AND on the final signed-ready card (phase "prepared": the pending ask is null there, which is why it never showed)
6176
6201
  function reviseShownFor(st){
6177
- return !!st.session && !!st.pendingAsk && st.pendingAsk.kind === "menu";
6202
+ return !!st.session && ((!!st.pendingAsk && st.pendingAsk.kind === "menu") || (st.phase === "prepared" && !st.pendingAsk));
6178
6203
  }
6179
6204
  // fwd M4e am14 item 3 (pure): 2 revises per draft, shown as "2 revises left" / "1 revise left"; with none left the same button reads Start over. The SERVER counts (revisesLeft); an
6180
6205
  // absent number (a state from before the count) reads as 2.
@@ -6193,6 +6218,7 @@
6193
6218
  }
6194
6219
  // hamr 2026-10-05: the ask box is open only while something asks for a reply; otherwise dimmed and emptied
6195
6220
  var open = askBoxOpenFor(st);
6221
+ chatRowEl.hidden = !open || !!(st.pendingAsk && st.pendingAsk.box);
6196
6222
  msgInput.disabled = !open;
6197
6223
  if(!open) msgInput.value = "";
6198
6224
  var b = mainButtonFor(st, !msgInput.value.trim(), reusePathNow() || verdictValue() === "reuse");
@@ -6238,7 +6264,7 @@
6238
6264
  // the empty-box examples (grey placeholders that vanish on typing) change with the Check type radio
6239
6265
  var JOB_PLACEHOLDERS = {
6240
6266
  deterministic: "Fix the failing date tests in src/date.js\n~ don't edit any test file\nMake npm test pass",
6241
- rubric: "Write a one-page summary of docs/plan.md\n~ PASS: every number is quoted from the file\n~ FAIL: a number that is not in the file\nKeep it under 300 words",
6267
+ rubric: "Write a one-page summary of docs/plan.md\n~ every number is quoted from the file\nKeep it under 300 words",
6242
6268
  };
6243
6269
  var INPUTS_PLACEHOLDER = "repo: /home/me/myrepo\nspec: docs/spec.md";
6244
6270
  function setJobPlaceholders(v){
@@ -6288,7 +6314,6 @@
6288
6314
  var ask = state && state.pendingAsk;
6289
6315
  var b = ask && ask.box ? ask.box : null;
6290
6316
  qBox.hidden = b === null;
6291
- document.querySelector(".chat-input-row").hidden = b !== null;
6292
6317
  mainBtn.hidden = b !== null; mainHint.hidden = b !== null;
6293
6318
  if(b === null){ qKey = null; return; }
6294
6319
  var key = String(sessionId) + ":" + String(ask.index) + ":" + String(ask.source) + ":" + b.text;
@@ -11,16 +11,19 @@
11
11
  //
12
12
  // `cls` is 'machine check' | 'judge' | null (null = not known yet: the confirm card's checks are the model's plan, the
13
13
  // stage kinds exist only after drafting). Pure; no file IO.
14
+ import { NOT_REACHED } from './status.js';
14
15
  import { ticketFilterWords } from '../ticketfilter.js';
15
16
  import { KIND_CATALOGUE } from '../authoring.js';
17
+ import { stageQuestionsByName } from '../stagewords.js';
16
18
  import { WEEK_ONLY_WORDS } from '../checklist.js';
17
19
  import { splitReadNotes } from '../pagedropwords.js';
18
- import { checksOfClose, signedFactNames, proseNotChecked, lineRules, confirmedGoalOf, refusedOf, listRowName, ruleNotCheckedItems } from '../rubricstep.js';
20
+ import { checksOfClose, carriesOneList, FENCE_KEY, guardKeyOf, stageKeyOf, guardRowText, signedFactNames, proseNotChecked, lineRules, confirmedGoalOf, refusedOf, listRowName, ruleNotCheckedItems } from '../rubricstep.js';
19
21
 
20
22
  /** `by` = who added the check: the drafter (`agent`) or the person's own pick (`you`); absent = code's own (an always-on guard, a number tie) or not known */
21
23
  /** `stage` = the signed close stage the row belongs to (its recorded verdict is the row's result in the Audit) */
22
- /** @typedef {{text: string, by: 'agent'|'you'|'default'|null, result: 'passed'|'failed'|'none'|'not-checked'|'held'|'record-missing', word?: string}} AuditRow */
23
- /** @typedef {{name: string, cls: 'machine check'|'judge'|null, by?: 'agent'|'you'|'default'|null, key?: string, stage?: string}} PlanCheck */
24
+ /** @typedef {{text: string, by: 'agent'|'you'|'default'|null, result: 'passed'|'failed'|'none'|'not-reached'|'not-checked'|'held'|'record-missing', word?: string, key?: string, why?: string}} AuditRow */
25
+ /** `fence` = a repo job's `~` rule the write fence keeps (its result is the gate's record of the run, like the fence row's) */
26
+ /** @typedef {{name: string, cls: 'machine check'|'judge'|null, by?: 'agent'|'you'|'default'|null, key?: string, stage?: string, fence?: true}} PlanCheck */
24
27
  /** @typedef {{n: number, text: string, rule: string, rules: string[], checks: PlanCheck[], refused: string[], always?: string[], picked?: string[]}} PlanLine */
25
28
  /** @typedef {{lines: PlanLine[], loose: PlanCheck[], notChecked: string[], readNotes: string[], alwaysOn: string[], older: boolean, goal?: string, ticketFilter?: string, notCheckedBy?: Record<string, 'you'|'agent'|'default'>, suggested?: {key: string, line: number, text: string}[], editable?: boolean}} JobPlan */
26
29
 
@@ -54,7 +57,7 @@ export function checkClassOfKind(kind) {
54
57
  * @returns {JobPlan}
55
58
  */
56
59
  export function planFromSpec(spec, ledger = null) {
57
- /** @type {{name: string, cls: 'machine check'|'judge'|null, fromLine: number[]|null, by?: 'agent'|'you'|'default'|null, stage?: string}[]} */
60
+ /** @type {{name: string, cls: 'machine check'|'judge'|null, fromLine: number[]|null, by?: 'agent'|'you'|'default'|null, stage?: string, key?: string}[]} */
58
61
  let stages = [];
59
62
  if (spec && Array.isArray(spec.closeDecl?.stages)) {
60
63
  stages = spec.closeDecl.stages.filter((/** @type {any} */ s) => s && typeof s.name === 'string' && s.name)
@@ -62,8 +65,13 @@ export function planFromSpec(spec, ledger = null) {
62
65
  const fromLine = Array.isArray(s.fromLine) && s.fromLine.length ? s.fromLine.filter(Number.isInteger) : null;
63
66
  // PART 1b: a rubric-step stage is shown as the checks it RUNS — one code-worded row per fact, per count, per limit — read by
64
67
  // the same reader (`checksOfClose`) the confirm card and the sign-time invariant use, so the Job tab cannot differ from them
65
- const rows = s.kind === 'rubric-step' ? checksOfClose({ stages: [s], picks: spec.closeDecl.picks, list: spec.closeDecl.list }) : [];
66
- return rows.length > 0 ? rows.map((r) => ({ name: r.text, cls: /** @type {'machine check'} */ ('machine check'), fromLine, by: r.by, stage: s.name })) : [{ name: s.name, cls: checkClassOfKind(s.kind), fromLine, by: /** @type {'agent'} */ ('agent'), stage: s.name }];
68
+ const rows = s.kind === 'rubric-step' ? checksOfClose({ stages: [s], picks: spec.closeDecl.picks, list: spec.closeDecl.list }).filter((r) => r.line !== 0) : [];
69
+ // a guard stage the signed list holds as a job-level `$` row (piece 2) is that row: one check that serves no one line, drawn once, never "Always checked"
70
+ const guardRow = s.kind !== 'rubric-step' && Array.isArray(spec.closeDecl.list) ? spec.closeDecl.list.find((/** @type {any} */ r) => r && r.kind === 'guard' && r.state === 'built' && r.key === guardKeyOf(s.name)) : null;
71
+ if (guardRow) return [{ name: guardRowText(s.name), cls: checkClassOfKind(s.kind), fromLine: /** @type {number[]} */ ([0]), by: /** @type {'default'} */ ('default'), stage: s.name, key: String(guardRow.key) }];
72
+ // a repo job's `!` work stage is its list row (Addendum 2026-11-15 (d)): the row's key rides on the check
73
+ const stageRow = s.kind !== 'rubric-step' && Array.isArray(spec.closeDecl.list) && spec.closeDecl.list.some((/** @type {any} */ r) => r && r.kind === 'stage' && r.key === stageKeyOf(s.name));
74
+ return rows.length > 0 ? rows.map((r) => ({ name: r.text, cls: /** @type {'machine check'} */ ('machine check'), fromLine, by: r.by, stage: s.name, ...(r.key ? { key: r.key } : {}) })) : [{ name: stageRow ? (stageQuestionsByName(spec).get(s.name) ?? s.name) : s.name, cls: checkClassOfKind(s.kind), fromLine, by: /** @type {'agent'} */ ('agent'), stage: s.name, ...(stageRow ? { key: stageKeyOf(s.name) } : {}) }];
67
75
  });
68
76
  } else if (spec && Array.isArray(spec.close)) {
69
77
  stages = spec.close.filter((/** @type {any} */ s) => s && typeof s.name === 'string' && s.name)
@@ -71,7 +79,7 @@ export function planFromSpec(spec, ledger = null) {
71
79
  }
72
80
  // a prose step says what it does not check (PART 1b, RF5): the person judges the text at Accept
73
81
  const allNotes = [
74
- ...(Array.isArray(spec?.closeDecl?.notes) ? spec.closeDecl.notes.filter((/** @type {any} */ n) => typeof n === 'string' && n) : []),
82
+ ...(Array.isArray(spec?.closeDecl?.notes) && !carriesOneList(spec.closeDecl) ? spec.closeDecl.notes.filter((/** @type {any} */ n) => typeof n === 'string' && n) : []),
75
83
  ...proseNotChecked(spec?.closeDecl),
76
84
  ];
77
85
  // code's notes on which written forms of a still-checked fact were not used are "How the page was read", not Not checked
@@ -98,11 +106,17 @@ export function planFromSpec(spec, ledger = null) {
98
106
  if (s.fromLine === null) { alwaysOn.push(s.name); continue; }
99
107
  // a check that serves several job lines is shown under EACH line it serves (no new element: the same check line, repeated)
100
108
  const served = lines.filter((l) => /** @type {number[]} */ (s.fromLine).includes(l.n));
101
- for (const line of served) line.checks.push({ name: s.name, cls: s.cls, ...(s.by ? { by: s.by } : {}), ...(s.stage ? { stage: s.stage } : {}) });
102
- if (served.length === 0) loose.push({ name: s.name, cls: s.cls, ...(s.by ? { by: s.by } : {}), ...(s.stage ? { stage: s.stage } : {}) });
109
+ for (const line of served) line.checks.push({ name: s.name, cls: s.cls, ...(s.by ? { by: s.by } : {}), ...(s.stage ? { stage: s.stage } : {}), ...(s.key ? { key: s.key } : {}) });
110
+ if (served.length === 0) loose.push({ name: s.name, cls: s.cls, ...(s.by ? { by: s.by } : {}), ...(s.stage ? { stage: s.stage } : {}), ...(s.key ? { key: s.key } : {}) });
103
111
  }
104
- // an always-on guard that the drafter said covers a job line is shown under that line too ("› check · always-on: <guard>")
105
- for (const g of Array.isArray(spec?.closeDecl?.guardLines) ? spec.closeDecl.guardLines : []) {
112
+ // the write fence is a job-level `$` row of the signed list (hamr 2026-11-15): one check that serves no one line
113
+ for (const c of checksOfClose(spec?.closeDecl ?? {}).filter((x) => x.key === FENCE_KEY)) loose.push({ name: c.text, cls: null, by: 'default', key: FENCE_KEY });
114
+ // a `~` rule the write fence keeps (a repo job's list; code proved the claim at drafting) is a check of its own line, kept by the fence
115
+ for (const c of checksOfClose(spec?.closeDecl ?? {}, spec?.jobLines ?? null).filter((x) => x.fence !== undefined)) {
116
+ lines.find((l) => l.n === c.line)?.checks.push({ name: c.text, cls: null, by: 'you', key: c.key, fence: true });
117
+ }
118
+ // an always-on guard that the drafter said covers a job line is shown under that line too ("› check · always-on: <guard>"); a close with the one list says none (code cannot prove a guard keeps a rule: Not checked)
119
+ for (const g of carriesOneList(spec?.closeDecl) ? [] : Array.isArray(spec?.closeDecl?.guardLines) ? spec.closeDecl.guardLines : []) {
106
120
  if (!g || typeof g.guard !== 'string' || !Array.isArray(g.lines)) continue;
107
121
  for (const line of lines.filter((l) => g.lines.includes(l.n))) (line.always ??= []).push(g.guard);
108
122
  }
@@ -111,7 +125,7 @@ export function planFromSpec(spec, ledger = null) {
111
125
  // a refusal of ONE ~ rule (PART 1b, RF16) names the rule in the person's words, so the row reads as that rule's Not checked; a list row of another kind names its fact when it has one
112
126
  const ruleText = line && Number.isInteger(r.rule) ? lineRules(spec.jobLines.find((/** @type {any} */ l) => l?.n === r.line))[Number(r.rule) - 1] : (r.label ?? null);
113
127
  // a list row that is not a fact or a rule (a phrase, a count) is named by its words: the draft log's, else the text after the key's kind prefix
114
- const named = line && !ruleText && r.fromList && r.key ? listRowName(r.kind, r.key, ledger?.find((x) => x.key === r.key)?.words) : null;
128
+ const named = line && !ruleText && r.fromList && r.key && r.kind !== 'stage' ? listRowName(r.kind, r.key, ledger?.find((x) => x.key === r.key)?.words) : null;
115
129
  const text = ruleText ? `"${ruleText}" — ${r.reason}` : (named ? `${named} — ${r.reason}` : r.reason);
116
130
  if (line) { line.refused.push(text); if (r.by) refusedBy[text] = r.by; }
117
131
  }
@@ -148,7 +162,7 @@ export function planFromConfirm(jobLines, plan) {
148
162
  const loose = [];
149
163
  // the person's picks are drawn once, from `plan.picked` (their words, with `kept from last draft`) as `[you picked]` check rows: a close row for the same pick is not a second row
150
164
  const hasPicked = Array.isArray(plan?.picked) && plan.picked.length > 0;
151
- for (const c of items.filter((x) => !(hasPicked && /** @type {any} */ (x).by === 'you' && !(/** @type {any} */ (x).key)))) {
165
+ for (const c of items.filter((x) => !(hasPicked && /** @type {any} */ (x).by === 'you' && (/** @type {any} */ (x).pick === true || !(/** @type {any} */ (x).key))))) {
152
166
  const by = /** @type {any} */ (c).by === null ? {} : { by: /** @type {'agent'|'you'|'default'} */ (/** @type {any} */ (c).by ?? 'agent') };
153
167
  const served = lines.filter((l) => Array.isArray(c.fromLine) && c.fromLine.includes(l.n));
154
168
  const key = typeof (/** @type {any} */ (c).key) === 'string' ? { key: /** @type {any} */ (c).key } : {};
@@ -178,16 +192,36 @@ export const AUDIT_NO_RESULT = 'no result recorded';
178
192
  * (`results`: stage name to passed), never re-derived; a row no verdict was recorded for says so. A Not checked row's result is "not checked" (its reason is in its words).
179
193
  * The write fence is enforced per write by the gate, so its row reads the gate's own record of THIS run (hamr ruling A, 2026-11-13): `blocked` = the write/edit attempts the gate denied
180
194
  * (`held · N writes blocked`), or `null` when the run's gate record is missing (said in plain words, never "held").
181
- * @param {JobPlan} plan @param {string[]} guards @param {Map<string, boolean>|null} results @param {number|null} [blocked]
195
+ * Each row reads ITS OWN recorded result when the close recorded one (`rowRes`, piece 4: `{results: key -> {result, why?}, unclaimed: line -> words}`), else (a close recorded before rows existed) the verdict of its stage.
196
+ * A gap no row owns is its own failed item of its line, in the gap's words.
197
+ * @param {JobPlan} plan @param {string[]} guards @param {Map<string, boolean>|null} results @param {number|null} [blocked] @param {boolean} [closeRan] the results are a CLOSE's (the latest), so a declared stage missing from them was not reached (the close stops at its first red); else a stage no verdict was recorded for reads none
198
+ * @param {{results: Map<string, {result: string, why?: string}>, unclaimed: Map<number, string[]>}|null} [rowRes]
182
199
  * @returns {{checks: AuditRow[], notChecked: AuditRow[], always: AuditRow[]}}
183
200
  */
184
- export function auditChecksOf(plan, guards, results, blocked = null) {
185
- /** @param {string|undefined|null} stage @returns {'passed'|'failed'|'none'} */
186
- const verdict = (stage) => (!stage || !results || !results.has(stage) ? 'none' : (results.get(stage) ? 'passed' : 'failed'));
201
+ export function auditChecksOf(plan, guards, results, blocked = null, closeRan = false, rowRes = null) {
202
+ /** @param {string|undefined|null} stage @returns {'passed'|'failed'|'none'|'not-reached'} */
203
+ const verdict = (stage) => (!stage || !results ? 'none' : (!results.has(stage) ? (closeRan ? 'not-reached' : 'none') : (results.get(stage) ? 'passed' : 'failed')));
187
204
  /** @type {AuditRow[]} */
188
205
  const checks = [];
189
- for (const l of plan.lines) for (const c of l.checks) checks.push({ text: `line ${l.n} · ${c.name}`, by: c.by ?? null, result: verdict(c.stage) });
190
- for (const c of plan.loose) checks.push({ text: `other · ${c.name}`, by: c.by ?? null, result: verdict(c.stage) });
206
+ /** one row: its own recorded result when there is one, else its stage's verdict @param {{by?: any, stage?: string, key?: string, fence?: true}} c @param {string} text @returns {AuditRow} */
207
+ const rowOf = (c, text) => {
208
+ // the fence row reads the gate's own record of THIS run (never a stage verdict): held · N writes blocked, or the record is missing
209
+ if (c.key === FENCE_KEY || c.fence === true) {
210
+ const by = c.fence === true ? /** @type {'you'} */ ('you') : /** @type {'default'} */ ('default');
211
+ return blocked === null
212
+ ? { text, by, result: /** @type {'record-missing'} */ ('record-missing'), word: "the gate's record for this run is missing", key: String(c.key) }
213
+ : { text, by, result: /** @type {'held'} */ ('held'), word: `held · ${blocked} ${blocked === 1 ? 'write' : 'writes'} blocked`, key: String(c.key) };
214
+ }
215
+ const own = c.key ? rowRes?.results.get(c.key) : undefined;
216
+ if (!own) return { text, by: c.by ?? null, result: verdict(c.stage), ...(c.key ? { key: c.key } : {}) };
217
+ // `unread`: the line's file could not be read, so this row was not looked at: never passed, never failed
218
+ return { text, by: c.by ?? null, result: own.result === 'passed' ? 'passed' : own.result === 'failed' ? 'failed' : 'none', ...(own.result === 'failed' && own.why ? { why: own.why } : {}), key: String(c.key) };
219
+ };
220
+ for (const l of plan.lines) {
221
+ for (const c of l.checks) checks.push(rowOf(c, `line ${l.n} · ${c.name}`));
222
+ for (const u of rowRes?.unclaimed.get(l.n) ?? []) checks.push({ text: `line ${l.n} · ${u}`, by: null, result: 'failed' });
223
+ }
224
+ for (const c of plan.loose) checks.push(rowOf(c, `other · ${c.name}`));
191
225
  /** @type {AuditRow[]} */
192
226
  const notChecked = [];
193
227
  const by = plan.notCheckedBy ?? {};
@@ -206,5 +240,6 @@ export function auditChecksOf(plan, guards, results, blocked = null) {
206
240
  }
207
241
  return { text: g, by: /** @type {'default'} */ ('default'), result: verdict(stage) };
208
242
  });
243
+ for (const r of [...checks, ...always]) if (r.result === 'not-reached') r.word = NOT_REACHED.word;
209
244
  return { checks, notChecked, always };
210
245
  }