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
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @typedef {{key: string, result: 'passed'|'failed'|'unread', why?: string}} RowResult
3
+ * @param {any[]|null|undefined} list the signed list (`closeDecl.list`) @param {{step: number, parts: any[]}} params the rubric-step stage's params
4
+ * @param {{verdict?: string, rawGaps?: any[], extraGaps?: string[], detail?: Record<string, any>}} graded `gradeStep`'s answer
5
+ * @returns {{rows: RowResult[], unclaimed: string[]}}
6
+ */
7
+ export function rowResultsOf(list: any[] | null | undefined, params: {
8
+ step: number;
9
+ parts: any[];
10
+ }, graded: {
11
+ verdict?: string;
12
+ rawGaps?: any[];
13
+ extraGaps?: string[];
14
+ detail?: Record<string, any>;
15
+ }): {
16
+ rows: RowResult[];
17
+ unclaimed: string[];
18
+ };
19
+ export type RowResult = {
20
+ key: string;
21
+ result: "passed" | "failed" | "unread";
22
+ why?: string;
23
+ };
@@ -138,7 +138,7 @@ export function plainStepGap(step: number, why: string, g: any, params?: any): s
138
138
  * the manifest's recorded sha via `inputShas`.
139
139
  * @param {Record<string, string>} inputShas the manifest's recorded sha256 per cited label
140
140
  * @returns {Promise<{verdict: 'green'|'red'|'stopped', gapLines: string[], fault: string|null, detail: Record<string, any>,
141
- * evidence?: any[], evidenceTotal?: number}>} `evidence`/`evidenceTotal` are bareguard's `full.evidence` (what each `cited` check read), carried out
141
+ * rawGaps?: any[], extraGaps?: string[], evidence?: any[], evidenceTotal?: number}>} `evidence`/`evidenceTotal` are bareguard's `full.evidence` (what each `cited` check read), carried out
142
142
  * for the report-only `rubric-evidence` spine record; no verdict, gap or count above is derived from them
143
143
  */
