bareloop 0.54.1 → 0.56.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 (149) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/bareloop.context.md +67 -6
  3. package/package.json +3 -3
  4. package/src/authorflow.js +217 -238
  5. package/src/authoring.js +22 -6
  6. package/src/authorjob.js +138 -30
  7. package/src/authorreadout.js +15 -4
  8. package/src/authorrun.js +13 -4
  9. package/src/authorscout.js +9 -6
  10. package/src/behaviour.js +14 -0
  11. package/src/blockasks.js +43 -0
  12. package/src/cardschedule.js +42 -0
  13. package/src/checkblock.js +772 -0
  14. package/src/checklist.js +128 -0
  15. package/src/checkpick.js +294 -0
  16. package/src/checksuggest.js +28 -0
  17. package/src/checkwords.js +27 -0
  18. package/src/cli.js +1 -1
  19. package/src/config.js +24 -1
  20. package/src/declaredclose.js +30 -1
  21. package/src/destpoint.js +151 -0
  22. package/src/draftspend.js +85 -0
  23. package/src/facts.js +8 -1
  24. package/src/factwords.js +14 -1
  25. package/src/fitcheck.js +5 -3
  26. package/src/job.js +81 -1
  27. package/src/jobblock.js +9 -0
  28. package/src/labelscan.js +11 -0
  29. package/src/launcher.js +3 -2
  30. package/src/mcpchecks.js +52 -0
  31. package/src/mcppick.js +36 -0
  32. package/src/mcpsources.js +77 -0
  33. package/src/mcpuse.js +97 -0
  34. package/src/natural.js +23 -0
  35. package/src/pagemap.js +20 -5
  36. package/src/panel/authorroutes.js +105 -18
  37. package/src/panel/authorsession.js +293 -44
  38. package/src/panel/index.html +873 -41
  39. package/src/panel/jobgrid.js +117 -0
  40. package/src/panel/jobplan.js +103 -35
  41. package/src/panel/scheduler.js +80 -13
  42. package/src/panel/schedules.js +189 -28
  43. package/src/panel/schedulestart.js +44 -13
  44. package/src/panel/server.js +471 -39
  45. package/src/panel/settingsroutes.js +133 -3
  46. package/src/panel/status.js +19 -1
  47. package/src/panel/tickets.js +44 -0
  48. package/src/pickrecord.js +163 -0
  49. package/src/placerule.js +355 -0
  50. package/src/plan.js +31 -2
  51. package/src/planrun.js +71 -15
  52. package/src/prcheckout.js +259 -0
  53. package/src/promptregisters.js +11 -0
  54. package/src/questionbox.js +112 -0
  55. package/src/readshim.js +3 -2
  56. package/src/revises.js +56 -0
  57. package/src/rowedit.js +115 -0
  58. package/src/rubricstep.js +265 -132
  59. package/src/run.js +19 -2
  60. package/src/runexport.js +2 -0
  61. package/src/runlist.js +3 -2
  62. package/src/schedulewords.js +46 -4
  63. package/src/source.js +81 -7
  64. package/src/stepmcp.js +86 -0
  65. package/src/ticket.js +113 -0
  66. package/src/ticketfilter.js +76 -0
  67. package/src/ticketlabels.js +79 -0
  68. package/src/ticketmcp.js +111 -0
  69. package/src/ticketnext.js +35 -0
  70. package/src/ticketrepo.js +98 -0
  71. package/src/ticketschedule.js +32 -0
  72. package/src/ticketshape.js +45 -0
  73. package/src/tools.js +9 -0
  74. package/src/trigger.js +14 -2
  75. package/src/triggerclock.js +7 -3
  76. package/src/triggerfiles.js +19 -11
  77. package/src/triggertickets.js +244 -0
  78. package/src/userrun.js +191 -10
  79. package/src/validate.js +3 -1
  80. package/src/worktree.js +43 -1
  81. package/types/authorflow.d.ts +86 -93
  82. package/types/authorjob.d.ts +35 -4
  83. package/types/authorreadout.d.ts +4 -3
  84. package/types/authorscout.d.ts +4 -2
  85. package/types/behaviour.d.ts +12 -0
  86. package/types/blockasks.d.ts +37 -0
  87. package/types/cardschedule.d.ts +24 -0
  88. package/types/checkblock.d.ts +361 -0
  89. package/types/checklist.d.ts +134 -0
  90. package/types/checkpick.d.ts +160 -0
  91. package/types/checksuggest.d.ts +30 -0
  92. package/types/checkwords.d.ts +14 -0
  93. package/types/config.d.ts +7 -0
  94. package/types/declaredclose.d.ts +4 -0
  95. package/types/destpoint.d.ts +89 -0
  96. package/types/draftspend.d.ts +37 -0
  97. package/types/factwords.d.ts +7 -0
  98. package/types/fitcheck.d.ts +7 -1
  99. package/types/job.d.ts +13 -0
  100. package/types/jobblock.d.ts +9 -0
  101. package/types/labelscan.d.ts +7 -0
  102. package/types/launcher.d.ts +2 -2
  103. package/types/mcpchecks.d.ts +8 -0
  104. package/types/mcppick.d.ts +33 -0
  105. package/types/mcpsources.d.ts +51 -0
  106. package/types/mcpuse.d.ts +15 -0
  107. package/types/natural.d.ts +2 -0
  108. package/types/pagemap.d.ts +6 -1
  109. package/types/panel/authorroutes.d.ts +11 -2
  110. package/types/panel/authorsession.d.ts +69 -3
  111. package/types/panel/jobgrid.d.ts +405 -0
  112. package/types/panel/jobplan.d.ts +55 -11
  113. package/types/panel/scheduler.d.ts +7 -2
  114. package/types/panel/schedules.d.ts +124 -4
  115. package/types/panel/schedulestart.d.ts +21 -3
  116. package/types/panel/server.d.ts +432 -10
  117. package/types/panel/settingsroutes.d.ts +4 -2
  118. package/types/panel/status.d.ts +16 -2
  119. package/types/panel/tickets.d.ts +61 -0
  120. package/types/pickrecord.d.ts +100 -0
  121. package/types/placerule.d.ts +194 -0
  122. package/types/plan.d.ts +1 -0
  123. package/types/prcheckout.d.ts +151 -0
  124. package/types/questionbox.d.ts +87 -0
  125. package/types/readshim.d.ts +4 -3
  126. package/types/revises.d.ts +23 -0
  127. package/types/rowedit.d.ts +32 -0
  128. package/types/rubricstep.d.ts +100 -48
  129. package/types/run.d.ts +27 -1
  130. package/types/runlist.d.ts +6 -3
  131. package/types/schedulewords.d.ts +29 -2
  132. package/types/source.d.ts +40 -4
  133. package/types/stepmcp.d.ts +40 -0
  134. package/types/ticket.d.ts +114 -0
  135. package/types/ticketfilter.d.ts +34 -0
  136. package/types/ticketlabels.d.ts +44 -0
  137. package/types/ticketmcp.d.ts +84 -0
  138. package/types/ticketnext.d.ts +33 -0
  139. package/types/ticketrepo.d.ts +118 -0
  140. package/types/ticketschedule.d.ts +21 -0
  141. package/types/ticketshape.d.ts +37 -0
  142. package/types/tools.d.ts +1 -0
  143. package/types/trigger.d.ts +9 -1
  144. package/types/triggerclock.d.ts +6 -2
  145. package/types/triggerfiles.d.ts +13 -5
  146. package/types/triggertickets.d.ts +110 -0
  147. package/types/userrun.d.ts +50 -0
  148. package/types/validate.d.ts +1 -0
  149. package/types/worktree.d.ts +19 -0
