bareloop 0.57.0 → 0.58.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 +45 -0
- package/bareloop.context.md +11 -8
- package/package.json +1 -1
- package/src/authorflow.js +50 -62
- package/src/authorjob.js +100 -30
- package/src/authorreadout.js +88 -0
- package/src/authorrun.js +63 -24
- package/src/authorscout.js +9 -1
- package/src/blockasks.js +11 -16
- package/src/checkblock.js +227 -31
- package/src/checkpick.js +0 -5
- package/src/declaredclose.js +38 -6
- package/src/draftspend.js +20 -4
- package/src/fencepointcall.js +76 -0
- package/src/guarddescriptions.js +14 -0
- package/src/kinds.js +5 -1
- package/src/pagemap.js +7 -29
- package/src/panel/authorroutes.js +6 -1
- package/src/panel/authorsession.js +108 -32
- package/src/panel/index.html +38 -13
- package/src/panel/jobplan.js +49 -16
- package/src/panel/server.js +66 -6
- package/src/planrun.js +2 -0
- package/src/promptregisters.js +5 -0
- package/src/questionbox.js +32 -20
- package/src/reviewdoor.js +1 -1
- package/src/rowresults.js +69 -0
- package/src/rubricstep.js +110 -22
- package/src/stagewords.js +24 -0
- package/types/authorflow.d.ts +42 -79
- package/types/authorjob.d.ts +3 -2
- package/types/authorreadout.d.ts +44 -0
- package/types/authorrun.d.ts +20 -0
- package/types/blockasks.d.ts +5 -10
- package/types/checkblock.d.ts +115 -11
- package/types/checkpick.d.ts +0 -3
- package/types/declaredclose.d.ts +3 -1
- package/types/draftspend.d.ts +16 -2
- package/types/fencepointcall.d.ts +68 -0
- package/types/guarddescriptions.d.ts +7 -0
- package/types/kinds.d.ts +1 -0
- package/types/pagemap.d.ts +2 -5
- package/types/panel/authorsession.d.ts +3 -2
- package/types/panel/jobplan.d.ts +13 -1
- package/types/panel/server.d.ts +41 -16
- package/types/questionbox.d.ts +20 -6
- package/types/rowresults.d.ts +23 -0
- package/types/rubricstep.d.ts +34 -7
- package/types/stagewords.d.ts +11 -0
package/types/authorflow.d.ts
CHANGED
|
@@ -7,16 +7,22 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export function linesNamedByReds(reds: Red[], declaration: any, lineNums: number[]): number[];
|
|
9
9
|
/**
|
|
10
|
-
* The machine's keep-or-drop of the try-3 questions. Kept only when its line is one the previous try's reds named and its
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
10
|
+
* The machine's keep-or-drop of the try-3 questions. Kept only when its line is one the previous try's reds named, its text is non-blank, at most {@link MAX_QUESTIONS}, and its TAG is sound
|
|
11
|
+
* (Addendum 2026-11-14 (c) piece 5): the drafter names the `rule` the question is about (a `~` rule number the line really has: the answer REPLACES it) or says `new` (the answer is added as a new rule).
|
|
12
|
+
* A rule the line does not have, a question with neither tag and one with both are dropped; code never guesses which the drafter meant. Every drop comes back with its reason, for the draft's log.
|
|
13
|
+
* @param {any} raw @param {number[]} failedLines @param {{n: number, rules?: string[], rule?: string}[]|null} [jobLines] the person's numbered lines (their rules are what a tag may name)
|
|
14
|
+
* @returns {{kept: {line: number, question: string, rule?: number, new?: true, source?: string, ask?: 'reading'|'cant-check', reading?: string}[], dropped: {reason: string, raw: any}[]}}
|
|
14
15
|
*/
|
|
15
|
-
export function normalizeQuestions(raw: any, failedLines: number[]
|
|
16
|
+
export function normalizeQuestions(raw: any, failedLines: number[], jobLines?: {
|
|
17
|
+
n: number;
|
|
18
|
+
rules?: string[];
|
|
19
|
+
rule?: string;
|
|
20
|
+
}[] | null): {
|
|
16
21
|
kept: {
|
|
17
22
|
line: number;
|
|
18
23
|
question: string;
|
|
19
24
|
rule?: number;
|
|
25
|
+
new?: true;
|
|
20
26
|
source?: string;
|
|
21
27
|
ask?: "reading" | "cant-check";
|
|
22
28
|
reading?: string;
|
|
@@ -144,6 +150,13 @@ export function declarationSchema(catalogue?: Record<string, any>, { verdictType
|
|
|
144
150
|
type: string;
|
|
145
151
|
minLength: number;
|
|
146
152
|
};
|
|
153
|
+
rule: {
|
|
154
|
+
type: string;
|
|
155
|
+
minimum: number;
|
|
156
|
+
};
|
|
157
|
+
new: {
|
|
158
|
+
type: string;
|
|
159
|
+
};
|
|
147
160
|
};
|
|
148
161
|
required: string[];
|
|
149
162
|
};
|
|
@@ -224,45 +237,19 @@ export function declarationSchema(catalogue?: Record<string, any>, { verdictType
|
|
|
224
237
|
items: {
|
|
225
238
|
type: string;
|
|
226
239
|
properties: {
|
|
227
|
-
line: {
|
|
228
|
-
type: string;
|
|
229
|
-
minimum: number;
|
|
230
|
-
description: string;
|
|
231
|
-
};
|
|
232
|
-
rule: {
|
|
233
|
-
type: string;
|
|
234
|
-
minimum: number;
|
|
235
|
-
description: string;
|
|
236
|
-
};
|
|
237
240
|
reason: {
|
|
238
241
|
type: string;
|
|
239
242
|
minLength: number;
|
|
240
243
|
description: string;
|
|
241
244
|
};
|
|
242
|
-
|
|
243
|
-
required: string[];
|
|
244
|
-
additionalProperties: boolean;
|
|
245
|
-
};
|
|
246
|
-
description: string;
|
|
247
|
-
};
|
|
248
|
-
guardLines: {
|
|
249
|
-
type: string;
|
|
250
|
-
items: {
|
|
251
|
-
type: string;
|
|
252
|
-
properties: {
|
|
253
|
-
guard: {
|
|
245
|
+
rule?: {
|
|
254
246
|
type: string;
|
|
255
|
-
|
|
247
|
+
minimum: number;
|
|
256
248
|
description: string;
|
|
257
|
-
};
|
|
258
|
-
|
|
249
|
+
} | undefined;
|
|
250
|
+
line: {
|
|
259
251
|
type: string;
|
|
260
|
-
|
|
261
|
-
uniqueItems: boolean;
|
|
262
|
-
items: {
|
|
263
|
-
type: string;
|
|
264
|
-
minimum: number;
|
|
265
|
-
};
|
|
252
|
+
minimum: number;
|
|
266
253
|
description: string;
|
|
267
254
|
};
|
|
268
255
|
};
|
|
@@ -308,6 +295,13 @@ export function declarationTool(box: {
|
|
|
308
295
|
type: string;
|
|
309
296
|
minLength: number;
|
|
310
297
|
};
|
|
298
|
+
rule: {
|
|
299
|
+
type: string;
|
|
300
|
+
minimum: number;
|
|
301
|
+
};
|
|
302
|
+
new: {
|
|
303
|
+
type: string;
|
|
304
|
+
};
|
|
311
305
|
};
|
|
312
306
|
required: string[];
|
|
313
307
|
};
|
|
@@ -388,45 +382,19 @@ export function declarationTool(box: {
|
|
|
388
382
|
items: {
|
|
389
383
|
type: string;
|
|
390
384
|
properties: {
|
|
391
|
-
line: {
|
|
392
|
-
type: string;
|
|
393
|
-
minimum: number;
|
|
394
|
-
description: string;
|
|
395
|
-
};
|
|
396
|
-
rule: {
|
|
397
|
-
type: string;
|
|
398
|
-
minimum: number;
|
|
399
|
-
description: string;
|
|
400
|
-
};
|
|
401
385
|
reason: {
|
|
402
386
|
type: string;
|
|
403
387
|
minLength: number;
|
|
404
388
|
description: string;
|
|
405
389
|
};
|
|
406
|
-
|
|
407
|
-
required: string[];
|
|
408
|
-
additionalProperties: boolean;
|
|
409
|
-
};
|
|
410
|
-
description: string;
|
|
411
|
-
};
|
|
412
|
-
guardLines: {
|
|
413
|
-
type: string;
|
|
414
|
-
items: {
|
|
415
|
-
type: string;
|
|
416
|
-
properties: {
|
|
417
|
-
guard: {
|
|
390
|
+
rule?: {
|
|
418
391
|
type: string;
|
|
419
|
-
|
|
392
|
+
minimum: number;
|
|
420
393
|
description: string;
|
|
421
|
-
};
|
|
422
|
-
|
|
394
|
+
} | undefined;
|
|
395
|
+
line: {
|
|
423
396
|
type: string;
|
|
424
|
-
|
|
425
|
-
uniqueItems: boolean;
|
|
426
|
-
items: {
|
|
427
|
-
type: string;
|
|
428
|
-
minimum: number;
|
|
429
|
-
};
|
|
397
|
+
minimum: number;
|
|
430
398
|
description: string;
|
|
431
399
|
};
|
|
432
400
|
};
|
|
@@ -541,7 +509,7 @@ export function confirmedBlock(confirmed: {
|
|
|
541
509
|
* names the ONE numbered job line it serves, or the line is refused with a reason; the mandatory guards serve no line.
|
|
542
510
|
* The $0 validator (validateDeclaration, `jobLines`) enforces it and the revise loop feeds a miss back.
|
|
543
511
|
* @param {number} count how many numbered job lines the person wrote
|
|
544
|
-
* @param {string[]} [guardNames] the mandatory guards' names; present = the block also tells
|
|
512
|
+
* @param {string[]} [guardNames] the mandatory guards' names; present = the block also tells that a rule needs no stage and no refusal (code decides what keeps a rule)
|
|
545
513
|
*/
|
|
546
514
|
export function jobLineTagBlock(count: number, guardNames?: string[]): string;
|
|
547
515
|
/**
|
|
@@ -967,7 +935,7 @@ export function confirmPrompt({ answers, questions, labels, facts, listing, writ
|
|
|
967
935
|
* ask: (step: {kind: string, [k: string]: any}) => Promise<string|null>,
|
|
968
936
|
* onPhase?: (phase: string, data?: any) => void, mode?: 'tool'|'text',
|
|
969
937
|
* worseThanBefore?: string, inputs?: {n: number, label: string, value: string}[]|null,
|
|
970
|
-
* jobLines?: {n: number}[]|null, ticket?: boolean, card?: {checkItems: {text: string, fromLine: number[], by: 'agent'|'you'|'default', key?: string}[], notChecked: string[], notCheckedBy?: Record<string, string
|
|
938
|
+
* jobLines?: {n: number}[]|null, ticket?: boolean, card?: {checkItems: {text: string, fromLine: number[], by: 'agent'|'you'|'default', key?: string}[], notChecked: string[], notCheckedBy?: Record<string, string>, closeDecl?: any}|null, block?: CheckBlock|null, cardOf?: (() => any)|null}} o retired field (hamr's ruling 2026-09-28):
|
|
971
939
|
* `worseThanBefore` is never asked any more and defaults to `''` — a
|
|
972
940
|
* caller may still pass a string through (kept for a future, non-ask
|
|
973
941
|
* source of the same constraint), it just never comes from an ask() step.
|
|
@@ -1019,6 +987,7 @@ export function runConfirmTurn({ verdictType, answers, questions, labels, facts,
|
|
|
1019
987
|
}[];
|
|
1020
988
|
notChecked: string[];
|
|
1021
989
|
notCheckedBy?: Record<string, string>;
|
|
990
|
+
closeDecl?: any;
|
|
1022
991
|
} | null;
|
|
1023
992
|
block?: CheckBlock | null;
|
|
1024
993
|
cardOf?: (() => any) | null;
|
|
@@ -1425,16 +1394,7 @@ export const ANSWER_QUESTION_FIELD: Readonly<{
|
|
|
1425
1394
|
* @type {Record<'confirm'|'fix'|'type-goal'|'start-over', string>}
|
|
1426
1395
|
*/
|
|
1427
1396
|
export const CONFIRM_MENU: Record<"confirm" | "fix" | "type-goal" | "start-over", string>;
|
|
1428
|
-
|
|
1429
|
-
* PLAIN-ENGLISH lines for the guards `classGuards` can compose, keyed by
|
|
1430
|
-
* guard NAME — frozen beside {@link CONFIRM_MENU} because both are constants
|
|
1431
|
-
* the confirm turn shows a person verbatim. One entry per guard that exists
|
|
1432
|
-
* in `MECHANICAL_GUARDS` (`src/authoring.js`); {@link confirmProtections}
|
|
1433
|
-
* throws if a guard `classGuards` hands back has no line here, so a battery
|
|
1434
|
-
* that grows a guard fails loudly instead of showing a blank description.
|
|
1435
|
-
* @type {Record<string, string>}
|
|
1436
|
-
*/
|
|
1437
|
-
export const GUARD_DESCRIPTIONS: Record<string, string>;
|
|
1397
|
+
export { GUARD_DESCRIPTIONS };
|
|
1438
1398
|
export const AUTHOR_SYSTEM: string;
|
|
1439
1399
|
/**
|
|
1440
1400
|
* ONE schema per PARAMETER NAME, composed into kinds by the catalogue's own
|
|
@@ -1836,6 +1796,8 @@ export const CONFIRM_STRUCTURE_INSTRUCTION: string;
|
|
|
1836
1796
|
* (`src/checklist.js`), made before the draft, never this turn's.
|
|
1837
1797
|
*/
|
|
1838
1798
|
export const RUBRIC_CONFIRM_NOTE: string;
|
|
1799
|
+
/** What the confirm turn tells the model about a REPO job (model-facing, registered; Addendum 2026-11-15 (d)): the turn plans the goal only, the job's checks are the one list's rows, built by code after the draft. */
|
|
1800
|
+
export const REPO_CONFIRM_NOTE: string;
|
|
1839
1801
|
export const CONFIRM_SYSTEM: string;
|
|
1840
1802
|
/** the confirm turn's system prompt for a rubric job (model-facing, registered): a one-sentence goal, no check of its own */
|
|
1841
1803
|
export const CONFIRM_GOAL_SYSTEM: string;
|
|
@@ -1848,3 +1810,4 @@ export type Red = {
|
|
|
1848
1810
|
};
|
|
1849
1811
|
import { scrubRaw } from './text.js';
|
|
1850
1812
|
import { CheckBlock } from './checkblock.js';
|
|
1813
|
+
import { GUARD_DESCRIPTIONS } from './guarddescriptions.js';
|
package/types/authorjob.d.ts
CHANGED
|
@@ -92,14 +92,14 @@ export function refuseLockedKind(kind: string): Refusal;
|
|
|
92
92
|
* ask?: ((step: {kind: string, [k: string]: any}) => Promise<string|null>)|null,
|
|
93
93
|
* answerQuestions?: ((o: {questions: {line: number, question: string, rule?: number, source?: string, ask?: string, reading?: string, key?: string}[], dropped: {reason: string, raw: any}[], confirmed: any}) =>
|
|
94
94
|
* Promise<{jobLines: {n: number, text: string, rule?: string}[], answers: Record<string|number, any>, left?: {line: number, rule: number}[], picks?: any[], choices?: {key: string, choice: string, text?: string}[]}|null>)|null,
|
|
95
|
-
* pickGenerate?: Function|null, ledgerGenerate?: Function|null, noteFn?: Function|null, onJobLines?: ((jobLines: any[]) => void)|null, editGenerate?: Function|null, carriedPicks?: any[]|null, carriedChoices?: any[]|null, onChoices?: (rec: any[]) => void, onPicks?: (o: {entries: any[], kept: {line: number, rule: number, entry: any}[]}) => void,
|
|
95
|
+
* pickGenerate?: Function|null, ledgerGenerate?: Function|null, fenceGenerate?: Function|null, noteFn?: Function|null, onJobLines?: ((jobLines: any[]) => void)|null, editGenerate?: Function|null, carriedPicks?: any[]|null, carriedChoices?: any[]|null, onChoices?: (rec: any[]) => void, onPicks?: (o: {entries: any[], kept: {line: number, rule: number, entry: any}[]}) => void,
|
|
96
96
|
* confirmGenerate?: Function|null, isRepo?: boolean,
|
|
97
97
|
* langResult?: {kind: string, candidates?: string[], [k: string]: any}|null}} o
|
|
98
98
|
* @returns {Promise<{ok: boolean, refusal: Refusal|null, verdictType: string|null,
|
|
99
99
|
* closeDecl: any, seedRef: string|null, authoring: any, reds: Red[],
|
|
100
100
|
* stop: string|null, cost: any, interview: any, confirmed: any, picked?: {line: number, text: string}[], hasBuiltCheck?: boolean, notBuilt?: {line: number, text: string}[]}>}
|
|
101
101
|
*/
|
|
102
|
-
export function authorCloseForJob({ answers, repoPath, lang, verdictType, questions, jobLines, inputs, generate, provider, seedRef, scout, listing, ceilingUsd, rates, draftThinking, writeScope, onPhase, onCall, seedFn, scoutFn, listingFn, lookFn, authorFn, authorOpts, pickGenerate, ledgerGenerate, noteFn, onJobLines, editGenerate, carriedPicks, onPicks, carriedChoices, onChoices, ask, confirmGenerate, isRepo, langResult, answerQuestions, }: {
|
|
102
|
+
export function authorCloseForJob({ answers, repoPath, lang, verdictType, questions, jobLines, inputs, generate, provider, seedRef, scout, listing, ceilingUsd, rates, draftThinking, writeScope, onPhase, onCall, seedFn, scoutFn, listingFn, lookFn, authorFn, authorOpts, pickGenerate, ledgerGenerate, fenceGenerate, noteFn, onJobLines, editGenerate, carriedPicks, onPicks, carriedChoices, onChoices, ask, confirmGenerate, isRepo, langResult, answerQuestions, }: {
|
|
103
103
|
answers: Record<string | number, any>;
|
|
104
104
|
repoPath?: string | null;
|
|
105
105
|
lang: string;
|
|
@@ -180,6 +180,7 @@ export function authorCloseForJob({ answers, repoPath, lang, verdictType, questi
|
|
|
180
180
|
} | null>) | null;
|
|
181
181
|
pickGenerate?: Function | null;
|
|
182
182
|
ledgerGenerate?: Function | null;
|
|
183
|
+
fenceGenerate?: Function | null;
|
|
183
184
|
noteFn?: Function | null;
|
|
184
185
|
onJobLines?: ((jobLines: any[]) => void) | null;
|
|
185
186
|
editGenerate?: Function | null;
|
package/types/authorreadout.d.ts
CHANGED
|
@@ -232,6 +232,39 @@ export function signingStopText({ reds, refusal, spend, noCheck }: {
|
|
|
232
232
|
export function redsRecord(reds: PlainRed[], { signing }?: {
|
|
233
233
|
signing?: boolean;
|
|
234
234
|
}): Record<string, any>[];
|
|
235
|
+
/** Zero-based indexes of the header and heading lines in a readout's text (split on "\n"): the panel draws those bold. @param {string} text @returns {number[]} */
|
|
236
|
+
export function readoutHeadIndexes(text: string): number[];
|
|
237
|
+
/**
|
|
238
|
+
* The plain-text readout of the draft the person is about to sign (hamr 2026-11-15, copied from fwdloop v0.34.0 `buildReadout`; ASKS, SEND TARGET, flows root and grants are fwd-only and not here).
|
|
239
|
+
* DISPLAY ONLY: built from the signed resolved spec, the draft log and the session's own figures; never signed, never stored, never part of the hash. Pure. The check rows are `cardOfClose`'s (the same reader and tags the card draws),
|
|
240
|
+
* the fence is `fenceRowText`'s, the Not checked rows are `ruleNotCheckedItems`'s plus the `refusedOf` rows it leaves out. The whole text goes through `redactSecrets`.
|
|
241
|
+
* @param {{spec: any, name?: string, modelId?: string|null, rounds: number, costUsd: number|null, spendComplete?: boolean, specHash?: string|null, source?: string, destination?: string,
|
|
242
|
+
* humans?: {question: string, answer: string, line?: number, choice?: string, words?: string}[], ledger?: {key: string, words: string[]}[]|null}} o
|
|
243
|
+
* `costUsd` = the known drafting spend; `spendComplete` false = a provider call was unpriced, so it reads "at least"
|
|
244
|
+
* @returns {string}
|
|
245
|
+
*/
|
|
246
|
+
export function buildReadout({ spec, name, modelId, rounds, costUsd, spendComplete, specHash, source, destination, humans, ledger }: {
|
|
247
|
+
spec: any;
|
|
248
|
+
name?: string;
|
|
249
|
+
modelId?: string | null;
|
|
250
|
+
rounds: number;
|
|
251
|
+
costUsd: number | null;
|
|
252
|
+
spendComplete?: boolean;
|
|
253
|
+
specHash?: string | null;
|
|
254
|
+
source?: string;
|
|
255
|
+
destination?: string;
|
|
256
|
+
humans?: {
|
|
257
|
+
question: string;
|
|
258
|
+
answer: string;
|
|
259
|
+
line?: number;
|
|
260
|
+
choice?: string;
|
|
261
|
+
words?: string;
|
|
262
|
+
}[];
|
|
263
|
+
ledger?: {
|
|
264
|
+
key: string;
|
|
265
|
+
words: string[];
|
|
266
|
+
}[] | null;
|
|
267
|
+
}): string;
|
|
235
268
|
/**
|
|
236
269
|
* ONE owner of the plain sentence for every drafting stop code (hamr 2026-10-09: "a user should get a reason they can
|
|
237
270
|
* understand and do something about"). What happened; `STOP_TODO` below overrides the default "draft again" where that is wrong.
|
|
@@ -241,6 +274,17 @@ export function redsRecord(reds: PlainRed[], { signing }?: {
|
|
|
241
274
|
export const STOP_HEADS: Record<string, string>;
|
|
242
275
|
/** codes the declaration gates (validateJob, validateCloseDecl) raise: one plain sentence covers the family */
|
|
243
276
|
export const DECLARATION_CODES: readonly string[];
|
|
277
|
+
/** The draft readout's section headings: the ONE list (fwd v0.34.0 `READOUT_HEADS`). `buildReadout` writes them from here and `readoutHeadIndexes` finds them by it, so the panel's bold and the text cannot drift. */
|
|
278
|
+
export const READOUT_HEADS: Readonly<{
|
|
279
|
+
inputs: "INPUTS";
|
|
280
|
+
steps: "STEPS";
|
|
281
|
+
fence: "WRITE FENCE";
|
|
282
|
+
notChecked: "REFUSED / NOT CHECKED";
|
|
283
|
+
jobLines: "JOB LINES";
|
|
284
|
+
answers: "YOUR ANSWERS";
|
|
285
|
+
}>;
|
|
286
|
+
/** The readout's top line prefix: ONE owner for the text `buildReadout` writes and the bold `readoutHeadIndexes` finds. */
|
|
287
|
+
export const READOUT_HEADER_PREFIX: "DRAFT READOUT \u2014 NOT SIGNED \u2014 job ";
|
|
244
288
|
export type PlainRed = {
|
|
245
289
|
code: string;
|
|
246
290
|
path: string;
|
package/types/authorrun.d.ts
CHANGED
|
@@ -11,6 +11,26 @@
|
|
|
11
11
|
* `'bareloop author'` so a person who typed that is told to re-run THAT,
|
|
12
12
|
* never a script path they never invoked and may not have on disk.
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* The lines the CLI prints for one question the plan raised: the ask, then (try-3 question, Addendum 2026-11-14 (c) piece 5) what the answer does, in the panel's own words ("This replaces: ..." or
|
|
16
|
+
* "This adds a new rule to line N"). Pure.
|
|
17
|
+
* @param {{index?: number, total?: number, question?: string, line?: number, replaces?: string, adds?: boolean, [k: string]: any}} step @returns {string[]}
|
|
18
|
+
*/
|
|
19
|
+
export function answerPromptLines(step: {
|
|
20
|
+
index?: number;
|
|
21
|
+
total?: number;
|
|
22
|
+
question?: string;
|
|
23
|
+
line?: number;
|
|
24
|
+
replaces?: string;
|
|
25
|
+
adds?: boolean;
|
|
26
|
+
[k: string]: any;
|
|
27
|
+
}): string[];
|
|
28
|
+
/**
|
|
29
|
+
* The confirm turn's plan as the CLI prints it, read from the SAME rows the panel card draws (Addendum 2026-11-14 (c) piece 3): every check is its row (line, tag, words), the protections are the
|
|
30
|
+
* write fence only for a job whose list holds the guards. A plan that carries no row items (a repo job) prints its plain `checks` as before. Pure: one string per printed line.
|
|
31
|
+
* @param {any} p the confirm plan @returns {string[]}
|
|
32
|
+
*/
|
|
33
|
+
export function confirmPlanLines(p: any): string[];
|
|
14
34
|
/**
|
|
15
35
|
* Parses this script's own argv shape and runs the authoring pipeline
|
|
16
36
|
* (scout, declaration loop, D9's gates) against the given (or real)
|
package/types/blockasks.d.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
/** @typedef {{key: string, rowKey: string, line: number, rule: number, source: 'look', ask: 'reading'|'
|
|
1
|
+
/** @typedef {{key: string, rowKey: string, line: number, rule: number, source: 'look', ask: 'reading'|'check', ruleText: string, question: string, counted: boolean, reading?: string, check?: Record<string, any>}} BlockAsk */
|
|
2
2
|
/**
|
|
3
|
-
* The questions the block has open, in the order the person meets them: the look's readings, then the
|
|
4
|
-
*
|
|
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[]}
|
|
3
|
+
* The questions the block has open, in the order the person meets them: the look's readings, then the pick path's check proposals in rule order (a proposal is not counted toward the 3-ask cap).
|
|
4
|
+
* @param {import('./checkblock.js').CheckBlock} block @returns {BlockAsk[]}
|
|
7
5
|
*/
|
|
8
|
-
export function questionsOfBlock(block: import("./checkblock.js").CheckBlock
|
|
9
|
-
line: number;
|
|
10
|
-
rule: number;
|
|
11
|
-
}[]): BlockAsk[];
|
|
6
|
+
export function questionsOfBlock(block: import("./checkblock.js").CheckBlock): BlockAsk[];
|
|
12
7
|
/**
|
|
13
8
|
* 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
9
|
* @param {import('./checkblock.js').CheckBlock} block @param {{key: string, choice: string, text?: string}[]} choices @returns {{key: string, why: string}[]}
|
|
@@ -27,7 +22,7 @@ export type BlockAsk = {
|
|
|
27
22
|
line: number;
|
|
28
23
|
rule: number;
|
|
29
24
|
source: "look";
|
|
30
|
-
ask: "reading" | "
|
|
25
|
+
ask: "reading" | "check";
|
|
31
26
|
ruleText: string;
|
|
32
27
|
question: string;
|
|
33
28
|
counted: boolean;
|
package/types/checkblock.d.ts
CHANGED
|
@@ -7,6 +7,23 @@ export function renderCard(rows: Row[]): {
|
|
|
7
7
|
reason: any;
|
|
8
8
|
text: string;
|
|
9
9
|
}[];
|
|
10
|
+
/**
|
|
11
|
+
* The Drop/Add choices of rows, tied to the line's words (not its number) and the row's own name, so a Revise keeps them. ONE owner for the block's own record and for a Drop made on a signed card.
|
|
12
|
+
* @param {{n: number, text: string}[]} lines @param {{line: number, key: string, choice: string}[]} picks @returns {{lineWords: string, occurrence: number, tail: string, choice: string}[]}
|
|
13
|
+
*/
|
|
14
|
+
export function choiceEntries(lines: {
|
|
15
|
+
n: number;
|
|
16
|
+
text: string;
|
|
17
|
+
}[], picks: {
|
|
18
|
+
line: number;
|
|
19
|
+
key: string;
|
|
20
|
+
choice: string;
|
|
21
|
+
}[]): {
|
|
22
|
+
lineWords: string;
|
|
23
|
+
occurrence: number;
|
|
24
|
+
tail: string;
|
|
25
|
+
choice: string;
|
|
26
|
+
}[];
|
|
10
27
|
/**
|
|
11
28
|
* 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
29
|
* `pick`, `aiReading`, `left`. `state` is built or not-checked; a not-checked row always has a plain `reason`.
|
|
@@ -26,7 +43,6 @@ export const EDIT_OPS: readonly string[];
|
|
|
26
43
|
export const REASON: Readonly<{
|
|
27
44
|
left: "You chose to leave it Not checked, so you judge it at Accept.";
|
|
28
45
|
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
46
|
noRule: "No rule can check this, so you judge it at Accept.";
|
|
31
47
|
waitingPick: "waiting for your answer on the proposed check";
|
|
32
48
|
waitingReading: "waiting for your answer on the reading";
|
|
@@ -34,6 +50,7 @@ export const REASON: Readonly<{
|
|
|
34
50
|
manyInputs: "the job has more than one input and code cannot pick which one the claims quote";
|
|
35
51
|
oneSidedTime: "a time limit the AI proposes must be a range, so you judge it at Accept.";
|
|
36
52
|
countNeedsFact: "a result count needs a fact to count; this line has none";
|
|
53
|
+
countNeedsSuggested: "a result count needs a fact to count; add the suggested fact on this line to count its results";
|
|
37
54
|
lookNoWords: "the page does not hold the words of the look's fact for this rule";
|
|
38
55
|
afterLast: "no more tries: Start over (rows are never changed by the AI after the last try)";
|
|
39
56
|
noPick: "No check was picked for it, so you judge it at Accept.";
|
|
@@ -42,15 +59,28 @@ export const REASON: Readonly<{
|
|
|
42
59
|
suggested: "Suggested: not in your job, so it is not checked unless you add it.";
|
|
43
60
|
}>;
|
|
44
61
|
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 }: {
|
|
62
|
+
/** @param {{texts: Record<string, string>, labels: string[], maxTries?: number, countScope?: (ruleText: string) => boolean, asks?: boolean, split?: boolean, repo?: {files: string[]|null, writeScope: string[]|null}|null}} 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) */
|
|
63
|
+
constructor({ texts, labels, maxTries, countScope, asks, split, repo }: {
|
|
47
64
|
texts: Record<string, string>;
|
|
48
65
|
labels: string[];
|
|
49
66
|
maxTries?: number;
|
|
50
67
|
countScope?: (ruleText: string) => boolean;
|
|
51
68
|
asks?: boolean;
|
|
52
69
|
split?: boolean;
|
|
70
|
+
repo?: {
|
|
71
|
+
files: string[] | null;
|
|
72
|
+
writeScope: string[] | null;
|
|
73
|
+
} | null;
|
|
53
74
|
});
|
|
75
|
+
/** a repo job's check TYPE (the only thing that varies): `files` = the repo listing at the seed (null until it is read), `writeScope` = the signed write fence. Null = a rubric job @type {{files: string[]|null, writeScope: string[]|null}|null} */
|
|
76
|
+
repo: {
|
|
77
|
+
files: string[] | null;
|
|
78
|
+
writeScope: string[] | null;
|
|
79
|
+
} | null;
|
|
80
|
+
/** @type {any[]} a repo job's drafted stages as the drafter wrote them (guards included); the rows of the work stages are in `rows`, the close's stages are these minus the dropped ones */
|
|
81
|
+
declared: any[];
|
|
82
|
+
/** the job lines a mandatory guard already covers (`guardLines`): a repo stage is never dropped when it is the last thing covering a line @type {Set<number>} */
|
|
83
|
+
guardCover: Set<number>;
|
|
54
84
|
/** 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
85
|
split: boolean;
|
|
56
86
|
countScope: (ruleText: string) => boolean;
|
|
@@ -85,6 +115,12 @@ export class CheckBlock {
|
|
|
85
115
|
closeCache: any;
|
|
86
116
|
/** @type {Map<number, 'yes'|'no'|'failed'>} the note question's answer per facts-only line (src/noteask.js; code decides what it means) */
|
|
87
117
|
notes: Map<number, "yes" | "no" | "failed">;
|
|
118
|
+
/** @type {string[]} the NAMES of the mandatory guards the close carries (Addendum 2026-11-14 (c) piece 2): each is a job-level `$` row of the signed list, never a row of `rows` (no line, so no check of a line) */
|
|
119
|
+
guards: string[];
|
|
120
|
+
/** @type {string[]|null} the write fence of the job: a job-level `$` row of the signed list (hamr 2026-11-15), never a row of `rows` */
|
|
121
|
+
fence: string[] | null;
|
|
122
|
+
/** the mandatory guards of this job's class, by name: signedRows() adds one `$` guard row for each, once for the whole job @param {string[]} names @param {string[]|null} [fence] the signed write fence, when the job has one */
|
|
123
|
+
setGuards(names: string[], fence?: string[] | null): void;
|
|
88
124
|
textOf(source: string | undefined): string;
|
|
89
125
|
/** @param {number} line @param {string} [kind] */
|
|
90
126
|
rowsOn(line: number, kind?: string): Row[];
|
|
@@ -160,10 +196,61 @@ export class CheckBlock {
|
|
|
160
196
|
line: number;
|
|
161
197
|
answer: "yes" | "no" | "failed";
|
|
162
198
|
}[]): void;
|
|
199
|
+
/**
|
|
200
|
+
* The person's job lines as they stand now (a try-3 answer replaced or added a `~` rule): a rule whose words changed is the person's own typed words (its old answer is void), a new rule is a new row, a rule that is gone leaves.
|
|
201
|
+
* @param {{n: number, text: string, rules?: string[]}[]} jobLines
|
|
202
|
+
*/
|
|
203
|
+
syncJob(jobLines: {
|
|
204
|
+
n: number;
|
|
205
|
+
text: string;
|
|
206
|
+
rules?: string[];
|
|
207
|
+
}[]): void;
|
|
208
|
+
/** the repo listing at the seed, once it is read (the rule rows are judged against it) @param {string[]|null} files */
|
|
209
|
+
setListing(files: string[] | null): void;
|
|
210
|
+
/**
|
|
211
|
+
* The drafter's work stages as `!` rows (a mandatory guard is not one), and a Not checked `!` row for each line the drafter refused: the refusal is only the SIGNAL, the reason is code's (`REASON.noRule`, the one table). Idempotent: the stage rows are made again from `stages`.
|
|
212
|
+
* @param {any[]} stages the declaration's stages, guards included @param {{guardNames?: string[], refused?: any[], guardLines?: any[]}} [o]
|
|
213
|
+
*/
|
|
214
|
+
addStages(stages: any[], { guardNames, refused, guardLines }?: {
|
|
215
|
+
guardNames?: string[];
|
|
216
|
+
refused?: any[];
|
|
217
|
+
guardLines?: any[];
|
|
218
|
+
}): void;
|
|
219
|
+
/** the repo paths outside the write scope (the pointing call is shown these); empty when there is no listing or no fence @returns {string[]} */
|
|
220
|
+
outsideScope(): string[];
|
|
221
|
+
/** the folders every file of which lies outside the write scope (a rule may ask such a folder to stay as it is, written `folder/`); the pointing call is shown them beside the files @returns {string[]} */
|
|
222
|
+
outsideFolders(): string[];
|
|
223
|
+
/** is this repo file a place the run may change? @param {string} f */
|
|
224
|
+
inScope(f: string): boolean;
|
|
225
|
+
/** the listing paths (a file, or a folder written `folder/`) a text names as whole tokens @param {string} text @returns {string[]} */
|
|
226
|
+
namedPaths(text: string): string[];
|
|
227
|
+
/**
|
|
228
|
+
* Code's proof of a fence pointer: `path` is on the listing, the rule's own words name it (whole token; a folder as `folder/`), and neither it nor any other path those words name holds a place the run may change.
|
|
229
|
+
* @param {string} text the rule's own words @param {string} path @returns {boolean}
|
|
230
|
+
*/
|
|
231
|
+
provesFence(text: string, path: string): boolean;
|
|
232
|
+
/** the AI's pointer at a repo `~` rule ({op:'fence', line, rule, path}): judged ALONE; code's proof decides, the AI only points @param {any} e */
|
|
233
|
+
editFence(e: any): {
|
|
234
|
+
refusedBecause: string;
|
|
235
|
+
accepted?: undefined;
|
|
236
|
+
landedKey?: undefined;
|
|
237
|
+
} | {
|
|
238
|
+
accepted: boolean;
|
|
239
|
+
landedKey: any;
|
|
240
|
+
refusedBecause?: undefined;
|
|
241
|
+
};
|
|
242
|
+
/** a repo `~` rule: kept by the write fence when the AI pointed at a path and code proves it from the person's words; else the same ask the rubric flow uses (the person's Agree / Drop it / own words), Not checked when nobody can be asked @param {Row} r */
|
|
243
|
+
matchRepoRule(r: Row): void;
|
|
244
|
+
/** a repo job's rows: a rule is built with the path the fence keeps for it or Not checked with its reason; a work stage is built, or dropped when the person dropped it and it is not the last thing on its line */
|
|
245
|
+
buildRepo(): any;
|
|
246
|
+
/** may this repo work-stage row be dropped? Never the last check on a line it serves (another live stage, a guard's `guardLines` or a line refusal still covers it), and never the last work stage of the job @param {Row} r */
|
|
247
|
+
dropOk(r: Row): any;
|
|
248
|
+
/** a row the person can Drop (and Add back): a `!` fact, phrase or count; in a repo job also a work stage the drafter wrote @param {Row} r */
|
|
249
|
+
droppable(r: Row): boolean;
|
|
163
250
|
ask(): any[];
|
|
164
251
|
hasOpenQuestions(): boolean;
|
|
165
252
|
hasPendingDelta(): boolean;
|
|
166
|
-
/** @param {string} qKey @param {string} choice @param {string} [text] @returns {{ok: true} | {ok: false, why: string}} */
|
|
253
|
+
/** @param {string} qKey @param {string} choice @param {string} [text] the person's correction (a reading question only) @returns {{ok: true} | {ok: false, why: string}} */
|
|
167
254
|
applyAnswer(qKey: string, choice: string, text?: string): {
|
|
168
255
|
ok: true;
|
|
169
256
|
} | {
|
|
@@ -210,11 +297,13 @@ export class CheckBlock {
|
|
|
210
297
|
applyEdit(e: any, kept: {
|
|
211
298
|
adds: number;
|
|
212
299
|
}): {
|
|
300
|
+
refusedBecause: string;
|
|
301
|
+
accepted?: undefined;
|
|
302
|
+
landedKey?: undefined;
|
|
303
|
+
} | {
|
|
213
304
|
accepted: boolean;
|
|
214
305
|
landedKey: any;
|
|
215
306
|
refusedBecause?: undefined;
|
|
216
|
-
} | {
|
|
217
|
-
refusedBecause: string;
|
|
218
307
|
};
|
|
219
308
|
editAdd(e: any): {
|
|
220
309
|
refusedBecause: string;
|
|
@@ -275,7 +364,7 @@ export class CheckBlock {
|
|
|
275
364
|
refusedBecause?: undefined;
|
|
276
365
|
};
|
|
277
366
|
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) */
|
|
367
|
+
/** 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
368
|
drive({ answer }: {
|
|
280
369
|
answer: any;
|
|
281
370
|
}): this;
|
|
@@ -292,14 +381,22 @@ export class CheckBlock {
|
|
|
292
381
|
* 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
382
|
*/
|
|
294
383
|
closeView(): {
|
|
384
|
+
fence?: string[] | undefined;
|
|
295
385
|
stages: any;
|
|
296
386
|
picks: {
|
|
297
387
|
line: number;
|
|
298
388
|
part: any;
|
|
299
389
|
}[];
|
|
300
|
-
list: {
|
|
390
|
+
list: ({
|
|
301
391
|
[k: string]: any;
|
|
302
|
-
}
|
|
392
|
+
} | {
|
|
393
|
+
line: number;
|
|
394
|
+
key: string;
|
|
395
|
+
from: string;
|
|
396
|
+
by: string;
|
|
397
|
+
kind: string;
|
|
398
|
+
state: string;
|
|
399
|
+
})[];
|
|
303
400
|
};
|
|
304
401
|
/** 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
402
|
picksOf(c: {
|
|
@@ -318,9 +415,16 @@ export class CheckBlock {
|
|
|
318
415
|
* 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
416
|
* `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
417
|
*/
|
|
321
|
-
signedRows(): {
|
|
418
|
+
signedRows(): ({
|
|
322
419
|
[k: string]: any;
|
|
323
|
-
}
|
|
420
|
+
} | {
|
|
421
|
+
line: number;
|
|
422
|
+
key: string;
|
|
423
|
+
from: string;
|
|
424
|
+
by: string;
|
|
425
|
+
kind: string;
|
|
426
|
+
state: string;
|
|
427
|
+
})[];
|
|
324
428
|
/** the suggestions code has proved it can build, as the card offers them (Add): `{key, line, text}` */
|
|
325
429
|
suggestedView(): {
|
|
326
430
|
dropped?: boolean | undefined;
|
package/types/checkpick.d.ts
CHANGED
|
@@ -152,9 +152,6 @@ export function suggestChannel(): {
|
|
|
152
152
|
execute: (args: any) => Promise<string>;
|
|
153
153
|
};
|
|
154
154
|
};
|
|
155
|
-
/** the can't-check ask, as the signed words say it */
|
|
156
|
-
export const CANT_CHECK_WORDS: "I can't check this. Your own words, or Not checked?";
|
|
157
|
-
export function HOW_TO_ANSWER(line: number, agree: boolean): string;
|
|
158
155
|
export type Rule = {
|
|
159
156
|
line: number;
|
|
160
157
|
rule: number;
|
package/types/declaredclose.d.ts
CHANGED
|
@@ -105,7 +105,8 @@ export function guardNames(closeDecl: any, verdictType: string): string[];
|
|
|
105
105
|
* @param {{timeoutMs?: number, cwd?: string, seedRef?: string,
|
|
106
106
|
* seedTrees?: any, gapCap?: number, maxBuffer?: number, baselineMode?: 'auto'|'worktree',
|
|
107
107
|
* humanRuling?: {decision: string, text?: string|null}|null,
|
|
108
|
-
* onRubricEvidence?: ((e: any) => void)|null}} [opts]
|
|
108
|
+
* onRubricEvidence?: ((e: any) => void)|null, list?: any[]|null}} [opts]
|
|
109
|
+
* `list` = the signed one check list (`closeDecl.list`): given, each stage entry records a RESULT PER ROW (`rows`, plus `unclaimed` words for a gap no row owns), report-only (Addendum 2026-11-14 (c) piece 4)
|
|
109
110
|
* @returns {Promise<any>}
|
|
110
111
|
*/
|
|
111
112
|
export function runDeclaredStages(stages: any[], redact?: (s: string) => string, opts?: {
|
|
@@ -121,6 +122,7 @@ export function runDeclaredStages(stages: any[], redact?: (s: string) => string,
|
|
|
121
122
|
text?: string | null;
|
|
122
123
|
} | null;
|
|
123
124
|
onRubricEvidence?: ((e: any) => void) | null;
|
|
125
|
+
list?: any[] | null;
|
|
124
126
|
}): Promise<any>;
|
|
125
127
|
/**
|
|
126
128
|
* The trend reader's input for ONE close verdict, whichever executor produced
|
package/types/draftspend.d.ts
CHANGED
|
@@ -43,10 +43,20 @@ export function sessionDirForRow(row: {
|
|
|
43
43
|
home?: string;
|
|
44
44
|
sessionsRoot?: string;
|
|
45
45
|
}): string | null;
|
|
46
|
+
/**
|
|
47
|
+
* What an answered look question DECIDED, in one spelling for every view (the draft readout and the Audit drafting table): agreed / you wrote / dropped.
|
|
48
|
+
* `null` for any other answer, and for an old log row with no `words` (those keep the question-and-answer form).
|
|
49
|
+
* @param {{choice?: string, words?: string}} h
|
|
50
|
+
* @returns {string|null}
|
|
51
|
+
*/
|
|
52
|
+
export function decidedWords(h: {
|
|
53
|
+
choice?: string;
|
|
54
|
+
words?: string;
|
|
55
|
+
}): string | null;
|
|
46
56
|
/**
|
|
47
57
|
* PRD v1.106 Part 5 Q1: one answered question as the two lines the Audit's drafting table shows under its step. ONE place owns the words.
|
|
48
|
-
* @param {{question: string, answer: string, source?: string, line?: number, at?: string}} h
|
|
49
|
-
* @returns {{question: string, answer: string, source: string, line?: number, at?: string, askedText: string, saidText: string}}
|
|
58
|
+
* @param {{question: string, answer: string, source?: string, line?: number, at?: string, choice?: string, words?: string}} h
|
|
59
|
+
* @returns {{question: string, answer: string, source: string, line?: number, at?: string, choice?: string, words?: string, askedText: string, saidText: string}}
|
|
50
60
|
*/
|
|
51
61
|
export function humanRowWords(h: {
|
|
52
62
|
question: string;
|
|
@@ -54,12 +64,16 @@ export function humanRowWords(h: {
|
|
|
54
64
|
source?: string;
|
|
55
65
|
line?: number;
|
|
56
66
|
at?: string;
|
|
67
|
+
choice?: string;
|
|
68
|
+
words?: string;
|
|
57
69
|
}): {
|
|
58
70
|
question: string;
|
|
59
71
|
answer: string;
|
|
60
72
|
source: string;
|
|
61
73
|
line?: number;
|
|
62
74
|
at?: string;
|
|
75
|
+
choice?: string;
|
|
76
|
+
words?: string;
|
|
63
77
|
askedText: string;
|
|
64
78
|
saidText: string;
|
|
65
79
|
};
|