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
package/src/authoring.js CHANGED
@@ -72,8 +72,7 @@
72
72
  // flagged a `runClose` naming collision between the kind executor and
73
73
  // src/ralph.js; the public surface is settled once at M4, not piecemeal.
74
74
 
75
- import { normalizeParser, MAX_JUDGED_PATHS, JUDGED_FLOOR_KIND } from './kinds.js';
76
- import { JUDGE_RULE_IDS, validateCard } from './judged.js';
75
+ import { normalizeParser } from './kinds.js';
77
76
  import { rubricStepShapeReds, checkRubricParts, checkRubricRules } from './rubricstep.js';
78
77
  import { isObj, isNonEmptyString, hasNestedQuantifier, globToPrefix } from './validate.js';
79
78
 
@@ -313,34 +312,6 @@ export const KIND_CATALOGUE = Object.freeze({
313
312
  shape: 'allowPrefixes: string[], requireNonEmpty: true',
314
313
  asserts: 'the set of files this run changed must be non-empty and must lie wholly inside allowPrefixes.',
315
314
  }),
316
- // LIVE at softgreen module 2, and the only kind that BUYS its measurement: a
317
- // pinned toolless judge extracts facts WITH QUOTES from each named artifact and
318
- // an arbiter-owned rulebook renders the verdict over them (src/judged.js). The
319
- // judge never says whether anything passed — a model asked "did this pass?" is
320
- // a model that can be argued with, and bareguard's A/B measured that
321
- // `judgeLocate` is not injectable where `judgeVerdict` is.
322
- //
323
- // `card` is the signer's own rubric, compiled to ENUMERATED items: `rule`
324
- // SELECTS from the rulebook we implement, so a rule we do not own is
325
- // inexpressible rather than rejected late, and `text` is the signer's words —
326
- // what a red is explained WITH, never what a red is decided BY. `paths` names
327
- // the AUTHORITATIVE artifacts, selected from the seed listing like every other
328
- // path, never the worker's summary of what it did.
329
- //
330
- // No `timeoutMs` and no `env`: this kind spawns nothing. Its own bounds are the
331
- // arbiter's (the retry ladder and the artifact ceiling live in src/kinds.js),
332
- // because a declaration that could widen them is a declaration that can spend.
333
- 'judged-floor': Object.freeze({
334
- verdictClass: 'soft-green',
335
- required: Object.freeze(['card', 'paths']),
336
- optional: Object.freeze([]),
337
- pathParams: Object.freeze(['paths']),
338
- shape: `card: {items: [{rule: ${JUDGE_RULE_IDS.join('|')}, text: string}]}, paths: string[] (at most ${MAX_JUDGED_PATHS})`,
339
- asserts: 'a pinned judge extracts facts and VERBATIM quotes from each named artifact, and an arbiter-owned rulebook '
340
- + 'renders pass/fail per card item over those facts — first red wins, and anything it cannot be sure of is a red. '
341
- + 'Name one card line per thing you actually look for, in the order you look for them, and name the real files the '
342
- + 'work lands in. It is never offered to the agent as an in-run check.',
343
- }),
344
315
  // PART 1a (docs/product/ITEM33-BUILD.md, "Addendum 2026-10-12"): the rubric job on LOCAL FILES. One stage per numbered job
345
316
  // line, reading the one file that line leaves behind (output/steps/N.json). It measures nothing with a command and buys
346
317
  // nothing: bareguard's rubric primitive grades the file against the person's own counted limits and quotes. It exists only in
@@ -1159,25 +1130,6 @@ function scopeOfJob(declaration, idx, guards) {
1159
1130
  return { scoped: false, via: null };
1160
1131
  }
1161
1132
 
