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.
- package/CHANGELOG.md +82 -0
- package/README.md +3 -3
- package/bareloop.context.md +69 -209
- package/package.json +2 -2
- package/src/authorflow.js +164 -340
- package/src/authoring.js +7 -127
- package/src/authorjob.js +139 -472
- package/src/authorreadout.js +24 -368
- package/src/authorrun.js +21 -215
- package/src/behaviour.js +14 -0
- package/src/blockasks.js +43 -0
- package/src/bundlerun.js +4 -1
- package/src/checkblock.js +798 -0
- package/src/checklist.js +128 -0
- package/src/checkpick.js +39 -312
- package/src/checkwords.js +3 -1
- package/src/cli.js +3 -3
- package/src/declaredclose.js +38 -108
- package/src/destpoint.js +4 -2
- package/src/draftspend.js +46 -0
- package/src/facts.js +8 -1
- package/src/index.js +3 -43
- package/src/interviewrun.js +13 -8
- package/src/job.js +20 -1
- package/src/jobblock.js +11 -46
- package/src/judged.js +13 -1229
- package/src/kinds.js +5 -347
- package/src/noteask.js +124 -0
- package/src/pagedry.js +27 -5
- package/src/pagemap.js +15 -3
- package/src/pagerules.js +18 -3
- package/src/panel/authorroutes.js +24 -6
- package/src/panel/authorsession.js +222 -177
- package/src/panel/importrun.js +0 -1
- package/src/panel/index.html +198 -26
- package/src/panel/jobplan.js +87 -33
- package/src/panel/server.js +74 -68
- package/src/panel/status.js +3 -0
- package/src/pickrecord.js +34 -55
- package/src/placerule.js +355 -0
- package/src/planrun.js +2 -48
- package/src/promptregisters.js +13 -17
- package/src/providerrows.js +0 -36
- package/src/providers.js +4 -25
- package/src/questionbox.js +104 -0
- package/src/rowedit.js +115 -0
- package/src/rubricstep.js +234 -127
- package/src/run.js +11 -16
- package/src/userrun.js +60 -112
- package/types/authorflow.d.ts +41 -197
- package/types/authoring.d.ts +1 -14
- package/types/authorjob.d.ts +35 -59
- package/types/authorreadout.d.ts +10 -88
- package/types/behaviour.d.ts +12 -0
- package/types/blockasks.d.ts +36 -0
- package/types/checkblock.d.ts +376 -0
- package/types/checklist.d.ts +134 -0
- package/types/checkpick.d.ts +8 -140
- package/types/cli.d.ts +1 -3
- package/types/declaredclose.d.ts +7 -33
- package/types/destpoint.d.ts +2 -0
- package/types/draftspend.d.ts +21 -0
- package/types/index.d.ts +2 -4
- package/types/job.d.ts +8 -0
- package/types/jobblock.d.ts +8 -38
- package/types/judged.d.ts +7 -357
- package/types/kinds.d.ts +3 -104
- package/types/noteask.d.ts +76 -0
- package/types/pagedry.d.ts +13 -0
- package/types/pagemap.d.ts +4 -0
- package/types/pagerules.d.ts +7 -0
- package/types/panel/authorsession.d.ts +47 -5
- package/types/panel/jobgrid.d.ts +8 -8
- package/types/panel/jobplan.d.ts +48 -10
- package/types/panel/server.d.ts +27 -18
- package/types/panel/status.d.ts +5 -0
- package/types/pickrecord.d.ts +20 -13
- package/types/placerule.d.ts +194 -0
- package/types/planrun.d.ts +1 -22
- package/types/providerrows.d.ts +0 -31
- package/types/providers.d.ts +3 -19
- package/types/questionbox.d.ts +87 -0
- package/types/rowedit.d.ts +32 -0
- package/types/rubricstep.d.ts +100 -48
- package/types/run.d.ts +9 -19
- package/types/userrun.d.ts +0 -1
- package/src/calibrate.js +0 -702
- package/src/cardauthor.js +0 -502
- package/src/fitcheck.js +0 -166
- package/types/calibrate.d.ts +0 -201
- package/types/cardauthor.d.ts +0 -358
- package/types/fitcheck.d.ts +0 -113
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
|
|
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
|
|
@@ -354,7 +325,7 @@ export const KIND_CATALOGUE = Object.freeze({
|
|
|
354
325
|
pathParams: Object.freeze([]),
|
|
355
326
|
shape: 'step: integer (the job line number), parts: [{text: string, class: "countable" | "fact" | "judged" | "guard" | "none", '
|
|
356
327
|
+ 'check?: "cited" | "minClaims" | "maxClaims", value?: integer, '
|
|
357
|
-
+ 'source?: string (an input label), domains?: string[],
|
|
328
|
+
+ 'source?: string (an input label), domains?: string[], rules?: integer[], '
|
|
358
329
|
+ 'fact parts: facts?: [{name, shape: "money"|"number"|"date"|"time"|"phrase"|"text", unit?|currency? (each one value or a list; money names at least one), phrase?, anchor?, until?, '
|
|
359
330
|
+ 'rule?: {op, value | lo+hi}, aiProposal?: boolean}], count?: {min?, max?}}]',
|
|
360
331
|
asserts: 'the file output/<step>.json under output/steps/ exists, is a JSON object, and its "text" is present and within the '
|
|
@@ -366,8 +337,7 @@ export const KIND_CATALOGUE = Object.freeze({
|
|
|
366
337
|
+ 'a line that FINDS, LISTS or LOOKS UP something gets ONE part of class "fact" instead (source = the input label, '
|
|
367
338
|
+ 'facts = the required facts, count = how many results): its step file holds only filled facts and no free text, so '
|
|
368
339
|
+ 'give such a line no word, section or claim-count parts; list in "rules" the number of every ~ rule a part carries out; '
|
|
369
|
-
+ '
|
|
370
|
-
+ 'covers is moved to Not checked before signing); "judged" when only reading '
|
|
340
|
+
+ '"judged" when only reading '
|
|
371
341
|
+ 'it could decide; "guard" for a rule about web sources (domains); "none" when you cannot sort it. Never turn a part you cannot '
|
|
372
342
|
+ 'count or quote into a countable one by guessing a number.',
|
|
373
343
|
}),
|
|
@@ -1160,25 +1130,6 @@ function scopeOfJob(declaration, idx, guards) {
|
|
|
1160
1130
|
return { scoped: false, via: null };
|
|
1161
1131
|
}
|
|
1162
1132
|
|
|
1163
|
-
/**
|
|
1164
|
-
* Which of a judged stage's paths lie OUTSIDE the job's write fence? One owner of the rule "a check must be
|
|
1165
|
-
* free to edit every file it can report on", called from every door that validates a declaration. It uses
|
|
1166
|
-
* the shipped fence spelling (`globToPrefix`, the same containment reading plan.js's `insideFence` has) and
|
|
1167
|
-
* returns `[]` when there is no fence to compare against or the paths are not a string list (shape is the
|
|
1168
|
-
* schema walk's business).
|
|
1169
|
-
* @param {unknown} paths @param {string[]|null|undefined} writeScope
|
|
1170
|
-
* @returns {string[]}
|
|
1171
|
-
*/
|
|
1172
|
-
export function judgedOutsideFence(paths, writeScope) {
|
|
1173
|
-
if (!Array.isArray(writeScope) || writeScope.length === 0 || !Array.isArray(paths)) return [];
|
|
1174
|
-
const fence = writeScope.filter(isNonEmptyString).map(globToPrefix);
|
|
1175
|
-
if (fence.length === 0) return [];
|
|
1176
|
-
return paths.filter(isNonEmptyString).filter((raw) => {
|
|
1177
|
-
const n = normPrefix(raw);
|
|
1178
|
-
return !fence.some((f) => f === '.' || n === f || n.startsWith(`${f}/`));
|
|
1179
|
-
});
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
1133
|
/**
|
|
1183
1134
|
* Kinds a declaration may carry AT MOST ONCE, as data beside the catalogue.
|
|
1184
1135
|
*
|
|
@@ -1197,7 +1148,7 @@ export function judgedOutsideFence(paths, writeScope) {
|
|
|
1197
1148
|
* stage — applied to the one population that decides whether the law fires at
|
|
1198
1149
|
* all.
|
|
1199
1150
|
*/
|
|
1200
|
-
const AT_MOST_ONCE_KINDS = Object.freeze(['files-changed', 'human-confirms'
|
|
1151
|
+
const AT_MOST_ONCE_KINDS = Object.freeze(['files-changed', 'human-confirms']);
|
|
1201
1152
|
|
|
1202
1153
|
/** why each at-most-once kind is at most once, in the author's own terms. A map
|
|
1203
1154
|
* rather than a chain of conditionals: a kind added to the list above with no
|
|
@@ -1211,20 +1162,12 @@ const AT_MOST_ONCE_REASON = Object.freeze({
|
|
|
1211
1162
|
'human-confirms': (label, owner) => `stage "${label}" is a second human-confirms stage — "${owner}" already asks the `
|
|
1212
1163
|
+ 'person. One signer, one judge (ruling 4), asked ONCE at the end: a second door is a second verdict, and the run '
|
|
1213
1164
|
+ 'has no way to say which of them was the one it stopped for',
|
|
1214
|
-
// softgreen module 3. The judged floor is the close's ONE judged ruler: two of
|
|
1215
|
-
// them are two bars for one verdict class, each buying its own paid calls, and
|
|
1216
|
-
// first-red-wins means the second only ever runs when the first was satisfied —
|
|
1217
|
-
// so its only reachable effect is to spend money re-judging a tree that already
|
|
1218
|
-
// cleared the bar the signer signed. One card, one calibration set, one ruler.
|
|
1219
|
-
'judged-floor': (label, owner) => `stage "${label}" is a second judged-floor stage — "${owner}" is already this `
|
|
1220
|
-
+ 'close\'s judged ruler. One card and one calibration set decide one bar: a second judged stage is a second bar '
|
|
1221
|
-
+ 'for the same verdict, and it buys its own paid calls to re-judge a tree the first one already passed',
|
|
1222
1165
|
});
|
|
1223
1166
|
|
|
1224
1167
|
/** the kinds NO ONE runs as an in-run ruler — ruling 5's law, as data. A
|
|
1225
1168
|
* declaration that offers one is a red rather than a normalization: the signer
|
|
1226
1169
|
* must not read one thing and have the runner store another. */
|
|
1227
|
-
export const NEVER_OFFERED_KINDS = Object.freeze(['human-confirms'
|
|
1170
|
+
export const NEVER_OFFERED_KINDS = Object.freeze(['human-confirms']);
|
|
1228
1171
|
|
|
1229
1172
|
/** @param {any} v */
|
|
1230
1173
|
const strArray = (v) => Array.isArray(v) && v.length > 0 && v.every(isNonEmptyString);
|
|
@@ -1276,13 +1219,11 @@ function readPath(p, dotted) {
|
|
|
1276
1219
|
* @param {{catalogue?: Record<string, KindSpec>, listing?: string[]|null,
|
|
1277
1220
|
* guards?: {name: string, kind: string, params: Record<string, any>, fill: string[]}[]|null,
|
|
1278
1221
|
* envOwned?: string[]|null, envInjected?: Record<string, string>|null, deferListing?: boolean,
|
|
1279
|
-
* verdictType?: string|null,
|
|
1222
|
+
* verdictType?: string|null, jobLines?: {n: number}[]|null, inputLabels?: string[]|null}} [opts]
|
|
1280
1223
|
* `inputLabels` — the labels of the person's inputs (Part 1a). Present, a rubric-step `cited` part must name one of them.
|
|
1281
1224
|
* `jobLines` — the person's numbered job lines (P7). Present, every stage must name the line it serves and every
|
|
1282
1225
|
* line needs a stage or a refusal ({@link checkJobLines}); absent (every spec that predates the job block), the
|
|
1283
1226
|
* rule is not run.
|
|
1284
|
-
* `writeScope` — the job's signed write fence. Every path a judged stage judges must sit inside it
|
|
1285
|
-
* ({@link judgedOutsideFence}); absent, the rule is not run (the plain-folder deferral has no fence).
|
|
1286
1227
|
* `listing` — repo-relative paths at the seed (`git ls-tree -r --name-only`).
|
|
1287
1228
|
* `guards` — the picked class's injected guards (`classGuards`).
|
|
1288
1229
|
* `verdictType` — the class the USER picked (`VERDICT_CLASSES`).
|
|
@@ -1299,7 +1240,7 @@ function readPath(p, dotted) {
|
|
|
1299
1240
|
export function validateDeclaration(declaration, opts = {}) {
|
|
1300
1241
|
const {
|
|
1301
1242
|
catalogue = KIND_CATALOGUE, listing = null, guards = null, envOwned = null, envInjected = null,
|
|
1302
|
-
verdictType = null,
|
|
1243
|
+
verdictType = null, jobLines = null, inputLabels = null,
|
|
1303
1244
|
} = opts;
|
|
1304
1245
|
const deferListing = opts.deferListing === true;
|
|
1305
1246
|
/** @type {Red[]} */
|
|
@@ -1442,18 +1383,6 @@ export function validateDeclaration(declaration, opts = {}) {
|
|
|
1442
1383
|
} else kindOwners.set(s.kind, label);
|
|
1443
1384
|
}
|
|
1444
1385
|
|
|
1445
|
-
// A judged stage may only judge what the run can fix: a path outside the write fence is a
|
|
1446
|
-
// finding the worker can never act on (run mv13ery3: bin/pulselog.js, fence src/**).
|
|
1447
|
-
if (s.kind === JUDGED_FLOOR_KIND && isObj(s.params)) {
|
|
1448
|
-
const outside = judgedOutsideFence(s.params.paths, writeScope);
|
|
1449
|
-
if (outside.length > 0) {
|
|
1450
|
-
red('judged-outside-write-scope', `${at}.params.paths`, `stage "${label}" judges ${outside.join(', ')}, but the `
|
|
1451
|
-
+ `job may only edit ${writeScope?.join(', ')}. A check that reports on a file the run is fenced out of can `
|
|
1452
|
-
+ 'never be satisfied — every finding on it is one the worker cannot fix. Name files inside the write fence',
|
|
1453
|
-
{ stage: label, outside, fence: (writeScope ?? []).map(globToPrefix) });
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
1386
|
// ── RULING 5, AS LAW: judged and human stages are `offer: false`, and the
|
|
1458
1387
|
// law is checked rather than applied. `checkMenu` filters `offer !== false`,
|
|
1459
1388
|
// so a declaration that says nothing is silent about a rule the runner
|
|
@@ -1479,31 +1408,6 @@ export function validateDeclaration(declaration, opts = {}) {
|
|
|
1479
1408
|
+ 'evidence package and the mechanical stages behind them would be silently deleted (the composition law: '
|
|
1480
1409
|
+ 'mechanical first, human last)', { kind: s.kind, stage: label, at: i, last: stages.length - 1 });
|
|
1481
1410
|
}
|
|
1482
|
-
// ── THE SAME LAW's judged half (design record 2026-08-17 §4.5: *mechanical
|
|
1483
|
-
// stages FIRST, the judged stage AFTER, first-red-wins*). The human rule is
|
|
1484
|
-
// stated as "last" because a person is the top of the hierarchy; the judged
|
|
1485
|
-
// rule is stated as "after the mechanical ones", because a human stage may
|
|
1486
|
-
// legally follow it — mechanical → judge → person is the full composition.
|
|
1487
|
-
//
|
|
1488
|
-
// What it costs to admit is the same both ways round: first-red-wins means a
|
|
1489
|
-
// judged stage in front of a mechanical one BUYS PAID CALLS to grade a tree
|
|
1490
|
-
// the free stages would have refused for nothing — and if the judge passes it
|
|
1491
|
-
// the mechanical red still lands, so the money bought no verdict either.
|
|
1492
|
-
// A SECOND judged stage is NOT this red (it is `duplicate-kind`, emitted
|
|
1493
|
-
// above): one problem, one red, in one vocabulary.
|
|
1494
|
-
if (s.kind === JUDGED_FLOOR_KIND) {
|
|
1495
|
-
const behind = stages.slice(i + 1).filter((/** @type {any} */ x) => isObj(x) && isNonEmptyString(x.kind)
|
|
1496
|
-
&& catalogue[x.kind] && CLASS_RANK[catalogue[x.kind].verdictClass] < CLASS_RANK['soft-green']);
|
|
1497
|
-
if (behind.length) {
|
|
1498
|
-
red('judged-stage-order', `${at}.kind`, `stage "${label}" is judged and runs BEFORE the mechanical `
|
|
1499
|
-
+ `stage${behind.length > 1 ? 's' : ''} ${behind.map((/** @type {any} */ x) => `"${x.name}"`).join(', ')}. `
|
|
1500
|
-
+ 'The close is first-red-wins and a judged stage buys a paid call per artifact: put every stage a command '
|
|
1501
|
-
+ 'can decide in front of it, so the free rulers shield the expensive one (the composition law: mechanical '
|
|
1502
|
-
+ 'first, judge after)',
|
|
1503
|
-
{ kind: s.kind, stage: label, at: i, behind: behind.map((/** @type {any} */ x) => x.name) });
|
|
1504
|
-
}
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
1411
|
const p = s.params;
|
|
1508
1412
|
if (!isObj(p)) { red('missing-field', `${at}.params`, `an object carrying: ${spec.required.join(', ')}`); return; }
|
|
1509
1413
|
for (const k of spec.required) {
|
|
@@ -1828,30 +1732,6 @@ function checkKind({ kind, params: p, at, red, scoped, label, populations, envOw
|
|
|
1828
1732
|
+ 'result — a human stage with nothing to ask is the bare "approve?" ruling 2 forbids');
|
|
1829
1733
|
}
|
|
1830
1734
|
break;
|
|
1831
|
-
case 'judged-floor': {
|
|
1832
|
-
// ONE spelling of what a card is, the JUDGE's own (`validateCard`, src/judged.js) —
|
|
1833
|
-
// the same rule `normalizeParser` follows: the validator and the grader must agree
|
|
1834
|
-
// about what a card MEANS, or the one that grades is the one nobody validated.
|
|
1835
|
-
const cv = validateCard(p.card);
|
|
1836
|
-
for (const detail of cv.reds) red('invalid-value', `${at}.params.card`, detail);
|
|
1837
|
-
// the artifact list. The listing rule (`checkPaths`) judges whether each element
|
|
1838
|
-
// EXISTS; this judges the shape and the bill — one paid call per artifact, so an
|
|
1839
|
-
// unbounded list is a bill rather than a red (the MAX_TERMS sibling).
|
|
1840
|
-
if (!strArray(p.paths)) {
|
|
1841
|
-
red('invalid-value', `${at}.params.paths`, 'a non-empty array of repository-relative files to judge — the '
|
|
1842
|
-
+ 'AUTHORITATIVE artifacts, read off the seed listing, never the worker\'s summary of what it did');
|
|
1843
|
-
} else if (new Set(p.paths.map(String)).size !== p.paths.length) {
|
|
1844
|
-
// one artifact is one population, and a list naming it twice buys two paid
|
|
1845
|
-
// calls over identical bytes — deduplicating it silently would leave the
|
|
1846
|
-
// signer reading one list while the runner spent on another
|
|
1847
|
-
red('invalid-value', `${at}.params.paths`, 'the same artifact is named twice — one artifact is one population, '
|
|
1848
|
-
+ 'and a duplicate buys a second paid call over identical bytes');
|
|
1849
|
-
} else if (p.paths.length > MAX_JUDGED_PATHS) {
|
|
1850
|
-
red('bounds', `${at}.params.paths`, `${p.paths.length} artifacts exceeds the ceiling of ${MAX_JUDGED_PATHS} — a `
|
|
1851
|
-
+ 'judged stage buys one call per artifact, and the ceiling is the arbiter\'s, not the declaration\'s');
|
|
1852
|
-
}
|
|
1853
|
-
break;
|
|
1854
|
-
}
|
|
1855
1735
|
default:
|
|
1856
1736
|
red('unknown-kind', `${at}.kind`, `"${kind}" is in the catalogue but has no checker`, { kind });
|
|
1857
1737
|
}
|