bareloop 0.56.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 +35 -0
- package/README.md +3 -3
- package/bareloop.context.md +65 -207
- package/package.json +2 -2
- package/src/authorflow.js +25 -78
- package/src/authoring.js +5 -124
- package/src/authorjob.js +33 -395
- package/src/authorreadout.js +17 -355
- package/src/authorrun.js +8 -211
- package/src/blockasks.js +2 -2
- package/src/bundlerun.js +4 -1
- package/src/checkblock.js +76 -50
- package/src/checklist.js +1 -1
- package/src/checkpick.js +10 -1
- package/src/cli.js +3 -3
- package/src/declaredclose.js +11 -110
- package/src/destpoint.js +1 -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 +2 -2
- package/src/pagerules.js +18 -3
- package/src/panel/authorroutes.js +9 -3
- package/src/panel/authorsession.js +99 -141
- package/src/panel/importrun.js +0 -1
- package/src/panel/index.html +6 -6
- package/src/panel/jobplan.js +7 -5
- package/src/panel/server.js +25 -64
- package/src/panel/status.js +3 -0
- package/src/pickrecord.js +15 -54
- package/src/planrun.js +2 -48
- package/src/promptregisters.js +2 -17
- package/src/providerrows.js +0 -36
- package/src/providers.js +4 -25
- package/src/questionbox.js +4 -12
- package/src/rubricstep.js +26 -6
- package/src/run.js +2 -15
- package/src/userrun.js +14 -111
- package/types/authorflow.d.ts +9 -58
- package/types/authoring.d.ts +1 -14
- package/types/authorjob.d.ts +13 -55
- package/types/authorreadout.d.ts +8 -80
- package/types/blockasks.d.ts +1 -2
- package/types/checkblock.d.ts +32 -17
- package/types/checklist.d.ts +2 -2
- package/types/checkpick.d.ts +5 -0
- package/types/cli.d.ts +1 -3
- package/types/declaredclose.d.ts +3 -33
- 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/pagerules.d.ts +7 -0
- package/types/panel/authorsession.d.ts +35 -4
- package/types/panel/jobplan.d.ts +3 -3
- package/types/panel/server.d.ts +13 -5
- package/types/panel/status.d.ts +5 -0
- package/types/pickrecord.d.ts +8 -13
- package/types/planrun.d.ts +1 -22
- package/types/providerrows.d.ts +0 -31
- package/types/providers.d.ts +3 -19
- package/types/rubricstep.d.ts +9 -0
- package/types/run.d.ts +1 -20
- package/types/userrun.d.ts +0 -1
- package/src/calibrate.js +0 -702
- package/src/cardauthor.js +0 -502
- package/src/fitcheck.js +0 -168
- package/types/calibrate.d.ts +0 -201
- package/types/cardauthor.d.ts +0 -358
- package/types/fitcheck.d.ts +0 -119
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bareloop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
4
4
|
"description": "Workflows that earn their own design, with receipts — agent-authored workflows for repeated, long, verifiable jobs that improve across runs under an un-gameable gate.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"bare-agent": "^0.59.0",
|
|
31
31
|
"barebrowse": "^0.25.0",
|
|
32
|
-
"bareguard": "^0.
|
|
32
|
+
"bareguard": "^0.36.0",
|
|
33
33
|
"litectx": "^0.41.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
package/src/authorflow.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
// TWO CONSEQUENCES, NAMED RATHER THAN SMOOTHED:
|
|
27
27
|
//
|
|
28
28
|
// 1. A LOCKED KIND IS INEXPRESSIBLE IN TOOL MODE. The schema carries one branch
|
|
29
|
-
// per LIVE kind, so there is no way to spell
|
|
29
|
+
// per LIVE kind, so there is no way to spell
|
|
30
30
|
// `human-confirms` — which is the `check-passes(name)` move applied one
|
|
31
31
|
// level up (illegal becomes unsayable, not rejected late). The price is
|
|
32
32
|
// real: M2's `locked-kind` red is bareloop's DEMAND COUNTER for its own
|
|
@@ -77,8 +77,7 @@ import { thinkingCallOptions } from './thinking.js';
|
|
|
77
77
|
import { createRequire } from 'node:module';
|
|
78
78
|
import { realpathSync } from 'node:fs';
|
|
79
79
|
import { join, relative, isAbsolute } from 'node:path';
|
|
80
|
-
import { seedRead as runSeedReadStages, makeSeedTrees, AGGREGATES, SIGNS, MAX_TERMS
|
|
81
|
-
import { JUDGE_RULE_IDS } from './judged.js';
|
|
80
|
+
import { seedRead as runSeedReadStages, makeSeedTrees, AGGREGATES, SIGNS, MAX_TERMS } from './kinds.js';
|
|
82
81
|
import {
|
|
83
82
|
KIND_CATALOGUE, MAX_STAGES, DIRECTIONS, BASELINES,
|
|
84
83
|
GENRE_LANGUAGES, RUBRIC_LANG, DECLARABLE_LANGUAGES, TYPES_GENRE_TEMPLATE, classGuards, genreEnv, genreOwnedEnvNames, genreInstruments,
|
|
@@ -90,7 +89,7 @@ import { redactSecrets } from './validate.js';
|
|
|
90
89
|
import { ledgerRecord } from './checklist.js';
|
|
91
90
|
import { ROW_EDIT_REVISE, rowEditUserText, rowEditChannel, editsOf } from './rowedit.js';
|
|
92
91
|
import { REASON, CheckBlock } from './checkblock.js';
|
|
93
|
-
import { stepFileContract, inputLabelsOf, stepFileRel, readFrozenInputs, lineRules } from './rubricstep.js';
|
|
92
|
+
import { stepFileContract, inputLabelsOf, stepFileRel, readFrozenInputs, lineRules, lineCarriesText } from './rubricstep.js';
|
|
94
93
|
import { dropRows, dropLine } from './pagedropwords.js';
|
|
95
94
|
import { renderLookReport } from './inputlook.js';
|
|
96
95
|
import { checkDeclarationWords, labelListsFor } from './factwords.js';
|
|
@@ -324,10 +323,10 @@ export const INPUTS_FIELD = Object.freeze({
|
|
|
324
323
|
+ '(e.g. `spec: docs/spec.md`) — git must track them.',
|
|
325
324
|
});
|
|
326
325
|
|
|
327
|
-
/** P7: how to write "The job" (printed under its question by the CLI; the panel's box shows the same in its
|
|
326
|
+
/** P7: how to write "The job" (printed under its question by the CLI; the panel's box shows the same in its placeholder). */
|
|
328
327
|
export const JOB_BLOCK_HELP = Object.freeze([
|
|
329
328
|
'One line per thing the job must do — each plain line gets a number. A line starting with `~` is a rule for the',
|
|
330
|
-
'numbered line above it
|
|
329
|
+
'numbered line above it (what you want checked, in your own words).',
|
|
331
330
|
]);
|
|
332
331
|
|
|
333
332
|
/** Destination's wording when Source resolved to a git repo: the answer IS the
|
|
@@ -402,37 +401,14 @@ export const FIELD_LABELS = Object.freeze({
|
|
|
402
401
|
* soft-green and hitl extensions below — computed, never hardcoded twice. */
|
|
403
402
|
const NEXT_FREE_TEXT_KEY = Object.keys(GREEN_QUESTIONS).length + 1;
|
|
404
403
|
|
|
405
|
-
/**
|
|
406
|
-
|
|
407
|
-
* rather than a second, hand-typed "6"/"7". */
|
|
408
|
-
export const SOFTGREEN_JUDGE_EXAMPLES_KEY = NEXT_FREE_TEXT_KEY;
|
|
409
|
-
|
|
410
|
-
/** The Judge Examples question — the signed table's own Holds text, verbatim
|
|
411
|
-
* ("one pass, one fail, and why"), not the old worded Q7 ("Give one example
|
|
412
|
-
* you'd pass and one you'd fail, and say why."). Exported so `cardauthor.js`'s
|
|
413
|
-
* prompt and this module's own `SOFTGREEN_QUESTIONS` render the identical
|
|
414
|
-
* string; its label ("Judge examples") lives in `SOFTGREEN_FIELD_LABELS`. */
|
|
415
|
-
export const JUDGE_EXAMPLES_QUESTION = 'the PASS: and FAIL: examples the person wrote under their job lines, each with its line number';
|
|
416
|
-
|
|
417
|
-
/** {@link FIELD_LABELS} plus Judge Examples' own label, for the soft-green set. */
|
|
418
|
-
export const SOFTGREEN_FIELD_LABELS = Object.freeze({
|
|
419
|
-
...FIELD_LABELS,
|
|
420
|
-
[SOFTGREEN_JUDGE_EXAMPLES_KEY]: 'Judge examples',
|
|
421
|
-
});
|
|
404
|
+
/** {@link FIELD_LABELS} for the soft-green set: the same one label (the judge examples are gone). */
|
|
405
|
+
export const SOFTGREEN_FIELD_LABELS = Object.freeze({ ...FIELD_LABELS });
|
|
422
406
|
|
|
423
407
|
/**
|
|
424
|
-
* THE SOFTGREEN SET — the green
|
|
425
|
-
*
|
|
426
|
-
* pair in the person's own words, which module 4 (`cardauthor.js`) compiles
|
|
427
|
-
* into the signed rubric card and the frozen calibration set. It rides in
|
|
428
|
-
* `answers` and reaches the composer verbatim through the prompt's interview
|
|
429
|
-
* block, exactly as every other free-text answer does — this module derives
|
|
430
|
-
* nothing from it.
|
|
408
|
+
* THE SOFTGREEN SET — the green set again: a rubric job's whole job is the numbered lines of "The job" (its `~` rules
|
|
409
|
+
* become the check list); the PASS/FAIL judge examples are gone (hamr 2026-11-14).
|
|
431
410
|
*/
|
|
432
|
-
export const SOFTGREEN_QUESTIONS = Object.freeze({
|
|
433
|
-
...GREEN_QUESTIONS,
|
|
434
|
-
[SOFTGREEN_JUDGE_EXAMPLES_KEY]: JUDGE_EXAMPLES_QUESTION,
|
|
435
|
-
});
|
|
411
|
+
export const SOFTGREEN_QUESTIONS = Object.freeze({ ...GREEN_QUESTIONS });
|
|
436
412
|
|
|
437
413
|
/**
|
|
438
414
|
* THE HITL SET (N4 slice 1, kept in code only — never offered in the form or
|
|
@@ -507,10 +483,8 @@ export const CLASS_STATEMENTS = Object.freeze({
|
|
|
507
483
|
'soft-green': 'The person declared this job SOFT-GREEN: part of what "done" means here needs JUDGEMENT — reading '
|
|
508
484
|
+ 'the result and deciding whether it is any good — and no command can render it. Compose the mechanical part '
|
|
509
485
|
+ 'first: everything about this repository a command can decide is still a mechanical stage, exactly as it would '
|
|
510
|
-
+ 'be for a green job.
|
|
511
|
-
+ '
|
|
512
|
-
+ 'because a finding on a file the run is fenced out of can never be fixed). A judged stage decides only the lines its card names, '
|
|
513
|
-
+ 'so name each thing they look for as its own line, and leave nothing to be inferred.',
|
|
486
|
+
+ 'be for a green job. Compose NO stage for the part that needs judgement: there is no judged stage to put it in '
|
|
487
|
+
+ '(the old judge is gone), so leave that part out and say so in your notes; the person judges it at Accept.',
|
|
514
488
|
// N4 slice 1. The mechanical-first composition law is stated as an ORDER
|
|
515
489
|
// because first-red-wins makes the order the mechanism: the cheap stages shield
|
|
516
490
|
// the expensive one, and the person is never the first filter.
|
|
@@ -649,10 +623,12 @@ export const GUARD_DESCRIPTIONS = Object.freeze({
|
|
|
649
623
|
* close — one source, never a second hand-typed list — rendered through the
|
|
650
624
|
* frozen line in {@link GUARD_DESCRIPTIONS}, plus the write fence (a real,
|
|
651
625
|
* signed fence — {@link writeScopeBlock}'s own subject) when one is set.
|
|
652
|
-
*
|
|
626
|
+
* A rubric line's file is listed as carrying text ONLY when the close really puts a text-present check on it ({@link lineCarriesText}, derived from `closeDecl`; one owner): a facts-only line
|
|
627
|
+
* (results and no note) is listed without it, and with no close to read nothing is claimed about text.
|
|
628
|
+
* @param {{verdictType: string, lang: string, writeScope?: string[]|null, jobLines?: {n: number}[]|null, closeDecl?: any}} o
|
|
653
629
|
* @returns {string[]}
|
|
654
630
|
*/
|
|
655
|
-
export function confirmProtections({ verdictType, lang, writeScope = null, jobLines = null }) {
|
|
631
|
+
export function confirmProtections({ verdictType, lang, writeScope = null, jobLines = null, closeDecl = null }) {
|
|
656
632
|
const guards = classGuards({ verdictType, lang });
|
|
657
633
|
const lines = guards.map((g) => {
|
|
658
634
|
const desc = GUARD_DESCRIPTIONS[g.name];
|
|
@@ -668,7 +644,7 @@ export function confirmProtections({ verdictType, lang, writeScope = null, jobLi
|
|
|
668
644
|
// PART 1a: a rubric job on local files always checks, for EVERY numbered line, that the line's file exists, is complete
|
|
669
645
|
// JSON and has text — a fact of the close's shape (`rubric-step`), not a plan of the model's, so it is listed from code
|
|
670
646
|
if (lang === RUBRIC_LANG && Array.isArray(jobLines)) {
|
|
671
|
-
for (const l of jobLines) lines.push(`line ${l.n} file — ${stepFileRel(l.n)} must exist, be complete JSON, and carry text`);
|
|
647
|
+
for (const l of jobLines) lines.push(`line ${l.n} file — ${stepFileRel(l.n)} must exist, be complete JSON${lineCarriesText(closeDecl, l.n) ? ', and carry text' : ''}`);
|
|
672
648
|
}
|
|
673
649
|
return lines;
|
|
674
650
|
}
|
|
@@ -790,39 +766,6 @@ export const PARAM_SCHEMAS = Object.freeze({
|
|
|
790
766
|
extensions: { type: 'array', minItems: 1, items: { type: 'string' } },
|
|
791
767
|
allowPrefixes: { type: 'array', minItems: 1, items: { type: 'string' } },
|
|
792
768
|
requireNonEmpty: { const: true },
|
|
793
|
-
// SOFTGREEN's two. `rule` is an ENUM off the judge's own rulebook — where only a
|
|
794
|
-
// closed set can satisfy a field, the illegal value is made inexpressible rather
|
|
795
|
-
// than rejected after the fact (`check-passes(name)`, again) — and `text` is the
|
|
796
|
-
// only free string, carrying the signer's words so a red can be explained in them.
|
|
797
|
-
card: {
|
|
798
|
-
type: 'object',
|
|
799
|
-
description: 'the rubric, as enumerated items: one line per thing the person actually looks for, in the order '
|
|
800
|
-
+ 'they look for them. The rule is SELECTED from the arbiter\'s own rulebook; the text is theirs.',
|
|
801
|
-
properties: {
|
|
802
|
-
items: {
|
|
803
|
-
type: 'array',
|
|
804
|
-
minItems: 1,
|
|
805
|
-
items: {
|
|
806
|
-
type: 'object',
|
|
807
|
-
properties: {
|
|
808
|
-
rule: { enum: [...JUDGE_RULE_IDS], description: 'which owned rule this line asserts' },
|
|
809
|
-
text: { type: 'string', minLength: 1, description: 'what this line means, in the person\'s own words' },
|
|
810
|
-
},
|
|
811
|
-
required: ['rule', 'text'],
|
|
812
|
-
additionalProperties: false,
|
|
813
|
-
},
|
|
814
|
-
},
|
|
815
|
-
},
|
|
816
|
-
required: ['items'],
|
|
817
|
-
additionalProperties: false,
|
|
818
|
-
},
|
|
819
|
-
paths: {
|
|
820
|
-
type: 'array',
|
|
821
|
-
minItems: 1,
|
|
822
|
-
maxItems: MAX_JUDGED_PATHS,
|
|
823
|
-
items: { type: 'string' },
|
|
824
|
-
description: 'the AUTHORITATIVE artifacts to judge, repository-relative, read off the listing. One paid call each.',
|
|
825
|
-
},
|
|
826
769
|
step: { type: 'integer', minimum: 1, description: 'the number of the job line this stage serves; its file is output/steps/<step>.json' },
|
|
827
770
|
parts: {
|
|
828
771
|
type: 'array',
|
|
@@ -2273,7 +2216,7 @@ export async function runConfirmTurn({
|
|
|
2273
2216
|
// the prompt below so the model can check `notChecked` against it, and
|
|
2274
2217
|
// reused (never recomputed) after the call so the shown, prompted, and
|
|
2275
2218
|
// recorded protections are always the exact same list.
|
|
2276
|
-
const protections = confirmProtections({ verdictType, lang: resolvedLang, writeScope, jobLines });
|
|
2219
|
+
const protections = confirmProtections({ verdictType, lang: resolvedLang, writeScope, jobLines, closeDecl: block !== null ? block.closeView() : null });
|
|
2277
2220
|
|
|
2278
2221
|
// ── up to 2 paid rounds (ruling 5) ─────────────────────────────────────────
|
|
2279
2222
|
/** @type {string|null} */
|
|
@@ -2358,12 +2301,16 @@ export async function runConfirmTurn({
|
|
|
2358
2301
|
// a rubric job's turn keeps nothing but the goal of the model's plan: its checks, gaps and questions are the list's to make, so code discards any it sent
|
|
2359
2302
|
if (goalOnly) r.plan = { ...r.plan, checks: [], notChecked: [], questions: [] };
|
|
2360
2303
|
const notChecked = [...(r.plan.notChecked ?? [])];
|
|
2361
|
-
|
|
2304
|
+
const lookRows = dropRows(facts?.look?.dropped).map((row) => ({ row, text: dropLine(row, jobLines, lineRules) }));
|
|
2305
|
+
for (const { text } of lookRows) if (!notChecked.includes(text)) notChecked.push(text);
|
|
2306
|
+
// ONE row per `~` rule on the CARD (hamr 2026-11-14, run mwgsl7zx): a rule the check list says Not checked is said by its row alone (its reason is the look's sentence, or the person's kept Drop, which wins),
|
|
2307
|
+
// so the look's own line for that rule is not drawn beside it. `accepted.notChecked` below stays the full list the drafter is told.
|
|
2308
|
+
const shownNotChecked = () => notChecked.filter((t) => !lookRows.some((l) => l.text === t && l.row.rule !== undefined && block !== null && block.saysRule(l.row.line, l.row.rule)));
|
|
2362
2309
|
const checkItems = normalizeChecks(r.plan.checks);
|
|
2363
2310
|
r.plan = { ...r.plan, checks: checkItems.map((c) => c.text), checkItems };
|
|
2364
2311
|
// the rows of the check block, drawn by the same readers as the signed card (hamr 2026-11-12: the confirm card showed no row the block had built); shown only, never accepted
|
|
2365
2312
|
const planFor = (/** @type {any} */ c) => ({
|
|
2366
|
-
...r.plan, ...(c === null ? {} : { checkItems: c.checkItems, checks: c.checkItems.map((/** @type {any} */ x) => x.text) }), protections, notChecked: c === null ? notChecked :
|
|
2313
|
+
...r.plan, ...(c === null ? {} : { checkItems: c.checkItems, checks: c.checkItems.map((/** @type {any} */ x) => x.text) }), protections, notChecked: [...new Set([...(c === null ? notChecked : shownNotChecked()), ...(c === null ? [] : c.notChecked)])], ...(c?.notCheckedBy ? { notCheckedBy: c.notCheckedBy } : {}),
|
|
2367
2314
|
signedFacts: (Array.isArray(facts?.look?.facts) ? facts.look.facts : []).map((/** @type {any} */ f) => String(f?.name)),
|
|
2368
2315
|
...(block !== null && cardOf !== null ? { suggested: block.suggestedView(), editable: true } : {}),
|
|
2369
2316
|
});
|
|
@@ -2741,7 +2688,7 @@ export async function authorClose({
|
|
|
2741
2688
|
// the draft gate on one settled declaration: validation, then (PART 1c, rubric) code proves, at $0, that every label is PICKED from the input's own list and every word a fact depends
|
|
2742
2689
|
// on is really in the source (white-space blind, once is enough). A word that is not found is a red naming the word and the input; the drafter revises like it does for any validation red.
|
|
2743
2690
|
const checkDraft = (/** @type {any} */ d) => {
|
|
2744
|
-
let r = validateDeclaration(d, { catalogue, listing: seedFiles, guards, envOwned: ownedEnvNames, verdictType,
|
|
2691
|
+
let r = validateDeclaration(d, { catalogue, listing: seedFiles, guards, envOwned: ownedEnvNames, verdictType, jobLines, inputLabels: inputLabelsOf(inputs) });
|
|
2745
2692
|
if (r.ok && lang === RUBRIC_LANG) {
|
|
2746
2693
|
const words = checkDeclarationWords(r.declaration, inputTexts, facts?.look ?? null);
|
|
2747
2694
|
if (words.length > 0) r = { ...r, ok: false, reds: [...r.reds, ...words], declaration: null };
|
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
|
|
@@ -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'
|
|
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'
|
|
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,
|
|
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,
|
|
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
|
}
|