1162
- /**
1163
- * Which of a judged stage's paths lie OUTSIDE the job's write fence? One owner of the rule "a check must be
1164
- * free to edit every file it can report on", called from every door that validates a declaration. It uses
1165
- * the shipped fence spelling (`globToPrefix`, the same containment reading plan.js's `insideFence` has) and
1166
- * returns `[]` when there is no fence to compare against or the paths are not a string list (shape is the
1167
- * schema walk's business).
1168
- * @param {unknown} paths @param {string[]|null|undefined} writeScope
1169
- * @returns {string[]}
1170
- */
1171
- export function judgedOutsideFence(paths, writeScope) {
1172
- if (!Array.isArray(writeScope) || writeScope.length === 0 || !Array.isArray(paths)) return [];
1173
- const fence = writeScope.filter(isNonEmptyString).map(globToPrefix);
1174
- if (fence.length === 0) return [];
1175
- return paths.filter(isNonEmptyString).filter((raw) => {
1176
- const n = normPrefix(raw);
1177
- return !fence.some((f) => f === '.' || n === f || n.startsWith(`${f}/`));
1178
- });
1179
- }
1180
-
1181
1133
  /**
1182
1134
  * Kinds a declaration may carry AT MOST ONCE, as data beside the catalogue.
1183
1135
  *
@@ -1196,7 +1148,7 @@ export function judgedOutsideFence(paths, writeScope) {
1196
1148
  * stage — applied to the one population that decides whether the law fires at
1197
1149
  * all.
1198
1150
  */
1199
- const AT_MOST_ONCE_KINDS = Object.freeze(['files-changed', 'human-confirms', 'judged-floor']);
1151
+ const AT_MOST_ONCE_KINDS = Object.freeze(['files-changed', 'human-confirms']);
1200
1152
 
1201
1153
  /** why each at-most-once kind is at most once, in the author's own terms. A map
1202
1154
  * rather than a chain of conditionals: a kind added to the list above with no
@@ -1210,20 +1162,12 @@ const AT_MOST_ONCE_REASON = Object.freeze({
1210
1162
  'human-confirms': (label, owner) => `stage "${label}" is a second human-confirms stage — "${owner}" already asks the `
1211
1163
  + 'person. One signer, one judge (ruling 4), asked ONCE at the end: a second door is a second verdict, and the run '
1212
1164
  + 'has no way to say which of them was the one it stopped for',
1213
- // softgreen module 3. The judged floor is the close's ONE judged ruler: two of
1214
- // them are two bars for one verdict class, each buying its own paid calls, and
1215
- // first-red-wins means the second only ever runs when the first was satisfied —
1216
- // so its only reachable effect is to spend money re-judging a tree that already
1217
- // cleared the bar the signer signed. One card, one calibration set, one ruler.
1218
- 'judged-floor': (label, owner) => `stage "${label}" is a second judged-floor stage — "${owner}" is already this `
1219
- + 'close\'s judged ruler. One card and one calibration set decide one bar: a second judged stage is a second bar '
1220
- + 'for the same verdict, and it buys its own paid calls to re-judge a tree the first one already passed',
1221
1165
  });
1222
1166
 
1223
1167
  /** the kinds NO ONE runs as an in-run ruler — ruling 5's law, as data. A
1224
1168
  * declaration that offers one is a red rather than a normalization: the signer
1225
1169
  * must not read one thing and have the runner store another. */
1226
- export const NEVER_OFFERED_KINDS = Object.freeze(['human-confirms', 'judged-floor']);
1170
+ export const NEVER_OFFERED_KINDS = Object.freeze(['human-confirms']);
1227
1171
 
1228
1172
  /** @param {any} v */
1229
1173
  const strArray = (v) => Array.isArray(v) && v.length > 0 && v.every(isNonEmptyString);
@@ -1275,13 +1219,11 @@ function readPath(p, dotted) {
1275
1219
  * @param {{catalogue?: Record<string, KindSpec>, listing?: string[]|null,
1276
1220
  * guards?: {name: string, kind: string, params: Record<string, any>, fill: string[]}[]|null,
1277
1221
  * envOwned?: string[]|null, envInjected?: Record<string, string>|null, deferListing?: boolean,
1278
- * verdictType?: string|null, writeScope?: string[]|null, jobLines?: {n: number}[]|null, inputLabels?: string[]|null}} [opts]
1222
+ * verdictType?: string|null, jobLines?: {n: number}[]|null, inputLabels?: string[]|null}} [opts]
1279
1223
  * `inputLabels` — the labels of the person's inputs (Part 1a). Present, a rubric-step `cited` part must name one of them.