@@ -0,0 +1,405 @@
1
+ /**
2
+ * ONE decider of a run's bucket: its status key through {@link GROUP_OF}; a run waiting at its review door (the run list's own `needs: 'Accept'`) needs the person, whatever its status.
3
+ * Anything the table does not know reads as Stopped.
4
+ * @param {string|null|undefined} statusKey @param {'Accept'|'Resume'|null|undefined} needs @returns {'wait'|'stop'|'done'|'skip'}
5
+ */
6
+ export function bucketOf(statusKey: string | null | undefined, needs: "Accept" | "Resume" | null | undefined): "wait" | "stop" | "done" | "skip";
7
+ /**
8
+ * A money figure in the panel's one spelling: `at least $0.08` when only a floor is known, `unknown` when nothing is (never `$0.00` for unknown).
9
+ * @param {number|null} usd @param {boolean} complete
10
+ */
11
+ export function moneyWords(usd: number | null, complete: boolean): string;
12
+ /**
13
+ * The stats line's money: the sum of the rows' money; a floor when any row's figure is a floor or unknown; `usd: null` = nothing is known.
14
+ * @param {Array<{usd: number|null, complete: boolean}>} moneys
15
+ */
16
+ export function sumMoney(moneys: Array<{
17
+ usd: number | null;
18
+ complete: boolean;
19
+ }>): {
20
+ usd: number | null;
21
+ complete: boolean;
22
+ };
23
+ /**
24
+ * One run's money: the run list's own figure (complete unless it says the figure is a floor), else the live/died floor, else unknown.
25
+ * @param {{spentUsd?: unknown, spendComplete?: unknown, spendFloorUsd?: unknown}} e
26
+ */
27
+ export function entryMoney(e: {
28
+ spentUsd?: unknown;
29
+ spendComplete?: unknown;
30
+ spendFloorUsd?: unknown;
31
+ }): {
32
+ usd: number;
33
+ complete: boolean;
34
+ } | {
35
+ usd: null;
36
+ complete: boolean;
37
+ };
38
+ /**
39
+ * The grid of one ticket job: every run a row in its bucket, newest first inside each bucket, and the stats line's numbers.
40
+ * @param {{entries: Array<{runId: string, runNo?: number|null, at: number|null, statusKey: string, sign: string, word: string, needs: 'Accept'|'Resume'|null, unsure?: boolean, number: number|null, title: string|null, url: string|null,
41
+ * steps: {done: number, total: number}|null, checks: {passed: number, total: number}|null, spentUsd: number|null, spendComplete: boolean, spendFloorUsd: number|null, wall: string|null, reason: string|null}>,
42
+ * scheduleLine?: string|null}} a
43
+ */
44
+ export function buildJobGrid({ entries, scheduleLine }: {
45
+ entries: Array<{
46
+ runId: string;
47
+ runNo?: number | null;
48
+ at: number | null;
49
+ statusKey: string;
50
+ sign: string;
51
+ word: string;
52
+ needs: "Accept" | "Resume" | null;
53
+ unsure?: boolean;
54
+ number: number | null;
55
+ title: string | null;
56
+ url: string | null;
57
+ steps: {
58
+ done: number;
59
+ total: number;
60
+ } | null;
61
+ checks: {
62
+ passed: number;
63
+ total: number;
64
+ } | null;
65
+ spentUsd: number | null;
66
+ spendComplete: boolean;
67
+ spendFloorUsd: number | null;
68
+ wall: string | null;
69
+ reason: string | null;
70
+ }>;
71
+ scheduleLine?: string | null;
72
+ }): {
73
+ groups: ({
74
+ rows: ({
75
+ anyway: boolean;
76
+ name: string;
77
+ ref: string;
78
+ bucket: "done" | "skip" | "stop" | "wait";
79
+ status: {
80
+ key: string;
81
+ sign: string;
82
+ word: string;
83
+ };
84
+ needs: "Accept" | "Resume" | null;
85
+ at: number | null;
86
+ steps: {
87
+ mark: "g" | "r" | "q" | "n";
88
+ text: string;
89
+ };
90
+ checks: {
91
+ mark: "g" | "r" | "q" | "n";
92
+ text: string;
93
+ };
94
+ cost: {
95
+ mark: string;
96
+ text: string;
97
+ };
98
+ time: {
99
+ mark: string;
100
+ text: string;
101
+ };
102
+ reason: string | null;
103
+ unsure: boolean;
104
+ unsureSay: string;
105
+ runId: string;
106
+ runNo: number | null;
107
+ number: number | null;
108
+ title: string | null;
109
+ url: string | null;
110
+ } | {
111
+ anyway: boolean;
112
+ name: string;
113
+ ref: string;
114
+ bucket: "done" | "skip" | "stop" | "wait";
115
+ status: {
116
+ key: string;
117
+ sign: string;
118
+ word: string;
119
+ };
120
+ needs: "Accept" | "Resume" | null;
121
+ at: number | null;
122
+ steps: {
123
+ mark: "g" | "r" | "q" | "n";
124
+ text: string;
125
+ };
126
+ checks: {
127
+ mark: "g" | "r" | "q" | "n";
128
+ text: string;
129
+ };
130
+ cost: {
131
+ mark: string;
132
+ text: string;
133
+ };
134
+ time: {
135
+ mark: string;
136
+ text: string;
137
+ };
138
+ reason: string | null;
139
+ unsure: boolean;
140
+ runId: string;
141
+ runNo: number | null;
142
+ number: number | null;
143
+ title: string | null;
144
+ url: string | null;
145
+ })[];
146
+ key: "wait";
147
+ label: "Needs you";
148
+ open: true;
149
+ } | {
150
+ rows: ({
151
+ anyway: boolean;
152
+ name: string;
153
+ ref: string;
154
+ bucket: "done" | "skip" | "stop" | "wait";
155
+ status: {
156
+ key: string;
157
+ sign: string;
158
+ word: string;
159
+ };
160
+ needs: "Accept" | "Resume" | null;
161
+ at: number | null;
162
+ steps: {
163
+ mark: "g" | "r" | "q" | "n";
164
+ text: string;
165
+ };
166
+ checks: {
167
+ mark: "g" | "r" | "q" | "n";
168
+ text: string;
169
+ };
170
+ cost: {
171
+ mark: string;
172
+ text: string;
173
+ };
174
+ time: {
175
+ mark: string;
176
+ text: string;
177
+ };
178
+ reason: string | null;
179
+ unsure: boolean;
180
+ unsureSay: string;
181
+ runId: string;
182
+ runNo: number | null;
183
+ number: number | null;
184
+ title: string | null;
185
+ url: string | null;
186
+ } | {
187
+ anyway: boolean;
188
+ name: string;
189
+ ref: string;
190
+ bucket: "done" | "skip" | "stop" | "wait";
191
+ status: {
192
+ key: string;
193
+ sign: string;
194
+ word: string;
195
+ };
196
+ needs: "Accept" | "Resume" | null;
197
+ at: number | null;
198
+ steps: {
199
+ mark: "g" | "r" | "q" | "n";
200
+ text: string;
201
+ };
202
+ checks: {
203
+ mark: "g" | "r" | "q" | "n";
204
+ text: string;
205
+ };
206
+ cost: {
207
+ mark: string;
208
+ text: string;
209
+ };
210
+ time: {
211
+ mark: string;
212
+ text: string;
213
+ };
214
+ reason: string | null;
215
+ unsure: boolean;
216
+ runId: string;
217
+ runNo: number | null;
218
+ number: number | null;
219
+ title: string | null;
220
+ url: string | null;
221
+ })[];
222
+ key: "stop";
223
+ label: "Stopped";
224
+ open: true;
225
+ } | {
226
+ rows: ({
227
+ anyway: boolean;
228
+ name: string;
229
+ ref: string;
230
+ bucket: "done" | "skip" | "stop" | "wait";
231
+ status: {
232
+ key: string;
233
+ sign: string;
234
+ word: string;
235
+ };
236
+ needs: "Accept" | "Resume" | null;
237
+ at: number | null;
238
+ steps: {
239
+ mark: "g" | "r" | "q" | "n";
240
+ text: string;
241
+ };
242
+ checks: {
243
+ mark: "g" | "r" | "q" | "n";
244
+ text: string;
245
+ };
246
+ cost: {
247
+ mark: string;
248
+ text: string;
249
+ };
250
+ time: {
251
+ mark: string;
252
+ text: string;
253
+ };
254
+ reason: string | null;
255
+ unsure: boolean;
256
+ unsureSay: string;
257
+ runId: string;
258
+ runNo: number | null;
259
+ number: number | null;
260
+ title: string | null;
261
+ url: string | null;
262
+ } | {
263
+ anyway: boolean;
264
+ name: string;
265
+ ref: string;
266
+ bucket: "done" | "skip" | "stop" | "wait";
267
+ status: {
268
+ key: string;
269
+ sign: string;
270
+ word: string;
271
+ };
272
+ needs: "Accept" | "Resume" | null;
273
+ at: number | null;
274
+ steps: {
275
+ mark: "g" | "r" | "q" | "n";
276
+ text: string;
277
+ };
278
+ checks: {
279
+ mark: "g" | "r" | "q" | "n";
280
+ text: string;
281
+ };
282
+ cost: {
283
+ mark: string;
284
+ text: string;
285
+ };
286
+ time: {
287
+ mark: string;
288
+ text: string;
289
+ };
290
+ reason: string | null;
291
+ unsure: boolean;
292
+ runId: string;
293
+ runNo: number | null;
294
+ number: number | null;
295
+ title: string | null;
296
+ url: string | null;
297
+ })[];
298
+ key: "done";
299
+ label: "Passed";
300
+ open: false;
301
+ } | {
302
+ rows: ({
303
+ anyway: boolean;
304
+ name: string;
305
+ ref: string;
306
+ bucket: "done" | "skip" | "stop" | "wait";
307
+ status: {
308
+ key: string;
309
+ sign: string;
310
+ word: string;
311
+ };
312
+ needs: "Accept" | "Resume" | null;
313
+ at: number | null;
314
+ steps: {
315
+ mark: "g" | "r" | "q" | "n";
316
+ text: string;
317
+ };
318
+ checks: {
319
+ mark: "g" | "r" | "q" | "n";
320
+ text: string;
321
+ };
322
+ cost: {
323
+ mark: string;
324
+ text: string;
325
+ };
326
+ time: {
327
+ mark: string;
328
+ text: string;
329
+ };
330
+ reason: string | null;
331
+ unsure: boolean;
332
+ unsureSay: string;
333
+ runId: string;
334
+ runNo: number | null;
335
+ number: number | null;
336
+ title: string | null;
337
+ url: string | null;
338
+ } | {
339
+ anyway: boolean;
340
+ name: string;
341
+ ref: string;
342
+ bucket: "done" | "skip" | "stop" | "wait";
343
+ status: {
344
+ key: string;
345
+ sign: string;
346
+ word: string;
347
+ };
348
+ needs: "Accept" | "Resume" | null;
349
+ at: number | null;
350
+ steps: {
351
+ mark: "g" | "r" | "q" | "n";
352
+ text: string;
353
+ };
354
+ checks: {
355
+ mark: "g" | "r" | "q" | "n";
356
+ text: string;
357
+ };
358
+ cost: {
359
+ mark: string;
360
+ text: string;
361
+ };
362
+ time: {
363
+ mark: string;
364
+ text: string;
365
+ };
366
+ reason: string | null;
367
+ unsure: boolean;
368
+ runId: string;
369
+ runNo: number | null;
370
+ number: number | null;
371
+ title: string | null;
372
+ url: string | null;
373
+ })[];
374
+ key: "skip";
375
+ label: "Skipped";
376
+ open: false;
377
+ })[];
378
+ scheduleLine: string | null;
379
+ stats: {
380
+ counts: {
381
+ [k: string]: number;
382
+ };
383
+ spent: string;
384
+ spentUsd: number | null;
385
+ spentComplete: boolean;
386
+ };
387
+ };
388
+ /** the buckets, in the mockup's order */
389
+ export const GRID_BUCKETS: readonly (Readonly<{
390
+ key: "wait";
391
+ label: "Needs you";
392
+ open: true;
393
+ }> | Readonly<{
394
+ key: "stop";
395
+ label: "Stopped";
396
+ open: true;
397
+ }> | Readonly<{
398
+ key: "done";
399
+ label: "Passed";
400
+ open: false;
401
+ }> | Readonly<{
402
+ key: "skip";
403
+ label: "Skipped";
404
+ open: false;
405
+ }>)[];
@@ -1,6 +1,3 @@
1
- /** @typedef {{name: string, cls: 'machine check'|'judge'|null}} PlanCheck */
2
- /** @typedef {{n: number, text: string, rule: string, rules: string[], checks: PlanCheck[], refused: string[], always?: string[]}} PlanLine */
3
- /** @typedef {{lines: PlanLine[], loose: PlanCheck[], notChecked: string[], readNotes: string[], alwaysOn: string[], older: boolean, goal?: string}} JobPlan */
4
1
  /**
5
2
  * `machine check` for a kind a command decides, `judge` for one that needs judgement; `null` for a stage whose kind is
6
3
  * unknown (a hand-written command close has no kind: it is a command, so a machine check).
@@ -8,26 +5,25 @@
8
5
  * @returns {'machine check'|'judge'|null}
9
6
  */
