fwdloop 0.36.0 → 0.37.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/README.md +1 -1
- package/bin/fwdloop +5 -2
- package/package.json +3 -3
- package/src/action-stop.js +1 -1
- package/src/auditchecks.js +41 -9
- package/src/authoring.js +74 -16
- package/src/blockasks.js +10 -12
- package/src/blockassemble.js +49 -43
- package/src/blockdraft.js +4 -2
- package/src/blockpick.js +10 -0
- package/src/canrun.js +2 -1
- package/src/cardlist.js +28 -5
- package/src/checkblock.js +610 -64
- package/src/checked.js +28 -33
- package/src/checklistsign.js +2 -1
- package/src/checklook.js +45 -0
- package/src/checkrows.js +202 -0
- package/src/cited-record.js +2 -2
- package/src/citedcheck.js +53 -12
- package/src/citedwords.js +7 -4
- package/src/closers.js +49 -2
- package/src/declaration.js +26 -4
- package/src/drafter.js +85 -61
- package/src/factwords.js +7 -4
- package/src/globprefix.js +26 -0
- package/src/model-step.js +22 -4
- package/src/pageask.js +0 -3
- package/src/pagedropwords.js +3 -11
- package/src/pagedry.js +75 -1
- package/src/pagefetch.js +11 -6
- package/src/pagelook.js +2 -1
- package/src/pagerules.js +8 -2
- package/src/panel/author.js +9 -3
- package/src/panel/data.js +3 -2
- package/src/panel/index.html +143 -33
- package/src/panel/result.js +34 -1
- package/src/pickrecord.js +14 -0
- package/src/planrebuild.js +55 -19
- package/src/ratelimit.js +117 -0
- package/src/report.js +14 -3
- package/src/rowresults.js +111 -0
- package/src/rubricstep.js +65 -2
- package/src/runner.js +38 -5
- package/src/shapebuild.js +281 -0
- package/src/shapelook.js +91 -0
- package/src/shapemenu.js +64 -0
- package/src/shaperesult.js +104 -0
- package/src/shaperows.js +263 -0
- package/src/shapewords.js +140 -0
- package/src/sheetbuild.js +41 -29
- package/src/sheetclaims.js +1 -1
- package/src/sheetrows.js +10 -64
- package/src/ticketrows.js +1 -1
- package/src/try-checks.js +39 -6
- package/src/types.js +1 -0
- package/src/whole-job.js +24 -8
- package/types/action-stop.d.ts +1 -1
- package/types/auditchecks.d.ts +13 -2
- package/types/authoring.d.ts +20 -2
- package/types/blockasks.d.ts +6 -10
- package/types/blockassemble.d.ts +13 -13
- package/types/blockdraft.d.ts +3 -2
- package/types/blockpick.d.ts +4 -0
- package/types/cardlist.d.ts +18 -2
- package/types/checkblock.d.ts +278 -28
- package/types/checked.d.ts +15 -6
- package/types/checklook.d.ts +36 -0
- package/types/checkrows.d.ts +119 -0
- package/types/citedcheck.d.ts +4 -2
- package/types/closers.d.ts +10 -1
- package/types/drafter.d.ts +8 -4
- package/types/globprefix.d.ts +5 -0
- package/types/model-step.d.ts +43 -2
- package/types/pageask.d.ts +0 -1
- package/types/pagedropwords.d.ts +0 -1
- package/types/pagedry.d.ts +27 -0
- package/types/pagefetch.d.ts +3 -2
- package/types/pagerules.d.ts +4 -0
- package/types/panel/result.d.ts +16 -1
- package/types/pickrecord.d.ts +10 -0
- package/types/ratelimit.d.ts +59 -0
- package/types/report.d.ts +2 -1
- package/types/rowresults.d.ts +28 -0
- package/types/rubricstep.d.ts +21 -0
- package/types/runner.d.ts +3 -1
- package/types/shapebuild.d.ts +97 -0
- package/types/shapelook.d.ts +76 -0
- package/types/shapemenu.d.ts +40 -0
- package/types/shaperesult.d.ts +40 -0
- package/types/shaperows.d.ts +102 -0
- package/types/shapewords.d.ts +43 -0
- package/types/sheetbuild.d.ts +31 -13
- package/types/sheetclaims.d.ts +1 -0
- package/types/sheetrows.d.ts +5 -36
- package/types/ticketrows.d.ts +1 -1
- package/types/try-checks.d.ts +2 -1
- package/types/types.d.ts +4 -0
- package/types/whole-job.d.ts +20 -4
package/src/sheetrows.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
// M16 am4 (docs/wiki/the-module-ladder.md, "M16 amendment 4" (2)): a sheet line's checks (`close.sheet`) are rows on the plan's list, beside every other check.
|
|
2
|
-
// The AI writes the sheet checks (M10b); code only READS them as rows: this file is the ONE writer of a sheet row, of its tag and of its card text
|
|
2
|
+
// The AI writes the sheet checks (M10b); code only READS them as rows: this file is the ONE writer of a sheet row, of its tag and of its card text.
|
|
3
3
|
// tag a check whose `covers` names one of the person's `~` rules is `[you]`; a check that covers none (the AI added it) is `[agent]`. (A `[default]` sheet check does not exist: no code adds one.)
|
|
4
|
-
// Drop only an `[agent]` row
|
|
5
|
-
// Add puts a dropped check back
|
|
4
|
+
// Drop only an `[agent]` row, and only the check block drops it (src/checkblock.js `rowChoice`, M19 S3): the check leaves `close.sheet` and the block's `sheetDroppedRecord` keeps it in the picks record (`sheetDropped`). A `[you]` row has no Drop.
|
|
5
|
+
// Add the block puts a dropped check back.
|
|
6
6
|
// Words are fwd's existing sheet-check words (src/sheetblock.js `sheetPlainText`); nothing here words a check. What this throws away: the check's fields (id, claim, range ...); a row keeps its line, tag, part and key.
|
|
7
7
|
import { sheetLineBlocks, sheetPlainText } from './sheetblock.js';
|
|
8
8
|
import { closePartsOf } from './checklistsign.js';
|
|
9
|
-
import { isDeepStrictEqual } from 'node:util';
|
|
10
9
|
|
|
11
10
|
const isRec = (/** @type {unknown} */ v) => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
12
11
|
|
|
13
12
|
/** the key of a sheet row: the block's `L<line>.<tail>` shape, tail `sheet.<check id>` @param {number} line @param {string} id */
|
|
14
13
|
export const sheetRowKey = (line, id) => `L${line}.sheet.${id}`;
|
|
14
|
+
// borrowed-from: bareloop src/sheetrows.js@v0.60.0 (`sheetCheckBody`; the tag's own header says bareloop copied the rest of that file from fwd)
|
|
15
|
+
/** the fields that say what a check IS: all but the names code gives it (id, claim), the rules it covers and its row tag. Two drafts name checks differently, so "the very same check" is read on these @param {any} c @returns {Record<string, any>} */
|
|
16
|
+
export function sheetCheckBody(c) { const { id: _i, claim: _c, covers: _v, row: _r, ...rest } = c; return rest; }
|
|
15
17
|
/** @param {unknown} key @returns {boolean} the key is a sheet row's */
|
|
16
18
|
export const isSheetKey = (key) => typeof key === 'string' && key.startsWith('L') && key.includes('.sheet.');
|
|
17
19
|
|
|
@@ -48,67 +50,11 @@ export function sheetRowsOf({ declaration, lines, csvRoles }) {
|
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
/**
|
|
51
|
-
* The plan's card with the sheet rows on it: the sheet rows after the block's rows
|
|
52
|
-
* @param {{rows: any[], suggested: any[]}} card the block's card (src/cardlist.js) @param {{card: any[]}} sheet `sheetRowsOf`
|
|
53
|
+
* The plan's card with the sheet rows on it: the sheet rows after the block's rows. A dropped sheet check is among the block's own suggestions (Add), like any dropped `!` row (src/cardlist.js).
|
|
54
|
+
* @param {{rows: any[], suggested: any[]}} card the block's card (src/cardlist.js) @param {{card: any[]}} sheet `sheetRowsOf`
|
|
53
55
|
*/
|
|
54
|
-
export function withSheetCard(card, sheet
|
|
55
|
-
return { ...card, rows: [...card.rows, ...sheet.card]
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** the dropped sheet checks the picks record keeps: `{key, line, index, check, text}` @returns {any[]} */
|
|
59
|
-
export const droppedSheetOf = (/** @type {any} */ record) => (isRec(record) && Array.isArray(record.sheetDropped) ? record.sheetDropped.filter((d) => isRec(d) && typeof d.key === 'string' && isRec(d.check) && Number.isInteger(d.line)) : []);
|
|
60
|
-
|
|
61
|
-
/** the fields that say what a check is: all but the names code gives it (id, claim) and the rules it covers */
|
|
62
|
-
const checkBody = (/** @type {any} */ c) => { const { id: _i, claim: _c, covers: _v, ...rest } = c; return rest; };
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* M17 am3: the key of the check of the line that IS a dropped one (same typed fields; code names every check, so an id says nothing across drafts), or null. A Revise keeps a Drop only for the very same check.
|
|
66
|
-
* @param {any} declaration @param {{line: number, check: any}} d a record of `droppedSheetOf` @returns {string|null}
|
|
67
|
-
*/
|
|
68
|
-
export function keyOfSameCheck(declaration, d) {
|
|
69
|
-
for (const st of isRec(declaration) && Array.isArray(declaration.steps) ? declaration.steps : []) {
|
|
70
|
-
if (!isRec(st) || st.fromLine !== d.line || !isRec(st.close) || !Array.isArray(st.close.sheet)) continue;
|
|
71
|
-
const hit = st.close.sheet.find((/** @type {any} */ c) => isRec(c) && isDeepStrictEqual(checkBody(c), checkBody(d.check)));
|
|
72
|
-
if (hit) return sheetRowKey(d.line, String(hit.id));
|
|
73
|
-
}
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* The person's Drop or Add on a sheet row, applied to the declaration (a copy). Same words as the block's own refusals (src/checkblock.js `rowChoice`).
|
|
79
|
-
* @param {{declaration: any, lines: any[], csvRoles: string[], op: 'drop'|'add', key: string, dropped: any[]}} o
|
|
80
|
-
* @returns {{ok: true, declaration: any, dropped: any[]}|{ok: false, why: string}}
|
|
81
|
-
*/
|
|
82
|
-
export function sheetChoice({ declaration, lines, csvRoles, op, key, dropped }) {
|
|
83
|
-
if (op === 'drop') {
|
|
84
|
-
const row = sheetRowsOf({ declaration, lines, csvRoles }).card.find((r) => r.key === key);
|
|
85
|
-
if (!row) return { ok: false, why: 'there is no such check on the list' };
|
|
86
|
-
if (row.by === 'you') return { ok: false, why: 'that check comes from a rule you wrote; edit the job to change it' };
|
|
87
|
-
let gone = null;
|
|
88
|
-
const steps = declaration.steps.map((/** @type {any} */ st) => {
|
|
89
|
-
if (gone !== null || !isRec(st) || st.fromLine !== row.line || !isRec(st.close) || !Array.isArray(st.close.sheet)) return st;
|
|
90
|
-
const index = st.close.sheet.findIndex((/** @type {any} */ c) => isRec(c) && sheetRowKey(row.line, String(c.id)) === key);
|
|
91
|
-
if (index === -1) return st;
|
|
92
|
-
gone = { key, line: row.line, index, check: st.close.sheet[index], text: row.text };
|
|
93
|
-
const sheet = st.close.sheet.filter((/** @type {unknown} */ _c, /** @type {number} */ k) => k !== index);
|
|
94
|
-
const { sheet: _s, ...close } = st.close;
|
|
95
|
-
return { ...st, close: sheet.length > 0 ? { ...close, sheet } : close };
|
|
96
|
-
});
|
|
97
|
-
if (gone === null) return { ok: false, why: 'there is no such check on the list' };
|
|
98
|
-
return { ok: true, declaration: { ...declaration, steps }, dropped: [...dropped.filter((d) => d.key !== key), gone] };
|
|
99
|
-
}
|
|
100
|
-
const was = dropped.find((d) => d.key === key);
|
|
101
|
-
if (!was) return { ok: false, why: 'only a suggested check can be added' };
|
|
102
|
-
let put = false;
|
|
103
|
-
const steps = declaration.steps.map((/** @type {any} */ st) => {
|
|
104
|
-
if (put || !isRec(st) || st.fromLine !== was.line || !isRec(st.close) || st.close.class !== 'green') return st;
|
|
105
|
-
put = true;
|
|
106
|
-
const sheet = Array.isArray(st.close.sheet) ? [...st.close.sheet] : [];
|
|
107
|
-
sheet.splice(Math.min(was.index, sheet.length), 0, was.check);
|
|
108
|
-
return { ...st, close: { ...st.close, sheet } };
|
|
109
|
-
});
|
|
110
|
-
if (!put) return { ok: false, why: 'only a suggested check can be added' };
|
|
111
|
-
return { ok: true, declaration: { ...declaration, steps }, dropped: dropped.filter((d) => d.key !== key) };
|
|
56
|
+
export function withSheetCard(card, sheet) {
|
|
57
|
+
return { ...card, rows: [...card.rows, ...sheet.card] };
|
|
112
58
|
}
|
|
113
59
|
|
|
114
60
|
/**
|
package/src/ticketrows.js
CHANGED
|
@@ -10,7 +10,7 @@ const isRec = (/** @type {unknown} */ v) => v !== null && typeof v === 'object'
|
|
|
10
10
|
/** @type {readonly ('ticketFilter'|'ticketWatch')[]} */
|
|
11
11
|
export const TICKET_FIELDS = Object.freeze(['ticketFilter', 'ticketWatch']);
|
|
12
12
|
/** the Not-checked reason of a ticket rule no legal value was suggested for (the block's own noPick sentence is used by the caller's words) */
|
|
13
|
-
export const NO_VALUE_WHY = 'No check was picked for it, so you judge it at
|
|
13
|
+
export const NO_VALUE_WHY = 'No check was picked for it, so you judge it at Accept.';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Which signed field a Tickets rule is the check of: `ticketWatch` (a state or labels change), `ticketFilter` (a priority P0 to P3 or a label), or null (a content rule or a count).
|
package/src/try-checks.js
CHANGED
|
@@ -6,6 +6,10 @@ import { serializeArtifact } from './ask.js';
|
|
|
6
6
|
import { labelled } from './checkwords.js';
|
|
7
7
|
import { sheetRowKey } from './sheetrows.js';
|
|
8
8
|
import { listLinesOf, partByOf } from './checklistsign.js';
|
|
9
|
+
import { rowResultsOf } from './rowresults.js';
|
|
10
|
+
import { stepRowsOf } from './checkrows.js';
|
|
11
|
+
import { itemCountOf } from './shaperows.js';
|
|
12
|
+
import { rulesOfLine } from './sheetblock.js';
|
|
9
13
|
|
|
10
14
|
export const EVERY_STEP = 'every step';
|
|
11
15
|
/** the words of the two checks every step has (#1 and #2 below): the Audit's "Always checked" rows, the plan card's and the Job tab's "Always checked" fold */
|
|
@@ -47,25 +51,28 @@ export function outputRecord(step, artifact) {
|
|
|
47
51
|
* #3 and up: the close's own checks. A softgreen close carries each of its checks; a green close is one check over all its cited fields; a close that
|
|
48
52
|
* judged nothing (`unparseable`, `crash`) is one check that could not run, with that third outcome as its result.
|
|
49
53
|
* @param {any} step @param {any} artifact @param {{verdict: string, red?: string|null, checks?: Array<{text:string, ok:boolean, result:string|null}>}} closed @param {any[]} [checkList] the signed list (M16): a line on it tags its checks
|
|
54
|
+
* @param {any[]} [jobLines] the signed job lines (M19 am11: the words of a list line's field rows read the person's rule)
|
|
50
55
|
*/
|
|
51
|
-
export function closeRecords(step, artifact, closed, checkList = undefined) {
|
|
56
|
+
export function closeRecords(step, artifact, closed, checkList = undefined, jobLines = undefined) {
|
|
52
57
|
// M16 item 5: a check of a list line carries `by`, the row's own (`you` / `agent` / `default`); the Audit draws the tag from it. Any other line keeps the words it has.
|
|
53
58
|
const decl = Array.isArray(checkList) ? { checkList } : undefined;
|
|
54
59
|
const listed = decl !== undefined && listLinesOf(decl).has(step?.fromLine);
|
|
55
60
|
const hasCited = step?.close?.class === 'green' && !!step?.close?.cited;
|
|
56
61
|
const by = (/** @type {number} */ idx, /** @type {'you'|'agent'|'default'} */ fallback) => (listed ? { by: partByOf(decl, step.fromLine, idx) ?? fallback, part: idx } : {});
|
|
57
|
-
const rows = factRecords(step, artifact, closed, listed ? (/** @type {number} */ idx) => partByOf(decl, step.fromLine, idx) : undefined, checkList).map((r) => (listed && hasCited && r.n === 3 ? { ...r, text: String(r.text).replace(/ \[agent\]$/, ''), ...by(0, 'agent') } : r));
|
|
62
|
+
const rows = factRecords(step, artifact, closed, listed ? (/** @type {number} */ idx) => partByOf(decl, step.fromLine, idx) : undefined, checkList, jobLines).map((r) => (listed && hasCited && r.n === 3 ? { ...r, text: String(r.text).replace(/ \[agent\]$/, ''), ...by(0, 'agent') } : r));
|
|
63
|
+
// the list's part order is the close's: the fact part, the item-fields part (M19 am10), then each pick, then the tie
|
|
64
|
+
const lead = (hasCited ? 1 : 0) + (step?.close?.itemShape ? 1 : 0);
|
|
58
65
|
// M10 am22 (1): the picks on a fact line are rows after the fact rows, each judged on the answer's text
|
|
59
66
|
const picks = Array.isArray(/** @type {any} */ (closed).pickChecks) ? /** @type {any} */ (closed).pickChecks : [];
|
|
60
|
-
const pickRows = picks.map((/** @type {any} */ c, /** @type {number} */ i) => ({ n: rows.length + 3 + i, text: listed ? c.text : labelled(c.text, 'picked'), ok: c.ok, result: c.result, source: lineSource(step), ...by(
|
|
67
|
+
const pickRows = picks.map((/** @type {any} */ c, /** @type {number} */ i) => ({ n: rows.length + 3 + i, text: listed ? c.text : labelled(c.text, 'picked'), ok: c.ok, result: c.result, source: lineSource(step), ...by(lead + i, 'you') }));
|
|
61
68
|
// M16 R7: the numbers tie of a text line is one more row
|
|
62
69
|
const tie = /** @type {any} */ (closed).numbersCheck;
|
|
63
70
|
const picked = Array.isArray(step?.close?.picked) ? step.close.picked.length : Array.isArray(step?.close?.shape?.picked) ? step.close.shape.picked.length : 0;
|
|
64
|
-
return [...rows, ...pickRows, ...(tie ? [{ n: rows.length + pickRows.length + 3, text: tie.text, ok: tie.ok, result: tie.result, source: lineSource(step), ...by(
|
|
71
|
+
return [...rows, ...pickRows, ...(tie ? [{ n: rows.length + pickRows.length + 3, text: tie.text, ok: tie.ok, result: tie.result, source: lineSource(step), ...by(lead + picked, 'default') }] : [])];
|
|
65
72
|
}
|
|
66
73
|
|
|
67
|
-
/** @param {any} step @param {any} artifact @param {any} closed @param {((idx: number) => string|null)} [partBy] set for a list line (M16): its softgreen picks carry the row's `by` instead of a label @param {any[]} [checkList] the signed list: a sheet row on it gives its check's `by` */
|
|
68
|
-
function factRecords(step, artifact, closed, partBy = undefined, checkList = undefined) {
|
|
74
|
+
/** @param {any} step @param {any} artifact @param {any} closed @param {((idx: number) => string|null)} [partBy] set for a list line (M16): its softgreen picks carry the row's `by` instead of a label @param {any[]} [checkList] the signed list: a sheet row on it gives its check's `by` @param {any[]} [jobLines] */
|
|
75
|
+
function factRecords(step, artifact, closed, partBy = undefined, checkList = undefined, jobLines = undefined) {
|
|
69
76
|
const source = lineSource(step);
|
|
70
77
|
if (closed.verdict === 'unparseable' || closed.verdict === 'crash') {
|
|
71
78
|
return [{
|
|
@@ -87,6 +94,7 @@ function factRecords(step, artifact, closed, partBy = undefined, checkList = und
|
|
|
87
94
|
n: 3, text: labelled('every result is quoted from the saved copy and passes its rules', 'agent'), ok: Array.isArray(/** @type {any} */ (closed).pickChecks) && closed.cited?.check ? closed.cited.check.verdict === 'green' : closed.verdict === 'green', result: `${n} result${n === 1 ? '' : 's'}`, source,
|
|
88
95
|
}];
|
|
89
96
|
}
|
|
97
|
+
if (step?.close?.class === 'green' && step?.close?.itemShape && !step.close.cited && partBy !== undefined) return itemShapeRecords(step, closed, checkList, jobLines, source);
|
|
90
98
|
if (step?.close?.class === 'green') {
|
|
91
99
|
const n = Object.keys(artifact?.fields ?? {}).length;
|
|
92
100
|
return [{
|
|
@@ -101,3 +109,28 @@ function factRecords(step, artifact, closed, partBy = undefined, checkList = und
|
|
|
101
109
|
return { n: 3 + i, text: id === 'keys' ? c.text : labelled(c.text, pk ? 'picked' : 'agent'), ok: c.ok, result: c.result, source };
|
|
102
110
|
});
|
|
103
111
|
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* M19 am11 item 4: a list line that quotes nothing: one record per row of its shape part (each item field, the rule that sets the item count), each with the result of its OWN row (src/rowresults.js `rowResultsOf`, from bareguard's own gaps),
|
|
115
|
+
* its row's `key`, `by` and `part`. A red no row owns is a record of its own, in the closer's words. Never "every cited field matches its source".
|
|
116
|
+
* @param {any} step @param {any} closed @param {any[]|undefined} checkList @param {any[]|undefined} jobLines @param {string} source
|
|
117
|
+
*/
|
|
118
|
+
function itemShapeRecords(step, closed, checkList, jobLines, source) {
|
|
119
|
+
const line = step.fromLine;
|
|
120
|
+
const list = Array.isArray(checkList) ? checkList : [];
|
|
121
|
+
const rows = stepRowsOf({ declaration: { checkList: list, steps: [step] }, st: step, lines: Array.isArray(jobLines) ? jobLines : [] }).rows.filter((/** @type {any} */ r) => r.idx === 0 && /:shape:/.test(String(r.part)));
|
|
122
|
+
const ofLine = list.filter((/** @type {any} */ r) => r?.line === line);
|
|
123
|
+
const rules = ofLine.filter((/** @type {any} */ r) => r.kind === 'rule' && r.state === 'built' && r.part?.part === 0).map((/** @type {any} */ r) => r.rule);
|
|
124
|
+
const said = rulesOfLine((Array.isArray(jobLines) ? jobLines : []).find((/** @type {any} */ l) => l?.n === line));
|
|
125
|
+
const ruleCounts = Object.fromEntries(rules.map((/** @type {number} */ k) => [k, itemCountOf(String(said[k - 1] ?? ''))]).filter(([, c]) => c !== null));
|
|
126
|
+
const graded = { verdict: closed.verdict, rawGaps: Array.isArray(closed.shapeGaps) ? closed.shapeGaps : [], ruleCounts };
|
|
127
|
+
const res = rowResultsOf(ofLine, { step: line, parts: [{ ...step.close.itemShape, class: 'shape', rules }] }, graded);
|
|
128
|
+
const got = new Map(res.rows.map((/** @type {any} */ r) => [r.key, r]));
|
|
129
|
+
/** @type {any[]} */
|
|
130
|
+
const out = rows.map((/** @type {any} */ r, /** @type {number} */ i) => {
|
|
131
|
+
const g = got.get(r.key);
|
|
132
|
+
return { n: 3 + i, text: r.text, ok: g?.result === 'passed', result: g === undefined ? 'no result' : g.result === 'passed' ? null : g.result === 'failed' ? g.why : g.result, source, by: r.by, part: r.idx, key: r.key };
|
|
133
|
+
});
|
|
134
|
+
for (const u of res.unclaimed) out.push({ n: 3 + out.length, text: u, ok: false, result: null, source, unclaimed: true });
|
|
135
|
+
return out;
|
|
136
|
+
}
|
package/src/types.js
CHANGED
|
@@ -255,6 +255,7 @@
|
|
|
255
255
|
* @property {Array<{id:string, text:string, ok:boolean, result:string|null}>} [checks] a softgreen close: every check it ran (M4d am29 item 2)
|
|
256
256
|
* @property {{text: string, ok: boolean, result: string|null}} [numbersCheck] the numbers tie of a text line (M16 R7): beside the class's own verdict
|
|
257
257
|
* @property {{part: any, check: any, results?: unknown}} [cited] a cited green close (M10 piece 4): the fact part and the check's own answer, for the run's cited-check record
|
|
258
|
+
* @property {any[]} [shapeGaps] a line with an itemShape close (M19 S5): bareguard's own gaps of the items check (names, counts and bounds, never a value)
|
|
258
259
|
* @property {{inputs: Array<{name:string, sha256:string}>, claims: unknown, checks: Array<{id:string, text:string, ok:boolean, result:string|null}>}} [sheetRecord] a sheet close (M10b piece 2): what the run's sheet-check record keeps
|
|
259
260
|
*/
|
|
260
261
|
|
package/src/whole-job.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// M13 am9 / M15 am3: the file holds the whole job. ONE writer of the whole-job text (`wholeJobText`), ONE finder of the Ask that shows it (`wholeJobAskIndex`).
|
|
2
|
-
// The last Ask before the
|
|
2
|
+
// The last Ask before the action shows every step's result in job order, built by code from each step's saved output (never picked by the AI). Since M15 am3 that text is the BODY of the
|
|
3
3
|
// run's one markdown report (`renderReportBody`, src/report.js: `## <n>. <line>`, the ~ rules, what code checked, the AI's answer under its heading; an Ask before it is one line
|
|
4
4
|
// `Line <n>: you accepted this at the Ask.`); the last Ask itself and the send line are not sections. The accepted artifact is `{text}`; the send adds the title and the Passed line and writes it.
|
|
5
5
|
// Throws away: what `renderReportBody` throws away. Third outcomes: a work step with no readable saved output refuses, naming the step; a frozen sheet the report needs that cannot be read refuses, naming it.
|
|
@@ -43,7 +43,7 @@ export function wholeJobAskIndex({ steps, askLines, sendLines }) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/** the `~` rules of a signed job line, one string each: the parsed line carries them joined by "; " in `guardrail` (several `~` lines under one step are one guardrail), as the Result tab reads it @param {any} jl @returns {string[]} */
|
|
46
|
-
const lineRulesOf = (jl) => (jl && typeof jl.guardrail === 'string' && jl.guardrail !== '' ? jl.guardrail.split('; ').filter(Boolean) : lineRules(jl));
|
|
46
|
+
export const lineRulesOf = (jl) => (jl && typeof jl.guardrail === 'string' && jl.guardrail !== '' ? jl.guardrail.split('; ').filter(Boolean) : lineRules(jl));
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Is the prose of this step checked by code (M15 am3 item 2: `### The answer` instead of the not-checked heading)? Only when code really checked the step's own text (a green close with a words-per-section
|
|
@@ -60,6 +60,9 @@ export function proseCheckedOf(step, checkList) {
|
|
|
60
60
|
return shape.wordsPerSection !== undefined || (Array.isArray(shape.picked) && shape.picked.length > 0) || (Array.isArray(c.picked) && c.picked.length > 0);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
/** the signed shape part of a step (its close's `itemShape`, M19 S5), or null: the report writes the shape section for a line that holds one (M19 amendment C) @param {any} step */
|
|
64
|
+
const shapeOfStep = (step) => (step?.close?.itemShape && typeof step.close.itemShape === 'object' && Array.isArray(step.close.itemShape.fields) ? step.close.itemShape : null);
|
|
65
|
+
|
|
63
66
|
/**
|
|
64
67
|
* What the report needs besides the steps: the signed lines' own words (the `~` rules), the run's frozen sheets and which sheet checks passed. Read once from the run folder.
|
|
65
68
|
* @param {{ runDir: string, steps: any[], jobLines: any[]|null|undefined, checkList?: any[]|null }} p
|
|
@@ -87,10 +90,10 @@ export function reportContextOf({ runDir, steps, jobLines, checkList }) {
|
|
|
87
90
|
/**
|
|
88
91
|
* @param {{ steps: { fromLine: number, goal: string, emits?: string, close?: any }[], askLines: Map<number, any>, lastAskIndex: number,
|
|
89
92
|
* readResult: (id: string) => ({ ok: true, value: any } | { ok: false, missing: true } | { ok: false, missing: false, red: string }),
|
|
90
|
-
* context: ReturnType<typeof reportContextOf
|
|
93
|
+
* context: ReturnType<typeof reportContextOf>, redPrefix?: string }} p `redPrefix` is `ask: ` (an Ask job's words, unchanged); M15 am4 gives a job with no Ask `send: `
|
|
91
94
|
* @returns {{ ok: true, value: { text: string } } | { ok: false, red: string }}
|
|
92
95
|
*/
|
|
93
|
-
export function wholeJobText({ steps, askLines, lastAskIndex, readResult, context }) {
|
|
96
|
+
export function wholeJobText({ steps, askLines, lastAskIndex, readResult, context, redPrefix = 'ask: ' }) {
|
|
94
97
|
if (!context.ok) return { ok: false, red: context.red };
|
|
95
98
|
/** @type {Parameters<typeof renderReportBody>[0]} */
|
|
96
99
|
const lines = [];
|
|
@@ -105,14 +108,15 @@ export function wholeJobText({ steps, askLines, lastAskIndex, readResult, contex
|
|
|
105
108
|
return {
|
|
106
109
|
ok: false,
|
|
107
110
|
red: r.missing
|
|
108
|
-
?
|
|
109
|
-
:
|
|
111
|
+
? `${redPrefix}the saved output "${s.emits}" of step "${s.goal}" is missing — refusing to show the whole job`
|
|
112
|
+
: `${redPrefix}the saved output "${s.emits}" of step "${s.goal}" — ${r.red}`,
|
|
110
113
|
};
|
|
111
114
|
}
|
|
112
115
|
const jl = context.jobLines.find((/** @type {any} */ l) => l && l.n === s.fromLine);
|
|
113
116
|
lines.push({
|
|
114
117
|
n: s.fromLine, kind: 'work', text: s.goal, rules: lineRulesOf(jl), artifact: r.value,
|
|
115
118
|
checks: Array.isArray(s.close?.sheet) ? s.close.sheet : [], okIds: context.okIdsOf(s.fromLine), proseChecked: proseCheckedOf(s, context.checkList),
|
|
119
|
+
shape: shapeOfStep(s),
|
|
116
120
|
});
|
|
117
121
|
}
|
|
118
122
|
return { ok: true, value: { text: renderReportBody(lines, context.tables) } };
|
|
@@ -121,10 +125,13 @@ export function wholeJobText({ steps, askLines, lastAskIndex, readResult, contex
|
|
|
121
125
|
/**
|
|
122
126
|
* M15 am3 item 6: the body the send writes. A plan whose last Ask shows the whole job (`wholeIdx` >= 0) was accepted AS that text: the body is `{text}` exactly, never rebuilt. A plan signed before
|
|
123
127
|
* M13 am9 (or a job with no Ask) sends the one step right before the send: its section is written from the accepted artifact, the line being that step's own (or, past an Ask, the step the Ask read).
|
|
124
|
-
*
|
|
128
|
+
* M15 am4: a job with no signed Ask (`askLines.size === 0`, no whole-job Ask) writes every work line before the send, in line order: the whole-job text over the steps before the send, the step right before it
|
|
129
|
+
* read from `content` (what the person accepted), the earlier ones from the run's saved outputs (`readResult`). A missing or unreadable earlier output refuses by name, in `send: ` words (never `ask: `).
|
|
130
|
+
* @param {{ content: any, wholeIdx: number, steps: any[], sendIndex: number, askLines: Map<number, any>, context: ReturnType<typeof reportContextOf>,
|
|
131
|
+
* readResult?: (id: string) => ({ ok: true, value: any } | { ok: false, missing: true } | { ok: false, missing: false, red: string }) }} p
|
|
125
132
|
* @returns {{ ok: true, body: string } | { ok: false, red: string }}
|
|
126
133
|
*/
|
|
127
|
-
export function sendBodyOf({ content, wholeIdx, steps, sendIndex, askLines, context }) {
|
|
134
|
+
export function sendBodyOf({ content, wholeIdx, steps, sendIndex, askLines, context, readResult }) {
|
|
128
135
|
if (wholeIdx >= 0) {
|
|
129
136
|
return typeof content?.text === 'string' && Object.keys(content).length === 1
|
|
130
137
|
? { ok: true, body: content.text }
|
|
@@ -132,6 +139,14 @@ export function sendBodyOf({ content, wholeIdx, steps, sendIndex, askLines, cont
|
|
|
132
139
|
}
|
|
133
140
|
if (!context.ok) return { ok: false, red: context.red };
|
|
134
141
|
const before = steps[sendIndex - 1];
|
|
142
|
+
if (askLines.size === 0) {
|
|
143
|
+
if (!readResult) return { ok: false, red: 'send: no reader for the run\'s saved outputs was given — refusing to write a report' };
|
|
144
|
+
const whole = wholeJobText({
|
|
145
|
+
steps, askLines, lastAskIndex: sendIndex, context, redPrefix: 'send: ',
|
|
146
|
+
readResult: (id) => (before && id === before.emits ? { ok: true, value: content } : readResult(id)),
|
|
147
|
+
});
|
|
148
|
+
return whole.ok ? { ok: true, body: whole.value.text } : whole;
|
|
149
|
+
}
|
|
135
150
|
const made = before && askLines.has(before.fromLine) ? steps.find((x) => x.emits === (before.reads ?? [])[0]) ?? before : before;
|
|
136
151
|
const jl = context.jobLines.find((/** @type {any} */ l) => l && l.n === made?.fromLine);
|
|
137
152
|
return {
|
|
@@ -139,6 +154,7 @@ export function sendBodyOf({ content, wholeIdx, steps, sendIndex, askLines, cont
|
|
|
139
154
|
body: renderReportBody([{
|
|
140
155
|
n: made?.fromLine, kind: 'work', text: made?.goal, rules: lineRulesOf(jl), artifact: content,
|
|
141
156
|
checks: Array.isArray(made?.close?.sheet) ? made.close.sheet : [], okIds: context.okIdsOf(made?.fromLine), proseChecked: proseCheckedOf(made, context.checkList),
|
|
157
|
+
shape: shapeOfStep(made),
|
|
142
158
|
}], context.tables),
|
|
143
159
|
};
|
|
144
160
|
}
|
package/types/action-stop.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export function lastAcceptedSha(steps: {
|
|
|
21
21
|
emits?: string;
|
|
22
22
|
}[], i: number, acceptedAskEmitsThisRun: Map<string, string | null>): string | null;
|
|
23
23
|
/**
|
|
24
|
-
* am11a 1/2: the wait of the stop. The LAST Ask's own wait when the job has an Ask before the action; else the card's Ask wait kept in the run's signed values (`
|
|
24
|
+
* am11a 1/2: the wait of the stop. The LAST Ask's own wait when the job has an Ask before the action; else the card's Ask wait kept in the run's signed values (`sendSlot.waitMs`, src/runvalues.js), else 1h.
|
|
25
25
|
* @param {{ fromLine: number }[]} steps @param {number} i @param {Map<number, {ttlMs: number}>} askLines @param {number|undefined} actionWaitMs
|
|
26
26
|
*/
|
|
27
27
|
export function stopWaitMs(steps: {
|
package/types/auditchecks.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {any} declaration the signed plan @param {any[]} diary the run's `checks` rows (src/diary.js readChecks) @param {{items?: string[], by?: Record<string, string>}|null} notChecked the sign row's Not-checked block
|
|
3
3
|
* @param {{lines?: any[], csvRoles?: string[]}} [sheet] the signed job lines and CSV roles: a plan whose list has sheet rows (M16 am4) shows them here, tagged by where each comes from (hamr 2026-11-14)
|
|
4
|
-
* @returns {{checks: AuditCheckRow[], notChecked: AuditCheckRow[], readNotes: string[], always: AuditCheckRow[]}|null} null for a plan with no list (it keeps its own Audit rows)
|
|
5
|
-
* @typedef {{text: string,
|
|
4
|
+
* @returns {{checks: AuditCheckRow[], notChecked: AuditCheckRow[], readNotes: string[], always: AuditCheckRow[], lines: AuditLine[], jobNotChecked: AuditCheckRow[]}|null} null for a plan with no list (it keeps its own Audit rows)
|
|
5
|
+
* @typedef {{n: number, text: string, checks: AuditCheckRow[], notChecked: AuditCheckRow[]}} AuditLine
|
|
6
|
+
* @typedef {{text: string, by: 'you'|'agent'|'default'|null, result: 'passed'|'failed'|'none'|'not-checked', kind?: 'truth'|'shape'|'file', why?: string}} AuditCheckRow
|
|
6
7
|
*/
|
|
7
8
|
export function auditChecksOf(declaration: any, diary: any[], notChecked: {
|
|
8
9
|
items?: string[];
|
|
@@ -15,11 +16,21 @@ export function auditChecksOf(declaration: any, diary: any[], notChecked: {
|
|
|
15
16
|
notChecked: AuditCheckRow[];
|
|
16
17
|
readNotes: string[];
|
|
17
18
|
always: AuditCheckRow[];
|
|
19
|
+
lines: AuditLine[];
|
|
20
|
+
jobNotChecked: AuditCheckRow[];
|
|
18
21
|
} | null;
|
|
19
22
|
/** the words of a row no result was recorded for: never "passed" */
|
|
20
23
|
export const AUDIT_NO_RESULT: "no result recorded";
|
|
24
|
+
export type AuditLine = {
|
|
25
|
+
n: number;
|
|
26
|
+
text: string;
|
|
27
|
+
checks: AuditCheckRow[];
|
|
28
|
+
notChecked: AuditCheckRow[];
|
|
29
|
+
};
|
|
21
30
|
export type AuditCheckRow = {
|
|
22
31
|
text: string;
|
|
23
32
|
by: "you" | "agent" | "default" | null;
|
|
24
33
|
result: "passed" | "failed" | "none" | "not-checked";
|
|
34
|
+
kind?: "truth" | "shape" | "file";
|
|
35
|
+
why?: string;
|
|
25
36
|
};
|
package/types/authoring.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export function fmtTtl(ms: any): string;
|
|
|
62
62
|
/** Zero-based indexes of the header and heading lines in a readout's text (split on "\n"): the panel renders those bold. */
|
|
63
63
|
export function readoutHeadIndexes(text: any): any[];
|
|
64
64
|
/** Plain-text readout of what the human is about to sign. Pure. */
|
|
65
|
-
export function buildReadout({ declaration, arbiter, lines, name, modelId, costUsd, rounds, spendComplete, root, }: {
|
|
65
|
+
export function buildReadout({ declaration, arbiter, lines, name, modelId, costUsd, rounds, spendComplete, root, notChecked, notCheckedBy, suggested, checkCard, }: {
|
|
66
66
|
declaration: any;
|
|
67
67
|
arbiter: any;
|
|
68
68
|
lines: any;
|
|
@@ -72,6 +72,23 @@ export function buildReadout({ declaration, arbiter, lines, name, modelId, costU
|
|
|
72
72
|
rounds: any;
|
|
73
73
|
spendComplete: any;
|
|
74
74
|
root: any;
|
|
75
|
+
notChecked?: string[] | undefined;
|
|
76
|
+
notCheckedBy?: Record<string, string> | undefined;
|
|
77
|
+
suggested?: {
|
|
78
|
+
line: number;
|
|
79
|
+
text: string;
|
|
80
|
+
key?: string;
|
|
81
|
+
dropped?: boolean;
|
|
82
|
+
}[] | undefined;
|
|
83
|
+
checkCard?: {
|
|
84
|
+
rows: {
|
|
85
|
+
line: number;
|
|
86
|
+
by: string;
|
|
87
|
+
state: string;
|
|
88
|
+
text: string;
|
|
89
|
+
kind?: string;
|
|
90
|
+
}[];
|
|
91
|
+
} | null | undefined;
|
|
75
92
|
}): string;
|
|
76
93
|
/** Read the prose file. Refuses (a red, never a throw) on unreadable or blank. */
|
|
77
94
|
export function readProseFile(file: any): {
|
|
@@ -115,7 +132,7 @@ export function writePlanFiles(dir: string, files: Record<string, string>, opts?
|
|
|
115
132
|
* Test seam: `provider`/`rates`/`modelId` are injected; without them a live provider is built.
|
|
116
133
|
* `onResult({ ok })` (M4d am32): called once, after the spend is booked and just before the result files are written (the CLI gives its monthly hold back there).
|
|
117
134
|
*/
|
|
118
|
-
export function draftToDir({ proseFile, dir, root, name, slot, model, draftThinking, keyNames, env, provider, rates, modelId, noQuestions, onResult, fetchPage, leftRules, columnAnswers, carriedColumns, checkPicks, carriedPicks, carriedChoices, carriedSheetDropped, proseRead, flowType, mcpServer, mcpPick, mcpServers, actionMode, }: {
|
|
135
|
+
export function draftToDir({ proseFile, dir, root, name, slot, model, draftThinking, keyNames, env, provider, rates, modelId, noQuestions, onResult, fetchPage, leftRules, columnAnswers, carriedColumns, checkPicks, carriedPicks, carriedChoices, carriedSheetDropped, carriedShapeDropped, proseRead, flowType, mcpServer, mcpPick, mcpServers, actionMode, }: {
|
|
119
136
|
proseFile: any;
|
|
120
137
|
dir: any;
|
|
121
138
|
root: any;
|
|
@@ -138,6 +155,7 @@ export function draftToDir({ proseFile, dir, root, name, slot, model, draftThink
|
|
|
138
155
|
carriedPicks: any;
|
|
139
156
|
carriedChoices: any;
|
|
140
157
|
carriedSheetDropped: any;
|
|
158
|
+
carriedShapeDropped: any;
|
|
141
159
|
proseRead: any;
|
|
142
160
|
flowType?: "tickets" | "mcp" | "plain" | undefined;
|
|
143
161
|
mcpServer?: string | undefined;
|
package/types/blockasks.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
/** @typedef {{key: string, rowKey: string, line: number, rule: number, source: 'look', ask: 'reading'|'
|
|
1
|
+
/** @typedef {{key: string, rowKey: string, line: number, rule: number, source: 'look', ask: 'reading'|'check', ruleText: string, question: string, counted: boolean, reading?: string, check?: Record<string, any>}} BlockAsk */
|
|
2
2
|
/**
|
|
3
|
-
* The questions the block has open, in the order the person meets them: the look's readings, then the
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param {import('./checkblock.js').CheckBlock} block @param {{line: number, rule: number}[]} [scoped] @returns {BlockAsk[]}
|
|
3
|
+
* The questions the block has open, in the order the person meets them: the look's readings, then the pick path's proposals (a proposal is not counted toward the 3-ask cap).
|
|
4
|
+
* M19 am3: a rule no check can settle is no longer asked, so `block.open` holds only `reading` and `check` asks; any other kind is a bug and throws.
|
|
5
|
+
* @param {import('./checkblock.js').CheckBlock} block @returns {BlockAsk[]}
|
|
7
6
|
*/
|
|
8
|
-
export function questionsOfBlock(block: import("./checkblock.js").CheckBlock
|
|
9
|
-
line: number;
|
|
10
|
-
rule: number;
|
|
11
|
-
}[]): BlockAsk[];
|
|
7
|
+
export function questionsOfBlock(block: import("./checkblock.js").CheckBlock): BlockAsk[];
|
|
12
8
|
/**
|
|
13
9
|
* The person's choices back into the block, one by one (the choice decides, never the words). A choice the block refuses is returned with its plain reason; the question stays open.
|
|
14
10
|
* @param {import('./checkblock.js').CheckBlock} block @param {{key: string, choice: string, text?: string}[]} choices @returns {{key: string, why: string}[]}
|
|
@@ -27,7 +23,7 @@ export type BlockAsk = {
|
|
|
27
23
|
line: number;
|
|
28
24
|
rule: number;
|
|
29
25
|
source: "look";
|
|
30
|
-
ask: "reading" | "
|
|
26
|
+
ask: "reading" | "check";
|
|
31
27
|
ruleText: string;
|
|
32
28
|
question: string;
|
|
33
29
|
counted: boolean;
|
package/types/blockassemble.d.ts
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The words a Not-checked row says. A rule the person left, wrote in their own words, or left with no pick keeps fwd's signed table (M10 am16 (5): src/pagedropwords.js), the words the plan card and the
|
|
3
|
-
* Audit already had; any other reason is the block's own (what code could not build and why).
|
|
4
|
-
* @param {string|null|undefined} reason @param {{cantAsked?: boolean}} [row]
|
|
5
|
-
*/
|
|
6
|
-
export function notCheckedWords(reason: string | null | undefined, row?: {
|
|
7
|
-
cantAsked?: boolean;
|
|
8
|
-
}): string;
|
|
9
1
|
/** a countable part as the picked check the softgreen close runs: its own fields, the rule named `rule` (the inverse of the block's partOfPick) @param {Record<string, any>} part */
|
|
10
2
|
export function pickedOf(part: Record<string, any>): {
|
|
11
3
|
rule: any;
|
|
12
4
|
};
|
|
13
5
|
/**
|
|
14
|
-
* @param {{declaration: Record<string, any>, block: import('./checkblock.js').CheckBlock, lines: {n: number, guardrail?: string|null}[], lineSet: Set<number>, askLines?: Set<number
|
|
15
|
-
* `lineSet` = the lines the block
|
|
6
|
+
* @param {{declaration: Record<string, any>, block: import('./checkblock.js').CheckBlock, lines: {n: number, guardrail?: string|null}[], lineSet: Set<number>, askLines?: Set<number>, sheetRoles?: string[], shapeOnlyClass?: 'green'|null}} o
|
|
7
|
+
* `lineSet` = the lines of the list (the block's step lines that are not sheet lines); `lines` = the signed lines (a guardrail decides the class); `askLines` = the signed Ask lines: each `~` rule on one is a Not-checked line here, never skipped (M17 am5 item 2);
|
|
8
|
+
* `sheetRoles` = the CSV inputs: the block's sheet part of a sheet line is the `close.sheet` of the line's first green step that reads one (M19 S3: the checks the block holds, drops and all)
|
|
16
9
|
* @returns {{declaration: Record<string, any>, notChecked: string[], notCheckedBy: Record<string, 'you'|'agent'|'default'>, built: Set<number>}} `built` = the lines that got a check from the block (a red naming one of them is a fault of the build)
|
|
17
10
|
*/
|
|
18
|
-
export function assembleFromBlock({ declaration, block, lines, lineSet, askLines }: {
|
|
11
|
+
export function assembleFromBlock({ declaration, block, lines, lineSet, askLines, sheetRoles, shapeOnlyClass }: {
|
|
19
12
|
declaration: Record<string, any>;
|
|
20
13
|
block: import("./checkblock.js").CheckBlock;
|
|
21
14
|
lines: {
|
|
@@ -24,6 +17,8 @@ export function assembleFromBlock({ declaration, block, lines, lineSet, askLines
|
|
|
24
17
|
}[];
|
|
25
18
|
lineSet: Set<number>;
|
|
26
19
|
askLines?: Set<number>;
|
|
20
|
+
sheetRoles?: string[];
|
|
21
|
+
shapeOnlyClass?: "green" | null;
|
|
27
22
|
}): {
|
|
28
23
|
declaration: Record<string, any>;
|
|
29
24
|
notChecked: string[];
|
|
@@ -46,5 +41,10 @@ export function closeUnbuiltSheetSteps(declaration: Record<string, any>, unbuilt
|
|
|
46
41
|
};
|
|
47
42
|
/** M17 am5 item 2 (D3): the reason a `~` rule on a signed Ask line is Not checked, the signed words */
|
|
48
43
|
export const ASK_LINE_REASON: "you judge it at the Ask";
|
|
49
|
-
/**
|
|
50
|
-
|
|
44
|
+
/**
|
|
45
|
+
* M19 amendment 1 (signed 2026-11-20): a line that is a list of items and nothing else (no quote) signs class `green` with `itemShape` and no `cited`; the person's own rules on its text still ride beside it. `null` (tests only) signs no
|
|
46
|
+
* list-of-items check and the rows are Not checked (REASON.noRule). A facts+shape line keeps its class (green, `cited` plus `itemShape`, amendment E) whatever this says.
|
|
47
|
+
* @type {'green'|null}
|
|
48
|
+
*/
|
|
49
|
+
export const SHAPE_ONLY_CLASS: "green" | null;
|
|
50
|
+
export { NO_GUARDRAIL_WORDS } from "./checkblock.js";
|
package/types/blockdraft.d.ts
CHANGED
|
@@ -9,13 +9,14 @@ export function isBuildFault(red: string, builtLines: number[]): boolean;
|
|
|
9
9
|
/**
|
|
10
10
|
* The block of a draft (M16 item 2): the person's `~` rules and `$` defaults, then the look's facts, then the picks the person made (kept from the last draft, and just answered), reconciled once.
|
|
11
11
|
* Fresh answers go through `carry` like the kept ones (the draft is a child process: the answer comes back as a pick or a left rule), and are not marked "kept".
|
|
12
|
-
* @param {{leaveOut?: {line: number, rule: number}[], texts: Record<string, string>, jobLines: any[], look: {facts: any[], dropped: any[]}, kept: {picks: any[], left: any[], askRules: any[]}, fresh: {picks: any[], left: {line: number, rule: number}[]}, asks: boolean, countScope: (t: string) => boolean}} o
|
|
12
|
+
* @param {{leaveOut?: {line: number, rule: number}[], sheetLines?: number[], texts: Record<string, string>, jobLines: any[], look: {facts: any[], dropped: any[]}, kept: {picks: any[], left: any[], askRules: any[]}, fresh: {picks: any[], left: {line: number, rule: number}[]}, asks: boolean, countScope: (t: string) => boolean}} o
|
|
13
13
|
*/
|
|
14
|
-
export function setUpBlock({ texts, jobLines, look, kept, fresh, asks, countScope, leaveOut }: {
|
|
14
|
+
export function setUpBlock({ texts, jobLines, look, kept, fresh, asks, countScope, leaveOut, sheetLines }: {
|
|
15
15
|
leaveOut?: {
|
|
16
16
|
line: number;
|
|
17
17
|
rule: number;
|
|
18
18
|
}[];
|
|
19
|
+
sheetLines?: number[];
|
|
19
20
|
texts: Record<string, string>;
|
|
20
21
|
jobLines: any[];
|
|
21
22
|
look: {
|
package/types/blockpick.d.ts
CHANGED
|
@@ -40,6 +40,10 @@ export function partOfPick(check: Record<string, any>, text: string, rules: numb
|
|
|
40
40
|
class: string;
|
|
41
41
|
check: any;
|
|
42
42
|
};
|
|
43
|
+
/** the numbers a text says as "under / fewer than / less than / below N" (the one reader of that wording: a list-items rule and a shape field's bound both use it) @param {string} text @returns {number[]} */
|
|
44
|
+
export function underNumbers(text: string): number[];
|
|
45
|
+
/** the numbers a text says as "at most / up to / no more than / not more than N" @param {string} text @returns {number[]} */
|
|
46
|
+
export function atMostNumbers(text: string): number[];
|
|
43
47
|
export { plainWords };
|
|
44
48
|
export function isCountable(g: unknown): boolean;
|
|
45
49
|
export function sameRuleWords(a: unknown, b: unknown): boolean;
|
package/types/cardlist.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {import('./checkblock.js').CheckBlock} block
|
|
3
|
-
* @returns {{rows: {key: string, line: number, by: string, state: string,
|
|
3
|
+
* @returns {{rows: {key: string, line: number, by: string, state: string, reason: string|null, drop: boolean, kind: 'truth'|'shape'|'file'}[], suggested: {key: string, line: number, text: string, dropped?: boolean}[], restorable?: {key: string, line: number, text: string}[]}}
|
|
4
4
|
*/
|
|
5
5
|
export function cardOfBlock(block: import("./checkblock.js").CheckBlock): {
|
|
6
6
|
rows: {
|
|
@@ -8,9 +8,9 @@ export function cardOfBlock(block: import("./checkblock.js").CheckBlock): {
|
|
|
8
8
|
line: number;
|
|
9
9
|
by: string;
|
|
10
10
|
state: string;
|
|
11
|
-
text: string;
|
|
12
11
|
reason: string | null;
|
|
13
12
|
drop: boolean;
|
|
13
|
+
kind: "truth" | "shape" | "file";
|
|
14
14
|
}[];
|
|
15
15
|
suggested: {
|
|
16
16
|
key: string;
|
|
@@ -18,4 +18,20 @@ export function cardOfBlock(block: import("./checkblock.js").CheckBlock): {
|
|
|
18
18
|
text: string;
|
|
19
19
|
dropped?: boolean;
|
|
20
20
|
}[];
|
|
21
|
+
restorable?: {
|
|
22
|
+
key: string;
|
|
23
|
+
line: number;
|
|
24
|
+
text: string;
|
|
25
|
+
}[];
|
|
21
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* M19 am6 to am9: the card a draft saves and the panel draws. The block's own card gives the suggestions, the restorable rows and the Drop flags; the rows come from the signed plan through the one reader (src/checkrows.js `planCard`),
|
|
29
|
+
* with the Not checked rows as a list of their own. `kept` = the picks and rules a Revise carried (the block's `keptFromLast` rows).
|
|
30
|
+
* @param {import('./checkblock.js').CheckBlock} block @param {any} withSheetAndTickets the block's card with the sheet and Tickets rows (src/sheetrows.js `withSheetCard`) @param {{declaration: any, lines: any[], csvRoles?: string[], log?: unknown}} plan
|
|
31
|
+
*/
|
|
32
|
+
export function cardOfPlanBlock(block: import("./checkblock.js").CheckBlock, withSheetAndTickets: any, plan: {
|
|
33
|
+
declaration: any;
|
|
34
|
+
lines: any[];
|
|
35
|
+
csvRoles?: string[];
|
|
36
|
+
log?: unknown;
|
|
37
|
+
}): any;
|