bareloop 0.55.0 → 0.57.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/CHANGELOG.md +82 -0
- package/README.md +3 -3
- package/bareloop.context.md +69 -209
- package/package.json +2 -2
- package/src/authorflow.js +164 -340
- package/src/authoring.js +7 -127
- package/src/authorjob.js +139 -472
- package/src/authorreadout.js +24 -368
- package/src/authorrun.js +21 -215
- package/src/behaviour.js +14 -0
- package/src/blockasks.js +43 -0
- package/src/bundlerun.js +4 -1
- package/src/checkblock.js +798 -0
- package/src/checklist.js +128 -0
- package/src/checkpick.js +39 -312
- package/src/checkwords.js +3 -1
- package/src/cli.js +3 -3
- package/src/declaredclose.js +38 -108
- package/src/destpoint.js +4 -2
- package/src/draftspend.js +46 -0
- package/src/facts.js +8 -1
- package/src/index.js +3 -43
- package/src/interviewrun.js +13 -8
- package/src/job.js +20 -1
- package/src/jobblock.js +11 -46
- package/src/judged.js +13 -1229
- package/src/kinds.js +5 -347
- package/src/noteask.js +124 -0
- package/src/pagedry.js +27 -5
- package/src/pagemap.js +15 -3
- package/src/pagerules.js +18 -3
- package/src/panel/authorroutes.js +24 -6
- package/src/panel/authorsession.js +222 -177
- package/src/panel/importrun.js +0 -1
- package/src/panel/index.html +198 -26
- package/src/panel/jobplan.js +87 -33
- package/src/panel/server.js +74 -68
- package/src/panel/status.js +3 -0
- package/src/pickrecord.js +34 -55
- package/src/placerule.js +355 -0
- package/src/planrun.js +2 -48
- package/src/promptregisters.js +13 -17
- package/src/providerrows.js +0 -36
- package/src/providers.js +4 -25
- package/src/questionbox.js +104 -0
- package/src/rowedit.js +115 -0
- package/src/rubricstep.js +234 -127
- package/src/run.js +11 -16
- package/src/userrun.js +60 -112
- package/types/authorflow.d.ts +41 -197
- package/types/authoring.d.ts +1 -14
- package/types/authorjob.d.ts +35 -59
- package/types/authorreadout.d.ts +10 -88
- package/types/behaviour.d.ts +12 -0
- package/types/blockasks.d.ts +36 -0
- package/types/checkblock.d.ts +376 -0
- package/types/checklist.d.ts +134 -0
- package/types/checkpick.d.ts +8 -140
- package/types/cli.d.ts +1 -3
- package/types/declaredclose.d.ts +7 -33
- package/types/destpoint.d.ts +2 -0
- package/types/draftspend.d.ts +21 -0
- package/types/index.d.ts +2 -4
- package/types/job.d.ts +8 -0
- package/types/jobblock.d.ts +8 -38
- package/types/judged.d.ts +7 -357
- package/types/kinds.d.ts +3 -104
- package/types/noteask.d.ts +76 -0
- package/types/pagedry.d.ts +13 -0
- package/types/pagemap.d.ts +4 -0
- package/types/pagerules.d.ts +7 -0
- package/types/panel/authorsession.d.ts +47 -5
- package/types/panel/jobgrid.d.ts +8 -8
- package/types/panel/jobplan.d.ts +48 -10
- package/types/panel/server.d.ts +27 -18
- package/types/panel/status.d.ts +5 -0
- package/types/pickrecord.d.ts +20 -13
- package/types/placerule.d.ts +194 -0
- package/types/planrun.d.ts +1 -22
- package/types/providerrows.d.ts +0 -31
- package/types/providers.d.ts +3 -19
- package/types/questionbox.d.ts +87 -0
- package/types/rowedit.d.ts +32 -0
- package/types/rubricstep.d.ts +100 -48
- package/types/run.d.ts +9 -19
- package/types/userrun.d.ts +0 -1
- package/src/calibrate.js +0 -702
- package/src/cardauthor.js +0 -502
- package/src/fitcheck.js +0 -166
- package/types/calibrate.d.ts +0 -201
- package/types/cardauthor.d.ts +0 -358
- package/types/fitcheck.d.ts +0 -113
package/types/authorreadout.d.ts
CHANGED
|
@@ -26,25 +26,6 @@ export function fellBackLines(authoring: {
|
|
|
26
26
|
brokenStages: string[];
|
|
27
27
|
} | null;
|
|
28
28
|
} | null): string[];
|
|
29
|
-
/**
|
|
30
|
-
* THE TWO SIGNED JUDGED ARTIFACTS, as a person reads them before signing
|
|
31
|
-
* (softgreen modules 4+5). Absent on a close that judges nothing, which is why
|
|
32
|
-
* this returns an EMPTY list rather than a "no card" line: a green close has no
|
|
33
|
-
* rubric and saying so every run is noise, not information.
|
|
34
|
-
*
|
|
35
|
-
* The CARD is printed in full — it is short, it is the whole standard the judge
|
|
36
|
-
* will hold the work to, and it is the signer's own words. The CASES are printed
|
|
37
|
-
* as a ROSTER (id, verdict, itemized reds) rather than in full: ten real source
|
|
38
|
-
* artifacts is a page of code the terminal cannot usefully show, and what a
|
|
39
|
-
* signer checks at this surface is that both polarities are there and that each
|
|
40
|
-
* red names something they recognise. The artifacts themselves are in the spec
|
|
41
|
-
* file, which is named right above this block.
|
|
42
|
-
* @param {{closeDecl?: any}} spec the RESOLVED spec
|
|
43
|
-
* @returns {string[]}
|
|
44
|
-
*/
|
|
45
|
-
export function rubricLines({ closeDecl }: {
|
|
46
|
-
closeDecl?: any;
|
|
47
|
-
}): string[];
|
|
48
29
|
/**
|
|
49
30
|
* THE CONFIRM TURN'S OPEN QUESTIONS (PRD item 33 M3 piece 4, ruling 5's D3
|
|
50
31
|
* addendum) — shown at the SIGNING readout, from `authored.json`'s own
|
|
@@ -75,32 +56,6 @@ export function openQuestionLines(confirmed: {
|
|
|
75
56
|
export function answeredQuestionLines(confirmed: {
|
|
76
57
|
answeredQuestions?: string[];
|
|
77
58
|
} | null): string[];
|
|
78
|
-
/**
|
|
79
|
-
* THE CALIBRATION GATE'S OWN READOUT — the one gate that spends money, and the
|
|
80
|
-
* one whose rows a signer has to read case by case.
|
|
81
|
-
*
|
|
82
|
-
* ITEMIZED, never an aggregate percentage: "9/10" tells a person nothing about
|
|
83
|
-
* which line of their own rubric is wrong, and the fix for a miss is a card line
|
|
84
|
-
* or a corrected case (§4.3's ceiling). A CASUALTY prints under its own name and
|
|
85
|
-
* says so, because a dead judge is not a failed set.
|
|
86
|
-
* @param {any} calibration `signing.gates.calibration`
|
|
87
|
-
* @returns {string[]}
|
|
88
|
-
*/
|
|
89
|
-
export function calibrationLines(calibration: any): string[];
|
|
90
|
-
/**
|
|
91
|
-
* The calibration gate's real result as one line a person reads next to the step (hamr, 2026-10-09: the panel
|
|
92
|
-
* showed `calibrating ✓` over a gate that graded 8 of 10 and let 2 attack styles leak). PASS IS THE GATE'S OWN:
|
|
93
|
-
* `ok` is `calibration.ok` as `runCalibration` decided it (every case right as a SET of reds, every style
|
|
94
|
-
* resisted), never recomputed here, so there is no second spelling of the floor. The counts are read from the
|
|
95
|
-
* record (`graded[].ok` is `compareExpectation`, which compares reds as sets); the denominators are the live
|
|
96
|
-
* constants (CALIBRATION_SIZE, the battery length), so a gate that stopped part-way reads "x of 10", not "x of x".
|
|
97
|
-
* @param {any} calibration `signing.gates.calibration`
|
|
98
|
-
* @returns {{ok: boolean, note: string}|null} null when the gate was not reached
|
|
99
|
-
*/
|
|
100
|
-
export function calibrationSummary(calibration: any): {
|
|
101
|
-
ok: boolean;
|
|
102
|
-
note: string;
|
|
103
|
-
} | null;
|
|
104
59
|
/**
|
|
105
60
|
* THE AUTHORING CEILING, parsed from `--budget`. Housed here for the same reason
|
|
106
61
|
* the readout above is: the runner is a script, and a rule no test can reach is a
|
|
@@ -193,12 +148,9 @@ export function plainKinds(): string[];
|
|
|
193
148
|
* An unknown code is NEVER dropped: it becomes a generic sentence that still
|
|
194
149
|
* quotes the code and path, under the kind `unmapped`.
|
|
195
150
|
* @param {PlainRed[]} reds
|
|
196
|
-
* @param {{cases?: any}} [o] the proposed cases, to name a case by its own id
|
|
197
151
|
* @returns {PlainReason[]}
|
|
198
152
|
*/
|
|
199
|
-
export function plainReasons(reds: PlainRed[]
|
|
200
|
-
cases?: any;
|
|
201
|
-
}): PlainReason[];
|
|
153
|
+
export function plainReasons(reds: PlainRed[]): PlainReason[];
|
|
202
154
|
/**
|
|
203
155
|
* WHY one drafting try was refused, in the code's own words: the unique `detail` of each red it raised (the same sentences
|
|
204
156
|
* `draftStopText` quotes at a stop), else the plain `reason` the loop gave (a seed-read failure raises no red). Scrubbed,
|
|
@@ -222,23 +174,6 @@ export function declarationRecord(declaration: unknown): {
|
|
|
222
174
|
declarationText: string;
|
|
223
175
|
declarationCut: true;
|
|
224
176
|
} | {};
|
|
225
|
-
/**
|
|
226
|
-
* THE MESSAGE a person reads when the rubric proposal was refused. Both doors
|
|
227
|
-
* (the panel's failed step and the CLI) print exactly this.
|
|
228
|
-
* @param {{stop: string, reds: PlainRed[], cases?: any, spend?: {knownUsd?: number|null, spendComplete?: boolean|null}|null,
|
|
229
|
-
* source?: 'proposal'|'signer'}} o
|
|
230
|
-
* @returns {string}
|
|
231
|
-
*/
|
|
232
|
-
export function proposalStopText({ stop, reds, cases, spend, source }: {
|
|
233
|
-
stop: string;
|
|
234
|
-
reds: PlainRed[];
|
|
235
|
-
cases?: any;
|
|
236
|
-
spend?: {
|
|
237
|
-
knownUsd?: number | null;
|
|
238
|
-
spendComplete?: boolean | null;
|
|
239
|
-
} | null;
|
|
240
|
-
source?: "proposal" | "signer";
|
|
241
|
-
}): string;
|
|
242
177
|
/**
|
|
243
178
|
* @param {{stop: string, reds?: PlainRed[]|null, refusal?: {detail?: string}|null,
|
|
244
179
|
* spend?: {knownUsd?: number|null, spendComplete?: boolean|null}|null, wholeJob?: boolean}} o `wholeJob` - a rubric job on the person's
|
|
@@ -258,20 +193,11 @@ export function draftStopText({ stop, reds, refusal, spend, wholeJob }: {
|
|
|
258
193
|
wholeJob?: boolean;
|
|
259
194
|
}): string;
|
|
260
195
|
/**
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
* @param {any} closeDecl @returns {boolean}
|
|
264
|
-
*/
|
|
265
|
-
export function isNoCheckRubricClose(closeDecl: any): boolean;
|
|
266
|
-
/**
|
|
267
|
-
* Plain sentences for the reds of a refused signing, one or more per red. Card and practice-case reds reuse the
|
|
268
|
-
* proposal table; an unknown code is a generic sentence that quotes the code.
|
|
269
|
-
* @param {PlainRed[]} reds @param {{cases?: any}} [o]
|
|
196
|
+
* Plain sentences for the reds of a refused signing, one or more per red. An unknown code is a generic sentence that quotes the code.
|
|
197
|
+
* @param {PlainRed[]} reds
|
|
270
198
|
* @returns {{kind: string, sentence: string, todo: string, red: PlainRed}[]}
|
|
271
199
|
*/
|
|
272
|
-
export function signingReasons(reds: PlainRed[]
|
|
273
|
-
cases?: any;
|
|
274
|
-
}): {
|
|
200
|
+
export function signingReasons(reds: PlainRed[]): {
|
|
275
201
|
kind: string;
|
|
276
202
|
sentence: string;
|
|
277
203
|
todo: string;
|
|
@@ -282,17 +208,16 @@ export function signingReasons(reds: PlainRed[], { cases }?: {
|
|
|
282
208
|
export function signingKinds(): string[];
|
|
283
209
|
/**
|
|
284
210
|
* THE MESSAGE a person reads when the signing gates refuse. The panel's failed step and the CLI print exactly this.
|
|
285
|
-
* @param {{reds: PlainRed[], refusal?: {detail?: string}|null,
|
|
286
|
-
* spend?: {knownUsd?: number|null, spendComplete?: boolean|null}|null}} o
|
|
211
|
+
* @param {{reds: PlainRed[], refusal?: {detail?: string}|null, noCheck?: boolean,
|
|
212
|
+
* spend?: {knownUsd?: number|null, spendComplete?: boolean|null}|null}} o `noCheck` = the check block has no built check (block.hasBuiltCheck() is false): the stop is the end check's own words
|
|
287
213
|
* @returns {string}
|
|
288
214
|
*/
|
|
289
|
-
export function signingStopText({ reds, refusal,
|
|
215
|
+
export function signingStopText({ reds, refusal, spend, noCheck }: {
|
|
290
216
|
reds: PlainRed[];
|
|
291
217
|
refusal?: {
|
|
292
218
|
detail?: string;
|
|
293
219
|
} | null;
|
|
294
|
-
|
|
295
|
-
closeDecl?: any;
|
|
220
|
+
noCheck?: boolean;
|
|
296
221
|
spend?: {
|
|
297
222
|
knownUsd?: number | null;
|
|
298
223
|
spendComplete?: boolean | null;
|
|
@@ -301,15 +226,12 @@ export function signingStopText({ reds, refusal, cases, spend, closeDecl }: {
|
|
|
301
226
|
/**
|
|
302
227
|
* The reds as the drafting log keeps them: every structured field, the plain
|
|
303
228
|
* sentence beside it, every string secret-scrubbed and bounded, the list capped.
|
|
304
|
-
* @param {PlainRed[]} reds @param {{
|
|
229
|
+
* @param {PlainRed[]} reds @param {{signing?: boolean}} [o] `signing`: the reds are the signing gates', worded by signingReasons
|
|
305
230
|
* @returns {Record<string, any>[]}
|
|
306
231
|
*/
|
|
307
|
-
export function redsRecord(reds: PlainRed[], {
|
|
308
|
-
cases?: any;
|
|
232
|
+
export function redsRecord(reds: PlainRed[], { signing }?: {
|
|
309
233
|
signing?: boolean;
|
|
310
234
|
}): Record<string, any>[];
|
|
311
|
-
/** the stops this module explains in plain words */
|
|
312
|
-
export const PLAIN_PROPOSAL_STOPS: readonly string[];
|
|
313
235
|
/**
|
|
314
236
|
* ONE owner of the plain sentence for every drafting stop code (hamr 2026-10-09: "a user should get a reason they can
|
|
315
237
|
* understand and do something about"). What happened; `STOP_TODO` below overrides the default "draft again" where that is wrong.
|
package/types/behaviour.d.ts
CHANGED
|
@@ -35,6 +35,18 @@ export function runBehaviour(events: Array<{
|
|
|
35
35
|
repeats: number;
|
|
36
36
|
repeatPct: number | null;
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* How many write/edit attempts the gate DENIED (they fell outside the write scope), from gate-audit records alone. One write-class test (action `type`
|
|
40
|
+
* write|edit, as `workerWrites`' reader in src/planrun.js uses), deny-decision only: an allowed write is never counted. Pure.
|
|
41
|
+
* @param {Array<{action?: {type?: string}, decision?: string|null}>} events
|
|
42
|
+
* @returns {number}
|
|
43
|
+
*/
|
|
44
|
+
export function writesBlocked(events: Array<{
|
|
45
|
+
action?: {
|
|
46
|
+
type?: string;
|
|
47
|
+
};
|
|
48
|
+
decision?: string | null;
|
|
49
|
+
}>): number;
|
|
38
50
|
/**
|
|
39
51
|
* Render a {@link runBehaviour} summary as the agreed printable block
|
|
40
52
|
* (2–4 short lines). A zero-call run formats plainly ("0 tool calls") rather
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** @typedef {{key: string, rowKey: string, line: number, rule: number, source: 'look', ask: 'reading'|'cant-check'|'no-check'|'check', ruleText: string, question: string, counted: boolean, reading?: string, check?: Record<string, any>}} BlockAsk */
|
|
2
|
+
/**
|
|
3
|
+
* The questions the block has open, in the order the person meets them: the look's readings, then the look's can't-checks, then the pick path's asks (a proposal or a can't-check about a rule the pick path owns) in rule order (a proposal is not counted toward the 3-ask cap).
|
|
4
|
+
* A can't-check about a rule the PICK path owns (`scoped`: src/checkpick.js scopedRules, every `~` rule of a file job) is the pick path's own ask, `no-check`, in fwd's words (a "Line N, guardrail ...: I can't check this" ask
|
|
5
|
+
* whose answer the panel records as a pick, so Revise carries it: am17/am18/am21); any other can't-check is the look's own ask about a page.
|
|
6
|
+
* @param {import('./checkblock.js').CheckBlock} block @param {{line: number, rule: number}[]} [scoped] @returns {BlockAsk[]}
|
|
7
|
+
*/
|
|
8
|
+
export function questionsOfBlock(block: import("./checkblock.js").CheckBlock, scoped?: {
|
|
9
|
+
line: number;
|
|
10
|
+
rule: number;
|
|
11
|
+
}[]): BlockAsk[];
|
|
12
|
+
/**
|
|
13
|
+
* The person's choices back into the block, one by one (the choice decides, never the words). A choice the block refuses is returned with its plain reason; the question stays open.
|
|
14
|
+
* @param {import('./checkblock.js').CheckBlock} block @param {{key: string, choice: string, text?: string}[]} choices @returns {{key: string, why: string}[]}
|
|
15
|
+
*/
|
|
16
|
+
export function applyChoices(block: import("./checkblock.js").CheckBlock, choices: {
|
|
17
|
+
key: string;
|
|
18
|
+
choice: string;
|
|
19
|
+
text?: string;
|
|
20
|
+
}[]): {
|
|
21
|
+
key: string;
|
|
22
|
+
why: string;
|
|
23
|
+
}[];
|
|
24
|
+
export type BlockAsk = {
|
|
25
|
+
key: string;
|
|
26
|
+
rowKey: string;
|
|
27
|
+
line: number;
|
|
28
|
+
rule: number;
|
|
29
|
+
source: "look";
|
|
30
|
+
ask: "reading" | "cant-check" | "no-check" | "check";
|
|
31
|
+
ruleText: string;
|
|
32
|
+
question: string;
|
|
33
|
+
counted: boolean;
|
|
34
|
+
reading?: string;
|
|
35
|
+
check?: Record<string, any>;
|
|
36
|
+
};
|
|
@@ -0,0 +1,376 @@
|
|
|
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}} 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 }: {
|
|
47
|
+
texts: Record<string, string>;
|
|
48
|
+
labels: string[];
|
|
49
|
+
maxTries?: number;
|
|
50
|
+
countScope?: (ruleText: string) => boolean;
|
|
51
|
+
asks?: boolean;
|
|
52
|
+
split?: boolean;
|
|
53
|
+
});
|
|
54
|
+
/** 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) */
|
|
55
|
+
split: boolean;
|
|
56
|
+
countScope: (ruleText: string) => boolean;
|
|
57
|
+
asks: boolean;
|
|
58
|
+
texts: Record<string, string>;
|
|
59
|
+
labels: string[];
|
|
60
|
+
maxTries: number;
|
|
61
|
+
/** @type {Row[]} the ONE store */
|
|
62
|
+
rows: Row[];
|
|
63
|
+
/** @type {{n: number, text: string}[]} */
|
|
64
|
+
lines: {
|
|
65
|
+
n: number;
|
|
66
|
+
text: string;
|
|
67
|
+
}[];
|
|
68
|
+
/** @type {any[]} the look's facts as given (a `reading` edit names one) */
|
|
69
|
+
lookFacts: any[];
|
|
70
|
+
/** @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) */
|
|
71
|
+
look: {
|
|
72
|
+
facts: any[];
|
|
73
|
+
dropped: any[];
|
|
74
|
+
} | null;
|
|
75
|
+
/** @type {any[]} replies waiting to be applied by `drive` */
|
|
76
|
+
queue: any[];
|
|
77
|
+
/** @type {any[]} the open questions, set by `ask` */
|
|
78
|
+
open: any[];
|
|
79
|
+
/** @type {string[]} the keys of questions a person did not answer */
|
|
80
|
+
unanswered: string[];
|
|
81
|
+
tries: number;
|
|
82
|
+
/** @type {any[]} every reply's record: each edit, kept or refused with its own reason */
|
|
83
|
+
deltaLog: any[];
|
|
84
|
+
/** @type {any} */
|
|
85
|
+
closeCache: any;
|
|
86
|
+
/** @type {Map<number, 'yes'|'no'|'failed'>} the note question's answer per facts-only line (src/noteask.js; code decides what it means) */
|
|
87
|
+
notes: Map<number, "yes" | "no" | "failed">;
|
|
88
|
+
textOf(source: string | undefined): string;
|
|
89
|
+
/** @param {number} line @param {string} [kind] */
|
|
90
|
+
rowsOn(line: number, kind?: string): Row[];
|
|
91
|
+
ruleRows(line: number): Row[];
|
|
92
|
+
/** 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 */
|
|
93
|
+
saysRule(line: number, rule: number): boolean;
|
|
94
|
+
/** every word the person wrote on a line: the line and its `~` rules */
|
|
95
|
+
said(line: number): string;
|
|
96
|
+
/** @param {Row} r @returns {Row} the row as stored (a repeated key gets `#2`) */
|
|
97
|
+
addRow(r: Row): Row;
|
|
98
|
+
/** @param {{n: number, text: string, rules?: string[]}[]} jobLines */
|
|
99
|
+
fromJob(jobLines: {
|
|
100
|
+
n: number;
|
|
101
|
+
text: string;
|
|
102
|
+
rules?: string[];
|
|
103
|
+
}[]): void;
|
|
104
|
+
/**
|
|
105
|
+
* @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)
|
|
106
|
+
* 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.
|
|
107
|
+
*/
|
|
108
|
+
addLook(facts: any[], dropped?: any[]): void;
|
|
109
|
+
match(): void;
|
|
110
|
+
/** 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) */
|
|
111
|
+
isBang(r: Row): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* 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
|
|
114
|
+
* 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.
|
|
115
|
+
*/
|
|
116
|
+
takeJobWord(r: Row): void;
|
|
117
|
+
/** 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 */
|
|
118
|
+
inJob(r: Row): any;
|
|
119
|
+
/** a `!` count row is built unless a `~` rule on its line already names the number */
|
|
120
|
+
matchCount(r: Row): void;
|
|
121
|
+
matchRule(r: Row): void;
|
|
122
|
+
/** a `~` rule that counts words, bullets, lines or sections: a settled pick builds it; else code proposes the check and asks */
|
|
123
|
+
matchCountRule(r: Row): void;
|
|
124
|
+
/** 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 */
|
|
125
|
+
matchBang(r: Row): void;
|
|
126
|
+
build(): any;
|
|
127
|
+
/** 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 */
|
|
128
|
+
trialOffer(r: Row): void;
|
|
129
|
+
/** 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 */
|
|
130
|
+
buildLine(l: {
|
|
131
|
+
n: number;
|
|
132
|
+
text: string;
|
|
133
|
+
}, lineParts: any[], lineRows: string[][], factLines: Set<number>): void;
|
|
134
|
+
/**
|
|
135
|
+
* The fact(s) a fact-like row builds, checked alone through the bareguard shapes and against the facts already on the line.
|
|
136
|
+
* @param {Row} r @param {any[]} onLine the facts already built on this line @returns {{fresh: any[], src: string, names: string[]} | {why: string}}
|
|
137
|
+
*/
|
|
138
|
+
factsOf(r: Row, onLine: any[]): {
|
|
139
|
+
fresh: any[];
|
|
140
|
+
src: string;
|
|
141
|
+
names: string[];
|
|
142
|
+
} | {
|
|
143
|
+
why: string;
|
|
144
|
+
};
|
|
145
|
+
/** 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 */
|
|
146
|
+
buildDefaults(l: {
|
|
147
|
+
n: number;
|
|
148
|
+
}, lineParts: any[], lineRows: string[][], factLines: Set<number>): void;
|
|
149
|
+
/**
|
|
150
|
+
* The `$` note row of a facts-only line (build 2026-11-14 (b)): the one note question said yes -> a countable nonEmpty text part sits beside the facts (the existing keep-both shape), so the brief
|
|
151
|
+
* 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.
|
|
152
|
+
*/
|
|
153
|
+
buildNote(l: {
|
|
154
|
+
n: number;
|
|
155
|
+
}, lineParts: any[], lineRows: string[][]): void;
|
|
156
|
+
/** 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[]} */
|
|
157
|
+
factOnlyLines(): number[];
|
|
158
|
+
/** the note question's answers, `{line, answer: 'yes'|'no'|'failed'}`; the whole list is reconciled again @param {{line: number, answer: 'yes'|'no'|'failed'}[]} answers */
|
|
159
|
+
setNotes(answers: {
|
|
160
|
+
line: number;
|
|
161
|
+
answer: "yes" | "no" | "failed";
|
|
162
|
+
}[]): void;
|
|
163
|
+
ask(): any[];
|
|
164
|
+
hasOpenQuestions(): boolean;
|
|
165
|
+
hasPendingDelta(): boolean;
|
|
166
|
+
/** @param {string} qKey @param {string} choice @param {string} [text] @returns {{ok: true} | {ok: false, why: string}} */
|
|
167
|
+
applyAnswer(qKey: string, choice: string, text?: string): {
|
|
168
|
+
ok: true;
|
|
169
|
+
} | {
|
|
170
|
+
ok: false;
|
|
171
|
+
why: string;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* 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.
|
|
175
|
+
* @template {{n: number, text: string}} L @param {L[]} jobLines @returns {(L & {rule: string, rules: string[]})[]}
|
|
176
|
+
*/
|
|
177
|
+
jobLinesView<L extends {
|
|
178
|
+
n: number;
|
|
179
|
+
text: string;
|
|
180
|
+
}>(jobLines: L[]): (L & {
|
|
181
|
+
rule: string;
|
|
182
|
+
rules: string[];
|
|
183
|
+
})[];
|
|
184
|
+
/**
|
|
185
|
+
* 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.
|
|
186
|
+
* @param {{picks?: {line: number, rule: number, check: any, own?: boolean}[], left?: {line: number, rule: number}[]}} kept
|
|
187
|
+
*/
|
|
188
|
+
carry({ picks, left }: {
|
|
189
|
+
picks?: {
|
|
190
|
+
line: number;
|
|
191
|
+
rule: number;
|
|
192
|
+
check: any;
|
|
193
|
+
own?: boolean;
|
|
194
|
+
}[];
|
|
195
|
+
left?: {
|
|
196
|
+
line: number;
|
|
197
|
+
rule: number;
|
|
198
|
+
}[];
|
|
199
|
+
}): void;
|
|
200
|
+
/** @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 */
|
|
201
|
+
applyDelta(delta: {
|
|
202
|
+
label?: string;
|
|
203
|
+
pre?: boolean;
|
|
204
|
+
edits?: any[];
|
|
205
|
+
}): {
|
|
206
|
+
label: string | undefined;
|
|
207
|
+
pre: boolean;
|
|
208
|
+
edits: any[];
|
|
209
|
+
};
|
|
210
|
+
applyEdit(e: any, kept: {
|
|
211
|
+
adds: number;
|
|
212
|
+
}): {
|
|
213
|
+
accepted: boolean;
|
|
214
|
+
landedKey: any;
|
|
215
|
+
refusedBecause?: undefined;
|
|
216
|
+
} | {
|
|
217
|
+
refusedBecause: string;
|
|
218
|
+
};
|
|
219
|
+
editAdd(e: any): {
|
|
220
|
+
refusedBecause: string;
|
|
221
|
+
accepted?: undefined;
|
|
222
|
+
landedKey?: undefined;
|
|
223
|
+
} | {
|
|
224
|
+
accepted: boolean;
|
|
225
|
+
landedKey: any;
|
|
226
|
+
refusedBecause?: undefined;
|
|
227
|
+
};
|
|
228
|
+
/** @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 */
|
|
229
|
+
onTheList(line: number, name: string, words: string[]): string | null;
|
|
230
|
+
addCount(e: any): {
|
|
231
|
+
refusedBecause: string;
|
|
232
|
+
accepted?: undefined;
|
|
233
|
+
landedKey?: undefined;
|
|
234
|
+
} | {
|
|
235
|
+
accepted: boolean;
|
|
236
|
+
landedKey: any;
|
|
237
|
+
refusedBecause?: undefined;
|
|
238
|
+
};
|
|
239
|
+
/** the `~` rule rows of a line an edit names by number */
|
|
240
|
+
targetsOf(e: any): any;
|
|
241
|
+
/** 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 */
|
|
242
|
+
wordsReading(l: any, text: string): {
|
|
243
|
+
op: "lt" | "lte" | "gt" | "gte";
|
|
244
|
+
value: number;
|
|
245
|
+
} | {
|
|
246
|
+
op: "between";
|
|
247
|
+
lo: number | string;
|
|
248
|
+
hi: number | string;
|
|
249
|
+
} | undefined;
|
|
250
|
+
editReading(e: any): {
|
|
251
|
+
refusedBecause: string;
|
|
252
|
+
accepted?: undefined;
|
|
253
|
+
landedKey?: undefined;
|
|
254
|
+
} | {
|
|
255
|
+
accepted: boolean;
|
|
256
|
+
landedKey: any;
|
|
257
|
+
refusedBecause?: undefined;
|
|
258
|
+
};
|
|
259
|
+
editPick(e: any): {
|
|
260
|
+
refusedBecause: string;
|
|
261
|
+
accepted?: undefined;
|
|
262
|
+
landedKey?: undefined;
|
|
263
|
+
} | {
|
|
264
|
+
accepted: boolean;
|
|
265
|
+
landedKey: any;
|
|
266
|
+
refusedBecause?: undefined;
|
|
267
|
+
};
|
|
268
|
+
editNot(e: any): {
|
|
269
|
+
refusedBecause: string;
|
|
270
|
+
accepted?: undefined;
|
|
271
|
+
landedKey?: undefined;
|
|
272
|
+
} | {
|
|
273
|
+
accepted: boolean;
|
|
274
|
+
landedKey: any;
|
|
275
|
+
refusedBecause?: undefined;
|
|
276
|
+
};
|
|
277
|
+
reconcile(): any;
|
|
278
|
+
/** 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) */
|
|
279
|
+
drive({ answer }: {
|
|
280
|
+
answer: any;
|
|
281
|
+
}): this;
|
|
282
|
+
card(): {
|
|
283
|
+
key: any;
|
|
284
|
+
line: any;
|
|
285
|
+
by: any;
|
|
286
|
+
state: any;
|
|
287
|
+
reason: any;
|
|
288
|
+
text: string;
|
|
289
|
+
}[];
|
|
290
|
+
/**
|
|
291
|
+
* 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
|
|
292
|
+
* 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).
|
|
293
|
+
*/
|
|
294
|
+
closeView(): {
|
|
295
|
+
stages: any;
|
|
296
|
+
picks: {
|
|
297
|
+
line: number;
|
|
298
|
+
part: any;
|
|
299
|
+
}[];
|
|
300
|
+
list: {
|
|
301
|
+
[k: string]: any;
|
|
302
|
+
}[];
|
|
303
|
+
};
|
|
304
|
+
/** 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}[]} */
|
|
305
|
+
picksOf(c: {
|
|
306
|
+
parts: any[];
|
|
307
|
+
map: {
|
|
308
|
+
part: number;
|
|
309
|
+
line: number;
|
|
310
|
+
}[];
|
|
311
|
+
}): {
|
|
312
|
+
line: number;
|
|
313
|
+
part: any;
|
|
314
|
+
}[];
|
|
315
|
+
/** the standing ruling "a run needs one check": one row that is not the floor is built */
|
|
316
|
+
hasBuiltCheck(): boolean;
|
|
317
|
+
/**
|
|
318
|
+
* 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
|
|
319
|
+
* `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.
|
|
320
|
+
*/
|
|
321
|
+
signedRows(): {
|
|
322
|
+
[k: string]: any;
|
|
323
|
+
}[];
|
|
324
|
+
/** the suggestions code has proved it can build, as the card offers them (Add): `{key, line, text}` */
|
|
325
|
+
suggestedView(): {
|
|
326
|
+
dropped?: boolean | undefined;
|
|
327
|
+
key: any;
|
|
328
|
+
line: any;
|
|
329
|
+
text: string;
|
|
330
|
+
}[];
|
|
331
|
+
/** the suggestions code could not build, in one plain sentence each: the Audit's draft lines (never the card) */
|
|
332
|
+
unbuiltSuggestions(): {
|
|
333
|
+
line: any;
|
|
334
|
+
text: string;
|
|
335
|
+
}[];
|
|
336
|
+
/**
|
|
337
|
+
* 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.
|
|
338
|
+
* @param {string} key @param {'drop'|'add'} choice @returns {{ok: true} | {ok: false, why: string}}
|
|
339
|
+
*/
|
|
340
|
+
rowChoice(key: string, choice: "drop" | "add"): {
|
|
341
|
+
ok: true;
|
|
342
|
+
} | {
|
|
343
|
+
ok: false;
|
|
344
|
+
why: string;
|
|
345
|
+
};
|
|
346
|
+
/** 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}[]} */
|
|
347
|
+
choicesRecord(): {
|
|
348
|
+
lineWords: string;
|
|
349
|
+
occurrence: number;
|
|
350
|
+
tail: string;
|
|
351
|
+
choice: string;
|
|
352
|
+
}[];
|
|
353
|
+
/** 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 */
|
|
354
|
+
carryChoices(rec: {
|
|
355
|
+
lineWords: string;
|
|
356
|
+
occurrence: number;
|
|
357
|
+
tail: string;
|
|
358
|
+
choice: string;
|
|
359
|
+
}[]): void;
|
|
360
|
+
/**
|
|
361
|
+
* 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
|
|
362
|
+
* @returns {{line: number, aiParts: number, kept: number, dropped: number, picks: boolean}[]}
|
|
363
|
+
*/
|
|
364
|
+
retention(): {
|
|
365
|
+
line: number;
|
|
366
|
+
aiParts: number;
|
|
367
|
+
kept: number;
|
|
368
|
+
dropped: number;
|
|
369
|
+
picks: boolean;
|
|
370
|
+
}[];
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* 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),
|
|
374
|
+
* `pick`, `aiReading`, `left`. `state` is built or not-checked; a not-checked row always has a plain `reason`.
|
|
375
|
+
*/
|
|
376
|
+
export type Row = Record<string, any>;
|