bareloop 0.55.0 → 0.57.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 (92) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +3 -3
  3. package/bareloop.context.md +69 -209
  4. package/package.json +2 -2
  5. package/src/authorflow.js +164 -340
  6. package/src/authoring.js +7 -127
  7. package/src/authorjob.js +139 -472
  8. package/src/authorreadout.js +24 -368
  9. package/src/authorrun.js +21 -215
  10. package/src/behaviour.js +14 -0
  11. package/src/blockasks.js +43 -0
  12. package/src/bundlerun.js +4 -1
  13. package/src/checkblock.js +798 -0
  14. package/src/checklist.js +128 -0
  15. package/src/checkpick.js +39 -312
  16. package/src/checkwords.js +3 -1
  17. package/src/cli.js +3 -3
  18. package/src/declaredclose.js +38 -108
  19. package/src/destpoint.js +4 -2
  20. package/src/draftspend.js +46 -0
  21. package/src/facts.js +8 -1
  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 +5 -347
  28. package/src/noteask.js +124 -0
  29. package/src/pagedry.js +27 -5
  30. package/src/pagemap.js +15 -3
  31. package/src/pagerules.js +18 -3
  32. package/src/panel/authorroutes.js +24 -6
  33. package/src/panel/authorsession.js +222 -177
  34. package/src/panel/importrun.js +0 -1
  35. package/src/panel/index.html +198 -26
  36. package/src/panel/jobplan.js +87 -33
  37. package/src/panel/server.js +74 -68
  38. package/src/panel/status.js +3 -0
  39. package/src/pickrecord.js +34 -55
  40. package/src/placerule.js +355 -0
  41. package/src/planrun.js +2 -48
  42. package/src/promptregisters.js +13 -17
  43. package/src/providerrows.js +0 -36
  44. package/src/providers.js +4 -25
  45. package/src/questionbox.js +104 -0
  46. package/src/rowedit.js +115 -0
  47. package/src/rubricstep.js +234 -127
  48. package/src/run.js +11 -16
  49. package/src/userrun.js +60 -112
  50. package/types/authorflow.d.ts +41 -197
  51. package/types/authoring.d.ts +1 -14
  52. package/types/authorjob.d.ts +35 -59
  53. package/types/authorreadout.d.ts +10 -88
  54. package/types/behaviour.d.ts +12 -0
  55. package/types/blockasks.d.ts +36 -0
  56. package/types/checkblock.d.ts +376 -0
  57. package/types/checklist.d.ts +134 -0
  58. package/types/checkpick.d.ts +8 -140
  59. package/types/cli.d.ts +1 -3
  60. package/types/declaredclose.d.ts +7 -33
  61. package/types/destpoint.d.ts +2 -0
  62. package/types/draftspend.d.ts +21 -0
  63. package/types/index.d.ts +2 -4
  64. package/types/job.d.ts +8 -0
  65. package/types/jobblock.d.ts +8 -38
  66. package/types/judged.d.ts +7 -357
  67. package/types/kinds.d.ts +3 -104
  68. package/types/noteask.d.ts +76 -0
  69. package/types/pagedry.d.ts +13 -0
  70. package/types/pagemap.d.ts +4 -0
  71. package/types/pagerules.d.ts +7 -0
  72. package/types/panel/authorsession.d.ts +47 -5
  73. package/types/panel/jobgrid.d.ts +8 -8
  74. package/types/panel/jobplan.d.ts +48 -10
  75. package/types/panel/server.d.ts +27 -18
  76. package/types/panel/status.d.ts +5 -0
  77. package/types/pickrecord.d.ts +20 -13
  78. package/types/placerule.d.ts +194 -0
  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 +87 -0
  83. package/types/rowedit.d.ts +32 -0
  84. package/types/rubricstep.d.ts +100 -48
  85. package/types/run.d.ts +9 -19
  86. package/types/userrun.d.ts +0 -1
  87. package/src/calibrate.js +0 -702
  88. package/src/cardauthor.js +0 -502
  89. package/src/fitcheck.js +0 -166
  90. package/types/calibrate.d.ts +0 -201
  91. package/types/cardauthor.d.ts +0 -358
  92. package/types/fitcheck.d.ts +0 -113
