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,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the page-word map (src/pagemap.js) KEPT and DROPPED for one input: the sets the second proof reads. A look from the old search-and-read
|
|
3
|
+
* path has no `dropped` list, so it gives null and the label is proved against the code-made list as before.
|
|
4
|
+
* @param {{facts?: any[], dropped?: (import('./pagerules.js').Dropped & {source?: string})[]}|null|undefined} look @param {string} source
|
|
5
|
+
* @returns {{labels: Set<string>, units: Set<string>, currencies: Set<string>, words: Set<string>, dropped: Map<string, import('./pagerules.js').Dropped>, forms: {labels: Set<string>, lang?: string, decimal?: string}[]}|null}
|
|
6
|
+
*/
|
|
7
|
+
export function keptSetOf(look: {
|
|
8
|
+
facts?: any[];
|
|
9
|
+
dropped?: (import("./pagerules.js").Dropped & {
|
|
10
|
+
source?: string;
|
|
11
|
+
})[];
|
|
12
|
+
} | null | undefined, source: string): {
|
|
13
|
+
labels: Set<string>;
|
|
14
|
+
units: Set<string>;
|
|
15
|
+
currencies: Set<string>;
|
|
16
|
+
words: Set<string>;
|
|
17
|
+
dropped: Map<string, import("./pagerules.js").Dropped>;
|
|
18
|
+
forms: {
|
|
19
|
+
labels: Set<string>;
|
|
20
|
+
lang?: string;
|
|
21
|
+
decimal?: string;
|
|
22
|
+
}[];
|
|
23
|
+
} | null;
|
|
24
|
+
/**
|
|
25
|
+
* The reds for ONE fact part against its frozen source text.
|
|
26
|
+
* @param {{part: any, text: string, line: number|string, scan?: import('./labelscan.js').LabelScan, kept?: ReturnType<typeof keptSetOf>}} o
|
|
27
|
+
* @returns {{code: string, detail: string}[]}
|
|
28
|
+
*/
|
|
29
|
+
export function checkFactWords({ part, text, line, scan, kept }: {
|
|
30
|
+
part: any;
|
|
31
|
+
text: string;
|
|
32
|
+
line: number | string;
|
|
33
|
+
scan?: import("./labelscan.js").LabelScan;
|
|
34
|
+
kept?: ReturnType<typeof keptSetOf>;
|
|
35
|
+
}): {
|
|
36
|
+
code: string;
|
|
37
|
+
detail: string;
|
|
38
|
+
}[];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** @typedef {{line: number, name: string, shape: string, source: string, label?: string, labelId?: string, value?: string, phrase?: string, example: string, rule?: any, aiProposal?: boolean, forRule?: number, reading?: import('./pagerules.js').Reading,
|
|
2
|
+
* words?: string[], labels?: string[], unit?: string[], currency?: string[], lang?: string, decimal?: string}} LookFact `words` / `labels` / `unit` / `currency`: what the page-word map kept (idea A core) */
|
|
3
|
+
/** @typedef {{line: number, rule?: number, words?: string, why: string}} LookNotFound */
|
|
4
|
+
/** @typedef {{facts: LookFact[], prose: {line: number, text?: string}[], notFound: LookNotFound[], dropped?: import('./pagerules.js').Dropped[]}} LookReport */
|
|
5
|
+
/**
|
|
6
|
+
* The look's report as the DRAFTER reads it: one block, per job line, of what can be checked (with the exact words to copy) and what
|
|
7
|
+
* could not be found. Written by code from the verified report.
|
|
8
|
+
* @param {LookReport} report @returns {string}
|
|
9
|
+
*/
|
|
10
|
+
export function renderLookReport(report: LookReport): string;
|
|
11
|
+
/**
|
|
12
|
+
* `words` / `labels` / `unit` / `currency`: what the page-word map kept (idea A core)
|
|
13
|
+
*/
|
|
14
|
+
export type LookFact = {
|
|
15
|
+
line: number;
|
|
16
|
+
name: string;
|
|
17
|
+
shape: string;
|
|
18
|
+
source: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
labelId?: string;
|
|
21
|
+
value?: string;
|
|
22
|
+
phrase?: string;
|
|
23
|
+
example: string;
|
|
24
|
+
rule?: any;
|
|
25
|
+
aiProposal?: boolean;
|
|
26
|
+
forRule?: number;
|
|
27
|
+
reading?: import("./pagerules.js").Reading;
|
|
28
|
+
words?: string[];
|
|
29
|
+
labels?: string[];
|
|
30
|
+
unit?: string[];
|
|
31
|
+
currency?: string[];
|
|
32
|
+
lang?: string;
|
|
33
|
+
decimal?: string;
|
|
34
|
+
};
|
|
35
|
+
export type LookNotFound = {
|
|
36
|
+
line: number;
|
|
37
|
+
rule?: number;
|
|
38
|
+
words?: string;
|
|
39
|
+
why: string;
|
|
40
|
+
};
|
|
41
|
+
export type LookReport = {
|
|
42
|
+
facts: LookFact[];
|
|
43
|
+
prose: {
|
|
44
|
+
line: number;
|
|
45
|
+
text?: string;
|
|
46
|
+
}[];
|
|
47
|
+
notFound: LookNotFound[];
|
|
48
|
+
dropped?: import("./pagerules.js").Dropped[];
|
|
49
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scan one source text for the labels that sit before values, per shape.
|
|
3
|
+
* @param {string} text
|
|
4
|
+
* @returns {LabelScan}
|
|
5
|
+
*/
|
|
6
|
+
export function scanLabels(text: string): LabelScan;
|
|
7
|
+
/**
|
|
8
|
+
* Is this label on the list for this shape? Compared the way a label is read: white space of any kind is one space, quote marks at the
|
|
9
|
+
* edges are dropped. `idOrText` may be a list id (`t1`) or the exact words.
|
|
10
|
+
* @param {LabelScan} scan @param {string} shape @param {unknown} idOrText
|
|
11
|
+
* @returns {LabelEntry|null}
|
|
12
|
+
*/
|
|
13
|
+
export function labelOnList(scan: LabelScan, shape: string, idOrText: unknown): LabelEntry | null;
|
|
14
|
+
/** @typedef {{id: string, label: string, count: number, example: string}} LabelEntry */
|
|
15
|
+
/** @typedef {Record<'money'|'number'|'date'|'time'|'text', LabelEntry[]>} LabelScan */
|
|
16
|
+
export const LABEL_SHAPES: readonly string[];
|
|
17
|
+
/** a label must occur at least this often to be listed (1: a one-page document with one total still has its label; the list is cut to the highest counts) */
|
|
18
|
+
export const MIN_COUNT: 1;
|
|
19
|
+
/** how many labels one shape's list holds at most (the highest counts first) */
|
|
20
|
+
export const MAX_PER_SHAPE: 40;
|
|
21
|
+
/** only this much of a source is scanned (a source over it is scanned up to a line end) */
|
|
22
|
+
export const SCAN_MAX_CHARS: 2000000;
|
|
23
|
+
/**
|
|
24
|
+
* The page reader's bracketed tag (`[ref=549]`), shared by the three places that strip it. The lookahead and lookbehind add no match and drop no
|
|
25
|
+
* match: a `[` that sits inside the run of an earlier `[letters=` (no `]` or white space between) is skipped, because that earlier start reads the same
|
|
26
|
+
* run to the same end - it matches (and consumes this one) or fails (and so does this one). Without them "[a=[a=[a=..." with no `]` is quadratic.
|
|
27
|
+
*/
|
|
28
|
+
export const TAG: RegExp;
|
|
29
|
+
export type LabelEntry = {
|
|
30
|
+
id: string;
|
|
31
|
+
label: string;
|
|
32
|
+
count: number;
|
|
33
|
+
example: string;
|
|
34
|
+
};
|
|
35
|
+
export type LabelScan = Record<"money" | "number" | "date" | "time" | "text", LabelEntry[]>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** What the AI is told: the numbered job lines (text only) and the one question. @param {{n: number, text: string}[]} lines @returns {string} */
|
|
2
|
+
export function notePrompt(lines: {
|
|
3
|
+
n: number;
|
|
4
|
+
text: string;
|
|
5
|
+
}[]): string;
|
|
6
|
+
/**
|
|
7
|
+
* Code reads the typed answer: every asked line answered exactly yes or no, else null (no repair). An answer for a line not asked is unreadable too.
|
|
8
|
+
* @param {any} args the tool's arguments @param {{n: number}[]} lines @returns {Map<number, 'yes'|'no'>|null}
|
|
9
|
+
*/
|
|
10
|
+
export function decideNote(args: any, lines: {
|
|
11
|
+
n: number;
|
|
12
|
+
}[]): Map<number, "yes" | "no"> | null;
|
|
13
|
+
/**
|
|
14
|
+
* The answers per asked line as the block reads them: the typed answer, or `failed` for every asked line when there is none. ONE function, shared by the draft and the replay.
|
|
15
|
+
* @param {number[]} asked the facts-only lines asked @param {any} args the tool's arguments, or null @param {{n: number}[]} lines
|
|
16
|
+
* @returns {{line: number, answer: 'yes'|'no'|'failed'}[]}
|
|
17
|
+
*/
|
|
18
|
+
export function noteAnswers(asked: number[], args: any, lines: {
|
|
19
|
+
n: number;
|
|
20
|
+
}[]): {
|
|
21
|
+
line: number;
|
|
22
|
+
answer: "yes" | "no" | "failed";
|
|
23
|
+
}[];
|
|
24
|
+
/** the label of the forced turn, as the draft's log and the replay in src/planrebuild.js see it */
|
|
25
|
+
export const NOTE_KIND: "note-ask";
|
|
26
|
+
export const NOTE_TOOL: "answer_note_question";
|
|
27
|
+
export const NOTE_SYSTEM: "You read the numbered lines of a job. You answer only about what each line says; you never invent words.";
|
|
28
|
+
export const NOTE_SCHEMA: Readonly<{
|
|
29
|
+
type: "object";
|
|
30
|
+
properties: {
|
|
31
|
+
lines: {
|
|
32
|
+
type: string;
|
|
33
|
+
items: {
|
|
34
|
+
type: string;
|
|
35
|
+
properties: {
|
|
36
|
+
line: {
|
|
37
|
+
type: string;
|
|
38
|
+
minimum: number;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
writtenWords: {
|
|
42
|
+
enum: string[];
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
required: string[];
|
|
46
|
+
additionalProperties: boolean;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
required: string[];
|
|
51
|
+
additionalProperties: false;
|
|
52
|
+
}>;
|
package/types/pageask.d.ts
CHANGED
|
@@ -17,29 +17,6 @@ export function panelQuestionText(q: {
|
|
|
17
17
|
line: number;
|
|
18
18
|
source?: string;
|
|
19
19
|
}): string;
|
|
20
|
-
/**
|
|
21
|
-
* The early asks CODE forces before any paid drafting, from the look's own result. One ask per rule text on a line; readings first, then can't-check
|
|
22
|
-
* asks, each in line order. The caller applies the cap and the answer gate.
|
|
23
|
-
* @param {{facts?: {line: number, forRule?: number, name?: string, shape?: string, unit?: string[], currency?: string[], reading?: import('./pagerules.js').Reading}[]}|null|undefined} look
|
|
24
|
-
* @param {{n: number, text?: string, rule?: string, rules?: string[]}[]|null|undefined} jobLines
|
|
25
|
-
* @returns {LookAsk[]}
|
|
26
|
-
*/
|
|
27
|
-
export function askableFromLook(look: {
|
|
28
|
-
facts?: {
|
|
29
|
-
line: number;
|
|
30
|
-
forRule?: number;
|
|
31
|
-
name?: string;
|
|
32
|
-
shape?: string;
|
|
33
|
-
unit?: string[];
|
|
34
|
-
currency?: string[];
|
|
35
|
-
reading?: import("./pagerules.js").Reading;
|
|
36
|
-
}[];
|
|
37
|
-
} | null | undefined, jobLines: {
|
|
38
|
-
n: number;
|
|
39
|
-
text?: string;
|
|
40
|
-
rule?: string;
|
|
41
|
-
rules?: string[];
|
|
42
|
-
}[] | null | undefined): LookAsk[];
|
|
43
20
|
/**
|
|
44
21
|
* More asks than the cap means the job needs a rewrite, not a questionnaire. The code-owned stop words list EVERY ask and its reading as the
|
|
45
22
|
* suggestion (no extra paid call). A secret in a rule is masked.
|
|
@@ -79,15 +56,5 @@ export function isDropIt(text: unknown): boolean;
|
|
|
79
56
|
export const AGREE_WORDS: string[];
|
|
80
57
|
export function isAgree(text: unknown): boolean;
|
|
81
58
|
export function stripAgreeLead(text: string): string;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*/
|
|
85
|
-
export type LookAsk = {
|
|
86
|
-
line: number;
|
|
87
|
-
rule: number;
|
|
88
|
-
source: "look";
|
|
89
|
-
question: string;
|
|
90
|
-
ask: "reading" | "cant-check";
|
|
91
|
-
ruleText: string;
|
|
92
|
-
reading?: string;
|
|
93
|
-
};
|
|
59
|
+
export function readingQuestion(n: number, rule: string, reading: string): string;
|
|
60
|
+
export function cantCheckQuestion(n: number, rule: string): string;
|
package/types/pagedry.d.ts
CHANGED
|
@@ -19,6 +19,19 @@ export function dryReadMoney(text: string, facts: KeptFact[]): Promise<{
|
|
|
19
19
|
reads: Record<string, number>;
|
|
20
20
|
results: Record<string, number>;
|
|
21
21
|
}>;
|
|
22
|
+
/**
|
|
23
|
+
* The page's RESULT LINES: the lines the given money facts read (`moneyResultLines`), each quote once. Empty when no money fact reads a line (the result lines are then unknown).
|
|
24
|
+
* The one owner of "what is a result row" for phrase facts, shared by the dry read below and by the check list's `!` rows (`phraseInNoResult`).
|
|
25
|
+
* @param {string} text @param {KeptFact[]} facts @returns {string[]}
|
|
26
|
+
*/
|
|
27
|
+
export function resultQuotes(text: string, facts: KeptFact[]): string[];
|
|
28
|
+
/**
|
|
29
|
+
* Is this phrase in the page but in NONE of its result lines (the `phrase-no-result` case)? Sync, for a `!` row the check list is about to build.
|
|
30
|
+
* True only when result lines exist and no line holds the words (case and spacing aside, a plain substring: it never refuses a phrase the run's presence check could pass).
|
|
31
|
+
* With no result line known nothing is guessed (false).
|
|
32
|
+
* @param {string} text @param {KeptFact[]} moneyFacts the line's money facts @param {string} words @returns {boolean}
|
|
33
|
+
*/
|
|
34
|
+
export function phraseInNoResult(text: string, moneyFacts: KeptFact[], words: string): boolean;
|
|
22
35
|
/**
|
|
23
36
|
* The same "can it read" for PHRASE facts (bareloop c550dc8; our failure: m10-walk-flights-3, "Rome" was on the page only in "Track prices from Madrid to
|
|
24
37
|
* Rome" switches, in none of the 18 result lines, so no result could ever say it). A kept phrase fact is read against the page's RESULT LINES = the lines
|
package/types/pagerules.d.ts
CHANGED
|
@@ -26,6 +26,13 @@ export function validReading(shape: unknown, r: unknown): boolean;
|
|
|
26
26
|
* @param {string} s @returns {string|undefined}
|
|
27
27
|
*/
|
|
28
28
|
export function numberAtEnd(s: string): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The ONE owner of a label's separator: the label as the page writes it. The run's checker reads a value right after the signed label, so a page that
|
|
31
|
+
* writes "Departure time: 10:24 AM." can only be read by the label "Departure time:". When EVERY place the page holds the label has a colon right after
|
|
32
|
+
* it, the label is signed with that colon; one bare place leaves it as the look gave it. A plain count of the page's own text, no pattern.
|
|
33
|
+
* @param {string} text the frozen page text @param {string} label a label as normLabel leaves it @returns {string}
|
|
34
|
+
*/
|
|
35
|
+
export function withColon(text: string, label: string): string;
|
|
29
36
|
/**
|
|
30
37
|
* Apply the rules to the AI's map over one saved page. Returns the kept facts and, for everything a rule removed, one `dropped` entry.
|
|
31
38
|
* The order of the rules is the POC's (apply-v3.mjs): found-on-page, then the rules that read the page. A place is read as a phrase.
|
package/types/panel/author.d.ts
CHANGED
|
@@ -385,6 +385,47 @@ export function createAuthor(opts: {
|
|
|
385
385
|
status: number;
|
|
386
386
|
body: any;
|
|
387
387
|
};
|
|
388
|
+
/**
|
|
389
|
+
* `POST /api/author/:id/row-edit` body `{ op: 'drop'|'add', key }` (M16 item 5, am3 (4); hamr 2026-11-13 N-2): the plan card's Drop and Add. $0 and instant: the panel REBUILDS the list from the
|
|
390
|
+
* newest green plan's saved files (src/planrebuild.js), applies the choice through the block's own `rowChoice`, and writes a NEW plan folder `draft-<n>` (records are write-once, the old plan is
|
|
391
|
+
* never touched) booked as a plan of its own with a $0 spend row. It spawns no `fwdloop draft`, builds no provider, makes no call. Signing then reads the new plan (its hash). A refusal is plain
|
|
392
|
+
* words and writes nothing.
|
|
393
|
+
* @param {string} id @param {any} body
|
|
394
|
+
*/
|
|
395
|
+
rowEdit(id: string, body: any): {
|
|
396
|
+
status: number;
|
|
397
|
+
body: {
|
|
398
|
+
ok: boolean;
|
|
399
|
+
refused: string;
|
|
400
|
+
say?: undefined;
|
|
401
|
+
draftId?: undefined;
|
|
402
|
+
n?: undefined;
|
|
403
|
+
plan?: undefined;
|
|
404
|
+
hash?: undefined;
|
|
405
|
+
};
|
|
406
|
+
} | {
|
|
407
|
+
status: number;
|
|
408
|
+
body: {
|
|
409
|
+
ok: boolean;
|
|
410
|
+
refused: string;
|
|
411
|
+
say: string;
|
|
412
|
+
draftId?: undefined;
|
|
413
|
+
n?: undefined;
|
|
414
|
+
plan?: undefined;
|
|
415
|
+
hash?: undefined;
|
|
416
|
+
};
|
|
417
|
+
} | {
|
|
418
|
+
status: number;
|
|
419
|
+
body: {
|
|
420
|
+
ok: boolean;
|
|
421
|
+
draftId: string;
|
|
422
|
+
n: number;
|
|
423
|
+
plan: string;
|
|
424
|
+
hash: string;
|
|
425
|
+
refused?: undefined;
|
|
426
|
+
say?: undefined;
|
|
427
|
+
};
|
|
428
|
+
};
|
|
388
429
|
/**
|
|
389
430
|
* `GET /api/author/live`: the newest draft that is not abandoned or signed, and the newest panel start the human has not cleared
|
|
390
431
|
* (`starting` or `refused`; a `started` one is in Runs) — read from files, never memory.
|
|
@@ -25,7 +25,7 @@ export function parseJobBox(text: string): {
|
|
|
25
25
|
* that line's own `~` lines (several answers for one line keep their order). The job box's own lines are untouched; the card -> prose path
|
|
26
26
|
* (`cardToProse`) then writes the answer as that line's guardrail, so it reaches the signed text and the hash. Pure. An answer for a line
|
|
27
27
|
* the box does not have is NOT added (the caller sees the count). An answer equal (exact string, after trim) to a `~` rule already on that line is not added
|
|
28
|
-
* again, and still counts: it is taken, the line already says it.
|
|
28
|
+
* again (case, spacing and trailing punctuation aside; also not when it is one `; ` part of a `~` line), and still counts: it is taken, the line already says it.
|
|
29
29
|
* @param {string} job @param {{ line: number, answer: string }[]} answers
|
|
30
30
|
* @returns {{ job: string, added: number }}
|
|
31
31
|
*/
|
|
@@ -37,7 +37,7 @@ export function appendAnswersToJob(job: string, answers: {
|
|
|
37
37
|
added: number;
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
|
-
* M10 am21: the submitted job box with ONE `~`
|
|
40
|
+
* M10 am21, M17 am1: the submitted job box with ONE `~` rule of a job line (a whole `~` line, or one `; ` part of it) replaced by the words of an answer. Pure.
|
|
41
41
|
* @param {string} job @param {number} line the job line (step) number @param {string} oldText the `~` words to replace (case and spacing aside) @param {string} newText
|
|
42
42
|
* @returns {{ job: string, replaced: boolean }}
|
|
43
43
|
*/
|
|
@@ -46,11 +46,12 @@ export function replaceRuleOnJob(job: string, line: number, oldText: string, new
|
|
|
46
46
|
replaced: boolean;
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
|
-
* THE one writer of what a set of answers does to the job box and to the picks (M4e am24, M10 am16 (4),
|
|
50
|
-
* (
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @
|
|
49
|
+
* THE one writer of what a set of answers does to the job box and to the picks (M4e am24, M10 am16 (4); M17 am1 (a), one rule in, one rule out): an answer about one of the person's `~` rules
|
|
50
|
+
* (a look ask with a rule number) REPLACES that rule in place, the same line and the same rule number (`replaceRuleOnJob`), and never adds a line beside it. Only an answer that is about no
|
|
51
|
+
* rule (a drafter question, a sheet column ask) is still added word for word as a new `~` line (`appendAnswersToJob`). Picks and left rules are numbered as the asks carried them; a pick carries
|
|
52
|
+
* no `added` words, because its rule's words ARE the answer. A rule-about answer whose rule is no longer on the job line is not applied (the caller sees the count and refuses).
|
|
53
|
+
* @param {string} job @param {{line: number, rule: string|null, left: boolean, check?: Record<string, any>|null, own?: boolean, ruleNo?: number, ruleText?: string, ask?: string, proposal?: string|null}[]} all
|
|
54
|
+
* @returns {{job: string, added: number, picks: {line: number, rule: number|undefined, check: Record<string, any>|null, own?: boolean}[], left: {line: number, rule: number|undefined}[], columns: {line: number, word: string, column: string}[]}}
|
|
54
55
|
*/
|
|
55
56
|
export function applyAnswers(job: string, all: {
|
|
56
57
|
line: number;
|
|
@@ -61,7 +62,7 @@ export function applyAnswers(job: string, all: {
|
|
|
61
62
|
ruleNo?: number;
|
|
62
63
|
ruleText?: string;
|
|
63
64
|
ask?: string;
|
|
64
|
-
|
|
65
|
+
proposal?: string | null;
|
|
65
66
|
}[]): {
|
|
66
67
|
job: string;
|
|
67
68
|
added: number;
|
|
@@ -69,13 +70,17 @@ export function applyAnswers(job: string, all: {
|
|
|
69
70
|
line: number;
|
|
70
71
|
rule: number | undefined;
|
|
71
72
|
check: Record<string, any> | null;
|
|
72
|
-
added: string;
|
|
73
73
|
own?: boolean;
|
|
74
74
|
}[];
|
|
75
75
|
left: {
|
|
76
76
|
line: number;
|
|
77
77
|
rule: number | undefined;
|
|
78
78
|
}[];
|
|
79
|
+
columns: {
|
|
80
|
+
line: number;
|
|
81
|
+
word: string;
|
|
82
|
+
column: string;
|
|
83
|
+
}[];
|
|
79
84
|
};
|
|
80
85
|
/**
|
|
81
86
|
* THE one place a step's `~` lines become its guardrail: several `~` lines under one step are ONE continuous guardrail (hamr ruling 2026-10-09),
|
|
@@ -95,7 +95,7 @@ export function createFlowsDoor(opts: {
|
|
|
95
95
|
} | {
|
|
96
96
|
ok: boolean;
|
|
97
97
|
card: {
|
|
98
|
-
flowType?: "
|
|
98
|
+
flowType?: "tickets" | "mcp" | "plain" | undefined;
|
|
99
99
|
mcp?: any;
|
|
100
100
|
job: string;
|
|
101
101
|
inputs: string;
|
|
@@ -123,7 +123,7 @@ export function createFlowsDoor(opts: {
|
|
|
123
123
|
roles: any;
|
|
124
124
|
pages: Record<string, string>;
|
|
125
125
|
tickets: string[];
|
|
126
|
-
flowType: "
|
|
126
|
+
flowType: "tickets" | "mcp" | "plain";
|
|
127
127
|
mcp: any;
|
|
128
128
|
nextRunId: string;
|
|
129
129
|
lastRunId: string | null;
|
|
@@ -188,7 +188,7 @@ export function createFlowsDoor(opts: {
|
|
|
188
188
|
} | {
|
|
189
189
|
ok: boolean;
|
|
190
190
|
card: {
|
|
191
|
-
flowType?: "
|
|
191
|
+
flowType?: "tickets" | "mcp" | "plain" | undefined;
|
|
192
192
|
mcp?: any;
|
|
193
193
|
job: string;
|
|
194
194
|
inputs: string;
|
|
@@ -216,7 +216,7 @@ export function createFlowsDoor(opts: {
|
|
|
216
216
|
roles: any;
|
|
217
217
|
pages: Record<string, string>;
|
|
218
218
|
tickets: string[];
|
|
219
|
-
flowType: "
|
|
219
|
+
flowType: "tickets" | "mcp" | "plain";
|
|
220
220
|
mcp: any;
|
|
221
221
|
nextRunId: string;
|
|
222
222
|
lastRunId: string | null;
|
package/types/panel/data.d.ts
CHANGED
|
@@ -658,7 +658,7 @@ export function getDraftBlock(flowDir: string, runDir: string): {
|
|
|
658
658
|
* shared-sidecar contamination risk here the way bareloop's gate-audit
|
|
659
659
|
* sidecar had). `null` when the flow/runId doesn't resolve (404).
|
|
660
660
|
* @param {{root: string, flow: string, runId: string, scheduleRead?: (flow: string) => any, home?: string, catalogue?: any, resumeAttempt?: (flow: string, runId: string) => any, startingRun?: (flow: string, runId: string) => boolean, now?: () => number}} opts
|
|
661
|
-
* @returns {{flow:string, runId:string, rows:any[], groups:any[], draft:ReturnType<typeof getDraftBlock>, learnings: any[], needsLeft: string|null, schedule: ReturnType<typeof scheduleAuditWords>, empty:boolean, why:string|null}|null}
|
|
661
|
+
* @returns {{flow:string, runId:string, rows:any[], groups:any[], draft:ReturnType<typeof getDraftBlock>, auditChecks: ReturnType<typeof auditChecksOf>, learnings: any[], needsLeft: string|null, schedule: ReturnType<typeof scheduleAuditWords>, empty:boolean, why:string|null}|null}
|
|
662
662
|
*/
|
|
663
663
|
export function getRunAudit({ root, flow, runId, scheduleRead, home, catalogue, resumeAttempt, startingRun, now, }: {
|
|
664
664
|
root: string;
|
|
@@ -676,6 +676,7 @@ export function getRunAudit({ root, flow, runId, scheduleRead, home, catalogue,
|
|
|
676
676
|
rows: any[];
|
|
677
677
|
groups: any[];
|
|
678
678
|
draft: ReturnType<typeof getDraftBlock>;
|
|
679
|
+
auditChecks: ReturnType<typeof auditChecksOf>;
|
|
679
680
|
learnings: any[];
|
|
680
681
|
needsLeft: string | null;
|
|
681
682
|
schedule: ReturnType<typeof scheduleAuditWords>;
|
|
@@ -756,7 +757,7 @@ export function getJobGrid({ root, flow, catalogue, now, }: {
|
|
|
756
757
|
name: string;
|
|
757
758
|
title: string | null;
|
|
758
759
|
number: number | null;
|
|
759
|
-
bucket: "wait" | "
|
|
760
|
+
bucket: "wait" | "skip" | "done" | "stop";
|
|
760
761
|
glyph: string;
|
|
761
762
|
at: number;
|
|
762
763
|
ex: "r" | "n" | "g" | "q";
|
|
@@ -786,7 +787,7 @@ export function getJobGrid({ root, flow, catalogue, now, }: {
|
|
|
786
787
|
spentUsd: number | null;
|
|
787
788
|
spentComplete: boolean;
|
|
788
789
|
};
|
|
789
|
-
flowType: "
|
|
790
|
+
flowType: "tickets" | "mcp" | "plain" | null;
|
|
790
791
|
} | null;
|
|
791
792
|
/**
|
|
792
793
|
* `GET /api/runs/:flow/:runId/download?i=<n>` (M10 am4): one saved file, or why not.
|
|
@@ -960,5 +961,6 @@ export const RUNS_LIST_LIMITS: Readonly<{
|
|
|
960
961
|
export const NO_DRAFT_WORDS: "no draft record";
|
|
961
962
|
/** M6: what the Job tab says for a run that started before runs kept a copy of their job. */
|
|
962
963
|
export const NO_JOB_COPY_WORDS: "This run started before runs kept a copy of their job, so this shows the job as it is now.";
|
|
964
|
+
import { auditChecksOf } from '../auditchecks.js';
|
|
963
965
|
import { scheduleAuditWords } from '../summary-words.js';
|
|
964
966
|
import { downloadOf } from './result.js';
|
package/types/panel/jobgrid.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export function buildJobGrid({ runs, anyway, now }: {
|
|
|
69
69
|
name: string;
|
|
70
70
|
title: string | null;
|
|
71
71
|
number: number | null;
|
|
72
|
-
bucket: "wait" | "
|
|
72
|
+
bucket: "wait" | "skip" | "done" | "stop";
|
|
73
73
|
glyph: string;
|
|
74
74
|
at: number;
|
|
75
75
|
ex: "r" | "n" | "g" | "q";
|
package/types/pickrecord.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ export function lineKeys(lines: {
|
|
|
10
10
|
occurrence: number;
|
|
11
11
|
}>;
|
|
12
12
|
/**
|
|
13
|
-
* The entries for answers just given, numbered on THIS card (the answer redraft's card: its line and rule numbers are the ones the asks carried).
|
|
13
|
+
* The entries for answers just given, numbered on THIS card (the answer redraft's card: its line and rule numbers are the ones the asks carried; the rule's text is the FINAL rule's words).
|
|
14
14
|
* @param {{n: number, text: string}[]} lines @param {Rule[]} rules
|
|
15
|
-
* @param {{line: number, rule: number, check?: Record<string, any>|null,
|
|
15
|
+
* @param {{line: number, rule: number, check?: Record<string, any>|null, own?: boolean}[]} picks @param {{line: number, rule: number}[]} left
|
|
16
16
|
* @returns {Entry[]}
|
|
17
17
|
*/
|
|
18
18
|
export function entriesFromAnswers(lines: {
|
|
@@ -22,7 +22,6 @@ export function entriesFromAnswers(lines: {
|
|
|
22
22
|
line: number;
|
|
23
23
|
rule: number;
|
|
24
24
|
check?: Record<string, any> | null;
|
|
25
|
-
added?: string | null;
|
|
26
25
|
own?: boolean;
|
|
27
26
|
}[], left: {
|
|
28
27
|
line: number;
|
|
@@ -30,12 +29,11 @@ export function entriesFromAnswers(lines: {
|
|
|
30
29
|
}[]): Entry[];
|
|
31
30
|
/**
|
|
32
31
|
* Decide, for the card in hand, which stored picks are kept and which guardrails must be asked.
|
|
33
|
-
* A pick is KEPT when the job line with its words (same order among equal lines) still has
|
|
34
|
-
*
|
|
35
|
-
* partner left on the card is folded (neither asked nor given the old check) - except an EDITED added line (M10 am21): that one is asked (`pairRule` = its source's number) and the source is folded. Pure.
|
|
32
|
+
* A pick is KEPT when the job line with its words (same order among equal lines) still has a guardrail with the pick's exact words. One rule in, one rule out (hamr 2026-11-14): an answer REPLACED the
|
|
33
|
+
* rule it was asked about, so the stored words are the final rule's words and there is no second line to pair; a rule whose words changed is simply new and asked. Pure.
|
|
36
34
|
* @param {Entry[]} entries @param {{n: number, text: string}[]} lines @param {Rule[]} rules every guardrail the call settles
|
|
37
|
-
* @returns {{picks: {line: number, rule: number, check: Record<string, any>|null,
|
|
38
|
-
* kept: {line: number, rule: number, entry: Entry}[], askRules:
|
|
35
|
+
* @returns {{picks: {line: number, rule: number, check: Record<string, any>|null, own?: boolean}[], left: {line: number, rule: number}[],
|
|
36
|
+
* kept: {line: number, rule: number, entry: Entry}[], askRules: Rule[]}}
|
|
39
37
|
*/
|
|
40
38
|
export function matchRecord(entries: Entry[], lines: {
|
|
41
39
|
n: number;
|
|
@@ -45,7 +43,6 @@ export function matchRecord(entries: Entry[], lines: {
|
|
|
45
43
|
line: number;
|
|
46
44
|
rule: number;
|
|
47
45
|
check: Record<string, any> | null;
|
|
48
|
-
added?: string;
|
|
49
46
|
own?: boolean;
|
|
50
47
|
}[];
|
|
51
48
|
left: {
|
|
@@ -57,15 +54,74 @@ export function matchRecord(entries: Entry[], lines: {
|
|
|
57
54
|
rule: number;
|
|
58
55
|
entry: Entry;
|
|
59
56
|
}[];
|
|
60
|
-
askRules:
|
|
61
|
-
pairRule?: number;
|
|
62
|
-
})[];
|
|
57
|
+
askRules: Rule[];
|
|
63
58
|
};
|
|
64
59
|
/**
|
|
65
60
|
* Read a carried record (the folder's file). A missing or unreadable file is no record (a plan from before am17 has none).
|
|
66
61
|
* @param {string} file @returns {Entry[]|null}
|
|
67
62
|
*/
|
|
68
63
|
export function readRecordFile(file: string): Entry[] | null;
|
|
64
|
+
/**
|
|
65
|
+
* The Drop/Add choices a draft's person made on the confirm card (hamr 2026-11-13, N-2), carried the same way as the picks: tied to the line's words and the row's own name, never to a number.
|
|
66
|
+
* @param {string} file @returns {{lineWords: string, occurrence: number, tail: string, choice: string}[]|null}
|
|
67
|
+
*/
|
|
68
|
+
export function readRowChoices(file: string): {
|
|
69
|
+
lineWords: string;
|
|
70
|
+
occurrence: number;
|
|
71
|
+
tail: string;
|
|
72
|
+
choice: string;
|
|
73
|
+
}[] | null;
|
|
74
|
+
/**
|
|
75
|
+
* The sheet checks the person dropped from a plan (hamr 2026-11-14: a Revise keeps a sheet Drop), carried like the page-row choices: the record's `sheetDropped` entries, each `{key, line, index, check, text}`;
|
|
76
|
+
* the next draft drops a new check with the same id again. Read through readFileInside; a missing or unreadable record is no record.
|
|
77
|
+
* @param {string} file @returns {{key: string, line: number, index: number, check: Record<string, any>, text: string}[]|null}
|
|
78
|
+
*/
|
|
79
|
+
export function readSheetDropped(file: string): {
|
|
80
|
+
key: string;
|
|
81
|
+
line: number;
|
|
82
|
+
index: number;
|
|
83
|
+
check: Record<string, any>;
|
|
84
|
+
text: string;
|
|
85
|
+
}[] | null;
|
|
86
|
+
/**
|
|
87
|
+
* M17 ruling 2: the columns a person agreed for a word of the job's prose (or a word that is not in the rule it was asked about), kept in the same record as the picks and carried like them:
|
|
88
|
+
* tied to the job line's WORDS (and its order among equal lines), never to a number. `columns` entries are `{lineWords, occurrence, word, column}`.
|
|
89
|
+
* @param {string} file @returns {{lineWords: string, occurrence: number, word: string, column: string}[]|null}
|
|
90
|
+
*/
|
|
91
|
+
export function readColumns(file: string): {
|
|
92
|
+
lineWords: string;
|
|
93
|
+
occurrence: number;
|
|
94
|
+
word: string;
|
|
95
|
+
column: string;
|
|
96
|
+
}[] | null;
|
|
97
|
+
/** @param {{n: number, text: string}[]} lines @param {{line: number, word: string, column: string}[]} cols @returns {{lineWords: string, occurrence: number, word: string, column: string}[]} the answers as the record keeps them */
|
|
98
|
+
export function columnEntries(lines: {
|
|
99
|
+
n: number;
|
|
100
|
+
text: string;
|
|
101
|
+
}[], cols: {
|
|
102
|
+
line: number;
|
|
103
|
+
word: string;
|
|
104
|
+
column: string;
|
|
105
|
+
}[]): {
|
|
106
|
+
lineWords: string;
|
|
107
|
+
occurrence: number;
|
|
108
|
+
word: string;
|
|
109
|
+
column: string;
|
|
110
|
+
}[];
|
|
111
|
+
/** @param {{lineWords: string, occurrence: number, word: string, column: string}[]} entries @param {{n: number, text: string}[]} lines @returns {{line: number, word: string, column: string}[]} the record's answers whose job line is still on the card (same words, same order) */
|
|
112
|
+
export function columnsOnLines(entries: {
|
|
113
|
+
lineWords: string;
|
|
114
|
+
occurrence: number;
|
|
115
|
+
word: string;
|
|
116
|
+
column: string;
|
|
117
|
+
}[], lines: {
|
|
118
|
+
n: number;
|
|
119
|
+
text: string;
|
|
120
|
+
}[]): {
|
|
121
|
+
line: number;
|
|
122
|
+
word: string;
|
|
123
|
+
column: string;
|
|
124
|
+
}[];
|
|
69
125
|
/** the record's file, inside a drafting folder only (never a run folder) */
|
|
70
126
|
export const RECORD_FILE: "picks-record.json";
|
|
71
127
|
/** the exact words a kept pick is marked with in the draft log, the Audit and the plan card (M10 am17 (6)) */
|
|
@@ -76,7 +132,7 @@ export type Entry = {
|
|
|
76
132
|
lineWords: string;
|
|
77
133
|
occurrence: number;
|
|
78
134
|
ruleText: string;
|
|
79
|
-
added
|
|
135
|
+
added?: string | null;
|
|
80
136
|
check: Record<string, any> | null;
|
|
81
137
|
own: boolean;
|
|
82
138
|
left: boolean;
|