fwdloop 0.22.0 → 0.23.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/package.json +2 -2
- package/src/ask.js +20 -4
- package/src/authoring.js +4 -0
- package/src/canrun.js +5 -0
- package/src/checked.js +14 -3
- package/src/citedcheck.js +16 -1
- package/src/closers.js +13 -223
- package/src/csv.js +69 -12
- package/src/declaration.js +64 -6
- package/src/drafter.js +37 -15
- package/src/model-step.js +13 -21
- package/src/panel/author.js +2 -1
- package/src/panel/authorcard.js +9 -2
- package/src/panel/data.js +20 -5
- package/src/panel/index.html +43 -1
- package/src/panel/result.js +6 -0
- package/src/runner.js +24 -7
- package/src/sheet-record.js +57 -0
- package/src/sheetblock.js +170 -0
- package/src/sheetchecks.js +206 -0
- package/src/sheetclaims.js +78 -0
- package/src/sheetoffer.js +125 -0
- package/src/sheetrun.js +105 -0
- package/src/try-checks.js +6 -0
- package/src/types.js +1 -9
- package/types/ask.d.ts +2 -1
- package/types/checked.d.ts +9 -3
- package/types/closers.d.ts +6 -31
- package/types/csv.d.ts +25 -4
- package/types/declaration.d.ts +6 -1
- package/types/drafter.d.ts +22 -8
- package/types/model-step.d.ts +19 -30
- package/types/panel/authorcard.d.ts +2 -1
- package/types/runner.d.ts +8 -4
- package/types/sheet-record.d.ts +24 -0
- package/types/sheetblock.d.ts +116 -0
- package/types/sheetchecks.d.ts +70 -0
- package/types/sheetclaims.d.ts +26 -0
- package/types/sheetoffer.d.ts +25 -0
- package/types/sheetrun.d.ts +35 -0
- package/types/types.d.ts +16 -11
package/types/runner.d.ts
CHANGED
|
@@ -98,11 +98,14 @@ export function freezePage(dir: string, id: string, url: string, { fetchPage }?:
|
|
|
98
98
|
* unreadable source refuses by name. A source that is a web address
|
|
99
99
|
* (M10 item 1) is fetched and frozen by `freezePage`, in the same manifest.
|
|
100
100
|
* @param {string} runDir @param {Array<{id: string, path: string}>} sources
|
|
101
|
-
*
|
|
101
|
+
* M10b amendment 1: a CSV input named in `tableRoles` (the sheets a step's `close.sheet` reads) also gets its `tableSha` (bareguard's fingerprint of the table made
|
|
102
|
+
* from the FROZEN copy) in its manifest entry - the ONE place it is written, once, with the run's inputs; every sheet check of the run uses this recorded value.
|
|
103
|
+
* A sheet bareguard cannot read as a table refuses the run here, naming the input.
|
|
104
|
+
* @param {{fetchPage?: (url: string) => Promise<{ok: true, text: string, url: string}|{ok: false, error: string}>, tableRoles?: string[]}} [o] */
|
|
102
105
|
export function freezeInputs(runDir: string, sources: Array<{
|
|
103
106
|
id: string;
|
|
104
107
|
path: string;
|
|
105
|
-
}>, { fetchPage }?: {
|
|
108
|
+
}>, { fetchPage, tableRoles }?: {
|
|
106
109
|
fetchPage?: (url: string) => Promise<{
|
|
107
110
|
ok: true;
|
|
108
111
|
text: string;
|
|
@@ -111,19 +114,20 @@ export function freezeInputs(runDir: string, sources: Array<{
|
|
|
111
114
|
ok: false;
|
|
112
115
|
error: string;
|
|
113
116
|
}>;
|
|
117
|
+
tableRoles?: string[];
|
|
114
118
|
}): Promise<{
|
|
115
119
|
ok: boolean;
|
|
116
120
|
red: string;
|
|
117
121
|
manifest?: undefined;
|
|
118
122
|
} | {
|
|
119
123
|
ok: boolean;
|
|
120
|
-
manifest: {
|
|
124
|
+
manifest: (Record<string, any> | {
|
|
121
125
|
id: string;
|
|
122
126
|
source: string;
|
|
123
127
|
frozen: string;
|
|
124
128
|
sha256: string;
|
|
125
129
|
bytes: number;
|
|
126
|
-
}[];
|
|
130
|
+
})[];
|
|
127
131
|
red?: undefined;
|
|
128
132
|
}>;
|
|
129
133
|
/** The send target's folder (M4e amendment 1, "Destination is any folder").
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} runDir @param {{n: number, try: number, checks: any[], closed: {verdict: string, red?: string|null, sheetRecord?: any}}} o
|
|
3
|
+
* @returns {void}
|
|
4
|
+
*/
|
|
5
|
+
export function writeSheetLine(runDir: string, { n, try: attempt, checks, closed }: {
|
|
6
|
+
n: number;
|
|
7
|
+
try: number;
|
|
8
|
+
checks: any[];
|
|
9
|
+
closed: {
|
|
10
|
+
verdict: string;
|
|
11
|
+
red?: string | null;
|
|
12
|
+
sheetRecord?: any;
|
|
13
|
+
};
|
|
14
|
+
}): void;
|
|
15
|
+
/**
|
|
16
|
+
* The reader of the record, for the Result tab and the separate checker: `{lines: [...]}`, or null when the file is missing or is not that shape (the page then
|
|
17
|
+
* shows no verdicts, never a half-read record). Read through the safe gateway.
|
|
18
|
+
* @param {string} runDir @returns {{lines: any[]}|null}
|
|
19
|
+
*/
|
|
20
|
+
export function readSheetChecks(runDir: string): {
|
|
21
|
+
lines: any[];
|
|
22
|
+
} | null;
|
|
23
|
+
/** the record's name in the run's own folder */
|
|
24
|
+
export const SHEET_CHECKS_FILE: "sheet-checks.json";
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/** the ops of bareguard that a name is needed for @returns {string[]} */
|
|
2
|
+
export function vocabularyOps(): string[];
|
|
3
|
+
/** @param {any} check a bareguard cells / table check @returns {string} the short name: `rows`, `count`, `sum`, `no duplicate Invoice #` ... */
|
|
4
|
+
export function sheetCheckName(check: any): string;
|
|
5
|
+
/**
|
|
6
|
+
* What the step claimed for one check, in plain words (a green check's "found"). Null when the claim has nothing to say (a `table` check, a missing box, a string).
|
|
7
|
+
* @param {any} check @param {unknown} claims the step's answer @returns {string|null}
|
|
8
|
+
*/
|
|
9
|
+
export function sheetFoundWords(check: any, claims: unknown): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* The block of every job line whose step reads a sheet. A line qualifies when its green step carries `close.sheet`, or (with `csvRoles`) reads a CSV input and carries no
|
|
12
|
+
* older `close.columns` / `close.cited` check (then every guardrail is Not checked).
|
|
13
|
+
* @param {{declaration: any, lines: Array<{n: number, rules?: string[], guardrail?: string, rule?: string}>, csvRoles?: string[], record?: any}} o
|
|
14
|
+
* `record` = the parsed `sheet-checks.json` (`{lines: [...]}`), only after a run
|
|
15
|
+
* @returns {Array<{line: number, guardrails: string[], checked: Array<{id: string, name: string, words: string, covers: string[], coversWords: string, text: string, ok?: boolean, found?: string}>, notChecked: string[]|'none'}>}
|
|
16
|
+
*/
|
|
17
|
+
export function sheetLineBlocks({ declaration, lines, csvRoles, record }: {
|
|
18
|
+
declaration: any;
|
|
19
|
+
lines: Array<{
|
|
20
|
+
n: number;
|
|
21
|
+
rules?: string[];
|
|
22
|
+
guardrail?: string;
|
|
23
|
+
rule?: string;
|
|
24
|
+
}>;
|
|
25
|
+
csvRoles?: string[];
|
|
26
|
+
record?: any;
|
|
27
|
+
}): Array<{
|
|
28
|
+
line: number;
|
|
29
|
+
guardrails: string[];
|
|
30
|
+
checked: Array<{
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
words: string;
|
|
34
|
+
covers: string[];
|
|
35
|
+
coversWords: string;
|
|
36
|
+
text: string;
|
|
37
|
+
ok?: boolean;
|
|
38
|
+
found?: string;
|
|
39
|
+
}>;
|
|
40
|
+
notChecked: string[] | "none";
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* The guardrail rules of a sheet step that no check covers, as the drafter's Not-checked lines (`line N: "rule" - no sheet check covers it`): the block's own
|
|
44
|
+
* `notChecked`, one list for the plan card and the drafter's saved record.
|
|
45
|
+
* @param {any} declaration @param {Array<{n: number, rules?: string[], guardrail?: string, rule?: string}>} lines @param {string[]} csvRoles @returns {string[]}
|
|
46
|
+
*/
|
|
47
|
+
export function uncoveredRules(declaration: any, lines: Array<{
|
|
48
|
+
n: number;
|
|
49
|
+
rules?: string[];
|
|
50
|
+
guardrail?: string;
|
|
51
|
+
rule?: string;
|
|
52
|
+
}>, csvRoles: string[]): string[];
|
|
53
|
+
/** @param {any} arbiter @returns {string[]} the roles of the signed sources that are a CSV file (the sheets a check reads) */
|
|
54
|
+
export function csvRolesOf(arbiter: any): string[];
|
|
55
|
+
/**
|
|
56
|
+
* M10b am4: the step's answer (its claim boxes) value by value, one line each: `invoiceCount: 8`, `daysPastDue: row 2 -> 124`. A list is one line per entry (a list of row
|
|
57
|
+
* numbers reads `row N`); a map is one line per key (`row <key> -> <value>`). An empty list or map reads `<name>: none`, never no line.
|
|
58
|
+
* Throws away: nothing but the box's own key (`value`, `rows`, `days`...), which the line's words already say.
|
|
59
|
+
* @param {unknown} claims the step's answer @returns {string[]}
|
|
60
|
+
*/
|
|
61
|
+
export function claimLines(claims: unknown): string[];
|
|
62
|
+
/**
|
|
63
|
+
* M10b am4: what an ask card shows for the claim boxes it was given. The step is the sheet step whose saved try (`sheet-checks.json`) holds exactly these claims; its block is
|
|
64
|
+
* the Result tab's own (`sheetLineBlocks`, that try's verdicts), and `answer` is the claims value by value. Null when no saved try matches: the caller then keeps the old line.
|
|
65
|
+
* @param {{claims: unknown, declaration: any, lines: Array<{n: number, rules?: string[], guardrail?: string, rule?: string}>, csvRoles?: string[], record?: any}} o
|
|
66
|
+
* @returns {{block: ReturnType<typeof sheetLineBlocks>[number], answer: string[]}|null}
|
|
67
|
+
*/
|
|
68
|
+
export function askSheetCard({ claims, declaration, lines, csvRoles, record }: {
|
|
69
|
+
claims: unknown;
|
|
70
|
+
declaration: any;
|
|
71
|
+
lines: Array<{
|
|
72
|
+
n: number;
|
|
73
|
+
rules?: string[];
|
|
74
|
+
guardrail?: string;
|
|
75
|
+
rule?: string;
|
|
76
|
+
}>;
|
|
77
|
+
csvRoles?: string[];
|
|
78
|
+
record?: any;
|
|
79
|
+
}): {
|
|
80
|
+
block: ReturnType<typeof sheetLineBlocks>[number];
|
|
81
|
+
answer: string[];
|
|
82
|
+
} | null;
|
|
83
|
+
/** the short plain name of each bareguard op (the ONE table; a test fails when bareguard gains an op this table does not name). `noDuplicates` and `noEmpty` add the column. */
|
|
84
|
+
export const SHEET_OP_NAMES: Readonly<{
|
|
85
|
+
count: "count";
|
|
86
|
+
countEmpty: "empty count";
|
|
87
|
+
countIf: "count";
|
|
88
|
+
uniqueCount: "unique count";
|
|
89
|
+
sum: "sum";
|
|
90
|
+
sumIf: "sum";
|
|
91
|
+
average: "average";
|
|
92
|
+
averageIf: "average";
|
|
93
|
+
median: "median";
|
|
94
|
+
min: "min";
|
|
95
|
+
max: "max";
|
|
96
|
+
found: "found";
|
|
97
|
+
lookup: "lookup";
|
|
98
|
+
rows: "rows";
|
|
99
|
+
topN: "top";
|
|
100
|
+
duplicates: "duplicates";
|
|
101
|
+
groupTotals: "group totals";
|
|
102
|
+
percentOfTotal: "percent of total";
|
|
103
|
+
band: "bucket";
|
|
104
|
+
daysBetween: "days between";
|
|
105
|
+
daysSince: "date";
|
|
106
|
+
earliest: "earliest date";
|
|
107
|
+
latest: "latest date";
|
|
108
|
+
allNumbers: "all numbers";
|
|
109
|
+
allDates: "all dates";
|
|
110
|
+
noEmpty: "no empty";
|
|
111
|
+
noDuplicates: "no duplicate";
|
|
112
|
+
rowCount: "row count";
|
|
113
|
+
rowMath: "row math";
|
|
114
|
+
}>;
|
|
115
|
+
export function rulesOfLine(l: any): string[];
|
|
116
|
+
export function coversWords(rules: string[]): string;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every column name one check holds: its own `column`, `keyColumn`, `groupColumn`, `result`, a row-math operand `a` / `b` (a name; `{const}` is no column), the
|
|
3
|
+
* date cells `from` / `to` / `cell`, and the column of each `where` condition and `dateFormats` entry.
|
|
4
|
+
* @param {any} check @returns {string[]}
|
|
5
|
+
*/
|
|
6
|
+
export function sheetCheckColumns(check: any): string[];
|
|
7
|
+
/**
|
|
8
|
+
* The plain words of ONE sheet check, written from its typed fields (never from model text). The ONE function; the plan card, the readout and the Checked
|
|
9
|
+
* list all call it. An op with no sentence of its own reads `<rule> <op> on <column>` plus its conditions, so a check can never be shown as nothing.
|
|
10
|
+
* @param {any} check a bareguard cells / table check object @returns {string}
|
|
11
|
+
*/
|
|
12
|
+
export function sheetCheckSentence(check: any): string;
|
|
13
|
+
/**
|
|
14
|
+
* M10b piece 4: a signed check may carry fwdloop's own `covers` (the numbers of the job line's `~` rules the drafter tagged it to; signed, so the person sees it).
|
|
15
|
+
* bareguard does not know it, so the checks are cleaned HERE, the ONE place, on the way into bareguard (`createRubric` at sign time and at run time).
|
|
16
|
+
* @param {any[]} checks @returns {any[]} a copy without `covers`
|
|
17
|
+
*/
|
|
18
|
+
export function bareguardChecks(checks: any[]): any[];
|
|
19
|
+
/**
|
|
20
|
+
* M10b piece 4: `covers`, when a check has it, is a list of rule numbers of its job line (counted from 1 over the line's `~` rules). A check without it is fine (an old draft).
|
|
21
|
+
* @param {any[]} checks @param {{n: number, rule?: string, rules?: string[]}} jobLine @returns {string[]} reds, each naming the line and the check
|
|
22
|
+
*/
|
|
23
|
+
export function sheetCoversReds(checks: any[], jobLine: {
|
|
24
|
+
n: number;
|
|
25
|
+
rule?: string;
|
|
26
|
+
rules?: string[];
|
|
27
|
+
}): string[];
|
|
28
|
+
/** The rows for a step's `close.sheet`, one per check, in order. @param {unknown} sheet @returns {string[]} */
|
|
29
|
+
export function sheetCheckRows(sheet: unknown): string[];
|
|
30
|
+
/**
|
|
31
|
+
* The $0 sign-time test of one step's sheet checks (M10b item 4): bareguard's `createRubric` is given the checks and the signed fingerprint of each sheet
|
|
32
|
+
* they read (`tableSha` of the drafting copy's table). A refusal is a red that names the job line (and the check). A column that is no header of its sheet is
|
|
33
|
+
* a red naming the line and the column. Never throws.
|
|
34
|
+
* @param {any[]} checks the step's `close.sheet` (already known to be a list of objects) @param {number} line the job line the step comes from
|
|
35
|
+
* @param {Record<string, {header: string[], rows: any[]}>} tables the drafting copy's table of each sheet role @returns {string[]} reds, each naming the line
|
|
36
|
+
*/
|
|
37
|
+
export function sheetCheckReds(checks: any[], line: number, tables: Record<string, {
|
|
38
|
+
header: string[];
|
|
39
|
+
rows: any[];
|
|
40
|
+
}>): string[];
|
|
41
|
+
/**
|
|
42
|
+
* M10b piece 3: a number or a date in a check comes from the job, never from the model. Every number in a `where` condition (gt gte lt lte eq between) must be a
|
|
43
|
+
* number the person said on the job line or its `~` rules (the SAME reader as the page number rules, src/citedwords.js `numbersSaid`: a bare number or an amount,
|
|
44
|
+
* not a piece of a time, a date or another amount), and every date (`asOf`, and the values of before / after / dateOn / dateBetween) must be a date they wrote
|
|
45
|
+
* exactly. Throws away: a text value (`equals`, `needle`), band bounds, `n`, `tolerance`, `range` are not read here (the job's words do not have to carry them).
|
|
46
|
+
* @param {any[]} checks the step's `close.sheet` @param {{n: number, text?: string, rule?: string, rules?: string[]}} jobLine @returns {string[]} reds, each naming the line
|
|
47
|
+
*/
|
|
48
|
+
export function sheetCheckWordReds(checks: any[], jobLine: {
|
|
49
|
+
n: number;
|
|
50
|
+
text?: string;
|
|
51
|
+
rule?: string;
|
|
52
|
+
rules?: string[];
|
|
53
|
+
}): string[];
|
|
54
|
+
/**
|
|
55
|
+
* M10b piece 3: a step whose sheet checks are ALL `table` checks has nothing to answer (a table check judges the sheet itself and carries no claim), so the
|
|
56
|
+
* step would be asked for nothing. Refused at $0, naming the line. @param {any[]} checks @param {number} line @returns {string[]}
|
|
57
|
+
*/
|
|
58
|
+
export function sheetNoClaimReds(checks: any[], line: number): string[];
|
|
59
|
+
/** the bareguard rules a sheet check may use (`diff` is out of scope for M10b) */
|
|
60
|
+
export const SHEET_RULES: readonly string[];
|
|
61
|
+
/** most checks one step may carry */
|
|
62
|
+
export const MAX_SHEET_CHECKS: 20;
|
|
63
|
+
/** the fields of a check that hold a column name as a plain string (the ONE list: {@link sheetCheckColumns} reads it, the drafter's tool schema offers a header enum on each) */
|
|
64
|
+
export const COLUMN_STRING_FIELDS: readonly string[];
|
|
65
|
+
/** the row-math operands: a column name, or (for `b`) `{const}` */
|
|
66
|
+
export const COLUMN_OPERAND_FIELDS: readonly string[];
|
|
67
|
+
/** the date-cell fields: `{column, row}` */
|
|
68
|
+
export const COLUMN_CELL_FIELDS: readonly string[];
|
|
69
|
+
/** the list fields whose entries hold a `column` */
|
|
70
|
+
export const COLUMN_LIST_FIELDS: readonly string[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The claim box of every `cells` check in the list: `[{claim, example}]`, one per claim name, in order. `example` is the op's worked-example answer (the box's shape
|
|
3
|
+
* with example values). A check bareguard has no example for, and a `table` check, add nothing.
|
|
4
|
+
* @param {any[]} checks a step's `close.sheet` @returns {Array<{claim: string, example: Record<string, any>, ops: string[]}>}
|
|
5
|
+
*/
|
|
6
|
+
export function sheetClaims(checks: any[]): Array<{
|
|
7
|
+
claim: string;
|
|
8
|
+
example: Record<string, any>;
|
|
9
|
+
ops: string[];
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* The `emit_artifact` tool's properties for a step that reads a sheet: one typed box per claim, each required. (`done` is added by the caller, as for every step.)
|
|
13
|
+
* @param {any[]} checks @returns {{properties: Record<string, any>, required: string[]}}
|
|
14
|
+
*/
|
|
15
|
+
export function sheetAnswerProps(checks: any[]): {
|
|
16
|
+
properties: Record<string, any>;
|
|
17
|
+
required: string[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* What the step is told about its answer (one key of its request): the name and the shape of each box, with the worked example's values. Never the check.
|
|
21
|
+
* @param {any[]} checks @returns {{answer: string, fields: Record<string, Record<string, any>>}}
|
|
22
|
+
*/
|
|
23
|
+
export function sheetBrief(checks: any[]): {
|
|
24
|
+
answer: string;
|
|
25
|
+
fields: Record<string, Record<string, any>>;
|
|
26
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tool schema of `close.sheet`: a list of bareguard cells / table checks. Every field is a field of bareguard's vocabulary; every column-bearing field
|
|
3
|
+
* (`column keyColumn groupColumn result a b from to cell where[].column dateFormats[].column`) is an enum of the sheet's exact header. `covers` is fwdloop's own field
|
|
4
|
+
* (which `~` rules of the job line the check covers), kept and signed.
|
|
5
|
+
* @param {Record<string, {header: string[]}>} tables the drafting copy's table of each CSV input role
|
|
6
|
+
* @returns {Record<string, any>|null} null when there is no sheet with a header to pick from
|
|
7
|
+
*/
|
|
8
|
+
export function sheetChecksProp(tables: Record<string, {
|
|
9
|
+
header: string[];
|
|
10
|
+
}>): Record<string, any> | null;
|
|
11
|
+
/**
|
|
12
|
+
* Every op of the cells and table rules with its summary, what it requires and allows, its claim shape and bareguard's worked example check. Generated from the
|
|
13
|
+
* vocabulary; a new op bareguard adds shows up here by itself.
|
|
14
|
+
* @returns {string[]} lines for the system prompt
|
|
15
|
+
*/
|
|
16
|
+
export function sheetOpsBrief(): string[];
|
|
17
|
+
/**
|
|
18
|
+
* The rules the validator enforces on `close.sheet`, as lines for the drafter (every one of them is a refusal at $0 in src/declaration.js / src/sheetchecks.js).
|
|
19
|
+
* @param {string[]} roles the CSV input roles @returns {string[]}
|
|
20
|
+
*/
|
|
21
|
+
export function sheetOfferRules(roles: string[]): string[];
|
|
22
|
+
/** @param {unknown} rule @returns {boolean} true for the `use the column 'X' for 'Y'` rule an agreed column ask writes ({@link columnRuleWords}) */
|
|
23
|
+
export function isColumnChoiceRule(rule: unknown): boolean;
|
|
24
|
+
/** The comparisons of a `where` condition. bareguard publishes them only inside the `where` description (no list), so this is the one copy; a test proves each is named there. */
|
|
25
|
+
export const WHERE_CMPS: readonly string[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** The sheet inputs any step's `close.sheet` reads, once each, in order. @param {any[]} steps @returns {string[]} */
|
|
2
|
+
export function sheetRolesOf(steps: any[]): string[];
|
|
3
|
+
/**
|
|
4
|
+
* bareguard's `tableSha` of the run's frozen CSV `<runDir>/inputs/<name>` (its table from src/csv.js `sheetTable`), read through the one safe gateway; null when the copy
|
|
5
|
+
* cannot be read or bareguard cannot read it as a table (a ragged row, a repeated header).
|
|
6
|
+
* @param {string} runDir @param {string} name the frozen file's name @returns {string|null}
|
|
7
|
+
*/
|
|
8
|
+
export function tableShaOfFrozen(runDir: string, name: string): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* What a sheet check reads in a run: the run's OWN frozen copy of each sheet its checks name, as bareguard's table, and the `tableSha` recorded in `inputs.json` at
|
|
11
|
+
* the run's start. The table is NOT compared here: bareguard compares it to the recorded sha when it checks (and stops if it differs).
|
|
12
|
+
* @param {string} runDir @param {any[]} checks the step's `close.sheet`
|
|
13
|
+
* @returns {{ok: true, tables: Record<string, {header: string[], rows: any[]}>, inputs: Array<{name: string, sha256: string}>}|{ok: false, red: string}}
|
|
14
|
+
*/
|
|
15
|
+
export function readRunSheets(runDir: string, checks: any[]): {
|
|
16
|
+
ok: true;
|
|
17
|
+
tables: Record<string, {
|
|
18
|
+
header: string[];
|
|
19
|
+
rows: any[];
|
|
20
|
+
}>;
|
|
21
|
+
inputs: Array<{
|
|
22
|
+
name: string;
|
|
23
|
+
sha256: string;
|
|
24
|
+
}>;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
red: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The close of a green step that reads a sheet. `sheet` = `readRunSheets`' answer. `artifact` is the step's typed answer (its claim boxes). Gaps come from bareguard
|
|
31
|
+
* (`renderGaps`: row numbers and counts, a data problem first); each signed check is also listed with its own pass or fail for the Checked list.
|
|
32
|
+
* @param {any[]} checks the step's `close.sheet` @param {unknown} artifact @param {ReturnType<typeof readRunSheets>|null|undefined} sheet
|
|
33
|
+
* @returns {Promise<import('./types.js').CloseVerdict>}
|
|
34
|
+
*/
|
|
35
|
+
export function closeSheet(checks: any[], artifact: unknown, sheet: ReturnType<typeof readRunSheets> | null | undefined): Promise<import("./types.js").CloseVerdict>;
|
package/types/types.d.ts
CHANGED
|
@@ -255,17 +255,6 @@ export type ExecutorContext = {
|
|
|
255
255
|
reads: Record<string, any>;
|
|
256
256
|
gap: string | null;
|
|
257
257
|
};
|
|
258
|
-
/**
|
|
259
|
-
* A green-class field value: `value` is the number/ISO-date/text claimed;
|
|
260
|
-
* `cite` resolves it (src/closers.js's own grammar).
|
|
261
|
-
*/
|
|
262
|
-
export type GreenField = {
|
|
263
|
-
value: string | number;
|
|
264
|
-
cite: string;
|
|
265
|
-
};
|
|
266
|
-
export type GreenArtifact = {
|
|
267
|
-
fields: Record<string, GreenField>;
|
|
268
|
-
};
|
|
269
258
|
export type SoftgreenArtifact = {
|
|
270
259
|
text: string;
|
|
271
260
|
lines?: string[];
|
|
@@ -294,6 +283,22 @@ export type CloseVerdict = {
|
|
|
294
283
|
check: any;
|
|
295
284
|
results?: unknown;
|
|
296
285
|
} | undefined;
|
|
286
|
+
/**
|
|
287
|
+
* a sheet close (M10b piece 2): what the run's sheet-check record keeps
|
|
288
|
+
*/
|
|
289
|
+
sheetRecord?: {
|
|
290
|
+
inputs: Array<{
|
|
291
|
+
name: string;
|
|
292
|
+
sha256: string;
|
|
293
|
+
}>;
|
|
294
|
+
claims: unknown;
|
|
295
|
+
checks: Array<{
|
|
296
|
+
id: string;
|
|
297
|
+
text: string;
|
|
298
|
+
ok: boolean;
|
|
299
|
+
result: string | null;
|
|
300
|
+
}>;
|
|
301
|
+
} | undefined;
|
|
297
302
|
};
|
|
298
303
|
/**
|
|
299
304
|
* One row appended to `runs/<run-id>/audit.jsonl` (M2 scope item 9).
|