bareloop 0.55.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/bareloop.context.md +4 -2
- package/package.json +2 -2
- package/src/authorflow.js +141 -264
- package/src/authoring.js +2 -3
- package/src/authorjob.js +117 -88
- package/src/authorreadout.js +9 -15
- package/src/authorrun.js +13 -4
- package/src/behaviour.js +14 -0
- package/src/blockasks.js +43 -0
- package/src/checkblock.js +772 -0
- package/src/checklist.js +128 -0
- package/src/checkpick.js +30 -312
- package/src/checkwords.js +3 -1
- package/src/declaredclose.js +30 -1
- package/src/destpoint.js +3 -1
- package/src/draftspend.js +46 -0
- package/src/facts.js +8 -1
- package/src/fitcheck.js +5 -3
- package/src/pagemap.js +15 -3
- package/src/panel/authorroutes.js +15 -3
- package/src/panel/authorsession.js +133 -46
- package/src/panel/index.html +194 -22
- package/src/panel/jobplan.js +85 -33
- package/src/panel/server.js +52 -7
- package/src/pickrecord.js +19 -1
- package/src/placerule.js +355 -0
- package/src/promptregisters.js +11 -0
- package/src/questionbox.js +112 -0
- package/src/rowedit.js +115 -0
- package/src/rubricstep.js +212 -125
- package/src/run.js +10 -2
- package/src/userrun.js +46 -1
- package/types/authorflow.d.ts +32 -139
- package/types/authorjob.d.ts +24 -6
- package/types/authorreadout.d.ts +4 -10
- package/types/behaviour.d.ts +12 -0
- package/types/blockasks.d.ts +37 -0
- package/types/checkblock.d.ts +361 -0
- package/types/checklist.d.ts +134 -0
- package/types/checkpick.d.ts +3 -140
- package/types/declaredclose.d.ts +4 -0
- package/types/destpoint.d.ts +2 -0
- package/types/draftspend.d.ts +21 -0
- package/types/fitcheck.d.ts +7 -1
- package/types/pagemap.d.ts +4 -0
- package/types/panel/authorsession.d.ts +13 -2
- package/types/panel/jobgrid.d.ts +8 -8
- package/types/panel/jobplan.d.ts +48 -10
- package/types/panel/server.d.ts +14 -13
- package/types/pickrecord.d.ts +12 -0
- package/types/placerule.d.ts +194 -0
- package/types/questionbox.d.ts +87 -0
- package/types/rowedit.d.ts +32 -0
- package/types/rubricstep.d.ts +91 -48
- package/types/run.d.ts +10 -1
package/src/rubricstep.js
CHANGED
|
@@ -3,7 +3,7 @@ import { readFile, lstat } from 'node:fs/promises';
|
|
|
3
3
|
import { join, dirname } from 'node:path';
|
|
4
4
|
import { createRubric, checkStep, renderGaps, numbersInQuote } from 'bareguard';
|
|
5
5
|
import { dropRows, dropLine } from './pagedropwords.js';
|
|
6
|
-
import { OFFERED } from './checkwords.js';
|
|
6
|
+
import { OFFERED, plainWords } from './checkwords.js';
|
|
7
7
|
import { factPartOf, factShapeReds, factDecides, factClaims, factRows, plainFactItem, factBrief, writtenSpans } from './facts.js';
|
|
8
8
|
|
|
9
9
|
// PART 1a (docs/product/ITEM33-BUILD.md, "Addendum 2026-10-12"): the rubric job on LOCAL FILES — what one job line leaves
|
|
@@ -48,6 +48,26 @@ export function stepFileContract() {
|
|
|
48
48
|
].join('\n');
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* R10 (fwd am28, rewritten here): what a facts+text line's worker is told about the person's picks, one plain line per pick, the values and what counts, never a verdict and never any other
|
|
53
|
+
* check. Written by code from the signed pick parts; a list item is what bareguard's listItems counts (its own line starting with "1." or "- " and a space).
|
|
54
|
+
* @param {any[]} picked countable parts (`{check, value, names, ...}`) @returns {string[]}
|
|
55
|
+
*/
|
|
56
|
+
export function toldPicks(picked) {
|
|
57
|
+
const list = (/** @type {unknown} */ v) => (Array.isArray(v) ? v.map((x) => String(x)).join(', ') : '');
|
|
58
|
+
return picked.map((p) => {
|
|
59
|
+
switch (p.check) {
|
|
60
|
+
case 'listItems': return `Your "text" must have exactly ${p.value} list items; a list item is its own line starting with "1." or "- " followed by a space and its text.`;
|
|
61
|
+
case 'maxListItems': return `Your "text" must have at most ${p.value} list items; a list item is its own line starting with "1." or "- " followed by a space and its text.`;
|
|
62
|
+
case 'minListItems': return `Your "text" must have at least ${p.value} list items; a list item is its own line starting with "1." or "- " followed by a space and its text.`;
|
|
63
|
+
case 'nonEmpty': return 'Your "text" must not be empty.';
|
|
64
|
+
case 'mustCarry': return `Your "text" must carry ${list(p.phrases)}.`;
|
|
65
|
+
case 'blockLines': return `Your "text" must be in blocks of ${p.size} lines, each carrying ${list(p.phrases)}.`;
|
|
66
|
+
default: return `Your "text" must have ${plainWords({ ...p, rule: p.check })}.`;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
51
71
|
/**
|
|
52
72
|
* What the worker is told about each line, from the close that will grade it (PART 1b item 7): a FACTS line gets its
|
|
53
73
|
* facts and its count; a TEXT line that follows a facts line is told its numbers come from that line's quotes. Written by code from
|
|
@@ -69,12 +89,16 @@ export function lineBriefs(closeDecl) {
|
|
|
69
89
|
: c.min !== undefined ? `at least ${c.min} results` : `at most ${c.max} results`;
|
|
70
90
|
// keep-both: the person's picks (countable parts) sit beside the fact on this line, so the same file also carries the "text" they limit
|
|
71
91
|
const alsoText = st.params.parts.some((/** @type {any} */ q) => isRec(q) && q.class === 'countable');
|
|
92
|
+
// R10 (fwd am28): the picks among them, as the signed close's own record names them, are told to the worker in plain words
|
|
93
|
+
const record = Array.isArray(closeDecl.picks) ? closeDecl.picks : [];
|
|
94
|
+
const picked = st.params.parts.filter((/** @type {any} */ q) => isRec(q) && q.class === 'countable' && OFFERED.includes(q.check) && record.some((/** @type {any} */ x) => isRec(x) && x.line === n && sameJson(x.part, q)));
|
|
72
95
|
out.push({
|
|
73
96
|
line: n,
|
|
74
97
|
text: [
|
|
75
98
|
alsoText
|
|
76
99
|
? `Job line ${n} is a FACTS line AND a TEXT line. Write ${stepFileRel(n)} as {"results": [{"quote": "...", "values": {...}}], "text": "..."} — the results are the facts below, the "text" is your answer to the line in your own words (its limits are in the line's ~ rules); no "cites".`
|
|
77
100
|
: `Job line ${n} is a FACTS line. Write ${stepFileRel(n)} as {"results": [{"quote": "...", "values": {...}}]} and nothing else — no "text", no "cites".`,
|
|
101
|
+
...(alsoText && picked.length ? toldPicks(picked).map((t) => ` ${t}`) : []),
|
|
78
102
|
` One result per thing you find in the input "${fp.source}": ${count}.`,
|
|
79
103
|
' "quote": ONE quote per result, copied exactly from that result\'s own text in the input (at most 4000 characters) — never joined from two results.',
|
|
80
104
|
' "values": one entry per fact below, written exactly as the quote writes it (for example "9:27 AM", not "09:27"; "389", not "389.00").',
|
|
@@ -165,6 +189,8 @@ export const COUNT_CHECKS = Object.freeze({
|
|
|
165
189
|
// R10 (bareguard 0.31, fwdloop v0.29.0 OFFERED): the five text checks a person's pick may carry; the drafter never writes them
|
|
166
190
|
nonEmpty: Object.freeze([]),
|
|
167
191
|
listItems: Object.freeze(['value']),
|
|
192
|
+
maxListItems: Object.freeze(['value']), // bareguard 0.35 (F315): an at-most / at-least bound on the list items, beside the exact listItems
|
|
193
|
+
minListItems: Object.freeze(['value']),
|
|
168
194
|
sectionOrder: Object.freeze(['names']),
|
|
169
195
|
mustCarry: Object.freeze(['phrases']),
|
|
170
196
|
blockLines: Object.freeze(['size', 'phrases']),
|
|
@@ -280,7 +306,7 @@ export function buildStepSpec(params, inputShas) {
|
|
|
280
306
|
case 'sections': checks.push({ id, rule: 'sections', field: 'text', names: [...part.names] }); break;
|
|
281
307
|
case 'sectionWords': checks.push({ id, rule: 'sectionWords', field: 'text', names: [...part.names], wordsPerSection: part.wordsPerSection }); break;
|
|
282
308
|
case 'nonEmpty': checks.push({ id, rule: 'nonEmpty', field: 'text' }); break;
|
|
283
|
-
case 'listItems': checks.push({ id, rule:
|
|
309
|
+
case 'listItems': case 'maxListItems': case 'minListItems': checks.push({ id, rule: part.check, field: 'text', value: part.value }); break;
|
|
284
310
|
case 'sectionOrder': checks.push({ id, rule: 'sectionOrder', field: 'text', names: [...part.names] }); break;
|
|
285
311
|
case 'mustCarry': checks.push({ id, rule: 'mustCarry', field: 'text', phrases: [...part.phrases] }); break;
|
|
286
312
|
case 'blockLines': checks.push({ id, rule: 'blockLines', field: 'text', size: part.size, phrases: [...part.phrases] }); break;
|
|
@@ -417,6 +443,8 @@ export function plainStepGap(step, why, g, params = null) {
|
|
|
417
443
|
if (g.check === 'minWords') return `${at}: "text" has ${g.measured} words, at least ${g.limit} are required`;
|
|
418
444
|
if (g.check === 'maxLines') return `${at}: "text" has ${g.measured} lines, at most ${g.limit} are allowed`;
|
|
419
445
|
if (g.check === 'sections') return `${at}: "text" is missing section(s): ${(g.items ?? []).join(', ')}`;
|
|
446
|
+
if (g.check === 'maxListItems') return `${at}: "text" has ${g.measured} list items, at most ${g.limit} are allowed`;
|
|
447
|
+
if (g.check === 'minListItems') return `${at}: "text" has ${g.measured} list items, at least ${g.limit} are required`;
|
|
420
448
|
if (g.check === 'listItems') return `${at}: "text" has ${g.measured} list items, exactly ${g.limit} are required`;
|
|
421
449
|
if (g.check === 'sectionOrder') return `${at}: "text" does not hold its sections in the asked order (${(g.items ?? []).map((/** @type {string} */ x) => x.replace(/^[^:]*:/, '')).join(', ')} out of place)`;
|
|
422
450
|
if (g.check === 'mustCarry') return `${at}: "text" does not carry: ${(g.items ?? []).join(', ')}`;
|
|
@@ -762,117 +790,134 @@ export function checkRubricRules(stages, { jobLines = null, refused = null, red
|
|
|
762
790
|
/** a clock time as a person writes it: 7:00, 07:00, 7:00 AM, 11 PM is not matched (no minutes) */
|
|
763
791
|
const CLOCK = '\\d{1,2}:\\d{2}(?:\\s?[AaPp][Mm])?';
|
|
764
792
|
const TIME_RANGE_RE = new RegExp(`\\b(?:between|from)\\s+(${CLOCK})\\s+(?:and|to|-)\\s+(${CLOCK})`, 'i');
|
|
765
|
-
const NEGATING_RE = /\b(?:not|no|never|outside|except|before|after|without)\b/i;
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
*/
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
const facts = fp.facts.map((/** @type {any} */ f) => {
|
|
790
|
-
if (!isRec(f) || !isRec(f.rule) || f.aiProposal !== true) return f;
|
|
791
|
-
const own = (/** @type {unknown[]} */ bounds) => bounds.every((b) => boundInWords(b, said));
|
|
792
|
-
const bounds = f.rule.op === 'between' ? [f.rule.lo, f.rule.hi] : [f.rule.value];
|
|
793
|
-
const { aiProposal: _drop, ...rest } = f;
|
|
794
|
-
if (own(bounds)) return rest;
|
|
795
|
-
if (ranges.length === 1 && proposed.length === 1 && proposed[0] === f) {
|
|
796
|
-
const m = /** @type {RegExpExecArray} */ (ranges[0]);
|
|
797
|
-
return { ...rest, rule: { op: 'between', lo: m[1], hi: m[2] } };
|
|
798
|
-
}
|
|
799
|
-
return f;
|
|
800
|
-
});
|
|
801
|
-
const parts = st.params.parts.map((/** @type {any} */ x) => (x === fp ? { ...x, facts } : x));
|
|
802
|
-
return { ...st, params: { ...st.params, parts } };
|
|
803
|
-
});
|
|
804
|
-
const carried = (/** @type {number} */ line, /** @type {number} */ n) => stages.some((/** @type {any} */ st) => isRec(st) && st.kind === 'rubric-step' && isRec(st.params) && st.params.step === line
|
|
805
|
-
&& Array.isArray(st.params.parts) && st.params.parts.some((/** @type {any} */ x) => isRec(x) && Array.isArray(x.rules) && x.rules.includes(n)));
|
|
806
|
-
/** @type {any} */
|
|
807
|
-
const out = { ...declaration, stages };
|
|
808
|
-
if (Array.isArray(declaration.refused)) out.refused = declaration.refused.filter((/** @type {any} */ r) => !(isRec(r) && Number.isInteger(r.line) && Number.isInteger(r.rule) && carried(r.line, r.rule)));
|
|
809
|
-
return out;
|
|
793
|
+
export const NEGATING_RE = /\b(?:not|no|never|outside|except|before|after|without)\b/i;
|
|
794
|
+
|
|
795
|
+
// The limit reader (hamr ruling A, 2026-11-12): when the look tied a money or time fact to a `~` rule but gave no limit, CODE reads the limit
|
|
796
|
+
// from the person's own rule words. ONE amount or ONE range only; every other text is a plain reason (Not checked), never a wrong check.
|
|
797
|
+
// The direction words are the FACT_OPS words of src/facts.js (lt under, lte at most, gt over, gte at least) plus their plain synonyms.
|
|
798
|
+
const AMOUNT = '(?:[$\\u20ac\\u00a3]\\s?(\\d[\\d,]*(?:\\.\\d+)?)|(\\d[\\d,]*(?:\\.\\d+)?)\\s?(?:US\\s)?(?:dollars?|euros?|pounds?|USD|EUR|GBP)\\b)';
|
|
799
|
+
const AMOUNT_ALL_RE = new RegExp(AMOUNT, 'gi');
|
|
800
|
+
const MONEY_BETWEEN_RE = new RegExp(`\\bbetween\\s+${AMOUNT}\\s+(?:and|to|-)\\s+${AMOUNT}`, 'i');
|
|
801
|
+
const MONEY_DIRECTION_RE = new RegExp(`\\b(under|below|less than|fewer than|at most|up to|no more than|over|above|more than|at least|no less than|no fewer than)\\s+${AMOUNT}`, 'i');
|
|
802
|
+
const MONEY_OR_LESS_RE = new RegExp(`${AMOUNT}\\s+or\\s+(less|fewer|under|below|lower|more|over|above|higher)\\b`, 'i');
|
|
803
|
+
const DIRECTION_OP = /** @type {Record<string, 'lt'|'lte'|'gt'|'gte'>} */ ({ under: 'lt', below: 'lt', 'less than': 'lt', 'fewer than': 'lt', 'at most': 'lte', 'up to': 'lte', 'no more than': 'lte', over: 'gt', above: 'gt', 'more than': 'gt', 'at least': 'gte', 'no less than': 'gte', 'no fewer than': 'gte' });
|
|
804
|
+
const CURRENCY_STEM = /** @type {Record<string, string>} */ ({ $: 'dollar', '€': 'euro', '£': 'pound', usd: 'dollar', eur: 'euro', gbp: 'pound' });
|
|
805
|
+
const num = (/** @type {string|undefined} */ a, /** @type {string|undefined} */ b) => Number(String(a ?? b).replace(/,/g, ''));
|
|
806
|
+
const hhmm = (/** @type {string} */ t) => (/[AaPp][Mm]/.test(t) ? null : t.replace(/\s+/g, '').replace(/^(\d):/, '0$1:'));
|
|
807
|
+
|
|
808
|
+
/** does the amount token's currency (sign or word) fit the look fact's currency and unit lists? A fact with neither list fits anything. */
|
|
809
|
+
function currencyFits(/** @type {string} */ tok, /** @type {any} */ fact) {
|
|
810
|
+
const cur = (Array.isArray(fact?.currency) ? fact.currency : fact?.currency ? [fact.currency] : []).map(String);
|
|
811
|
+
const unit = (Array.isArray(fact?.unit) ? fact.unit : fact?.unit ? [fact.unit] : []).map((/** @type {unknown} */ u) => String(u).toLowerCase());
|
|
812
|
+
if (!cur.length && !unit.length) return true;
|
|
813
|
+
const sym = /^[$€£]/.test(tok) ? tok.charAt(0) : null;
|
|
814
|
+
const last = String(tok.trim().split(/\s+/).at(-1)).toLowerCase();
|
|
815
|
+
const stem = sym ? CURRENCY_STEM[sym] : (CURRENCY_STEM[last] ?? last.replace(/s$/, ''));
|
|
816
|
+
return (sym !== null && cur.includes(sym)) || unit.some((/** @type {string} */ u) => u.includes(String(stem)));
|
|
810
817
|
}
|
|
811
818
|
|
|
812
819
|
/**
|
|
813
|
-
*
|
|
814
|
-
*
|
|
815
|
-
*
|
|
816
|
-
* @param {any} declaration @returns {any}
|
|
820
|
+
* Does this rule text hold more than one amount (money) or more than one time range (time)? The ONE guard code's own limit read and an AI
|
|
821
|
+
* reading edit both use: "under $450 or over $900" is two limits, and one reading of it would be a wrong check.
|
|
822
|
+
* @param {string} shape @param {string} text @returns {boolean}
|
|
817
823
|
*/
|
|
818
|
-
export function
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
const
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
*/
|
|
843
|
-
export function withDropNotes(declaration, dropped, jobLines) {
|
|
844
|
-
if (!isRec(declaration) || !Array.isArray(dropped) || dropped.length === 0) return declaration;
|
|
845
|
-
const stages = Array.isArray(declaration.stages) ? declaration.stages : [];
|
|
846
|
-
const carried = (/** @type {number} */ line, /** @type {number} */ n) => stages.some((/** @type {any} */ st) => isRec(st) && st.kind === 'rubric-step' && isRec(st.params) && st.params.step === line
|
|
847
|
-
&& Array.isArray(st.params.parts) && st.params.parts.some((/** @type {any} */ x) => isRec(x) && Array.isArray(x.rules) && x.rules.includes(n)));
|
|
848
|
-
const refused = Array.isArray(declaration.refused) ? [...declaration.refused] : [];
|
|
849
|
-
const notes = Array.isArray(declaration.notes) ? [...declaration.notes] : [];
|
|
850
|
-
for (const row of dropRows(dropped)) {
|
|
851
|
-
const named = row.rule !== undefined && refused.some((/** @type {any} */ r) => isRec(r) && r.line === row.line && r.rule === row.rule);
|
|
852
|
-
if (named) continue;
|
|
853
|
-
if (row.full && row.rule !== undefined && !carried(row.line, row.rule)) {
|
|
854
|
-
refused.push({ line: row.line, rule: row.rule, reason: row.sentences.join(' ') });
|
|
855
|
-
continue;
|
|
856
|
-
}
|
|
857
|
-
const text = dropLine(row, jobLines, lineRules);
|
|
858
|
-
if (!notes.includes(text)) notes.push(text);
|
|
824
|
+
export function holdsManyBounds(shape, text) {
|
|
825
|
+
const t = String(text ?? '');
|
|
826
|
+
if (shape === 'time') return [...t.matchAll(new RegExp(TIME_RANGE_RE.source, 'gi'))].length > 1 || (t.match(/\d{1,2}:\d{2}/g) ?? []).length > 2;
|
|
827
|
+
if (shape === 'money') { const amts = [...t.matchAll(AMOUNT_ALL_RE)]; return amts.length > 1 && !(MONEY_BETWEEN_RE.test(t) && amts.length === 2); }
|
|
828
|
+
return false;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* The limit the person's own words give a fact of this shape: `{reading}` or `{why}` (a plain reason; the rule then stays Not checked).
|
|
833
|
+
* @param {string} shape money or time @param {string} text the `~` rule's words @param {any} [fact] the look fact (its currency and unit lists must fit)
|
|
834
|
+
* @returns {{reading: {op: 'lt'|'lte'|'gt'|'gte', value: number} | {op: 'between', lo: number|string, hi: number|string}} | {why: string}}
|
|
835
|
+
*/
|
|
836
|
+
export function readLimit(shape, text, fact = {}) {
|
|
837
|
+
const t = String(text ?? '');
|
|
838
|
+
if (shape === 'time') {
|
|
839
|
+
if (NEGATING_RE.test(t)) return { why: 'a one-sided or negated time (before, after, not) is not a range code can read' };
|
|
840
|
+
if (/\b\d{1,2}(?::\d{2})?\s?[ap]\.?m\b/i.test(t)) return { why: 'a 12-hour time (am or pm) is not read, write it like 06:00' };
|
|
841
|
+
if (holdsManyBounds('time', t)) return { why: 'more than one time range in the rule' };
|
|
842
|
+
const m = TIME_RANGE_RE.exec(t);
|
|
843
|
+
if (!m) return { why: 'no range between two times in the rule' };
|
|
844
|
+
const lo = hhmm(String(m[1])), hi = hhmm(String(m[2]));
|
|
845
|
+
if (!lo || !hi) return { why: 'a 12-hour time (am or pm) is not read, write it like 06:00' };
|
|
846
|
+
if (lo >= hi) return { why: 'a range whose end is not after its start is not read' };
|
|
847
|
+
return { reading: { op: 'between', lo, hi } };
|
|
859
848
|
}
|
|
860
|
-
|
|
849
|
+
if (shape === 'money') {
|
|
850
|
+
if (/\b(?:not|never|outside|except|without)\b/i.test(t)) return { why: 'a negated limit (not, except, without) is not read' };
|
|
851
|
+
const amts = [...t.matchAll(AMOUNT_ALL_RE)];
|
|
852
|
+
if (!amts.length) return { why: 'no amount with a currency sign or word in the rule' };
|
|
853
|
+
for (const a of amts) if (!currencyFits(a[0], fact)) return { why: 'the amount is in another currency than the page fact' };
|
|
854
|
+
if (holdsManyBounds('money', t)) return { why: 'more than one amount in the rule' };
|
|
855
|
+
const b = MONEY_BETWEEN_RE.exec(t);
|
|
856
|
+
if (b) { const lo = num(b[1], b[2]), hi = num(b[3], b[4]); return lo < hi ? { reading: { op: 'between', lo, hi } } : { why: 'a range whose end is not above its start is not read' }; }
|
|
857
|
+
const d = MONEY_DIRECTION_RE.exec(t);
|
|
858
|
+
if (d) return { reading: { op: /** @type {'lt'|'lte'|'gt'|'gte'} */ (DIRECTION_OP[String(d[1]).toLowerCase()]), value: num(d[2], d[3]) } };
|
|
859
|
+
const o = MONEY_OR_LESS_RE.exec(t);
|
|
860
|
+
if (o) return { reading: { op: /^(less|fewer|under|below|lower)$/i.test(String(o[3])) ? 'lte' : 'gte', value: num(o[1], o[2]) } };
|
|
861
|
+
return { why: 'the rule gives an amount but no direction (under, over, at most, at least, between)' };
|
|
862
|
+
}
|
|
863
|
+
return { why: 'code reads a limit only for money or time' };
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/** the words a list row of kind `$cited` / `$numbers` carries no text for */
|
|
867
|
+
const DEFAULT_ROW_WORDS = Object.freeze({ cited: 'every claim quotes its input', numbers: 'every number matches a quote' });
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* A check-list row named in the person's plain words: `phrase "### Fixed"`. The words are the draft log's; with none, the text after the key's kind prefix (`L1.phrase.### fixed`).
|
|
871
|
+
* Never empty. Pure.
|
|
872
|
+
* @param {unknown} kind @param {string} key @param {string[]|null|undefined} words
|
|
873
|
+
* @returns {string}
|
|
874
|
+
*/
|
|
875
|
+
export function listRowName(kind, key, words) {
|
|
876
|
+
const k = typeof kind === 'string' && kind ? kind : 'check';
|
|
877
|
+
if (k === 'cited' || k === 'numbers') return DEFAULT_ROW_WORDS[k];
|
|
878
|
+
const tail = key.replace(/^L\d+\.(?:[^.]*\.)?/, '').trim();
|
|
879
|
+
const w = Array.isArray(words) && words.length ? words : [tail || key];
|
|
880
|
+
return `${k} ${w.map((x) => `"${x}"`).join(', ')}`;
|
|
861
881
|
}
|
|
862
882
|
|
|
863
883
|
/**
|
|
864
884
|
* The ~ rules the drafter listed under Not checked (`refused` entries that name a `rule`), each as one line in the person's own
|
|
865
885
|
* words: `line N: "<the rule as written>" — <the drafter's reason>` (PART 1b, RF6 / RF16).
|
|
866
|
-
* @param {any} closeDecl @param {any[]|null|undefined} jobLines @returns {string[]}
|
|
886
|
+
* @param {any} closeDecl @param {any[]|null|undefined} jobLines @param {{key: string, words: string[]}[]|null} [ledger] the draft log's final list rows (`readDraftLedger`) @returns {string[]}
|
|
867
887
|
*/
|
|
868
|
-
export function ruleNotChecked(closeDecl, jobLines) {
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
888
|
+
export function ruleNotChecked(closeDecl, jobLines, ledger = null) {
|
|
889
|
+
return ruleNotCheckedItems(closeDecl, jobLines, ledger).map((i) => i.text);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
/** the same lines as {@link ruleNotChecked}, each with who it belongs to (`by`: the row's kind, F-c) @param {any} closeDecl @param {any[]|null|undefined} jobLines @param {{key: string, words: string[]}[]|null} [ledger] @returns {{text: string, by?: 'you'|'agent'|'default'}[]} */
|
|
893
|
+
export function ruleNotCheckedItems(closeDecl, jobLines, ledger = null) {
|
|
894
|
+
return refusedOf(closeDecl).filter((r) => Number.isInteger(r.rule) || r.fromList).map((r) => {
|
|
895
|
+
const text = Number.isInteger(r.rule) ? lineRules((jobLines ?? []).find((/** @type {any} */ l) => isRec(l) && l.n === r.line))[/** @type {number} */ (r.rule) - 1] : (r.label ?? null);
|
|
896
|
+
const by = r.by ? { by: r.by } : {};
|
|
897
|
+
// a list row that is not a fact or a rule is named by its words, as the Job tab names it (one owner: listRowName)
|
|
898
|
+
if (!text && r.fromList && r.key) return { text: `line ${r.line}: ${listRowName(r.kind, r.key, ledger?.find((x) => x.key === r.key)?.words)} — ${r.reason}`, ...by };
|
|
899
|
+
return { text: `line ${r.line}: ${text ? `"${text}"` : `rule ${r.rule ?? r.kind}`} — ${r.reason}`, ...by };
|
|
873
900
|
});
|
|
874
901
|
}
|
|
875
902
|
|
|
903
|
+
/**
|
|
904
|
+
* The refusals of a signed close, as ONE reader: when the close carries the one check list (`closeDecl.list`) its not-checked rows are the refusals (a `~` rule's row names the rule, a fact row its
|
|
905
|
+
* fact name); the old `closeDecl.refused` entries a list has no row for (a line-level refusal, a rule the list never saw) are kept, so nothing the older close said is lost. A close with no list
|
|
906
|
+
* reads `refused` alone. Pure.
|
|
907
|
+
* @param {any} closeDecl
|
|
908
|
+
* @returns {{line: number, rule?: number, kind?: string, key?: string, by?: 'you'|'agent'|'default', label?: string, reason: string, fromList: boolean}[]}
|
|
909
|
+
*/
|
|
910
|
+
export function refusedOf(closeDecl) {
|
|
911
|
+
const old = (isRec(closeDecl) && Array.isArray(closeDecl.refused) ? closeDecl.refused : []).filter((/** @type {any} */ r) => isRec(r) && Number.isInteger(r.line) && typeof r.reason === 'string');
|
|
912
|
+
const list = isRec(closeDecl) && Array.isArray(closeDecl.list) ? closeDecl.list : null;
|
|
913
|
+
if (list === null) return old.map((/** @type {any} */ r) => ({ line: r.line, ...(Number.isInteger(r.rule) ? { rule: r.rule } : {}), reason: r.reason, fromList: false }));
|
|
914
|
+
const rows = list.filter((/** @type {any} */ r) => isRec(r) && r.state === 'not-checked' && Number.isInteger(r.line) && typeof r.reason === 'string' && r.kind !== 'floor').map((/** @type {any} */ r) => ({
|
|
915
|
+
line: r.line, ...(Number.isInteger(r.rule) ? { rule: r.rule } : {}), kind: String(r.kind), key: String(r.key), ...(['you', 'agent', 'default'].includes(r.by) ? { by: r.by } : {}), ...(r.kind === 'fact' ? { label: String(r.key).split('.').slice(2).join('.') } : {}), reason: r.reason, fromList: true,
|
|
916
|
+
}));
|
|
917
|
+
const seen = (/** @type {any} */ r) => rows.some((x) => x.line === r.line && x.rule === (Number.isInteger(r.rule) ? r.rule : undefined) && Number.isInteger(r.rule));
|
|
918
|
+
return [...rows, ...old.filter((/** @type {any} */ r) => !seen(r)).map((/** @type {any} */ r) => ({ line: r.line, ...(Number.isInteger(r.rule) ? { rule: r.rule } : {}), reason: r.reason, fromList: false }))];
|
|
919
|
+
}
|
|
920
|
+
|
|
876
921
|
/**
|
|
877
922
|
* The Not-checked lines code owns for the rubric-step stages of a close: a prose step's CONTENT is judged by the person at
|
|
878
923
|
* Accept, and the card says so (PART 1b, RF5). One line per prose step (a stage with no fact part).
|
|
@@ -907,6 +952,8 @@ export function partSentence(part) {
|
|
|
907
952
|
case 'sectionWords': return `each section (${list(part.names)}) is about ${part.wordsPerSection} words`;
|
|
908
953
|
case 'nonEmpty': return 'the text is not empty';
|
|
909
954
|
case 'listItems': return `the text has exactly ${n(part.value, 'list item')}`;
|
|
955
|
+
case 'maxListItems': return `the text has at most ${n(part.value, 'list item')}`;
|
|
956
|
+
case 'minListItems': return `the text has at least ${n(part.value, 'list item')}`;
|
|
910
957
|
case 'sectionOrder': return `the text has the section(s) ${list(part.names)}, in that order`;
|
|
911
958
|
case 'mustCarry': return `the text carries ${list(part.phrases)}`;
|
|
912
959
|
case 'blockLines': return `the text is in blocks of ${n(part.size, 'line')}, each carrying ${list(part.phrases)}`;
|
|
@@ -918,24 +965,43 @@ export function partSentence(part) {
|
|
|
918
965
|
}
|
|
919
966
|
}
|
|
920
967
|
|
|
968
|
+
/** the words of the default cited check code adds to a text line of a one-input job (the one list's `$` row); the card reads a part with exactly these words as `[default]` @param {string} label @returns {string} */
|
|
969
|
+
export const defaultCitedText = (label) => `every claim is backed by a quote copied from "${label}"`;
|
|
970
|
+
|
|
921
971
|
/**
|
|
922
972
|
* The checks a signed close actually runs, per job line, in plain code-written sentences: one per countable part of every
|
|
923
973
|
* rubric-step stage. This is the ONE reader both the plan card and the sign-time invariant use.
|
|
924
974
|
* 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;
|
|
925
|
-
* `
|
|
975
|
+
* `default` = code's own (the one list's `$` rows: the cited part written by `defaultCitedText`, and the numbers tie of a text step).
|
|
926
976
|
* @param {any} closeDecl
|
|
927
|
-
* @returns {{line: number, text: string,
|
|
977
|
+
* @returns {{line: number, text: string, by: 'agent'|'you'|'default', key?: string}[]}
|
|
928
978
|
*/
|
|
929
979
|
export function checksOfClose(closeDecl) {
|
|
930
980
|
const stages = isRec(closeDecl) && Array.isArray(closeDecl.stages) ? closeDecl.stages : [];
|
|
931
981
|
const record = isRec(closeDecl) && Array.isArray(closeDecl.picks) ? closeDecl.picks : [];
|
|
982
|
+
const list = isRec(closeDecl) && Array.isArray(closeDecl.list) ? closeDecl.list.filter((/** @type {any} */ r) => isRec(r) && r.state === 'built') : [];
|
|
983
|
+
/** the tag of a fact by its row's kind (hamr 2026-11-13, F-c): a fact a `~` rule built is [you], a `!` row's [agent]; `facts` on the signed row names what it built. No such row (an older close): the old reading */
|
|
984
|
+
const factBy = (/** @type {number} */ line, /** @type {string} */ name) => {
|
|
985
|
+
const rows = list.filter((/** @type {any} */ r) => r.line === line && Array.isArray(r.facts) && r.facts.includes(name));
|
|
986
|
+
const r = rows.find((/** @type {any} */ x) => x.by === 'you') ?? rows[0];
|
|
987
|
+
return r ? { by: /** @type {'agent'|'you'|'default'} */ (r.by), key: String(r.key) } : null;
|
|
988
|
+
};
|
|
989
|
+
const countBy = (/** @type {number} */ line, /** @type {number} */ pi) => {
|
|
990
|
+
const r = list.find((/** @type {any} */ x) => x.line === line && x.kind === 'count' && isRec(x.part) && x.part.part === pi);
|
|
991
|
+
return r ? { by: /** @type {'agent'|'you'|'default'} */ (r.by), key: String(r.key) } : null;
|
|
992
|
+
};
|
|
932
993
|
return stages.flatMap((/** @type {any} */ st) => (isRec(st) && st.kind === 'rubric-step' && isRec(st.params) && Array.isArray(st.params.parts)
|
|
933
|
-
? st.params.parts.
|
|
934
|
-
|
|
935
|
-
/** @type {'agent'|'you'|
|
|
936
|
-
const by = p.check === 'numbersFromFacts' ?
|
|
994
|
+
? st.params.parts.flatMap((/** @type {any} */ p, /** @type {number} */ pi) => {
|
|
995
|
+
if (!isRec(p) || (p.class !== 'countable' && p.class !== 'fact')) return [];
|
|
996
|
+
/** @type {'agent'|'you'|'default'} */
|
|
997
|
+
const by = p.check === 'numbersFromFacts' || (p.check === 'cited' && p.text === defaultCitedText(p.source)) ? 'default' : record.some((/** @type {any} */ x) => isRec(x) && x.line === st.params.step && sameJson(x.part, p)) ? 'you' : 'agent';
|
|
937
998
|
// a fact part is one plan row per fact (and one for its count): the person signs the rows, the close runs the same list
|
|
938
|
-
|
|
999
|
+
if (p.class !== 'fact') return [{ line: st.params.step, text: partSentence(p), by }];
|
|
1000
|
+
const facts = Array.isArray(p.facts) ? p.facts : [];
|
|
1001
|
+
return factRows(p).map((/** @type {string} */ text, /** @type {number} */ i) => {
|
|
1002
|
+
const own = i < facts.length ? factBy(st.params.step, facts[i]?.name) : countBy(st.params.step, pi);
|
|
1003
|
+
return { line: st.params.step, text, by: own?.by ?? by, ...(own ? { key: own.key } : {}) };
|
|
1004
|
+
});
|
|
939
1005
|
})
|
|
940
1006
|
: []));
|
|
941
1007
|
}
|
|
@@ -952,30 +1018,51 @@ export function signedFactNames(closeDecl) {
|
|
|
952
1018
|
}
|
|
953
1019
|
|
|
954
1020
|
/**
|
|
955
|
-
*
|
|
956
|
-
*
|
|
957
|
-
*
|
|
958
|
-
*
|
|
959
|
-
* @
|
|
960
|
-
* `jobLines` — the person's numbered lines, so a ~ rule the drafter listed as Not checked reads in the person's own words
|
|
961
|
-
* @returns {{checkItems: {text: string, fromLine: number[], by: 'agent'|'you'|null}[], notChecked: string[], moved: {text: string, fromLine: number[]|null}[]}}
|
|
1021
|
+
* The plan card after drafting, read from the signed close ALONE (one source, the same the Job tab reads): its checks are `checksOfClose`; its Not checked is the close's own notes, the prose
|
|
1022
|
+
* 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
|
|
1023
|
+
* in: a rubric confirm turn plans the goal only, so a check can never be shown and then silently dropped (run mv5bk400).
|
|
1024
|
+
* @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
|
|
1025
|
+
* @returns {{checkItems: {text: string, fromLine: number[], by: 'agent'|'you'|'default', key?: string}[], notChecked: string[], notCheckedBy: Record<string, 'you'|'agent'|'default'>}}
|
|
962
1026
|
*/
|
|
963
|
-
export function
|
|
964
|
-
const
|
|
965
|
-
const
|
|
966
|
-
|
|
1027
|
+
export function cardOfClose({ closeDecl, jobLines = null, ledger = null }) {
|
|
1028
|
+
const notes = isRec(closeDecl) && Array.isArray(closeDecl.notes) ? closeDecl.notes.filter((/** @type {any} */ n) => typeof n === 'string' && n) : [];
|
|
1029
|
+
const items = ruleNotCheckedItems(closeDecl, jobLines, ledger);
|
|
1030
|
+
/** @type {Record<string, 'you'|'agent'|'default'>} */
|
|
1031
|
+
const notCheckedBy = {};
|
|
1032
|
+
for (const i of items) if (i.by) notCheckedBy[i.text] = i.by;
|
|
967
1033
|
return {
|
|
968
|
-
checkItems:
|
|
969
|
-
notChecked: [
|
|
970
|
-
|
|
971
|
-
...proseNotChecked(closeDecl),
|
|
972
|
-
...ruleNotChecked(closeDecl, jobLines),
|
|
973
|
-
...moved.map((m) => `${m.fromLine && m.fromLine.length ? `line ${m.fromLine.join(', ')}: ` : ''}${m.text} — nothing in this close counts it or checks it against a quote`),
|
|
974
|
-
],
|
|
975
|
-
moved,
|
|
1034
|
+
checkItems: checksOfClose(closeDecl).map((c) => ({ text: c.text, fromLine: [c.line], by: c.by, ...(c.key ? { key: c.key } : {}) })),
|
|
1035
|
+
notChecked: [...new Set([...notes, ...proseNotChecked(closeDecl), ...items.map((i) => i.text)])],
|
|
1036
|
+
notCheckedBy,
|
|
976
1037
|
};
|
|
977
1038
|
}
|
|
978
1039
|
|
|
1040
|
+
/**
|
|
1041
|
+
* The sign-time check of a close that carries the one check list: every BUILT row (the mechanical floor aside) points at a part that is really in the close, and every real check part
|
|
1042
|
+
* (countable or fact) has at least one built row pointing at it, so a check cannot be in the close with no row and a row cannot claim a check the close does not run. A close with no list is
|
|
1043
|
+
* not examined here. Pure.
|
|
1044
|
+
* @param {any} closeDecl @returns {{ok: true}|{ok: false, error: string}}
|
|
1045
|
+
*/
|
|
1046
|
+
export function listMatchesClose(closeDecl) {
|
|
1047
|
+
const list = isRec(closeDecl) && Array.isArray(closeDecl.list) ? closeDecl.list : null;
|
|
1048
|
+
if (list === null) return { ok: true };
|
|
1049
|
+
const stages = Array.isArray(closeDecl.stages) ? closeDecl.stages : [];
|
|
1050
|
+
const partsOn = (/** @type {number} */ n) => stages.filter((/** @type {any} */ st) => isRec(st) && st.kind === 'rubric-step' && isRec(st.params) && st.params.step === n && Array.isArray(st.params.parts)).flatMap((/** @type {any} */ st) => st.params.parts);
|
|
1051
|
+
const built = list.filter((/** @type {any} */ r) => isRec(r) && r.state === 'built' && r.kind !== 'floor');
|
|
1052
|
+
const bad = built.filter((/** @type {any} */ r) => !(isRec(r.part) && r.part.line === r.line && Number.isInteger(r.part.part) && isRec(partsOn(r.line)[r.part.part])));
|
|
1053
|
+
const lines = [...new Set(stages.filter((/** @type {any} */ st) => isRec(st) && st.kind === 'rubric-step' && isRec(st.params)).map((/** @type {any} */ st) => st.params.step))];
|
|
1054
|
+
const bare = lines.flatMap((/** @type {number} */ n) => partsOn(n).map((/** @type {any} */ p, /** @type {number} */ i) => ({ n, i, p })))
|
|
1055
|
+
.filter(({ p }) => isRec(p) && (p.class === 'countable' || p.class === 'fact'))
|
|
1056
|
+
// a part has its row when a built row points at it, or when the part lists (in its `rules`) the number of a built `~` row of its line (a row points at ONE part, a rule may be carried by several)
|
|
1057
|
+
.filter(({ n, i, p }) => !built.some((/** @type {any} */ r) => (isRec(r.part) && r.part.line === n && r.part.part === i)
|
|
1058
|
+
|| (r.kind === 'rule' && r.line === n && Array.isArray(p.rules) && p.rules.includes(r.rule))));
|
|
1059
|
+
if (bad.length === 0 && bare.length === 0) return { ok: true };
|
|
1060
|
+
const parts = [];
|
|
1061
|
+
if (bad.length) parts.push(`a row points at a check the close does not run: ${bad.map((/** @type {any} */ r) => r.key).join('; ')}`);
|
|
1062
|
+
if (bare.length) parts.push(`a check in the close has no row: line ${bare.map(({ n, i }) => `${n} part ${i + 1}`).join('; ')}`);
|
|
1063
|
+
return { ok: false, error: `The list of checks does not match the signed close (${parts.join(' | ')}). Nothing was signed — draft again.` };
|
|
1064
|
+
}
|
|
1065
|
+
|
|
979
1066
|
/**
|
|
980
1067
|
* The sign-time invariant: the checks the person was shown (`shown`, from the plan card) are exactly the checks the signed
|
|
981
1068
|
* close runs (`checksOfClose`), per line. Pure.
|
package/src/run.js
CHANGED
|
@@ -18,6 +18,7 @@ import { runPlan } from './planrun.js';
|
|
|
18
18
|
import { SMOKE_STORE, resolveHumanRuling } from './kinds.js';
|
|
19
19
|
import { readShimArm } from './readshim.js';
|
|
20
20
|
import { codeVersion } from './codeversion.js';
|
|
21
|
+
import { bindPlaceValues } from './placerule.js';
|
|
21
22
|
|
|
22
23
|
/** @typedef {{code: string, path: string, detail?: string}} Red */
|
|
23
24
|
|
|
@@ -112,6 +113,10 @@ async function primitiveSmoke(workdir) {
|
|
|
112
113
|
* never a step knob and never agent-selectable; absent, a judged stage instrument-stops as
|
|
113
114
|
* a wiring gap rather than grading on whatever binding happened to be at hand. Its spend
|
|
114
115
|
* lands on this ledger as `judge-round` (see `ACCOUNTED_ROUND_TYPES`).
|
|
116
|
+
* @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
|
|
117
|
+
* 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
|
|
118
|
+
* SIGNED one and the signed spec is never changed; the planner and the close read the copy. Absent = the signed words.
|
|
119
|
+
* @param {{workflowKey: string, rows: object[]}|null} [opts.placeRead] PLACE RULES: what the run start read (rows {key, kind, found, value, was, reason}); recorded once as a `place-rules` event right after `job-start`. Absent = the job has none (or this is a resume, whose first leg wrote it).
|
|
115
120
|
* @param {number} [opts.capRuns] shell-owned iteration cap for the plan flow's
|
|
116
121
|
* CLOSE-FIX loop (a plan STEP runs under the strike ladder instead)
|
|
117
122
|
* @param {number} [opts.strikeLimit] shell-owned strike ceiling for a plan step's ladder
|
|
@@ -280,7 +285,7 @@ async function primitiveSmoke(workdir) {
|
|
|
280
285
|
* deliberately NOT in the resumable/checkpoint set (`src/reuse.js`) — an
|
|
281
286
|
* unknown in-flight state is not a known-safe resume point.
|
|
282
287
|
*/
|
|
283
|
-
export async function runJob(rawSpec, { approvals, workdir, provider, nativeProvider, providerFor, judgeProvider = null, judgeModel = null, rates = null, judgeRates = null, emit, capRuns = 3, strikeLimit, shellCapUsd = 2, closeTimeoutMs, closeDir = null, layerRoot = false, readShim = false, scout = true, bridge = null, draftSpentUsd = 0, draftSpendComplete = true, priorSpentUsd = 0, priorSpendComplete = true, priorWallMs = 0, resumeSeed = null, resumeGrades = [], resumeReplans = null, resumeBranch = null, humanRuling = null, heldRuling = null, reviewDoor = null, doorRerun = null, resumable = true, stopFile = null, learnHints = null, ticketRecord = null, ticketUnsure = null, prRecord = null }) {
|
|
288
|
+
export async function runJob(rawSpec, { approvals, workdir, provider, nativeProvider, providerFor, judgeProvider = null, judgeModel = null, rates = null, judgeRates = null, emit, capRuns = 3, strikeLimit, shellCapUsd = 2, closeTimeoutMs, closeDir = null, layerRoot = false, readShim = false, scout = true, bridge = null, draftSpentUsd = 0, draftSpendComplete = true, priorSpentUsd = 0, priorSpendComplete = true, priorWallMs = 0, resumeSeed = null, resumeGrades = [], resumeReplans = null, resumeBranch = null, humanRuling = null, heldRuling = null, reviewDoor = null, doorRerun = null, resumable = true, stopFile = null, learnHints = null, ticketRecord = null, ticketUnsure = null, prRecord = null, placeValues = null, placeRead = null }) {
|
|
284
289
|
// THE READ SHIM's ARM, resolved at the door — the FIRST thing this entry does,
|
|
285
290
|
// before the ledger, before the approval gate, before a byte of the spec is read.
|
|
286
291
|
// An unrecognised spelling throws here at zero cost instead of being coerced by
|
|
@@ -389,7 +394,7 @@ export async function runJob(rawSpec, { approvals, workdir, provider, nativeProv
|
|
|
389
394
|
emit('job-end', { outcome: 'job-red', ...spend() });
|
|
390
395
|
return 'job-red';
|
|
391
396
|
}
|
|
392
|
-
|
|
397
|
+
let job = /** @type {any} */ (jv.job);
|
|
393
398
|
/** F103 — the two TIME figures, resolved once here and read the same way by
|
|
394
399
|
* `runPlan`'s clock. An unreadable ruling resolves to `fresh: false` and folds as
|
|
395
400
|
* it always did; `runPlan` is where it is refused, so this never has to. */
|
|
@@ -460,6 +465,9 @@ export async function runJob(rawSpec, { approvals, workdir, provider, nativeProv
|
|
|
460
465
|
? { priorReplans: Math.floor(resumeReplans.count), priorReplanGrantUsed: resumeReplans.grantUsed === true }
|
|
461
466
|
: {}),
|
|
462
467
|
});
|
|
468
|
+
// PLACE RULES: the approval was checked on the signed spec and `job-start` recorded its hash; only now does the run's own copy take the values its start read
|
|
469
|
+
if (placeValues !== null) job = bindPlaceValues(job, placeValues);
|
|
470
|
+
if (placeRead !== null) emit('place-rules', placeRead);
|
|
463
471
|
|
|
464
472
|
// F140/PRD item 28 (c) — the backstop that fires on the ABSENCE of a
|
|
465
473
|
// `job-end`. A provider promise that never settles (BA-25's class; 0.42.0
|