1280
1224
  * `jobLines` — the person's numbered job lines (P7). Present, every stage must name the line it serves and every
1281
1225
  * line needs a stage or a refusal ({@link checkJobLines}); absent (every spec that predates the job block), the
1282
1226
  * rule is not run.
1283
- * `writeScope` — the job's signed write fence. Every path a judged stage judges must sit inside it
1284
- * ({@link judgedOutsideFence}); absent, the rule is not run (the plain-folder deferral has no fence).
1285
1227
  * `listing` — repo-relative paths at the seed (`git ls-tree -r --name-only`).
1286
1228
  * `guards` — the picked class's injected guards (`classGuards`).
1287
1229
  * `verdictType` — the class the USER picked (`VERDICT_CLASSES`).
@@ -1298,7 +1240,7 @@ function readPath(p, dotted) {
1298
1240
  export function validateDeclaration(declaration, opts = {}) {
1299
1241
  const {
1300
1242
  catalogue = KIND_CATALOGUE, listing = null, guards = null, envOwned = null, envInjected = null,
1301
- verdictType = null, writeScope = null, jobLines = null, inputLabels = null,
1243
+ verdictType = null, jobLines = null, inputLabels = null,
1302
1244
  } = opts;
1303
1245
  const deferListing = opts.deferListing === true;
1304
1246
  /** @type {Red[]} */
@@ -1441,18 +1383,6 @@ export function validateDeclaration(declaration, opts = {}) {
1441
1383
  } else kindOwners.set(s.kind, label);
1442
1384
  }
1443
1385
 
1444
- // A judged stage may only judge what the run can fix: a path outside the write fence is a
1445
- // finding the worker can never act on (run mv13ery3: bin/pulselog.js, fence src/**).
1446
- if (s.kind === JUDGED_FLOOR_KIND && isObj(s.params)) {
1447
- const outside = judgedOutsideFence(s.params.paths, writeScope);
1448
- if (outside.length > 0) {
1449
- red('judged-outside-write-scope', `${at}.params.paths`, `stage "${label}" judges ${outside.join(', ')}, but the `
1450
- + `job may only edit ${writeScope?.join(', ')}. A check that reports on a file the run is fenced out of can `
1451
- + 'never be satisfied — every finding on it is one the worker cannot fix. Name files inside the write fence',
1452
- { stage: label, outside, fence: (writeScope ?? []).map(globToPrefix) });
1453
- }
1454
- }
1455
-
1456
1386
  // ── RULING 5, AS LAW: judged and human stages are `offer: false`, and the
1457
1387
  // law is checked rather than applied. `checkMenu` filters `offer !== false`,
1458
1388
  // so a declaration that says nothing is silent about a rule the runner
@@ -1478,31 +1408,6 @@ export function validateDeclaration(declaration, opts = {}) {
1478
1408
  + 'evidence package and the mechanical stages behind them would be silently deleted (the composition law: '
1479
1409
  + 'mechanical first, human last)', { kind: s.kind, stage: label, at: i, last: stages.length - 1 });
1480
1410
  }