@@ -14,7 +14,7 @@ export function advanceSteps(steps: StepLine[], id: string, detail?: string, lab
14
14
  * The confirm turn's plan as a chat message (P7): a STRUCTURED `{role:'bot', kind:'plan', plan}` the page draws with the
15
15
  * same renderer the Job tab uses — each numbered job line, its `~` rule, its drafted checks folded; the AI's own "not
16
16
  * checked"; the always-on guards. `questions` (what the plan still asks) ride inside the plan. One owner of the shape.
17
- * @param {{goal?: string, checks?: string[], checkItems?: {text: string, fromLine: number[]|null}[], notChecked?: string[], questions?: string[], protections?: string[], signedFacts?: string[], ticketFilter?: any, picked?: {line: number, text: string}[]}} p the confirm turn's plan
17
+ * @param {{goal?: string, checks?: string[], checkItems?: {text: string, fromLine: number[]|null, by?: 'agent'|'you'|'default'|null, key?: string}[], notChecked?: string[], notCheckedBy?: Record<string, 'you'|'agent'|'default'>, suggested?: {key: string, line: number, text: string}[], editable?: boolean, questions?: string[], protections?: string[], signedFacts?: string[], ticketFilter?: any, picked?: {line: number, text: string}[]}} p the confirm turn's plan
18
18
  * @param {{n: number, text: string, rule: string}[]|null} jobLines
19
19
  * @returns {{role: 'bot', kind: 'plan', text: string, plan: ReturnType<typeof planFromConfirm> & {goal: string, questions: string[]}}}
20
20
  */
@@ -24,8 +24,17 @@ export function planMessage(p: {
24
24
  checkItems?: {
25
25
  text: string;
26
26
  fromLine: number[] | null;
27
+ by?: "agent" | "you" | "default" | null;
28
+ key?: string;
27
29
  }[];
28
30
  notChecked?: string[];
31
+ notCheckedBy?: Record<string, "you" | "agent" | "default">;
32
+ suggested?: {
33
+ key: string;
34
+ line: number;
35
+ text: string;
36
+ }[];
37
+ editable?: boolean;
29
38
  questions?: string[];
30
39
  protections?: string[];
31
40
  signedFacts?: string[];
@@ -72,6 +81,33 @@ export function jobNameTaken(name: string, opts?: {
72
81
  export function nextFreeJobName(origin: string, runJobs: Iterable<string>, opts?: {
73
82
  jobsDir?: string;
74
83
  }): string;
84
+ /**
85
+ * The card's Inputs as the JOB reads them: the one place that decides which lines are inputs (hamr 2026-11-14, piece 5): the fresh card, the session, the
86
+ * Destination check and Reuse (`buildReuseSpec`) all read THIS, never a copy.
87
+ * @param {any} card
88
+ * @param {{rubric?: boolean, flowType?: 'plain'|'mcp'|'tickets'}} [o]
89
+ * @returns {{ok: true, inputs: import('../jobblock.js').JobInput[]}|{ok: false, error: string}}
90
+ */
91
+ export function cardInputs(card: any, o?: {
92
+ rubric?: boolean;
93
+ flowType?: "plain" | "mcp" | "tickets";
94
+ }): {
95
+ ok: true;
96
+ inputs: import("../jobblock.js").JobInput[];
97
+ } | {
98
+ ok: false;
99
+ error: string;
100
+ };
101
+ /**
102
+ * The renumbering itself, for a caller that holds parsed lines already (`startSession`): a Tickets + rubric job reads the ticket and nothing else (a repo line is
103
+ * not an input of it), so the ticket line stands alone, numbered 1 (a signed spec's inputs must run 1, 2, 3...). Any other job keeps its lines as typed.
104
+ * @param {import('../jobblock.js').JobInput[]} inputs @param {{rubric: boolean, flowType: 'plain'|'mcp'|'tickets'}} o
105
+ * @returns {import('../jobblock.js').JobInput[]}
106
+ */
107
+ export function ticketRubricInputs(inputs: import("../jobblock.js").JobInput[], { rubric, flowType }: {
108
+ rubric: boolean;
109
+ flowType: "plain" | "mcp" | "tickets";
110
+ }): import("../jobblock.js").JobInput[];
75
111
  /**
76
112
  * The repo a card names: Inputs line 1 (P7 — the Source box is gone; the first input IS the repo). `''` when the Inputs
77
113
  * box does not parse (the card validator refuses that before anything uses this).
@@ -206,8 +242,8 @@ export function validateJobCard(card: any, opts?: {
206
242
  * `signPrepare()` are the only ways in.
207
243
  * @param {any} card the validated job card (see {@link validateJobCard})
208
244
  * @param {{env?: Record<string,string|undefined>, sessionsRoot?: string, home?: string, timeoutMs?: number,
209
- * scout?: any, generate?: Function, pickGenerate?: Function|null, carryFrom?: string, carryKind?: string, confirmGenerate?: Function, authorFn?: Function,
210
- * prepareSigningFn?: Function, npmCiFn?: Function, lookFn?: Function|null, fitFn?: Function|null, destFn?: Function|null, fetchUrl?: (url: string) => Promise<{ok: true, text: string, url: string}|{ok: false, error: string}>, draftThinking?: "on"|"off", reuse?: {spec: any, workflowKey: string}, schedule?: import('../trigger.js').Trigger|null, flow?: {flowType: 'plain'|'mcp'|'tickets', pick: {server: string, tools: string[]}|null}}} [deps] `scout`..`prepareSigningFn` are
245
+ * scout?: any, generate?: Function, pickGenerate?: Function|null, ledgerGenerate?: Function|null, noteFn?: Function|null, editGenerate?: Function|null, carryFrom?: string, carryKind?: string, confirmGenerate?: Function, authorFn?: Function,
246
+ * prepareSigningFn?: Function, npmCiFn?: Function, lookFn?: Function|null, destFn?: Function|null, newestUnrunTicket?: typeof newestUnrunTicket, readTicketFn?: typeof readTicket, fetchUrl?: (url: string) => Promise<{ok: true, text: string, url: string}|{ok: false, error: string}>, draftThinking?: "on"|"off", reuse?: {spec: any, workflowKey: string}, schedule?: import('../trigger.js').Trigger|null, flow?: {flowType: 'plain'|'mcp'|'tickets', pick: {server: string, tools: string[]}|null}}} [deps] `scout`..`prepareSigningFn` are
211
247
  * TEST SEAMS ONLY — see the note just above where each is read, below. `reuse` (Reuse workflow) is NOT a seam: the
212
248
  * caller (`/api/author/start`) sets it only when the server's own same-job rule held.
213
249
  * @returns {any} the session object
@@ -220,6 +256,9 @@ export function createSession(card: any, deps?: {
220
256
  scout?: any;
221
257
  generate?: Function;
222
258
  pickGenerate?: Function | null;
259
+ ledgerGenerate?: Function | null;
260
+ noteFn?: Function | null;
261
+ editGenerate?: Function | null;
223
262
  carryFrom?: string;
224
263
  carryKind?: string;
225
264
  confirmGenerate?: Function;
@@ -227,8 +266,9 @@ export function createSession(card: any, deps?: {
227
266
  prepareSigningFn?: Function;
228
267
  npmCiFn?: Function;
229
268
  lookFn?: Function | null;
230
- fitFn?: Function | null;
231
269
  destFn?: Function | null;
270
+ newestUnrunTicket?: typeof newestUnrunTicket;
271
+ readTicketFn?: typeof readTicket;
232
272
  fetchUrl?: (url: string) => Promise<{
233
273
  ok: true;
234
274
  text: string;
@@ -277,7 +317,7 @@ export const CARD_FIELDS: readonly string[];
277
317
  /**
278
318
  * REUSE WORKFLOW, ONE DOOR (RULED 2026-10-15, v1.101; replaces v1.88's five open boxes). Every box on the card is open. What decides
279
319
  * the path is the CARD compared with the origin run's card, never the drafted spec: the JOB boxes are the job text (numbered lines,
280
- * `~` rules, `~ PASS`/`~ FAIL`), the check type and the thinking tick. The RUN boxes (Inputs, Destination, Model, $ cap, Time cap)
320
+ * `~` rules), the check type and the thinking tick. The RUN boxes (Inputs, Destination, Model, $ cap, Time cap)
281
321
  * never decide it. A green origin with no job box changed reuses the signed plan verbatim (no drafting); anything else drafts.
282
322
  */
283
323
  export const JOB_BOXES: readonly string[];
@@ -292,6 +332,8 @@ export type StepLine = {
292
332
  detail: string;
293
333
  };
294
334
  import { planFromConfirm } from './jobplan.js';
335
+ import { newestUnrunTicket } from '../ticketnext.js';
336
+ import { readTicket } from '../ticket.js';
295
337
  import { thinkingRowText } from '../thinking.js';
296
338
  import { nonRepoSourceMessage } from '../source.js';
297
339
  export { thinkingRowText, nonRepoSourceMessage };
@@ -75,7 +75,7 @@ export function buildJobGrid({ entries, scheduleLine }: {
75
75
  anyway: boolean;
76
76
  name: string;
77
77
  ref: string;
78
- bucket: "done" | "stop" | "skip" | "wait";
78
+ bucket: "done" | "skip" | "stop" | "wait";
79
79
  status: {
80
80
  key: string;
81
81
  sign: string;
@@ -111,7 +111,7 @@ export function buildJobGrid({ entries, scheduleLine }: {
111
111
  anyway: boolean;
112
112
  name: string;
113
113
  ref: string;
114
- bucket: "done" | "stop" | "skip" | "wait";
114
+ bucket: "done" | "skip" | "stop" | "wait";
115
115
  status: {
116
116
  key: string;
117
117
  sign: string;
@@ -151,7 +151,7 @@ export function buildJobGrid({ entries, scheduleLine }: {
151
151
  anyway: boolean;
152
152
  name: string;
153
153
  ref: string;
154
- bucket: "done" | "stop" | "skip" | "wait";
154
+ bucket: "done" | "skip" | "stop" | "wait";
155
155
  status: {
156
156
  key: string;
157
157
  sign: string;
@@ -187,7 +187,7 @@ export function buildJobGrid({ entries, scheduleLine }: {
187
187
  anyway: boolean;
188
188
  name: string;
189
189
  ref: string;
190
- bucket: "done" | "stop" | "skip" | "wait";
190
+ bucket: "done" | "skip" | "stop" | "wait";
191
191
  status: {
192
192
  key: string;
193
193
  sign: string;
@@ -227,7 +227,7 @@ export function buildJobGrid({ entries, scheduleLine }: {
227
227
  anyway: boolean;
228
228
  name: string;
229
229
  ref: string;
230
- bucket: "done" | "stop" | "skip" | "wait";
230
+ bucket: "done" | "skip" | "stop" | "wait";
231
231
  status: {
232
232
  key: string;
233
233
  sign: string;
@@ -263,7 +263,7 @@ export function buildJobGrid({ entries, scheduleLine }: {
263
263
  anyway: boolean;
264
264
  name: string;
265
265
  ref: string;
266
- bucket: "done" | "stop" | "skip" | "wait";
266
+ bucket: "done" | "skip" | "stop" | "wait";
267
267
  status: {
268
268
  key: string;
269
269
  sign: string;
@@ -303,7 +303,7 @@ export function buildJobGrid({ entries, scheduleLine }: {
303
303
  anyway: boolean;
304
304
  name: string;
305
305
  ref: string;
306
- bucket: "done" | "stop" | "skip" | "wait";
306
+ bucket: "done" | "skip" | "stop" | "wait";
307
307
  status: {
308
308
  key: string;
309
309
  sign: string;
@@ -339,7 +339,7 @@ export function buildJobGrid({ entries, scheduleLine }: {
339
339
  anyway: boolean;
340
340
  name: string;
341
341
  ref: string;
342
- bucket: "done" | "stop" | "skip" | "wait";
342
+ bucket: "done" | "skip" | "stop" | "wait";
343
343
  status: {
344
344
  key: string;
345
345
  sign: string;
@@ -5,26 +5,25 @@
5
5
  * @returns {'machine check'|'judge'|null}
6
6
  */
7
7
  export function checkClassOfKind(kind: unknown): "machine check" | "judge" | null;
8
- /**
9
- * The `~` rules of one job line, each on its own (the page draws one `~` row per rule): the line's own `rules` array when it
10
- * has one (a rule may itself contain "; "), else the joined `rule` split on "; " (an older line that saved only the join).
11
- * @param {any} l @returns {string[]}
12
- */
13
- export function rulesOfLine(l: any): string[];
14
8
  /**
15
9
  * The plan of a SIGNED spec. With `jobLines`, each stage lands under EACH line its `fromLine` array names (a stage with none is
16
10
  * a mandatory guard: "Always checked"), `closeDecl.refused` reasons land under their line, and `closeDecl.notes` are the
17
11
  * drafter's own "not checked" words. Without `jobLines` (a spec that predates the job block) the signed goal sentence is
18
12
  * line 1 and every stage name is a check under it — `older: true`.
13
+ * `ledger` = the draft log's final check-list rows (`readDraftLedger`), the words a Not checked row is named by; absent (no draft log) a row is named from its key.
19
14
  * @param {any} spec
15
+ * @param {{key: string, words: string[]}[]|null} [ledger]
20
16
  * @returns {JobPlan}
21
17
  */
22
- export function planFromSpec(spec: any): JobPlan;
18
+ export function planFromSpec(spec: any, ledger?: {
19
+ key: string;
20
+ words: string[];
21
+ }[] | null): JobPlan;
23
22
  /**
24
23
  * The plan of the confirm turn, before anything is drafted: the person's own job lines, the model's checks under the
25
24
  * line each names, its own "not checked" words, and the real protections (code-owned) as "Always checked".
26
25
  * @param {{n: number, text: string, rule: string, rules?: string[]}[]|null|undefined} jobLines
27
- * @param {{checkItems?: {text: string, fromLine: number[]|null, by?: 'agent'|'you'|null}[], checks?: string[], notChecked?: string[], protections?: string[], signedFacts?: string[], ticketFilter?: any, picked?: {line: number, text: string}[]}} plan
26
+ * @param {{checkItems?: {text: string, fromLine: number[]|null, by?: 'agent'|'you'|'default'|null, key?: string}[], checks?: string[], notChecked?: string[], protections?: string[], signedFacts?: string[], ticketFilter?: any, picked?: {line: number, text: string}[], notCheckedBy?: Record<string, 'you'|'agent'|'default'>, suggested?: {key: string, line: number, text: string}[], editable?: boolean}} plan
28
27
  * `signedFacts` = the names of the facts the look signs (so an S1 copy of a signed fact reads as a note, not Not checked)
29
28
  * @returns {JobPlan}
30
29
  */
@@ -37,7 +36,8 @@ export function planFromConfirm(jobLines: {
37
36
  checkItems?: {
38
37
  text: string;
39
38
  fromLine: number[] | null;
40
- by?: "agent" | "you" | null;
39
+ by?: "agent" | "you" | "default" | null;
40
+ key?: string;
41
41
  }[];
42
42
  checks?: string[];
43
43
  notChecked?: string[];
@@ -48,11 +48,42 @@ export function planFromConfirm(jobLines: {
48
48
  line: number;
49
49
  text: string;
50
50
  }[];
51
+ notCheckedBy?: Record<string, "you" | "agent" | "default">;
52
+ suggested?: {
53
+ key: string;
54
+ line: number;
55
+ text: string;
56
+ }[];
57
+ editable?: boolean;
51
58
  }): JobPlan;
59
+ /**
60
+ * The Audit's check list (hamr ruling A, 2026-11-13): the SAME sections as the card, read from the SAME model (`plan` = {@link planFromSpec}'s, plus `guards` = the
61
+ * code-owned protections the confirm card shows), each row with its tag and, after the run, its result. A check's result is the recorded verdict of its own signed stage
62
+ * (`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).
63
+ * 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
64
+ * (`held · N writes blocked`), or `null` when the run's gate record is missing (said in plain words, never "held").
65
+ * @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
66
+ * @returns {{checks: AuditRow[], notChecked: AuditRow[], always: AuditRow[]}}
67
+ */
68
+ export function auditChecksOf(plan: JobPlan, guards: string[], results: Map<string, boolean> | null, blocked?: number | null, closeRan?: boolean): {
69
+ checks: AuditRow[];
70
+ notChecked: AuditRow[];
71
+ always: AuditRow[];
72
+ };
73
+ /** the words of a row the run recorded no verdict for: never "passed" */
74
+ export const AUDIT_NO_RESULT: "no result recorded";
75
+ export type AuditRow = {
76
+ text: string;
77
+ by: "agent" | "you" | "default" | null;
78
+ result: "passed" | "failed" | "none" | "not-reached" | "not-checked" | "held" | "record-missing";
79
+ word?: string;
80
+ };
52
81
  export type PlanCheck = {
53
82
  name: string;
54
83
  cls: "machine check" | "judge" | null;
55
- by?: "agent" | "you" | null;
84
+ by?: "agent" | "you" | "default" | null;
85
+ key?: string;
86
+ stage?: string;
56
87
  };
57
88
  export type PlanLine = {
58
89
  n: number;
@@ -73,4 +104,11 @@ export type JobPlan = {
73
104
  older: boolean;
74
105
  goal?: string;
75
106
  ticketFilter?: string;
107
+ notCheckedBy?: Record<string, "you" | "agent" | "default">;
108
+ suggested?: {
109
+ key: string;
110
+ line: number;
111
+ text: string;
112
+ }[];
113
+ editable?: boolean;
76
114
  };
@@ -361,7 +361,7 @@ export function getJobGrid(runid: string, opts?: {
361
361
  anyway: boolean;
362
362
  name: string;
363
363
  ref: string;
364
- bucket: "done" | "stop" | "skip" | "wait";
364
+ bucket: "done" | "skip" | "stop" | "wait";
365
365
  status: {
366
366
  key: string;
367
367
  sign: string;
@@ -397,7 +397,7 @@ export function getJobGrid(runid: string, opts?: {
397
397
  anyway: boolean;
398
398
  name: string;
399
399
  ref: string;
400
- bucket: "done" | "stop" | "skip" | "wait";
400
+ bucket: "done" | "skip" | "stop" | "wait";
401
401
  status: {
402
402
  key: string;
403
403
  sign: string;
@@ -437,7 +437,7 @@ export function getJobGrid(runid: string, opts?: {
437
437
  anyway: boolean;
438
438
  name: string;
439
439
  ref: string;
440
- bucket: "done" | "stop" | "skip" | "wait";
440
+ bucket: "done" | "skip" | "stop" | "wait";
441
441
  status: {
442
442
  key: string;
443
443
  sign: string;
@@ -473,7 +473,7 @@ export function getJobGrid(runid: string, opts?: {
473
473
  anyway: boolean;
474
474
  name: string;
475
475
  ref: string;
476
- bucket: "done" | "stop" | "skip" | "wait";
476
+ bucket: "done" | "skip" | "stop" | "wait";
477
477
  status: {
478
478
  key: string;
479
479
  sign: string;
@@ -513,7 +513,7 @@ export function getJobGrid(runid: string, opts?: {
513
513
  anyway: boolean;
514
514
  name: string;
515
515
  ref: string;
516
- bucket: "done" | "stop" | "skip" | "wait";
516
+ bucket: "done" | "skip" | "stop" | "wait";
517
517
  status: {
518
518
  key: string;
519
519
  sign: string;
@@ -549,7 +549,7 @@ export function getJobGrid(runid: string, opts?: {
549
549
  anyway: boolean;
550
550
  name: string;
551
551
  ref: string;
552
- bucket: "done" | "stop" | "skip" | "wait";
552
+ bucket: "done" | "skip" | "stop" | "wait";
553
553
  status: {
554
554
  key: string;
555
555
  sign: string;
@@ -589,7 +589,7 @@ export function getJobGrid(runid: string, opts?: {
589
589
  anyway: boolean;
590
590
  name: string;
591
591
  ref: string;
592
- bucket: "done" | "stop" | "skip" | "wait";
592
+ bucket: "done" | "skip" | "stop" | "wait";
593
593
  status: {
594
594
  key: string;
595
595
  sign: string;
@@ -625,7 +625,7 @@ export function getJobGrid(runid: string, opts?: {
625
625
  anyway: boolean;
626
626
  name: string;
627
627
  ref: string;
628
- bucket: "done" | "stop" | "skip" | "wait";
628
+ bucket: "done" | "skip" | "stop" | "wait";
629
629
  status: {
630
630
  key: string;
631
631
  sign: string;
@@ -735,9 +735,17 @@ export function getRunResult(runid: string, opts?: {
735
735
  scopeLine: string | null;
736
736
  } | null;
737
737
  checks: {
738
+ head: string;
739
+ passed: number;
740
+ total: number;
741
+ allPassed: boolean;
742
+ stages: any[];
743
+ notes: never[];
744
+ } | {
738
745
  head: string;
739
746
  passed: any;
740
747
  total: any;
748
+ notReached: number;
741
749
  allPassed: boolean;
742
750
  stages: any;
743
751
  notes: any;
@@ -763,11 +771,6 @@ export function getRunResult(runid: string, opts?: {
763
771
  ask: string;
764
772
  };
765
773
  } | {
766
- runid: string;
767
- lines: any[];
768
- pages: string[];
769
- pageNote: string | null;
770
- notChecked: string[];
771
774
  readNotes: string[];
772
775
  door: {
773
776
  head: "waiting for you";
@@ -786,6 +789,12 @@ export function getRunResult(runid: string, opts?: {
786
789
  more: number;
787
790
  moreText: string | null;
788
791
  } | null;
792
+ notCheckedBy?: Record<string, "you" | "agent" | "default"> | undefined;
793
+ runid: string;
794
+ lines: any[];
795
+ pages: string[];
796
+ pageNote: string | null;
797
+ notChecked: string[];
789
798
  } | null;
790
799
  /**
791
800
  * `GET /api/runs/:runid/download?i=<n>` — delivered file `n` (an index into the run's own `destination-written` list), or why not. The path is
@@ -919,13 +928,13 @@ export function callsLineOf(records: any[], behaviour: {
919
928
  denied: number;
920
929
  } | null): string;
921
930
  /**
922
- * "16 run · 8 passed · 8 failed (write-flight-facts tries 1-5, then tries 1-3)" — counts of what ran, never a fraction (the "checks N/M"
923
- * headline stays withdrawn). Every `exit-eval` result plus every graded `outer-close` stage; the parenthesis names the steps and try ranges
924
- * that failed, from the same `tries[]` the Audit reads. A run with neither says `not recorded`.
925
- * @param {any[]} records the run's raw spine @param {any[]|null|undefined} parts the enriched parts
931
+ * "3 run · 3 passed · 0 failed" (+ " · N not reached") — counts of what the run's LATEST close ran, never a fraction (the "checks N/M" headline stays withdrawn).
932
+ * Read from {@link checksOf}, the one owner the Audit checks fold and the Result checks box read (live run mwg3pov1): the last staged close, a stage it never reached counts as
933
+ * neither passed nor failed, and a run no close reached falls back to the checks its steps ran. No history of earlier tries. A run with neither says `not recorded`.
934
+ * @param {any[]} records the run's raw spine @param {any} spec the run's signed spec (names the stages the close declares)
926
935
  * @returns {string}
927
936
  */
928
- export function checksLineOf(records: any[], parts: any[] | null | undefined): string;
937
+ export function checksLineOf(records: any[], spec: any): string;
929
938
  /**
930
939
  * The step card's extra line (PRD v1.106 Part 5 G): "5 tries · last try: 1 check passed, 1 failed", with the cut-off try named when there is one
931
940
  * ("4 tries (the 4th cut off before its checks ran) · last try: no checks ran"). Words for what passed and failed, never a fraction. `null`
@@ -110,6 +110,11 @@ export const STATUS: Readonly<{
110
110
  word: "skipped";
111
111
  }>;
112
112
  }>;
113
+ /** a close stage the run's LATEST close never reached (it stops at the first red): the [·] sign, grey, never the precheck's old reading. Beside STATUS, not in it: it is a stage's standing, never a run's status */
114
+ export const NOT_REACHED: Readonly<{
115
+ sign: "·";
116
+ word: "not reached";
117
+ }>;
113
118
  /**
114
119
  * PRD v1.106 Part 5 (C, choice 9): the review door's words, ONE table. The door is the only human step bareloop has; there is no "you
115
120
  * cancelled" (cancel is deleted). `decision` is the spine's `door-decision.decision`, or null while nothing has been decided.
@@ -10,9 +10,9 @@ export function lineKeys(lines: {
10
10
  occurrence: number;
11
11
  }>;
12
12
  /**
13
- * The entries for answers just given, numbered on THIS card (the answer redraft's card: its line and rule numbers are the ones the asks carried).
13
+ * The entries for answers just given, numbered on THIS card (the answer redraft's card: its line and rule numbers are the ones the asks carried; the rule's text is the FINAL rule's words).
14
14
  * @param {{n: number, text: string}[]} lines @param {Rule[]} rules
15
- * @param {{line: number, rule: number, check?: Record<string, any>|null, added?: string|null, own?: boolean}[]} picks @param {{line: number, rule: number}[]} left
15
+ * @param {{line: number, rule: number, check?: Record<string, any>|null, own?: boolean}[]} picks @param {{line: number, rule: number}[]} left
16
16
  * @returns {Entry[]}
17
17
  */
18
18
  export function entriesFromAnswers(lines: {
@@ -22,7 +22,6 @@ export function entriesFromAnswers(lines: {
22
22
  line: number;
23
23
  rule: number;
24
24
  check?: Record<string, any> | null;
25
- added?: string | null;
26
25
  own?: boolean;
27
26
  }[], left: {
28
27
  line: number;
@@ -30,12 +29,11 @@ export function entriesFromAnswers(lines: {
30
29
  }[]): Entry[];
31
30
  /**
32
31
  * Decide, for the card in hand, which stored picks are kept and which guardrails must be asked.
33
- * A pick is KEPT when the job line with its words (same order among equal lines) still has its source guardrail with the exact words and, if the pick wrote a `~` line,
34
- * that line with its exact words too. Otherwise the pick is dropped (never partly kept) and its guardrails are asked: a pair broken on one side is ONE ask, so the
35
- * partner left on the card is folded (neither asked nor given the old check) - except an EDITED added line (M10 am21): that one is asked (`pairRule` = its source's number) and the source is folded. Pure.
32
+ * A pick is KEPT when the job line with its words (same order among equal lines) still has a guardrail with the pick's exact words. One rule in, one rule out (hamr 2026-11-14): an answer REPLACED the
33
+ * rule it was asked about, so the stored words are the final rule's words and there is no second line to pair; a rule whose words changed is simply new and asked. Pure.
36
34
  * @param {Entry[]} entries @param {{n: number, text: string}[]} lines @param {Rule[]} rules every guardrail the call settles
37
- * @returns {{picks: {line: number, rule: number, check: Record<string, any>|null, added?: string, own?: boolean}[], left: {line: number, rule: number}[],
38
- * kept: {line: number, rule: number, entry: Entry}[], askRules: (Rule & {pairRule?: number})[]}}
35
+ * @returns {{picks: {line: number, rule: number, check: Record<string, any>|null, own?: boolean}[], left: {line: number, rule: number}[],
36
+ * kept: {line: number, rule: number, entry: Entry}[], askRules: Rule[]}}
39
37
  */
40
38
  export function matchRecord(entries: Entry[], lines: {
41
39
  n: number;
@@ -45,7 +43,6 @@ export function matchRecord(entries: Entry[], lines: {
45
43
  line: number;
46
44
  rule: number;
47
45
  check: Record<string, any> | null;
48
- added?: string;
49
46
  own?: boolean;
50
47
  }[];
51
48
  left: {
@@ -57,15 +54,25 @@ export function matchRecord(entries: Entry[], lines: {
57
54
  rule: number;
58
55
  entry: Entry;
59
56
  }[];
60
- askRules: (Rule & {
61
- pairRule?: number;
62
- })[];
57
+ askRules: Rule[];
63
58
  };
64
59
  /**
65
60
  * Read a carried record (the session folder's file). A missing or unreadable file is no record (a draft from before R10 has none).
66
61
  * @param {string} file @returns {Entry[]|null}
67
62
  */
68
63
  export function readRecordFile(file: string): Entry[] | null;
64
+ /**
65
+ * The Drop/Add choices a draft's person made on the confirm card (hamr 2026-11-13, N-2), carried the same way as the picks: tied to the line's words and the row's own name, never to a number.
66
+ * @param {string} file @returns {{lineWords: string, occurrence: number, tail: string, choice: string}[]|null}
67
+ */
68
+ export function readRowChoices(file: string): {
69
+ lineWords: string;
70
+ occurrence: number;
71
+ tail: string;
72
+ choice: string;
73
+ }[] | null;
74
+ /** write a part of the record without losing the other: `patch` is `{picks}` or `{rowChoices}` @param {string} file @param {Record<string, any>} patch */
75
+ export function writeRecordPart(file: string, patch: Record<string, any>): void;
69
76
  /** the record's file, inside a drafting session folder only (never a run folder) */
70
77
  export const RECORD_FILE: "picks-record.json";
71
78
  /** the exact words a kept pick is marked with in the draft log, the Audit and the plan card (M10 am17 (6)) */
@@ -76,7 +83,7 @@ export type Entry = {
76
83
  lineWords: string;
77
84
  occurrence: number;
78
85
  ruleText: string;
79
- added: string | null;
86
+ added?: string | null;
80
87
  check: Record<string, any> | null;
81
88
  own: boolean;
82
89
  left: boolean;