10
7
  export function checkClassOfKind(kind: unknown): "machine check" | "judge" | null;
11
- /**
12
- * 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
13
- * has one (a rule may itself contain "; "), else the joined `rule` split on "; " (an older line that saved only the join).
14
- * @param {any} l @returns {string[]}
15
- */
16
- export function rulesOfLine(l: any): string[];
17
8
  /**
18
9
  * The plan of a SIGNED spec. With `jobLines`, each stage lands under EACH line its `fromLine` array names (a stage with none is
19
10
  * a mandatory guard: "Always checked"), `closeDecl.refused` reasons land under their line, and `closeDecl.notes` are the
20
11
  * drafter's own "not checked" words. Without `jobLines` (a spec that predates the job block) the signed goal sentence is
21
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.
22
14
  * @param {any} spec
15
+ * @param {{key: string, words: string[]}[]|null} [ledger]
23
16
  * @returns {JobPlan}
24
17
  */
25
- export function planFromSpec(spec: any): JobPlan;
18
+ export function planFromSpec(spec: any, ledger?: {
19
+ key: string;
20
+ words: string[];
21
+ }[] | null): JobPlan;
26
22
  /**
27
23
  * The plan of the confirm turn, before anything is drafted: the person's own job lines, the model's checks under the
28
24
  * line each names, its own "not checked" words, and the real protections (code-owned) as "Always checked".
29
25
  * @param {{n: number, text: string, rule: string, rules?: string[]}[]|null|undefined} jobLines
30
- * @param {{checkItems?: {text: string, fromLine: number[]|null}[], checks?: string[], notChecked?: string[], protections?: string[], signedFacts?: 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
31
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)
32
28
  * @returns {JobPlan}
33
29
  */