1481
- // ── THE SAME LAW's judged half (design record 2026-08-17 §4.5: *mechanical
1482
- // stages FIRST, the judged stage AFTER, first-red-wins*). The human rule is
1483
- // stated as "last" because a person is the top of the hierarchy; the judged
1484
- // rule is stated as "after the mechanical ones", because a human stage may
1485
- // legally follow it — mechanical → judge → person is the full composition.
1486
- //
1487
- // What it costs to admit is the same both ways round: first-red-wins means a
1488
- // judged stage in front of a mechanical one BUYS PAID CALLS to grade a tree
1489
- // the free stages would have refused for nothing — and if the judge passes it
1490
- // the mechanical red still lands, so the money bought no verdict either.
1491
- // A SECOND judged stage is NOT this red (it is `duplicate-kind`, emitted
1492
- // above): one problem, one red, in one vocabulary.
1493
- if (s.kind === JUDGED_FLOOR_KIND) {
1494
- const behind = stages.slice(i + 1).filter((/** @type {any} */ x) => isObj(x) && isNonEmptyString(x.kind)
1495
- && catalogue[x.kind] && CLASS_RANK[catalogue[x.kind].verdictClass] < CLASS_RANK['soft-green']);
1496
- if (behind.length) {
1497
- red('judged-stage-order', `${at}.kind`, `stage "${label}" is judged and runs BEFORE the mechanical `
1498
- + `stage${behind.length > 1 ? 's' : ''} ${behind.map((/** @type {any} */ x) => `"${x.name}"`).join(', ')}. `
1499
- + 'The close is first-red-wins and a judged stage buys a paid call per artifact: put every stage a command '
1500
- + 'can decide in front of it, so the free rulers shield the expensive one (the composition law: mechanical '
1501
- + 'first, judge after)',
1502
- { kind: s.kind, stage: label, at: i, behind: behind.map((/** @type {any} */ x) => x.name) });
1503
- }
1504
- }
1505
-
1506
1411
  const p = s.params;
1507
1412
  if (!isObj(p)) { red('missing-field', `${at}.params`, `an object carrying: ${spec.required.join(', ')}`); return; }
1508
1413
  for (const k of spec.required) {
@@ -1827,30 +1732,6 @@ function checkKind({ kind, params: p, at, red, scoped, label, populations, envOw
1827
1732
  + 'result — a human stage with nothing to ask is the bare "approve?" ruling 2 forbids');
1828
1733
  }
1829
1734
  break;
1830
- case 'judged-floor': {
1831
- // ONE spelling of what a card is, the JUDGE's own (`validateCard`, src/judged.js) —
1832
- // the same rule `normalizeParser` follows: the validator and the grader must agree
1833
- // about what a card MEANS, or the one that grades is the one nobody validated.
1834
- const cv = validateCard(p.card);
1835
- for (const detail of cv.reds) red('invalid-value', `${at}.params.card`, detail);
1836
- // the artifact list. The listing rule (`checkPaths`) judges whether each element
1837
- // EXISTS; this judges the shape and the bill — one paid call per artifact, so an
1838
- // unbounded list is a bill rather than a red (the MAX_TERMS sibling).
1839
- if (!strArray(p.paths)) {
1840
- red('invalid-value', `${at}.params.paths`, 'a non-empty array of repository-relative files to judge — the '
1841
- + 'AUTHORITATIVE artifacts, read off the seed listing, never the worker\'s summary of what it did');
1842
- } else if (new Set(p.paths.map(String)).size !== p.paths.length) {
1843
- // one artifact is one population, and a list naming it twice buys two paid
1844
- // calls over identical bytes — deduplicating it silently would leave the
1845
- // signer reading one list while the runner spent on another
1846
- red('invalid-value', `${at}.params.paths`, 'the same artifact is named twice — one artifact is one population, '
1847
- + 'and a duplicate buys a second paid call over identical bytes');
1848
- } else if (p.paths.length > MAX_JUDGED_PATHS) {
1849
- red('bounds', `${at}.params.paths`, `${p.paths.length} artifacts exceeds the ceiling of ${MAX_JUDGED_PATHS} — a `
1850
- + 'judged stage buys one call per artifact, and the ceiling is the arbiter\'s, not the declaration\'s');
1851
- }
1852
- break;
1853
- }
1854
1735
  default:
1855
1736
  red('unknown-kind', `${at}.kind`, `"${kind}" is in the catalogue but has no checker`, { kind });
1856
1737
  }