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,75 @@
|
|
|
1
|
+
/** the tail of a revise turn that follows refused edits: each refusal's own reason and nothing else (bareloop renderRejectBlock) @param {string[]} reds */
|
|
2
|
+
export function renderRejectBlock(reds: string[], cap?: number): string;
|
|
3
|
+
/**
|
|
4
|
+
* Is this validator red about a check the BLOCK built (R2)? It names a line the block gave a check to (`builtLines`, from the red's own line number) and is about a close the code wrote: the quote check, a
|
|
5
|
+
* picked check, the numbers tie, the class, the list or the picked-lines record; or it is the cited words' own `line N:` red. A red on a step's primitives, reads, emits or an ask names none of those.
|
|
6
|
+
* @param {string} red @param {number[]} builtLines the lines the red names that the block built a check on
|
|
7
|
+
*/
|
|
8
|
+
export function isBuildFault(red: string, builtLines: number[]): boolean;
|
|
9
|
+
/**
|
|
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
|
+
* 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
|
|
13
|
+
*/
|
|
14
|
+
export function setUpBlock({ texts, jobLines, look, kept, fresh, asks, countScope, leaveOut }: {
|
|
15
|
+
leaveOut?: {
|
|
16
|
+
line: number;
|
|
17
|
+
rule: number;
|
|
18
|
+
}[];
|
|
19
|
+
texts: Record<string, string>;
|
|
20
|
+
jobLines: any[];
|
|
21
|
+
look: {
|
|
22
|
+
facts: any[];
|
|
23
|
+
dropped: any[];
|
|
24
|
+
};
|
|
25
|
+
kept: {
|
|
26
|
+
picks: any[];
|
|
27
|
+
left: any[];
|
|
28
|
+
askRules: any[];
|
|
29
|
+
};
|
|
30
|
+
fresh: {
|
|
31
|
+
picks: any[];
|
|
32
|
+
left: {
|
|
33
|
+
line: number;
|
|
34
|
+
rule: number;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
|
37
|
+
asks: boolean;
|
|
38
|
+
countScope: (t: string) => boolean;
|
|
39
|
+
}): import("./checkblock.js").CheckBlock;
|
|
40
|
+
/** the `add` pre-edits of the ledger-suggest call (bareloop authorjob.js@v0.56.0: a count or a phrase; anything else is not an edit) @param {any[]} extra */
|
|
41
|
+
export function ledgerEdits(extra: any[]): any[];
|
|
42
|
+
/**
|
|
43
|
+
* M16 item 4 ("Tickets `ticketFilter` and `ticketWatch` stay as they are"): the rules of a Tickets job that are not the block's. Before M16 only a count guardrail of such a job (it signs a
|
|
44
|
+
* ticket page input, which routes its guardrails: src/checkpick.js codeScope) was picked or asked; every other rule ("priority P1 only", "run a ticket again when its state changes") was the
|
|
45
|
+
* declaration's own typed ticketFilter / ticketWatch, never asked and never listed as Not checked. Since M17 am6 these rules are ticket rows (src/ticketrows.js), so one the look tied to a fact is left out of the block too: it shows once, as the ticket row.
|
|
46
|
+
* @param {string} flowType @param {{n: number, rules?: string[]}[]} jobLines @returns {{line: number, rule: number}[]}
|
|
47
|
+
*/
|
|
48
|
+
export function ticketLeaveOut(flowType: string, jobLines: {
|
|
49
|
+
n: number;
|
|
50
|
+
rules?: string[];
|
|
51
|
+
}[]): {
|
|
52
|
+
line: number;
|
|
53
|
+
rule: number;
|
|
54
|
+
}[];
|
|
55
|
+
/** the cap of refusals one revise turn carries (bareloop REVISE_RED_CAP) */
|
|
56
|
+
export const REVISE_RED_CAP: 20;
|
|
57
|
+
export function buildFaultWords(reds: string[]): string;
|
|
58
|
+
export function pickEdits(rows: {
|
|
59
|
+
line: number;
|
|
60
|
+
rule: number;
|
|
61
|
+
check: Record<string, any> | null;
|
|
62
|
+
}[], blockLines: Set<number>): {
|
|
63
|
+
op: string;
|
|
64
|
+
line: number;
|
|
65
|
+
rules: number[];
|
|
66
|
+
check: Record<string, any> | null;
|
|
67
|
+
}[];
|
|
68
|
+
export function repairedEditsReadable(value: any): any;
|
|
69
|
+
export function editRecord(rec: {
|
|
70
|
+
edits: any[];
|
|
71
|
+
}): {
|
|
72
|
+
refusedBecause?: any;
|
|
73
|
+
op: any;
|
|
74
|
+
accepted: boolean;
|
|
75
|
+
}[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} prose the job's signed text (or the draft's prose)
|
|
3
|
+
* @param {any} [declaration] the declaration, once there is one. Before it exists nothing in fwd says which line reads a sheet (sheetLineBlocks reads the steps' `reads` / `close.sheet`),
|
|
4
|
+
* so a sheet line is then given as a step line; the caller passes the declaration whenever it has one.
|
|
5
|
+
* @param {number[]} [tiedSheetLines] lines whose `~` rule the sheet look (src/sheetlook.js) tied to a real column: sheet lines before there is a declaration (M16 R6); they stay on fwd's sheet path
|
|
6
|
+
* @returns {{ok: true, jobLines: {n: number, text: string, rules: string[]}[], skipped: {ask: number[], send: number[], sheet: number[]}}|{ok: false, reds: string[]}}
|
|
7
|
+
*/
|
|
8
|
+
export function blockJobLines(prose: string, declaration?: any, tiedSheetLines?: number[]): {
|
|
9
|
+
ok: true;
|
|
10
|
+
jobLines: {
|
|
11
|
+
n: number;
|
|
12
|
+
text: string;
|
|
13
|
+
rules: string[];
|
|
14
|
+
}[];
|
|
15
|
+
skipped: {
|
|
16
|
+
ask: number[];
|
|
17
|
+
send: number[];
|
|
18
|
+
sheet: number[];
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
ok: false;
|
|
22
|
+
reds: string[];
|
|
23
|
+
};
|
|
24
|
+
/** a block over step lines only, with no `$` cited default (M16 am1). `texts`: label -> frozen text. */
|
|
25
|
+
export function newJobBlock({ texts, jobLines, asks, countScope }: {
|
|
26
|
+
texts: any;
|
|
27
|
+
jobLines: any;
|
|
28
|
+
asks?: boolean | undefined;
|
|
29
|
+
countScope?: ((t: string) => boolean) | undefined;
|
|
30
|
+
}): CheckBlock;
|
|
31
|
+
import { CheckBlock } from './checkblock.js';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** every whole-output word number in a guardrail ("under 600 words" -> [600]); a "<n> words each" / "per section" size is never listed here @param {unknown} g @returns {number[]} */
|
|
2
|
+
export function guardrailWordNumbers(g: unknown): number[];
|
|
3
|
+
/** every standalone number in a guardrail's own text (digits not joined to letters) @param {unknown} g @returns {number[]} */
|
|
4
|
+
export function guardrailStandaloneNumbers(g: unknown): number[];
|
|
5
|
+
/** the "<n> words each" / "<n> words per section" size, or null @param {unknown} g @returns {number|null} */
|
|
6
|
+
export function guardrailWordsPerSection(g: unknown): number | null;
|
|
7
|
+
/** the first "<N> sections" in a guardrail (digits, or one..ten), or null @param {unknown} g @returns {number|null} */
|
|
8
|
+
export function guardrailSectionCount(g: unknown): number | null;
|
|
9
|
+
/** the first "<N> bullets / list items / items / lines / points" in a guardrail (digits, or one..ten), or null @param {unknown} g @returns {number|null} */
|
|
10
|
+
export function guardrailItemCount(g: unknown): number | null;
|
|
11
|
+
/**
|
|
12
|
+
* Keep a suggestion only if its rule is on bareguard's list, it carries only that rule's own fields, every number in it is a number the guardrail names and every word in it
|
|
13
|
+
* is a word of the guardrail. Anything else is dropped, with the reason. `none` is a drop with the reason `none`.
|
|
14
|
+
* @param {string} guardrail @param {any} sug the model's entry for this guardrail
|
|
15
|
+
* @returns {{kept: true, check: Record<string, any>}|{kept: false, why: string}}
|
|
16
|
+
*/
|
|
17
|
+
export function keepOrDrop(guardrail: string, sug: any): {
|
|
18
|
+
kept: true;
|
|
19
|
+
check: Record<string, any>;
|
|
20
|
+
} | {
|
|
21
|
+
kept: false;
|
|
22
|
+
why: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The check a counting rule's own words already ARE ("exactly 3 list items" -> listItems 3), or null. No obvious asks (hamr 2026-11-14): such a rule is settled as written, never proposed back to the person.
|
|
26
|
+
* @param {string} text @returns {Record<string, any>|null}
|
|
27
|
+
*/
|
|
28
|
+
export function obviousCheck(text: string): Record<string, any> | null;
|
|
29
|
+
/**
|
|
30
|
+
* The check CODE proposes for a count rule when the call yields none (R10, ours; fwd has no such fallback): a bullets / list-items / points count -> listItems N (exact; "at most / up to / no more than / fewer than / under / below" -> maxListItems, "at least / minimum / no fewer than / more than" -> minListItems, F315), a lines count ->
|
|
31
|
+
* maxLines N, ONE word number -> minWords N when the rule says "at least / minimum / more than", else maxWords N. A section count names no sections, so none is built; a rule naming two different counts ("3 bullets under 80 words") is not built either; a rule with
|
|
32
|
+
* several word numbers or a range ("between 100 and 200 words") is not guessed. The result passes `keepOrDrop`, so every number is one the rule names.
|
|
33
|
+
* @param {string} text @returns {Record<string, any>|null}
|
|
34
|
+
*/
|
|
35
|
+
export function countCheck(text: string): Record<string, any> | null;
|
|
36
|
+
/** a part of a rubric-step stage, from a pick: the check's own fields, the rule's words, and the `~` rule numbers it carries out @param {Record<string, any>} check @param {string} text @param {number[]} rules */
|
|
37
|
+
export function partOfPick(check: Record<string, any>, text: string, rules: number[]): {
|
|
38
|
+
rules: number[];
|
|
39
|
+
text: string;
|
|
40
|
+
class: string;
|
|
41
|
+
check: any;
|
|
42
|
+
};
|
|
43
|
+
export { plainWords };
|
|
44
|
+
export function isCountable(g: unknown): boolean;
|
|
45
|
+
export function sameRuleWords(a: unknown, b: unknown): boolean;
|
|
46
|
+
import { plainWords } from './checkwords.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import('./checkblock.js').CheckBlock} block
|
|
3
|
+
* @returns {{rows: {key: string, line: number, by: string, state: string, text: string, reason: string|null, drop: boolean}[], suggested: {key: string, line: number, text: string, dropped?: boolean}[]}}
|
|
4
|
+
*/
|
|
5
|
+
export function cardOfBlock(block: import("./checkblock.js").CheckBlock): {
|
|
6
|
+
rows: {
|
|
7
|
+
key: string;
|
|
8
|
+
line: number;
|
|
9
|
+
by: string;
|
|
10
|
+
state: string;
|
|
11
|
+
text: string;
|
|
12
|
+
reason: string | null;
|
|
13
|
+
drop: boolean;
|
|
14
|
+
}[];
|
|
15
|
+
suggested: {
|
|
16
|
+
key: string;
|
|
17
|
+
line: number;
|
|
18
|
+
text: string;
|
|
19
|
+
dropped?: boolean;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
/** the card lines: rows in, lines out. ONE pure function of the rows; nothing else may feed it. @param {Row[]} rows */
|
|
2
|
+
export function renderCard(rows: Row[]): {
|
|
3
|
+
key: any;
|
|
4
|
+
line: any;
|
|
5
|
+
by: any;
|
|
6
|
+
state: any;
|
|
7
|
+
reason: any;
|
|
8
|
+
text: string;
|
|
9
|
+
}[];
|
|
10
|
+
/**
|
|
11
|
+
* A row. `kind`: rule, fact, phrase, count, cited, numbers, floor. `by`: you (`~`), agent (`!`), default (`$`). A `~` row may carry `links` (the look's facts tied to it),
|
|
12
|
+
* `pick`, `aiReading`, `left`. `state` is built or not-checked; a not-checked row always has a plain `reason`.
|
|
13
|
+
* @typedef {Record<string, any>} Row
|
|
14
|
+
*/
|
|
15
|
+
/** the card's fixed words, one spelling (the renderer reads them; a test reads them too) */
|
|
16
|
+
export const CARD_T: Readonly<{
|
|
17
|
+
count: "result count";
|
|
18
|
+
cited: "every claim is backed by a quote copied from";
|
|
19
|
+
theInput: "the input";
|
|
20
|
+
numbers: "every number in the text is in a checked quote of line";
|
|
21
|
+
withWords: "with the words";
|
|
22
|
+
}>;
|
|
23
|
+
/** the four row edits an AI reply may hold */
|
|
24
|
+
export const EDIT_OPS: readonly string[];
|
|
25
|
+
/** the plain reasons code gives, in one place (the card, the Job tab and the Audit read them from the row) */
|
|
26
|
+
export const REASON: Readonly<{
|
|
27
|
+
left: "You chose to leave it Not checked, so you judge it at Accept.";
|
|
28
|
+
nothingOnPage: "Your own words are on the line; the machine has no check for them, so you judge it at Accept.";
|
|
29
|
+
cantCheck: "I can't check this on the page; waiting for your answer";
|
|
30
|
+
noRule: "No rule can check this, so you judge it at Accept.";
|
|
31
|
+
waitingPick: "waiting for your answer on the proposed check";
|
|
32
|
+
waitingReading: "waiting for your answer on the reading";
|
|
33
|
+
onePerLine: "this line finds facts, so it has no text to quote";
|
|
34
|
+
manyInputs: "the job has more than one input and code cannot pick which one the claims quote";
|
|
35
|
+
oneSidedTime: "a time limit the AI proposes must be a range, so you judge it at Accept.";
|
|
36
|
+
countNeedsFact: "a result count needs a fact to count; this line has none";
|
|
37
|
+
lookNoWords: "the page does not hold the words of the look's fact for this rule";
|
|
38
|
+
afterLast: "no more tries: Start over (rows are never changed by the AI after the last try)";
|
|
39
|
+
noPick: "No check was picked for it, so you judge it at Accept.";
|
|
40
|
+
negated: "it says what is not needed, so there is nothing to check";
|
|
41
|
+
dropped: "You dropped it.";
|
|
42
|
+
suggested: "Suggested: not in your job, so it is not checked unless you add it.";
|
|
43
|
+
}>;
|
|
44
|
+
export class CheckBlock {
|
|
45
|
+
/** @param {{texts: Record<string, string>, labels: string[], maxTries?: number, countScope?: (ruleText: string) => boolean, asks?: boolean, split?: boolean, cited?: boolean}} o the frozen input texts, their labels, how many AI replies (tries) may still change a row, whether code scopes a counting `~` rule in (a pick is asked), and whether a person can be asked at all (`asks`: false = a rule code cannot settle is Not checked, a reading code proposes is built as the AI's proposal) */
|
|
46
|
+
constructor({ texts, labels, maxTries, countScope, asks, split, cited }: {
|
|
47
|
+
texts: Record<string, string>;
|
|
48
|
+
labels: string[];
|
|
49
|
+
maxTries?: number;
|
|
50
|
+
countScope?: (ruleText: string) => boolean;
|
|
51
|
+
asks?: boolean;
|
|
52
|
+
split?: boolean;
|
|
53
|
+
cited?: boolean;
|
|
54
|
+
});
|
|
55
|
+
cited: boolean;
|
|
56
|
+
/** the product path sets it: `!` rows split into job-derived and suggested, a suggestion code cannot build is hidden (hamr 2026-11-13). Off, every `!` row is built as before (the older callers and their tests) */
|
|
57
|
+
split: boolean;
|
|
58
|
+
countScope: (ruleText: string) => boolean;
|
|
59
|
+
asks: boolean;
|
|
60
|
+
texts: Record<string, string>;
|
|
61
|
+
labels: string[];
|
|
62
|
+
maxTries: number;
|
|
63
|
+
/** @type {Row[]} the ONE store */
|
|
64
|
+
rows: Row[];
|
|
65
|
+
/** @type {{n: number, text: string}[]} */
|
|
66
|
+
lines: {
|
|
67
|
+
n: number;
|
|
68
|
+
text: string;
|
|
69
|
+
}[];
|
|
70
|
+
/** @type {any[]} the look's facts as given (a `reading` edit names one) */
|
|
71
|
+
lookFacts: any[];
|
|
72
|
+
/** @type {{facts: any[], dropped: any[]}|null} the look as the draft gate reads it (null = no look report: the gate proves a label against the list code made) */
|
|
73
|
+
look: {
|
|
74
|
+
facts: any[];
|
|
75
|
+
dropped: any[];
|
|
76
|
+
} | null;
|
|
77
|
+
/** @type {any[]} replies waiting to be applied by `drive` */
|
|
78
|
+
queue: any[];
|
|
79
|
+
/** @type {any[]} the open questions, set by `ask` */
|
|
80
|
+
open: any[];
|
|
81
|
+
/** @type {string[]} the keys of questions a person did not answer */
|
|
82
|
+
unanswered: string[];
|
|
83
|
+
tries: number;
|
|
84
|
+
/** @type {any[]} every reply's record: each edit, kept or refused with its own reason */
|
|
85
|
+
deltaLog: any[];
|
|
86
|
+
/** @type {any} */
|
|
87
|
+
closeCache: any;
|
|
88
|
+
/** @type {Map<number, 'yes'|'no'|'failed'>} the note question's answer per facts-only line (src/noteask.js; code decides what it means) */
|
|
89
|
+
notes: Map<number, "yes" | "no" | "failed">;
|
|
90
|
+
textOf(source: string | undefined): string;
|
|
91
|
+
/** @param {number} line @param {string} [kind] */
|
|
92
|
+
rowsOn(line: number, kind?: string): Row[];
|
|
93
|
+
ruleRows(line: number): Row[];
|
|
94
|
+
/** does a `~` rule's own row say it is Not checked? Then its row is the ONE place the rule is said (its reason: the look's sentence, or the person's Drop) @param {number} line @param {number} rule */
|
|
95
|
+
saysRule(line: number, rule: number): boolean;
|
|
96
|
+
/** every word the person wrote on a line: the line and its `~` rules */
|
|
97
|
+
said(line: number): string;
|
|
98
|
+
/** @param {Row} r @returns {Row} the row as stored (a repeated key gets `#2`) */
|
|
99
|
+
addRow(r: Row): Row;
|
|
100
|
+
/** @param {{n: number, text: string, rules?: string[]}[]} jobLines */
|
|
101
|
+
fromJob(jobLines: {
|
|
102
|
+
n: number;
|
|
103
|
+
text: string;
|
|
104
|
+
rules?: string[];
|
|
105
|
+
}[]): void;
|
|
106
|
+
/**
|
|
107
|
+
* @param {any[]} facts the look's kept facts @param {any[]} [dropped] the look's drops (`look.dropped`): a whole fact a page rule left out. Its plain sentence (src/pagedropwords.js)
|
|
108
|
+
* becomes the `why` of the `~` rule it was tied to, or a Not checked `!` row of its own, so every drop shows under Not checked.
|
|
109
|
+
*/
|
|
110
|
+
addLook(facts: any[], dropped?: any[]): void;
|
|
111
|
+
match(): void;
|
|
112
|
+
/** a `!` row: the agent's fact, phrase or count (a look fact tied to a rule is a link on that rule's row, never a row of its own) */
|
|
113
|
+
isBang(r: Row): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* The job's own word for a `!` row: when none of its page words is in the job line or its `~` rules but a proper name the job holds (capital or digit first, 3+ characters) is a whole-word part of one
|
|
116
|
+
* page word and the page holds it, the row's words become that job word. The page's long name is kept as `pageWords`; the row's other fields are untouched.
|
|
117
|
+
*/
|
|
118
|
+
takeJobWord(r: Row): void;
|
|
119
|
+
/** are the row's words (or its count number, or the name it asks for a fact by) in the job line or its `~` rules? Normalised, case-insensitive */
|
|
120
|
+
inJob(r: Row): any;
|
|
121
|
+
/** a `!` count row is built unless a `~` rule on its line already names the number */
|
|
122
|
+
matchCount(r: Row): void;
|
|
123
|
+
matchRule(r: Row): void;
|
|
124
|
+
/** a `~` rule that counts words, bullets, lines or sections: a settled pick builds it; else code proposes the check and asks */
|
|
125
|
+
matchCountRule(r: Row): void;
|
|
126
|
+
/** a `!` fact or phrase row: its words must be on the page; a version or a date is true only today, so only a place rule's fit may carry it */
|
|
127
|
+
matchBang(r: Row): void;
|
|
128
|
+
build(): any;
|
|
129
|
+
/** build the line as if this held row were on: when it builds, `offer` is the row as the card would draw it; else the row is hidden with code's reason. The rows' own state is restored */
|
|
130
|
+
trialOffer(r: Row): void;
|
|
131
|
+
/** one line's parts: a pick part per count rule, ONE fact part carrying every fact row of the line (and its result count), then the `$` defaults */
|
|
132
|
+
buildLine(l: {
|
|
133
|
+
n: number;
|
|
134
|
+
text: string;
|
|
135
|
+
}, lineParts: any[], lineRows: string[][], factLines: Set<number>): void;
|
|
136
|
+
/**
|
|
137
|
+
* The fact(s) a fact-like row builds, checked alone through the bareguard shapes and against the facts already on the line.
|
|
138
|
+
* @param {Row} r @param {any[]} onLine the facts already built on this line @returns {{fresh: any[], src: string, names: string[]} | {why: string}}
|
|
139
|
+
*/
|
|
140
|
+
factsOf(r: Row, onLine: any[]): {
|
|
141
|
+
fresh: any[];
|
|
142
|
+
src: string;
|
|
143
|
+
names: string[];
|
|
144
|
+
} | {
|
|
145
|
+
why: string;
|
|
146
|
+
};
|
|
147
|
+
/** the `$` defaults of a line, decided from what the line ended with: a text line quotes its input (one input only) and ties its numbers to the fact lines before it */
|
|
148
|
+
buildDefaults(l: {
|
|
149
|
+
n: number;
|
|
150
|
+
}, lineParts: any[], lineRows: string[][], factLines: Set<number>): void;
|
|
151
|
+
/**
|
|
152
|
+
* The `$` note row of a facts-only line: the one note question said yes -> a countable nonEmpty text part sits beside the facts (the existing keep-both shape), so the brief
|
|
153
|
+
* is FACTS AND TEXT and text-present is floored; no -> nothing; the call failed -> a Not checked row in plain words. One owner of the row and its part.
|
|
154
|
+
*/
|
|
155
|
+
buildNote(l: {
|
|
156
|
+
n: number;
|
|
157
|
+
}, lineParts: any[], lineRows: string[][]): void;
|
|
158
|
+
/** the job lines that ended up facts-only (a fact part and no text beside it): the lines the note question is about. Reconciles first. @returns {number[]} */
|
|
159
|
+
factOnlyLines(): number[];
|
|
160
|
+
/** the note question's answers, `{line, answer: 'yes'|'no'|'failed'}`; the whole list is reconciled again @param {{line: number, answer: 'yes'|'no'|'failed'}[]} answers */
|
|
161
|
+
setNotes(answers: {
|
|
162
|
+
line: number;
|
|
163
|
+
answer: "yes" | "no" | "failed";
|
|
164
|
+
}[]): void;
|
|
165
|
+
ask(): any[];
|
|
166
|
+
hasOpenQuestions(): boolean;
|
|
167
|
+
hasPendingDelta(): boolean;
|
|
168
|
+
/** @param {string} qKey @param {string} choice @param {string} [text] @returns {{ok: true} | {ok: false, why: string}} */
|
|
169
|
+
applyAnswer(qKey: string, choice: string, text?: string): {
|
|
170
|
+
ok: true;
|
|
171
|
+
} | {
|
|
172
|
+
ok: false;
|
|
173
|
+
why: string;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* The job lines as the list now holds them: every line's `~` rules are the rule rows' own words, in rule order (a replaced rule keeps its place and number). ONE owner of the job text after an answer.
|
|
177
|
+
* @template {{n: number, text: string}} L @param {L[]} jobLines @returns {(L & {rule: string, rules: string[]})[]}
|
|
178
|
+
*/
|
|
179
|
+
jobLinesView<L extends {
|
|
180
|
+
n: number;
|
|
181
|
+
text: string;
|
|
182
|
+
}>(jobLines: L[]): (L & {
|
|
183
|
+
rule: string;
|
|
184
|
+
rules: string[];
|
|
185
|
+
})[];
|
|
186
|
+
/**
|
|
187
|
+
* Revise keeps the picks of the last draft (am17/am18, `src/pickrecord.js` `matchRecord`): a kept pick settles its rule (its words are the final rule's words) and a kept left rule is left.
|
|
188
|
+
* @param {{picks?: {line: number, rule: number, check: any, own?: boolean}[], left?: {line: number, rule: number}[]}} kept
|
|
189
|
+
*/
|
|
190
|
+
carry({ picks, left }: {
|
|
191
|
+
picks?: {
|
|
192
|
+
line: number;
|
|
193
|
+
rule: number;
|
|
194
|
+
check: any;
|
|
195
|
+
own?: boolean;
|
|
196
|
+
}[];
|
|
197
|
+
left?: {
|
|
198
|
+
line: number;
|
|
199
|
+
rule: number;
|
|
200
|
+
}[];
|
|
201
|
+
}): void;
|
|
202
|
+
/** @param {{label?: string, pre?: boolean, edits?: any[]}} delta `pre` = a reply that is not a drafter try (the suggest call): it does not count against the tries */
|
|
203
|
+
applyDelta(delta: {
|
|
204
|
+
label?: string;
|
|
205
|
+
pre?: boolean;
|
|
206
|
+
edits?: any[];
|
|
207
|
+
}): {
|
|
208
|
+
label: string | undefined;
|
|
209
|
+
pre: boolean;
|
|
210
|
+
edits: any[];
|
|
211
|
+
};
|
|
212
|
+
applyEdit(e: any, kept: {
|
|
213
|
+
adds: number;
|
|
214
|
+
}): {
|
|
215
|
+
accepted: boolean;
|
|
216
|
+
landedKey: any;
|
|
217
|
+
refusedBecause?: undefined;
|
|
218
|
+
} | {
|
|
219
|
+
refusedBecause: string;
|
|
220
|
+
};
|
|
221
|
+
editAdd(e: any): {
|
|
222
|
+
refusedBecause: string;
|
|
223
|
+
accepted?: undefined;
|
|
224
|
+
landedKey?: undefined;
|
|
225
|
+
} | {
|
|
226
|
+
accepted: boolean;
|
|
227
|
+
landedKey: any;
|
|
228
|
+
refusedBecause?: undefined;
|
|
229
|
+
};
|
|
230
|
+
/** @returns {string|null} the plain reason an add repeats what the list already holds (a look fact tied to a `~` rule, a `~` rule's own words, another `!` row), else null */
|
|
231
|
+
onTheList(line: number, name: string, words: string[]): string | null;
|
|
232
|
+
addCount(e: any): {
|
|
233
|
+
refusedBecause: string;
|
|
234
|
+
accepted?: undefined;
|
|
235
|
+
landedKey?: undefined;
|
|
236
|
+
} | {
|
|
237
|
+
accepted: boolean;
|
|
238
|
+
landedKey: any;
|
|
239
|
+
refusedBecause?: undefined;
|
|
240
|
+
};
|
|
241
|
+
/** the `~` rule rows of a line an edit names by number */
|
|
242
|
+
targetsOf(e: any): any;
|
|
243
|
+
/** the one owner of "what do the person's own words say": code's reading of a `~` rule for a money/time fact, or undefined when it cannot read it */
|
|
244
|
+
wordsReading(l: any, text: string): {
|
|
245
|
+
op: "lt" | "lte" | "gt" | "gte";
|
|
246
|
+
value: number;
|
|
247
|
+
} | {
|
|
248
|
+
op: "between";
|
|
249
|
+
lo: number | string;
|
|
250
|
+
hi: number | string;
|
|
251
|
+
} | undefined;
|
|
252
|
+
editReading(e: any): {
|
|
253
|
+
refusedBecause: string;
|
|
254
|
+
accepted?: undefined;
|
|
255
|
+
landedKey?: undefined;
|
|
256
|
+
} | {
|
|
257
|
+
accepted: boolean;
|
|
258
|
+
landedKey: any;
|
|
259
|
+
refusedBecause?: undefined;
|
|
260
|
+
};
|
|
261
|
+
editPick(e: any): {
|
|
262
|
+
refusedBecause: string;
|
|
263
|
+
accepted?: undefined;
|
|
264
|
+
landedKey?: undefined;
|
|
265
|
+
} | {
|
|
266
|
+
accepted: boolean;
|
|
267
|
+
landedKey: any;
|
|
268
|
+
refusedBecause?: undefined;
|
|
269
|
+
};
|
|
270
|
+
editNot(e: any): {
|
|
271
|
+
refusedBecause: string;
|
|
272
|
+
accepted?: undefined;
|
|
273
|
+
landedKey?: undefined;
|
|
274
|
+
} | {
|
|
275
|
+
accepted: boolean;
|
|
276
|
+
landedKey: any;
|
|
277
|
+
refusedBecause?: undefined;
|
|
278
|
+
};
|
|
279
|
+
reconcile(): any;
|
|
280
|
+
/** the loop: while a question is open or a reply waits, apply it and reconcile the WHOLE list again. `answer(q)` gives {choice, text} or null (a person who did not answer) */
|
|
281
|
+
drive({ answer }: {
|
|
282
|
+
answer: any;
|
|
283
|
+
}): this;
|
|
284
|
+
card(): {
|
|
285
|
+
key: any;
|
|
286
|
+
line: any;
|
|
287
|
+
by: any;
|
|
288
|
+
state: any;
|
|
289
|
+
reason: any;
|
|
290
|
+
text: string;
|
|
291
|
+
}[];
|
|
292
|
+
/**
|
|
293
|
+
* The rows as the close shape the card readers (`checksOfClose`, `refusedOf`, `cardOfClose`) already read: the block's stages, the picks code records and the signed list. The confirm card
|
|
294
|
+
* and the signed card read the rows through the SAME readers, so a row shown at confirm is the row signed. Reconciles first (the whole list, every time).
|
|
295
|
+
*/
|
|
296
|
+
closeView(): {
|
|
297
|
+
stages: any;
|
|
298
|
+
picks: {
|
|
299
|
+
line: number;
|
|
300
|
+
part: any;
|
|
301
|
+
}[];
|
|
302
|
+
list: {
|
|
303
|
+
[k: string]: any;
|
|
304
|
+
}[];
|
|
305
|
+
};
|
|
306
|
+
/** the picks code records: a countable part carrying the `~` rule numbers it settles @param {{parts: any[], map: {part: number, line: number}[]}} c the build @returns {{line: number, part: any}[]} */
|
|
307
|
+
picksOf(c: {
|
|
308
|
+
parts: any[];
|
|
309
|
+
map: {
|
|
310
|
+
part: number;
|
|
311
|
+
line: number;
|
|
312
|
+
}[];
|
|
313
|
+
}): {
|
|
314
|
+
line: number;
|
|
315
|
+
part: any;
|
|
316
|
+
}[];
|
|
317
|
+
/** the standing ruling "a run needs one check": one row that is not the floor is built */
|
|
318
|
+
hasBuiltCheck(): boolean;
|
|
319
|
+
/**
|
|
320
|
+
* The signed list (`closeDecl.list`): the signed fields of every row, never its words. A suggestion not added is signed `dropped` ("suggested, not added"), a suggestion code could not build
|
|
321
|
+
* `dropped` with code's reason (it is on the Audit, never on the card), and a built row carries the names of the facts it made (`facts`), so every reader can tag each fact by its row's kind.
|
|
322
|
+
*/
|
|
323
|
+
signedRows(): {
|
|
324
|
+
[k: string]: any;
|
|
325
|
+
}[];
|
|
326
|
+
/** the suggestions code has proved it can build, as the card offers them (Add): `{key, line, text}` */
|
|
327
|
+
suggestedView(): {
|
|
328
|
+
dropped?: boolean | undefined;
|
|
329
|
+
key: any;
|
|
330
|
+
line: any;
|
|
331
|
+
text: string;
|
|
332
|
+
}[];
|
|
333
|
+
/** the suggestions code could not build, in one plain sentence each: the Audit's draft lines (never the card) */
|
|
334
|
+
unbuiltSuggestions(): {
|
|
335
|
+
line: any;
|
|
336
|
+
text: string;
|
|
337
|
+
}[];
|
|
338
|
+
/**
|
|
339
|
+
* The person's Drop or Add on a `!` row (hamr 2026-11-13: instant, $0, no AI; the choice decides). The whole list is reconciled again, so an Add is judged by code like every other row.
|
|
340
|
+
* @param {string} key @param {'drop'|'add'} choice @returns {{ok: true} | {ok: false, why: string}}
|
|
341
|
+
*/
|
|
342
|
+
rowChoice(key: string, choice: "drop" | "add"): {
|
|
343
|
+
ok: true;
|
|
344
|
+
} | {
|
|
345
|
+
ok: false;
|
|
346
|
+
why: string;
|
|
347
|
+
};
|
|
348
|
+
/** the person's Drop/Add choices, tied to the line's words (not its number) and the row's own name, so a Revise keeps them @returns {{lineWords: string, occurrence: number, tail: string, choice: string}[]} */
|
|
349
|
+
choicesRecord(): {
|
|
350
|
+
lineWords: string;
|
|
351
|
+
occurrence: number;
|
|
352
|
+
tail: string;
|
|
353
|
+
choice: string;
|
|
354
|
+
}[];
|
|
355
|
+
/** a Revise keeps the last draft's Drop/Add choices on the rows that are still there (same line words, same row); code still judges every one @param {{lineWords: string, occurrence: number, tail: string, choice: string}[]} rec */
|
|
356
|
+
carryChoices(rec: {
|
|
357
|
+
lineWords: string;
|
|
358
|
+
occurrence: number;
|
|
359
|
+
tail: string;
|
|
360
|
+
choice: string;
|
|
361
|
+
}[]): void;
|
|
362
|
+
/**
|
|
363
|
+
* per line, the shape of `retentionOfList` (counts only): `aiParts` = the rows the agent proposed (and the default cited), `kept` = those built, `dropped` = the rest, `picks` = a `~` row built from a pick
|
|
364
|
+
* @returns {{line: number, aiParts: number, kept: number, dropped: number, picks: boolean}[]}
|
|
365
|
+
*/
|
|
366
|
+
retention(): {
|
|
367
|
+
line: number;
|
|
368
|
+
aiParts: number;
|
|
369
|
+
kept: number;
|
|
370
|
+
dropped: number;
|
|
371
|
+
picks: boolean;
|
|
372
|
+
}[];
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* A row. `kind`: rule, fact, phrase, count, cited, numbers, floor. `by`: you (`~`), agent (`!`), default (`$`). A `~` row may carry `links` (the look's facts tied to it),
|
|
376
|
+
* `pick`, `aiReading`, `left`. `state` is built or not-checked; a not-checked row always has a plain `reason`.
|
|
377
|
+
*/
|
|
378
|
+
export type Row = Record<string, any>;
|
package/types/checked.d.ts
CHANGED
|
@@ -26,8 +26,8 @@ export function checkedLines(declaration: {
|
|
|
26
26
|
sentences: string[];
|
|
27
27
|
sheet?: ReturnType<typeof sheetLineBlocks>[number];
|
|
28
28
|
}[];
|
|
29
|
-
/** The "Not checked" block the page shows: always the label, then the drafter's items (an empty list says the drafter listed nothing). @param {unknown} items */
|
|
30
|
-
export function notCheckedBlock(items: unknown): {
|
|
29
|
+
/** The "Not checked" block the page shows: always the label, then the drafter's items (an empty list says the drafter listed nothing). @param {unknown} items @param {string} [label] */
|
|
30
|
+
export function notCheckedBlock(items: unknown, label?: string): {
|
|
31
31
|
label: string;
|
|
32
32
|
items: any[];
|
|
33
33
|
};
|
|
@@ -41,6 +41,20 @@ export function notCheckedView(items: unknown, declaration: any): {
|
|
|
41
41
|
items: string[];
|
|
42
42
|
readNotes: string[];
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* The checks of one list line's step as rows `{text, by, part}` in the close's part order (the quote check's facts and count, each picked check, the numbers tie), each with the `by` of the row that built it.
|
|
46
|
+
* ONE reader for the plan card's sentences and the Audit's Checks fold; `part` is the index the signed list's rows point at (src/checklistsign.js). Pure.
|
|
47
|
+
* @param {any} declaration @param {any} st the step @param {(line: number, c: any) => string} [keptOf]
|
|
48
|
+
* @returns {{text: string, by: 'you'|'agent'|'default', part: number}[]}
|
|
49
|
+
*/
|
|
50
|
+
export function listPartRows(declaration: any, st: any, keptOf?: (line: number, c: any) => string): {
|
|
51
|
+
text: string;
|
|
52
|
+
by: "you" | "agent" | "default";
|
|
53
|
+
part: number;
|
|
54
|
+
}[];
|
|
44
55
|
/** The label that always sits with the "Not checked" list (am41 item 3: the ONE place these words live; the Job tab and the Chat card read it off their payloads). */
|
|
45
56
|
export const NOT_CHECKED_LABEL: "not checked (the AI's own reading)";
|
|
57
|
+
/** M16 item 5 (replaces M4e am40/am41's words for the checks of a line on the list): the label of a plan that has a list */
|
|
58
|
+
export const LIST_NOT_CHECKED_LABEL: "Not checked";
|
|
59
|
+
export function notCheckedLabelOf(declaration: any): "not checked (the AI's own reading)" | "Not checked";
|
|
46
60
|
import { sheetLineBlocks } from './sheetblock.js';
|