fwdloop 0.32.0 → 0.34.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/bin/fwdloop +20 -2
- package/package.json +2 -2
- package/src/auditchecks.js +55 -0
- package/src/authoring.js +53 -12
- package/src/blockasks.js +45 -0
- package/src/blockassemble.js +159 -0
- package/src/blockdraft.js +86 -0
- package/src/blocklines.js +30 -0
- package/src/blockpick.js +175 -0
- package/src/cardlist.js +19 -0
- package/src/checkblock.js +843 -0
- package/src/checked.js +48 -9
- package/src/checklist.js +99 -0
- package/src/checklistsign.js +93 -0
- package/src/checkpick.js +7 -73
- package/src/checkwords.js +20 -1
- package/src/cited-record.js +21 -1
- package/src/citedcheck.js +162 -7
- package/src/closers.js +41 -3
- package/src/declaration.js +34 -9
- package/src/declaredclose.js +4 -0
- package/src/draft-steps.js +3 -1
- package/src/drafter.js +311 -206
- package/src/factwords.js +112 -0
- package/src/inputlook.js +53 -0
- package/src/labelscan.js +162 -0
- package/src/noteask.js +62 -0
- package/src/pageask.js +9 -69
- package/src/pagedropwords.js +11 -1
- package/src/pagedry.js +27 -4
- package/src/pagerules.js +19 -3
- package/src/panel/author.js +76 -7
- package/src/panel/authorcard.js +43 -17
- package/src/panel/data.js +41 -9
- package/src/panel/index.html +208 -13
- package/src/panel/result.js +4 -3
- package/src/panel/server.js +3 -1
- package/src/pickrecord.js +70 -54
- package/src/placerule.js +398 -0
- package/src/planrebuild.js +216 -0
- package/src/rowedit.js +148 -0
- package/src/rubricstep.js +272 -0
- package/src/runfile.js +4 -2
- package/src/runner.js +67 -10
- package/src/setup.js +11 -5
- package/src/sheetblock.js +22 -8
- package/src/sheetbuild.js +151 -0
- package/src/sheetchecks.js +52 -66
- package/src/sheetclaims.js +12 -32
- package/src/sheetfind.js +4 -4
- package/src/sheetlook.js +14 -3
- package/src/sheetoffer.js +74 -57
- package/src/sheetrows.js +123 -0
- package/src/sheetrun.js +13 -10
- package/src/summary-words.js +3 -3
- package/src/ticket-draft.js +4 -21
- package/src/ticketrows.js +100 -0
- package/src/try-checks.js +31 -12
- package/src/types.js +1 -0
- package/types/auditchecks.d.ts +25 -0
- package/types/authoring.d.ts +21 -2
- package/types/blockasks.d.ts +36 -0
- package/types/blockassemble.d.ts +50 -0
- package/types/blockdraft.d.ts +75 -0
- package/types/blocklines.d.ts +31 -0
- package/types/blockpick.d.ts +46 -0
- package/types/cardlist.d.ts +21 -0
- package/types/checkblock.d.ts +378 -0
- package/types/checked.d.ts +16 -2
- package/types/checklist.d.ts +115 -0
- package/types/checklistsign.d.ts +27 -0
- package/types/checkpick.d.ts +4 -34
- package/types/checkwords.d.ts +5 -0
- package/types/cited-record.d.ts +9 -0
- package/types/citedcheck.d.ts +33 -2
- package/types/closers.d.ts +24 -2
- package/types/declaration.d.ts +7 -0
- package/types/declaredclose.d.ts +2 -0
- package/types/drafter.d.ts +29 -715
- package/types/factwords.d.ts +38 -0
- package/types/inputlook.d.ts +49 -0
- package/types/labelscan.d.ts +35 -0
- package/types/noteask.d.ts +52 -0
- package/types/pageask.d.ts +2 -35
- package/types/pagedry.d.ts +13 -0
- package/types/pagerules.d.ts +7 -0
- package/types/panel/author.d.ts +41 -0
- package/types/panel/authorcard.d.ts +14 -9
- package/types/panel/authorflows.d.ts +4 -4
- package/types/panel/data.d.ts +5 -3
- package/types/panel/jobgrid.d.ts +1 -1
- package/types/pickrecord.d.ts +69 -13
- package/types/placerule.d.ts +208 -0
- package/types/planrebuild.d.ts +52 -0
- package/types/provider.d.ts +1 -1
- package/types/rowedit.d.ts +48 -0
- package/types/rubricstep.d.ts +63 -0
- package/types/runfile.d.ts +5 -2
- package/types/runner.d.ts +45 -1
- package/types/sheetblock.d.ts +12 -4
- package/types/sheetbuild.d.ts +84 -0
- package/types/sheetchecks.d.ts +12 -18
- package/types/sheetclaims.d.ts +2 -1
- package/types/sheetfind.d.ts +2 -2
- package/types/sheetoffer.d.ts +31 -6
- package/types/sheetrows.d.ts +81 -0
- package/types/sheetrun.d.ts +4 -4
- package/types/summary-words.d.ts +2 -1
- package/types/ticket-draft.d.ts +3 -49
- package/types/ticketrows.d.ts +61 -0
- package/types/try-checks.d.ts +4 -2
- package/types/types.d.ts +8 -0
- package/src/repairs.js +0 -38
- package/types/repairs.d.ts +0 -13
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A check that needs exact words from the input is true only while the input stays as it is when those words hold a VERSION-like token (1.2 or 1.2.3, not after a currency sign or before
|
|
3
|
+
* a percent) or a DATE-like token (2026-11-04, 04/11/2026, "Nov 4, 2026", "4 November 2026", "November 2026"). Code refuses it; a `~` rule is the person's own and is never refused by this.
|
|
4
|
+
* @param {unknown} t @returns {boolean}
|
|
5
|
+
*/
|
|
6
|
+
export function weekOnly(t: unknown): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* The version-like and date-like tokens a text holds (the very tokens {@link weekOnly} reads), each once. Pure.
|
|
9
|
+
* @param {unknown} t @returns {string[]}
|
|
10
|
+
*/
|
|
11
|
+
export function weekTokens(t: unknown): string[];
|
|
12
|
+
/** @param {{n: number, text: string, rules?: string[], rule?: string}[]} jobLines @param {Record<string, string>} texts @returns {string} */
|
|
13
|
+
export function ledgerUserText(jobLines: {
|
|
14
|
+
n: number;
|
|
15
|
+
text: string;
|
|
16
|
+
rules?: string[];
|
|
17
|
+
rule?: string;
|
|
18
|
+
}[], texts: Record<string, string>): string;
|
|
19
|
+
/** at most this many `!` checks come from the call */
|
|
20
|
+
export const MAX_BANG: 3;
|
|
21
|
+
/** the reason a check on a version or a date goes under Not checked: it is true only for the input as it is today */
|
|
22
|
+
export const WEEK_ONLY_WORDS: "It names a version or a date from the input, true only for the input as it is today, so you judge it at Accept.";
|
|
23
|
+
/** the label of the list call, as the drafting book and the draft log see it */
|
|
24
|
+
export const LEDGER_LABEL: "ledger-suggest";
|
|
25
|
+
export const LEDGER_TOOL: "suggest_extra_checks";
|
|
26
|
+
/** the reason the empty list is logged with */
|
|
27
|
+
export const EMPTY_LIST_WORDS: "empty list: nothing to check";
|
|
28
|
+
export function isEmptyList(rows: Row[]): boolean;
|
|
29
|
+
export function ledgerRecord(rows: Row[]): ({
|
|
30
|
+
key: string;
|
|
31
|
+
line: number;
|
|
32
|
+
rowKind: "rule" | "numbers" | "fact" | "phrase" | "cited" | "count" | "floor" | "note";
|
|
33
|
+
from: "default" | "agent" | "rule" | "look" | "pick";
|
|
34
|
+
by: "default" | "agent" | "you";
|
|
35
|
+
words: string[];
|
|
36
|
+
state: "dropped" | "built" | "not-checked" | "listed";
|
|
37
|
+
reason: string | null;
|
|
38
|
+
} | {
|
|
39
|
+
key: string;
|
|
40
|
+
line: number;
|
|
41
|
+
rowKind: string;
|
|
42
|
+
from: string;
|
|
43
|
+
by: string;
|
|
44
|
+
words: never[];
|
|
45
|
+
state: string;
|
|
46
|
+
reason: string;
|
|
47
|
+
})[];
|
|
48
|
+
/** the list call's own system text (model-facing; used only by the list call of a rubric job with input text) */
|
|
49
|
+
export const LEDGER_SYSTEM: "You look at the inputs of a job and name checks the inputs themselves support, beyond the guardrails the person wrote.\nCall suggest_extra_checks once with up to 3 entries, or with an empty list.\n- kind \"count\": how many results the input shows or the job asks for (min and/or max, whole numbers).\n- kind \"phrase\": fixed words copied verbatim from an input (phrase, and source = that input's label).\nUse only what you can see in the inputs. Do not repeat a guardrail the person wrote. If the inputs support none, send an empty list.";
|
|
50
|
+
export const LEDGER_SCHEMA: Readonly<{
|
|
51
|
+
type: "object";
|
|
52
|
+
properties: {
|
|
53
|
+
extra: {
|
|
54
|
+
type: string;
|
|
55
|
+
maxItems: number;
|
|
56
|
+
items: {
|
|
57
|
+
type: string;
|
|
58
|
+
properties: {
|
|
59
|
+
line: {
|
|
60
|
+
type: string;
|
|
61
|
+
minimum: number;
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
kind: {
|
|
65
|
+
enum: string[];
|
|
66
|
+
};
|
|
67
|
+
source: {
|
|
68
|
+
type: string;
|
|
69
|
+
description: string;
|
|
70
|
+
};
|
|
71
|
+
phrase: {
|
|
72
|
+
type: string;
|
|
73
|
+
description: string;
|
|
74
|
+
};
|
|
75
|
+
min: {
|
|
76
|
+
type: string;
|
|
77
|
+
minimum: number;
|
|
78
|
+
};
|
|
79
|
+
max: {
|
|
80
|
+
type: string;
|
|
81
|
+
minimum: number;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
required: string[];
|
|
85
|
+
additionalProperties: boolean;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
required: string[];
|
|
90
|
+
additionalProperties: false;
|
|
91
|
+
}>;
|
|
92
|
+
export type Row = {
|
|
93
|
+
key: string;
|
|
94
|
+
line: number;
|
|
95
|
+
kind: "rule" | "fact" | "cited" | "count" | "phrase" | "numbers" | "note" | "floor";
|
|
96
|
+
from: "rule" | "pick" | "look" | "agent" | "default";
|
|
97
|
+
by: "you" | "agent" | "default";
|
|
98
|
+
words: string[];
|
|
99
|
+
text?: string;
|
|
100
|
+
rule?: number;
|
|
101
|
+
part?: {
|
|
102
|
+
line: number;
|
|
103
|
+
part: number;
|
|
104
|
+
};
|
|
105
|
+
source?: string;
|
|
106
|
+
name?: string;
|
|
107
|
+
min?: number;
|
|
108
|
+
max?: number;
|
|
109
|
+
pick?: string;
|
|
110
|
+
after?: number[];
|
|
111
|
+
state: "listed" | "built" | "not-checked" | "dropped";
|
|
112
|
+
reason: string | null;
|
|
113
|
+
forRule?: number;
|
|
114
|
+
reading?: import("./pagerules.js").Reading;
|
|
115
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The checks of one step's close in the block's part order. M16 am4: with `withSheet` (a plan whose list has sheet rows) each `close.sheet` check is a part too, after the others.
|
|
3
|
+
* @param {any} step @param {boolean} [withSheet] @returns {{what: string}[]}
|
|
4
|
+
*/
|
|
5
|
+
export function closePartsOf(step: any, withSheet?: boolean): {
|
|
6
|
+
what: string;
|
|
7
|
+
}[];
|
|
8
|
+
/**
|
|
9
|
+
* Every red of a plan's `checkList` (a plan without one is not examined): a built row must point at a check the close really has, every check a list line's close has must have a built row
|
|
10
|
+
* pointing at it, and a list line's close carries no other check of its own (a `close.shape` key besides `picked`). Each red names the line. Pure.
|
|
11
|
+
* @param {any} declaration @returns {string[]}
|
|
12
|
+
*/
|
|
13
|
+
export function checkListReds(declaration: any): string[];
|
|
14
|
+
/** the job lines that have a list: a plan from before M16 has no `checkList`, so none. Sheet rows (M16 am4, `kind: 'sheet'`) do not make a line a block line: a CSV job's other readers stay as they were. @param {any} declaration @returns {Set<number>} */
|
|
15
|
+
export function listLinesOf(declaration: any): Set<number>;
|
|
16
|
+
/** M16 am4: every line the plan card draws a list on - the block's lines and the sheet lines @param {any} declaration @returns {Set<number>} */
|
|
17
|
+
export function cardLinesOf(declaration: any): Set<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Who made the check at part `idx` of a list line's close (`'you'` a `~` rule, `'agent'` a `!` row, `'default'` a `$` row), read from the row that points at it (`part`), else null.
|
|
20
|
+
* ONE reader of the rows' `by` for the close's parts (the readout, the plan card and the Audit tag a check through it). Pure.
|
|
21
|
+
* @param {any} declaration @param {number} line @param {number} idx @returns {'you'|'agent'|'default'|null}
|
|
22
|
+
*/
|
|
23
|
+
export function partByOf(declaration: any, line: number, idx: number): "you" | "agent" | "default" | null;
|
|
24
|
+
/** who made the fact named `name` of a list line's quote check (the row that built it), else null @param {any} declaration @param {number} line @param {string} name @returns {'you'|'agent'|'default'|null} */
|
|
25
|
+
export function factByOf(declaration: any, line: number, name: string): "you" | "agent" | "default" | null;
|
|
26
|
+
/** who made the result count of a list line's quote check, else null @param {any} declaration @param {number} line @returns {'you'|'agent'|'default'|null} */
|
|
27
|
+
export function countByOf(declaration: any, line: number): "you" | "agent" | "default" | null;
|
package/types/checkpick.d.ts
CHANGED
|
@@ -73,10 +73,9 @@ export function countCheck(text: string): Record<string, any> | null;
|
|
|
73
73
|
* The asks for the rows: `Line n, guardrail "<…>": I propose <check in plain words>.` for a kept check, `Line n, guardrail "<…>": I can't check this. Your own words, or
|
|
74
74
|
* Not checked?` when nothing was kept. A proposal is not counted toward am1's cap; a can't-check ask is (am16 (5)).
|
|
75
75
|
* @param {ReturnType<typeof rowsFromAnswer>} rows
|
|
76
|
-
* @returns {{
|
|
76
|
+
* @returns {{line: number, rule: number, source: 'look', ask: 'check'|'no-check', ruleText: string, question: string, reading?: string, check?: Record<string, any>, counted: boolean}[]}
|
|
77
77
|
*/
|
|
78
78
|
export function checkAsks(rows: ReturnType<typeof rowsFromAnswer>): {
|
|
79
|
-
pairRule?: number;
|
|
80
79
|
line: number;
|
|
81
80
|
rule: number;
|
|
82
81
|
source: "look";
|
|
@@ -88,37 +87,9 @@ export function checkAsks(rows: ReturnType<typeof rowsFromAnswer>): {
|
|
|
88
87
|
counted: boolean;
|
|
89
88
|
}[];
|
|
90
89
|
/**
|
|
91
|
-
* @typedef {{line: number, rule: number, check: Record<string, any>|null,
|
|
92
|
-
* `check` = the check the person agreed to (null for their own words); `
|
|
90
|
+
* @typedef {{line: number, rule: number, check: Record<string, any>|null, own?: boolean}} Pick
|
|
91
|
+
* `check` = the check the person agreed to (null for their own words); `own` = their own words
|
|
93
92
|
*/
|
|
94
|
-
/**
|
|
95
|
-
* Settle every scoped rule against the person's answers: a rule with a picked check is checked; the `~` line an agree wrote is covered by that pick; every other
|
|
96
|
-
* rule is Not checked, with the reason (`person-left` = they chose it, `own-words` = they gave their own words, `no-pick` = nothing was picked).
|
|
97
|
-
* @param {ReturnType<typeof scopedRules>} rules @param {Pick[]} picks @param {{line: number, rule: number}[]} left
|
|
98
|
-
* @returns {{checks: Map<number, Record<string, any>[]>, notes: {line: number, rule: number, text: string, reason: 'person-left'|'own-words'|'no-pick'}[]}}
|
|
99
|
-
*/
|
|
100
|
-
export function settleRules(rules: ReturnType<typeof scopedRules>, picks: Pick[], left: {
|
|
101
|
-
line: number;
|
|
102
|
-
rule: number;
|
|
103
|
-
}[]): {
|
|
104
|
-
checks: Map<number, Record<string, any>[]>;
|
|
105
|
-
notes: {
|
|
106
|
-
line: number;
|
|
107
|
-
rule: number;
|
|
108
|
-
text: string;
|
|
109
|
-
reason: "person-left" | "own-words" | "no-pick";
|
|
110
|
-
}[];
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* Overwrite the drafter's check on every step of a line this call settles (a green step, which another signed part settles, is left alone): a line with picked checks
|
|
114
|
-
* is softgreen and carries exactly those checks; a line with none is hitl. Whatever `close.shape` the drafter wrote is gone. Pure: returns a new declaration.
|
|
115
|
-
* @param {any} declaration @param {ReturnType<typeof scopedRules>} rules @param {ReturnType<typeof settleRules>} settled
|
|
116
|
-
* @param {(note: {line: number, reason: 'person-left'|'own-words'|'no-pick'}) => string} sentence the one table's words for a reason
|
|
117
|
-
*/
|
|
118
|
-
export function applyPicks(declaration: any, rules: ReturnType<typeof scopedRules>, settled: ReturnType<typeof settleRules>, sentence: (note: {
|
|
119
|
-
line: number;
|
|
120
|
-
reason: "person-left" | "own-words" | "no-pick";
|
|
121
|
-
}) => string): any;
|
|
122
93
|
/**
|
|
123
94
|
* M10 am27 (4) RETENTION record of one draft (record only, counts, no words). Per job line: `aiParts` = the cited facts the drafter wrote on that line (a `cited` close counts once per
|
|
124
95
|
* fact, at least 1), `kept` = how many are still in the final declaration, `dropped` = what code removed, `picks` = the line has the person's picks; `classAsked` / `classFinal`
|
|
@@ -170,13 +141,12 @@ export const SUGGEST_SCHEMA: Readonly<{
|
|
|
170
141
|
export const CANT_CHECK_WORDS: "I can't check this. Your own words, or Not checked?";
|
|
171
142
|
export function HOW_TO_ANSWER(line: number, agree: boolean): string;
|
|
172
143
|
/**
|
|
173
|
-
* `check` = the check the person agreed to (null for their own words); `
|
|
144
|
+
* `check` = the check the person agreed to (null for their own words); `own` = their own words
|
|
174
145
|
*/
|
|
175
146
|
export type Pick = {
|
|
176
147
|
line: number;
|
|
177
148
|
rule: number;
|
|
178
149
|
check: Record<string, any> | null;
|
|
179
|
-
added?: string;
|
|
180
150
|
own?: boolean;
|
|
181
151
|
};
|
|
182
152
|
import { plainWords } from './checkwords.js';
|
package/types/checkwords.d.ts
CHANGED
|
@@ -16,3 +16,8 @@ export const OFFERED: readonly string[];
|
|
|
16
16
|
export const LABEL_AGENT: "[agent]";
|
|
17
17
|
export const LABEL_PICKED: "[you picked]";
|
|
18
18
|
export function labelled(text: string, by: "agent" | "picked"): string;
|
|
19
|
+
/** @type {Readonly<Record<string, string>>} */
|
|
20
|
+
export const TAG: Readonly<Record<string, string>>;
|
|
21
|
+
export function tagOf(by: unknown): string;
|
|
22
|
+
export function tagged(text: string, by: unknown): string;
|
|
23
|
+
export function sheetByOf(covers: unknown[]): "you" | "agent";
|
package/types/cited-record.d.ts
CHANGED
|
@@ -17,3 +17,12 @@ export function citedLineOf({ n, part, results, check, confirmed, }: {
|
|
|
17
17
|
* @param {string} runDir @param {Record<string, any>} line @returns {void}
|
|
18
18
|
*/
|
|
19
19
|
export function writeCitedLine(runDir: string, line: Record<string, any>): void;
|
|
20
|
+
/**
|
|
21
|
+
* M16 R7: the quotes of earlier lines' PASSED cited checks, read from the run's own record (what the numbers tie of a later text line is checked against). A line with no record, or
|
|
22
|
+
* one that did not pass, is `missing`: the tie then reads "its answer is not there yet", a normal red, never a pass. Read through the safe gateway; an unreadable record is every line missing.
|
|
23
|
+
* @param {string} runDir @param {number[]} from @returns {{quotes: Record<string, string[]>, missing: number[]}}
|
|
24
|
+
*/
|
|
25
|
+
export function quotesOfLines(runDir: string, from: number[]): {
|
|
26
|
+
quotes: Record<string, string[]>;
|
|
27
|
+
missing: number[];
|
|
28
|
+
};
|
package/types/citedcheck.d.ts
CHANGED
|
@@ -21,9 +21,10 @@ export function factDecides(part: any): Record<string, any>[];
|
|
|
21
21
|
* The claims bareguard reads, built from the step's `results`. The claim TEXT is written here from the values the step gave (`name: value; name: value`),
|
|
22
22
|
* a phrase fact contributes its own signed words. A result that is not an object, or has no string quote, still becomes a claim (an empty one) so
|
|
23
23
|
* bareguard reds it by name rather than the result vanishing.
|
|
24
|
-
*
|
|
24
|
+
* `asWritten` (bareloop v0.56.0): per result, per fact index, the value as the page writes it, for the claim's words of a date or amount a page form signs.
|
|
25
|
+
* @param {any} part @param {unknown} results @param {Record<number, string>[]} [asWritten] @returns {{claim: string, quote: string, values?: Record<string, string>}[]}
|
|
25
26
|
*/
|
|
26
|
-
export function factClaims(part: any, results: unknown): {
|
|
27
|
+
export function factClaims(part: any, results: unknown, asWritten?: Record<number, string>[]): {
|
|
27
28
|
claim: string;
|
|
28
29
|
quote: string;
|
|
29
30
|
values?: Record<string, string>;
|
|
@@ -39,6 +40,21 @@ export function buildCitedSpec(part: any, sha256: string): Record<string, any>;
|
|
|
39
40
|
* @param {any} f @param {string} source @returns {string}
|
|
40
41
|
*/
|
|
41
42
|
export function factSentence(f: any, source: string): string;
|
|
43
|
+
/** the `fact` part of a step's parameters, or null (a step has at most one) @param {any} params @returns {any|null} */
|
|
44
|
+
export function factPartOf(params: any): any | null;
|
|
45
|
+
/**
|
|
46
|
+
* The SHAPE of a `fact` part (what it may carry), pushed as reds in the same form `rubricStepShapeReds` uses. Whether the
|
|
47
|
+
* bareguard rubric it builds is signable is asked of bareguard itself (`checkRubricParts` builds it once at drafting).
|
|
48
|
+
* @param {any} part @param {string} w the path prefix @param {(code: string, path: string, detail: string) => void} red
|
|
49
|
+
*/
|
|
50
|
+
export function factShapeReds(part: any, w: string, red: (code: string, path: string, detail: string) => void): void;
|
|
51
|
+
/**
|
|
52
|
+
* Where bareguard read each page-form fact's value inside each quote, as the quote spells it: from `checkStep`'s `full.evidence` (one entry per
|
|
53
|
+
* claim: `text` = the normalized quote the decides ran on, `spans` = where each decide read its anchor, value and unit/currency). Only a fact that
|
|
54
|
+
* signs `lang` or `decimal` is looked up; the span is the decide's `value` span (the one equal to the claim's own value when bareguard flags it).
|
|
55
|
+
* @param {any} part @param {any[]|undefined} evidence @returns {(Record<number, string>|undefined)[]} per claim index
|
|
56
|
+
*/
|
|
57
|
+
export function writtenSpans(part: any, evidence: any[] | undefined): (Record<number, string> | undefined)[];
|
|
42
58
|
/** @param {any} part @returns {string|null} the "N results" row of a fact part */
|
|
43
59
|
export function countSentence(part: any): string | null;
|
|
44
60
|
/**
|
|
@@ -99,3 +115,18 @@ export const FACT_SHAPES: readonly string[];
|
|
|
99
115
|
export const MAX_FACTS: 10;
|
|
100
116
|
export const CITED_ID: "facts";
|
|
101
117
|
export function sha256Text(t: string): string;
|
|
118
|
+
/** the languages whose month names bareguard 0.27 reads on a `date` fact (its `lang`), each with the name a person reads; absent `lang` = ISO YYYY-MM-DD only */
|
|
119
|
+
export const FACT_LANGS: Readonly<{
|
|
120
|
+
en: "English";
|
|
121
|
+
de: "German";
|
|
122
|
+
fr: "French";
|
|
123
|
+
es: "Spanish";
|
|
124
|
+
it: "Italian";
|
|
125
|
+
pt: "Portuguese";
|
|
126
|
+
nl: "Dutch";
|
|
127
|
+
}>;
|
|
128
|
+
/** the decimal marks a number or money fact may sign (bareguard 0.27 `decimal`); absent = "." */
|
|
129
|
+
export const FACT_DECIMALS: readonly string[];
|
|
130
|
+
/** every field a part of class `fact` may carry (the shared ones are checked by rubricStepShapeReds) */
|
|
131
|
+
export const FACT_PART_FIELDS: readonly string[];
|
|
132
|
+
export function moneyForms(f: any): string[];
|
package/types/closers.d.ts
CHANGED
|
@@ -85,9 +85,9 @@ export function closeSoftgreen(artifact: any, shape: {
|
|
|
85
85
|
/**
|
|
86
86
|
* The one dispatcher — `close by declared class` (M2 scope item 4).
|
|
87
87
|
*
|
|
88
|
-
* @param {{ close?: { class?: string, shape?: Record<string, any>, picked?: any[], cited?: any, columns?: {source: string, column: string}[], sheet?: any[] } }} step
|
|
88
|
+
* @param {{ close?: { class?: string, shape?: Record<string, any>, picked?: any[], cited?: any, columns?: {source: string, column: string}[], sheet?: any[], numbersFrom?: number[] } }} step
|
|
89
89
|
* @param {unknown} artifact
|
|
90
|
-
* @param {{ reads: Record<string, any>, businessDate: string, source?: {ok: true, text: string, sha256: string}|{ok: false, red: string}|null, sheet?: any }} ctx
|
|
90
|
+
* @param {{ reads: Record<string, any>, businessDate: string, source?: {ok: true, text: string, sha256: string}|{ok: false, red: string}|null, sheet?: any, numbers?: {quotes: Record<string, string[]>, missing: number[]} }} ctx
|
|
91
91
|
* `source` (M10 piece 4) = the run's own frozen copy a cited step reads, from `readRunSource`; only a step whose close carries `cited` reads it
|
|
92
92
|
* `sheet` (M10b piece 2) = the run's own tables and recorded `tableSha`s a step with `close.sheet` is checked on, from `readRunSheets`
|
|
93
93
|
* @returns {Promise<CloseVerdict>}
|
|
@@ -103,6 +103,7 @@ export function closeByClass(step: {
|
|
|
103
103
|
column: string;
|
|
104
104
|
}[];
|
|
105
105
|
sheet?: any[];
|
|
106
|
+
numbersFrom?: number[];
|
|
106
107
|
};
|
|
107
108
|
}, artifact: unknown, ctx: {
|
|
108
109
|
reads: Record<string, any>;
|
|
@@ -116,6 +117,27 @@ export function closeByClass(step: {
|
|
|
116
117
|
red: string;
|
|
117
118
|
} | null;
|
|
118
119
|
sheet?: any;
|
|
120
|
+
numbers?: {
|
|
121
|
+
quotes: Record<string, string[]>;
|
|
122
|
+
missing: number[];
|
|
123
|
+
};
|
|
119
124
|
}): Promise<CloseVerdict>;
|
|
125
|
+
/**
|
|
126
|
+
* M16 am3 (2), R7: the `$` numbers default of the check list. Every number in the answer's `text` must be in a quote an EARLIER line's cited check already passed (bareguard's `numbersInQuote`: a token match
|
|
127
|
+
* on the numbers, not a canonical compare, a documented limit; words are free). The quotes are the run's cited record of those lines (`ctx.numbers.quotes`, line -> quotes; `missing` = lines with none).
|
|
128
|
+
* Third outcomes: an answer with no `text` is `unparseable`, quotes that cannot be read (no record, a line not there yet) are `crash`; neither is ever green.
|
|
129
|
+
* What it throws away: only the numbers' token form is compared; a number written another way in the quote (1,000 vs 1000) is a bareguard question, not ours.
|
|
130
|
+
* @borrowed-from bareloop src/rubricstep.js@v0.56.0 (3383cce) gradeStep, PART 1b
|
|
131
|
+
* @param {any} step @param {unknown} artifact @param {number[]} from @param {{quotes: Record<string, string[]>, missing: number[]}|undefined} numbers
|
|
132
|
+
* @returns {{verdict: 'green'|'red'|'unparseable'|'crash', red: string|null, text: string}}
|
|
133
|
+
*/
|
|
134
|
+
export function closeNumbers(step: any, artifact: unknown, from: number[], numbers: {
|
|
135
|
+
quotes: Record<string, string[]>;
|
|
136
|
+
missing: number[];
|
|
137
|
+
} | undefined): {
|
|
138
|
+
verdict: "green" | "red" | "unparseable" | "crash";
|
|
139
|
+
red: string | null;
|
|
140
|
+
text: string;
|
|
141
|
+
};
|
|
120
142
|
export type CloseVerdict = import("./types.js").CloseVerdict;
|
|
121
143
|
import { createRubric } from 'bareguard';
|
package/types/declaration.d.ts
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
* @param {Record<string, any>} declaration @returns {'plain'|'mcp'|'tickets'}
|
|
5
5
|
*/
|
|
6
6
|
export function flowTypeOf(declaration: Record<string, any>): "plain" | "mcp" | "tickets";
|
|
7
|
+
/** M12 piece 3 (item 4): the signed label filter, `ticketFilter: {priority?: ['P0'..'P3'], labels?: [names]}`; optional, and only on a job that lists MCP tools.
|
|
8
|
+
* Pure data: code decides at run (src/ticket-labels.js); the drafter may only suggest it and a human signs it.
|
|
9
|
+
* @param {Record<string, any>} declaration @param {string[]} reds */
|
|
10
|
+
export function checkTicketFilter(declaration: Record<string, any>, reds: string[]): void;
|
|
11
|
+
/** M12 piece 3 (signed item 7): the ticket fields a schedule may watch, `ticketWatch: ['state'|'labels']`; optional, only on a job that lists MCP tools, typed values only.
|
|
12
|
+
* The scheduler compares (src/trigger-tickets.js); the drafter may suggest, a human signs. @param {Record<string, any>} declaration @param {string[]} reds */
|
|
13
|
+
export function checkTicketWatch(declaration: Record<string, any>, reds: string[]): void;
|
|
7
14
|
/**
|
|
8
15
|
* A small, pure walker over `declaration.steps` for callers that only want
|
|
9
16
|
* the shape-key verdict (e.g. poc/m1/slot-batch.mjs's `shape` column) —
|