@@ -40,15 +36,54 @@ export function planFromConfirm(jobLines: {
40
36
  checkItems?: {
41
37
  text: string;
42
38
  fromLine: number[] | null;
39
+ by?: "agent" | "you" | "default" | null;
40
+ key?: string;
43
41
  }[];
44
42
  checks?: string[];
45
43
  notChecked?: string[];
46
44
  protections?: string[];
47
45
  signedFacts?: string[];
46
+ ticketFilter?: any;
47
+ picked?: {
48
+ line: number;
49
+ text: string;
50
+ }[];
51
+ notCheckedBy?: Record<string, "you" | "agent" | "default">;
52
+ suggested?: {
53
+ key: string;
54
+ line: number;
55
+ text: string;
56
+ }[];
57
+ editable?: boolean;
48
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]
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): {
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-checked" | "held" | "record-missing";
79
+ word?: string;
80
+ };
49
81
  export type PlanCheck = {
50
82
  name: string;
51
83
  cls: "machine check" | "judge" | null;
84
+ by?: "agent" | "you" | "default" | null;
85
+ key?: string;
86
+ stage?: string;
52
87
  };
53
88
  export type PlanLine = {
54
89
  n: number;
@@ -58,6 +93,7 @@ export type PlanLine = {
58
93
  checks: PlanCheck[];
59
94
  refused: string[];
60
95
  always?: string[];
96
+ picked?: string[];
61
97
  };
62
98
  export type JobPlan = {
63
99
  lines: PlanLine[];
@@ -67,4 +103,12 @@ export type JobPlan = {
67
103
  alwaysOn: string[];
68
104
  older: boolean;
69
105
  goal?: string;
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;
70
114
  };
@@ -1,13 +1,17 @@
1
1
  /**
2
- * @param {{ door: ReturnType<typeof import('./schedules.js').createScheduleDoor>, now?: () => number, intervalMs?: number }} opts
3
- * `intervalMs` 0 = no timer (a test drives `tick`).
2
+ * @param {{ door: ReturnType<typeof import('./schedules.js').createScheduleDoor>, now?: () => number, intervalMs?: number, look?: typeof lookTickets, mcpConfig?: string }} opts
3
+ * `intervalMs` 0 = no timer (a test drives `tick`). `look` / `mcpConfig` = the ticket look and the MCP config file it reads (tests inject them; default the real look over the person's own config).
4
4
  */
5
5
  export function createScheduler(opts: {
6
6
  door: ReturnType<typeof import("./schedules.js").createScheduleDoor>;
7
7
  now?: () => number;
8
8
  intervalMs?: number;
9
+ look?: typeof lookTickets;
10
+ mcpConfig?: string;
9
11
  }): {
10
12
  tick: () => Promise<void>;
13
+ /** resolves when every ticket look now out has been written to its ledger (a test awaits it; the timer never does) */
14
+ settled(): Promise<void>;
11
15
  /** Start the real timer (idempotent). */
12
16
  start(): void;
13
17
  /** Stop it (idempotent). The server's close calls this. */
@@ -15,3 +19,4 @@ export function createScheduler(opts: {
15
19
  /** whether the real timer is running (a test reads this) */
16
20
  readonly running: boolean;
17
21
  };
22
+ import { lookTickets } from '../triggertickets.js';