144
144
  export function gradeStep({ params, bytes, outputBytes, inputs, factQuotes, factMissing }: {
@@ -156,6 +156,8 @@ export function gradeStep({ params, bytes, outputBytes, inputs, factQuotes, fact
156
156
  gapLines: string[];
157
157
  fault: string | null;
158
158
  detail: Record<string, any>;
159
+ rawGaps?: any[];
160
+ extraGaps?: string[];
159
161
  evidence?: any[];
160
162
  evidenceTotal?: number;
161
163
  }>;
@@ -285,19 +287,38 @@ export function proseNotCheckedItems(closeDecl: any): {
285
287
  * @param {any} part @returns {string}
286
288
  */
287
289
  export function partSentence(part: any): string;
290
+ /**
291
+ * Does the signed close really put a text-present check on job line `n`'s step file? (ONE reader, derived from the close: the protections list and the brief never claim it otherwise.)
292
+ * A facts line has no text check unless a countable part (a pick, or the default note) sits beside its facts; a line with no stage has none.
293
+ * @param {any} closeDecl @param {number} n @returns {boolean}
294
+ */
295
+ export function lineCarriesText(closeDecl: any, n: number): boolean;
296
+ /** the fence a close's row names: `closeDecl.fence` (the confirm card's view of it) or the allowed prefixes its own `changed-from-seed` guard stage signs @param {any} closeDecl @returns {string[]|null} */
297
+ export function fenceOfClose(closeDecl: any): string[] | null;
298
+ /**
299
+ * The words of a line's `$` floor row (Addendum 2026-11-14 (c) piece 1), written by code from the signed close: the line's file must exist and be complete JSON, and carry text only when the close
300
+ * really puts a text check on it ({@link lineCarriesText}); a facts-only line says it has none. ONE owner: the card, the Job tab and the Audit read it.
301
+ * @param {any} closeDecl @param {number} n @returns {string}
302
+ */
303
+ export function floorText(closeDecl: any, n: number): string;
304
+ /** the one spelling of the floor row's words (the check block's own card view reads it with the line's `carriesText`) @param {number} n @param {boolean} carriesText @returns {string} */
305
+ export function floorWords(n: number, carriesText: boolean): string;
288
306
  /**
289
307
  * The checks a signed close actually runs, per job line, in plain code-written sentences: one per countable part of every
290
308
  * rubric-step stage. This is the ONE reader both the plan card and the sign-time invariant use.
291
309
  * Each row says who added the check (`by`): `you` = one of the person's picks, as the signed close's own record (`closeDecl.picks`) names it; `agent` = the drafter's;
292
310
  * `default` = code's own (the one list's `$` rows: the cited part written by `defaultCitedText`, and the numbers tie of a text step).
293
- * @param {any} closeDecl
294
- * @returns {{line: number, text: string, by: 'agent'|'you'|'default', key?: string}[]}
311
+ * A repo job's list (Addendum 2026-11-15 (d)) adds its rows here: an `!` row per work stage (the stage's name) and a `~` row the write fence keeps (the rule in the person's words, from `jobLines`; else its number), `fence` holding the path.
312
+ * @param {any} closeDecl @param {any[]|null} [jobLines] the person's numbered lines, so a `~` row reads in their own words
313
+ * @returns {{line: number, text: string, by: 'agent'|'you'|'default', key?: string, pick?: true, fence?: string}[]}
295
314
  */
296
- export function checksOfClose(closeDecl: any): {
315
+ export function checksOfClose(closeDecl: any, jobLines?: any[] | null): {
297
316
  line: number;
298
317
  text: string;
299
318
  by: "agent" | "you" | "default";
300
319
  key?: string;
320
+ pick?: true;
321
+ fence?: string;
301
322
  }[];
302
323
  /**
303
324
  * The names of the facts a signed close checks (every fact part of every rubric-step stage). Pure.
@@ -309,7 +330,7 @@ export function signedFactNames(closeDecl: any): string[];
309
330
  * steps' "you judge it at Accept" lines and the refusals (`ruleNotChecked`, which reads the list's not-checked rows when the close carries the list). Nothing the confirm turn said is merged
310
331
  * in: a rubric confirm turn plans the goal only, so a check can never be shown and then silently dropped (run mv5bk400).
311
332
  * @param {{closeDecl: any, jobLines?: any[]|null, ledger?: {key: string, words: string[]}[]|null}} o `jobLines` the person's numbered lines, so a ~ rule reads in the person's own words; `ledger` the draft log's final list rows, so a phrase row is named by its words
312
- * @returns {{checkItems: {text: string, fromLine: number[], by: 'agent'|'you'|'default', key?: string}[], notChecked: string[], notCheckedBy: Record<string, 'you'|'agent'|'default'>}}
333
+ * @returns {{checkItems: {text: string, fromLine: number[], by: 'agent'|'you'|'default', key?: string, pick?: true}[], notChecked: string[], notCheckedBy: Record<string, 'you'|'agent'|'default'>}}
313
334
  */
314
335
  export function cardOfClose({ closeDecl, jobLines, ledger }: {
315
336
  closeDecl: any;
@@ -324,6 +345,7 @@ export function cardOfClose({ closeDecl, jobLines, ledger }: {
324
345
  fromLine: number[];
325
346
  by: "agent" | "you" | "default";
326
347
  key?: string;
348
+ pick?: true;
327
349
  }[];
328
350
  notChecked: string[];
329
351
  notCheckedBy: Record<string, "you" | "agent" | "default">;
@@ -343,13 +365,13 @@ export function listMatchesClose(closeDecl: any): {
343
365
  /**
344
366
  * The sign-time invariant: the checks the person was shown (`shown`, from the plan card) are exactly the checks the signed
345
367
  * close runs (`checksOfClose`), per line. Pure.
346
- * @param {{text: string, fromLine: number[]|null}[]} shown @param {any} closeDecl
368
+ * @param {{text: string, fromLine: number[]|null}[]} shown @param {any} closeDecl @param {any[]|null} [jobLines] the person's numbered lines (a repo job's `~` row reads the rule in their words)
347
369
  * @returns {{ok: true}|{ok: false, error: string}}
348
370
  */
349
371
  export function planMatchesClose(shown: {
350
372
  text: string;
351
373
  fromLine: number[] | null;
352
- }[], closeDecl: any): {
374
+ }[], closeDecl: any, jobLines?: any[] | null): {
353
375
  ok: true;
354
376
  } | {
355
377
  ok: false;
@@ -392,7 +414,21 @@ export function sha256Of(b: string | Buffer): string;
392
414
  export function boundInWords(b: unknown, said: string): boolean;
393
415
  export function wordsSaidOn(jl: any): string;
394
416
  export const NEGATING_RE: RegExp;
417
+ /** the plain reason a rule's amount is in a currency the page fact does not use; `readLimit` gives it and the check list reads it, one spelling */
418
+ export const WHY_OTHER_CURRENCY: "the amount is in another currency than the page fact";
395
419
  export function defaultCitedText(label: string): string;
420
+ export function defaultNoteText(n: number): string;
421
+ export function carriesOneList(closeDecl: any): boolean;
422
+ export function guardKeyOf(name: string): string;
423
+ export function guardNameOfKey(key: unknown): string;
424
+ export function stageKeyOf(name: string): string;
425
+ export function stageNameOfKey(key: unknown): string;
426
+ /** the words of a text line's `prose` row: the person judges what the text says at Accept (the same words the stage-derived line always used) */
427
+ export const PROSE_WORDS: "what the text says \u2014 you judge it at Accept";
428
+ /** the key of the job-level write fence row (the one list, hamr 2026-11-15: the fence is a `$` row like every other rule) */
429
+ export const FENCE_KEY: "J.$fence";
430
+ export function fenceRowText(scope: string[]): string;
431
+ export function guardRowText(name: string): string;
396
432
  export type ShapeRed = {
397
433
  code: string;
398
434
  path: string;
package/types/run.d.ts CHANGED
@@ -38,19 +38,6 @@
38
38
  * (`ratesFor`, src/providerrows.js — USD per 1K tokens), resolved once by the door and handed to every
39
39
  * worker/planner Loop as bare-agent's `rates` (rounds then read `rateSource:'caller'`). Absent = the
40
40
  * built-in guess, exactly as before. A Loop-driven provider only: a native session reports its own cost.
41
- * @param {{in: number, out: number}|null} [opts.judgeRates] the same, for the judge's own key row
42
- * @param {string|null} [opts.judgeModel] SOFTGREEN — WHICH model the judge provider drives
43
- * (PRD item 32.1), resolved by the CALLER (`resolveJudge`, src/judged.js) and passed
44
- * through untouched. Travels with `judgeProvider`; absent, a judged stage stops as a
45
- * wiring gap rather than grading under an identity nobody named.
46
- * @param {any} [opts.judgeProvider] SOFTGREEN — the provider a JUDGED close stage runs its
47
- * locate call through, built by the CALLER from the RESOLVED judge identity (PRD item
48
- * 32.1: `resolveJudge`/`resolveJobJudge`, src/judged.js — the spec's signed `judge`
49
- * override, else the job's own worker provider and model), never pinned. Forwarded to the plan
50
- * flow. It is its own seam and not `provider`/`providerFor`, because the judge tier is
51
- * never a step knob and never agent-selectable; absent, a judged stage instrument-stops as
52
- * a wiring gap rather than grading on whatever binding happened to be at hand. Its spend
53
- * lands on this ledger as `judge-round` (see `ACCOUNTED_ROUND_TYPES`).
54
41
  * @param {Record<string, string>|null} [opts.placeValues] PLACE RULES (src/placerule.js): the values this run's start read for the spec's place-rule facts, by key. Bound
55
42
  * as those facts' phrases on the run's own in-memory copy AFTER the approval check and the `job-start` record, so the hash checked and the hash recorded stay the
56
43
  * SIGNED one and the signed spec is never changed; the planner and the close read the copy. Absent = the signed words.
@@ -223,7 +210,7 @@
223
210
  * deliberately NOT in the resumable/checkpoint set (`src/reuse.js`) — an
224
211
  * unknown in-flight state is not a known-safe resume point.
225
212
  */
226
- export function runJob(rawSpec: object | string, { approvals, workdir, provider, nativeProvider, providerFor, judgeProvider, judgeModel, rates, judgeRates, emit, capRuns, strikeLimit, shellCapUsd, closeTimeoutMs, closeDir, layerRoot, readShim, scout, bridge, draftSpentUsd, draftSpendComplete, priorSpentUsd, priorSpendComplete, priorWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, reviewDoor, doorRerun, resumable, stopFile, learnHints, ticketRecord, ticketUnsure, prRecord, placeValues, placeRead }: {
213
+ export function runJob(rawSpec: object | string, { approvals, workdir, provider, nativeProvider, providerFor, rates, emit, capRuns, strikeLimit, shellCapUsd, closeTimeoutMs, closeDir, layerRoot, readShim, scout, bridge, draftSpentUsd, draftSpendComplete, priorSpentUsd, priorSpendComplete, priorWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, reviewDoor, doorRerun, resumable, stopFile, learnHints, ticketRecord, ticketUnsure, prRecord, placeValues, placeRead }: {
227
214
  approvals: unknown;
228
215
  workdir: string;
229
216
  provider: any;
@@ -239,12 +226,6 @@ export function runJob(rawSpec: object | string, { approvals, workdir, provider,
239
226
  in: number;
240
227
  out: number;
241
228
  } | null | undefined;
242
- judgeRates?: {
243
- in: number;
244
- out: number;
245
- } | null | undefined;
246
- judgeModel?: string | null | undefined;
247
- judgeProvider?: any;
248
229
  placeValues?: Record<string, string> | null | undefined;
249
230
  placeRead?: {
250
231
  workflowKey: string;
@@ -90,6 +90,17 @@ export function stageQuestionText({ kind, params, genre, suiteCmdKeys, }: {
90
90
  * @returns {Map<string, string|null>}
91
91
  */
92
92
  export function stageQuestionsByName(spec: any): Map<string, string | null>;
93
+ /**
94
+ * The plain question of the `$ [default]` write-fence row, built from the signed fence itself: `src/**` reads `src/`; an entry that is a glob this cannot read as a folder or file is quoted as it was signed.
95
+ * @param {string[]} scope @returns {string}
96
+ */
97
+ export function fenceQuestionText(scope: string[]): string;
98
+ /**
99
+ * The plain question of a job-level `$ [default]` guard row (the one list's guard rows, by guard NAME) — the one owner the plan card, Job tab, Audit, Result and the CLI print read, in place of the guard's raw name and its
100
+ * long frozen sentence (GUARD_DESCRIPTIONS stays the older confirm-turn "protections" line). `null` for a guard with no line here: the caller keeps the old words, never an invented question.
101
+ * @param {string} name @returns {string|null}
102
+ */
103
+ export function guardQuestionText(name: string): string | null;
93
104
  /** the genre-owned noun for the count a TYPES-genre typecheck stage measures (see {@link stageQuestionText}) */
94
105
  export const GENRE_WHAT: Readonly<{
95
106
  TYPES: "type errors";
@@ -80,7 +80,6 @@ export type Deps = {
80
80
  ok: false;
81
81
  error: string;
82
82
  }>) | undefined;
83
- judgeProvider?: any;
84
83
  /**
85
84
  * R6 - a test seam: how a Tickets run that names no `--ticket` finds the newest unrun ticket (production: the real look, src/ticketnext.js)
86
85
  */