fwdloop 0.32.0 → 0.33.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.
Files changed (93) hide show
  1. package/bin/fwdloop +8 -2
  2. package/package.json +2 -2
  3. package/src/auditchecks.js +53 -0
  4. package/src/authoring.js +52 -12
  5. package/src/blockasks.js +44 -0
  6. package/src/blockassemble.js +140 -0
  7. package/src/blockdraft.js +91 -0
  8. package/src/blocklines.js +30 -0
  9. package/src/blockpick.js +165 -0
  10. package/src/cardlist.js +19 -0
  11. package/src/checkblock.js +804 -0
  12. package/src/checked.js +48 -9
  13. package/src/checklist.js +99 -0
  14. package/src/checklistsign.js +93 -0
  15. package/src/checkwords.js +20 -1
  16. package/src/cited-record.js +21 -1
  17. package/src/citedcheck.js +162 -7
  18. package/src/closers.js +41 -3
  19. package/src/declaration.js +25 -2
  20. package/src/declaredclose.js +4 -0
  21. package/src/draft-steps.js +3 -1
  22. package/src/drafter.js +205 -122
  23. package/src/factwords.js +112 -0
  24. package/src/inputlook.js +53 -0
  25. package/src/labelscan.js +162 -0
  26. package/src/pageask.js +4 -1
  27. package/src/pagedropwords.js +11 -1
  28. package/src/panel/author.js +73 -4
  29. package/src/panel/authorcard.js +9 -6
  30. package/src/panel/data.js +41 -9
  31. package/src/panel/index.html +202 -13
  32. package/src/panel/result.js +4 -3
  33. package/src/panel/server.js +3 -1
  34. package/src/pickrecord.js +28 -0
  35. package/src/placerule.js +398 -0
  36. package/src/planrebuild.js +206 -0
  37. package/src/rowedit.js +118 -0
  38. package/src/rubricstep.js +264 -0
  39. package/src/runfile.js +4 -2
  40. package/src/runner.js +67 -10
  41. package/src/setup.js +10 -4
  42. package/src/sheetblock.js +6 -2
  43. package/src/sheetchecks.js +49 -64
  44. package/src/sheetclaims.js +12 -32
  45. package/src/sheetoffer.js +24 -52
  46. package/src/sheetrows.js +107 -0
  47. package/src/sheetrun.js +13 -10
  48. package/src/summary-words.js +3 -3
  49. package/src/try-checks.js +31 -12
  50. package/src/types.js +1 -0
  51. package/types/auditchecks.d.ts +24 -0
  52. package/types/authoring.d.ts +18 -1
  53. package/types/blockasks.d.ts +37 -0
  54. package/types/blockassemble.d.ts +33 -0
  55. package/types/blockdraft.d.ts +83 -0
  56. package/types/blocklines.d.ts +31 -0
  57. package/types/blockpick.d.ts +41 -0
  58. package/types/cardlist.d.ts +21 -0
  59. package/types/checkblock.d.ts +363 -0
  60. package/types/checked.d.ts +16 -2
  61. package/types/checklist.d.ts +115 -0
  62. package/types/checklistsign.d.ts +27 -0
  63. package/types/checkwords.d.ts +5 -0
  64. package/types/cited-record.d.ts +9 -0
  65. package/types/citedcheck.d.ts +33 -2
  66. package/types/closers.d.ts +24 -2
  67. package/types/declaredclose.d.ts +2 -0
  68. package/types/drafter.d.ts +15 -361
  69. package/types/factwords.d.ts +38 -0
  70. package/types/inputlook.d.ts +49 -0
  71. package/types/labelscan.d.ts +35 -0
  72. package/types/pageask.d.ts +2 -0
  73. package/types/panel/author.d.ts +41 -0
  74. package/types/panel/authorcard.d.ts +1 -1
  75. package/types/panel/data.d.ts +4 -2
  76. package/types/panel/jobgrid.d.ts +1 -1
  77. package/types/pickrecord.d.ts +22 -0
  78. package/types/placerule.d.ts +208 -0
  79. package/types/planrebuild.d.ts +52 -0
  80. package/types/provider.d.ts +1 -1
  81. package/types/rowedit.d.ts +33 -0
  82. package/types/rubricstep.d.ts +60 -0
  83. package/types/runfile.d.ts +5 -2
  84. package/types/runner.d.ts +45 -1
  85. package/types/sheetblock.d.ts +1 -0
  86. package/types/sheetchecks.d.ts +10 -17
  87. package/types/sheetclaims.d.ts +2 -1
  88. package/types/sheetoffer.d.ts +5 -5
  89. package/types/sheetrows.d.ts +73 -0
  90. package/types/sheetrun.d.ts +4 -4
  91. package/types/summary-words.d.ts +2 -1
  92. package/types/try-checks.d.ts +4 -2
  93. package/types/types.d.ts +8 -0
@@ -132,12 +132,12 @@ const splitNext = (rows) => ({ next: rows.map(([l, t]) => `${l} ${t}`).join('\n'
132
132
  /**
133
133
  * ENDED / NEXT of a finished run. Every outcome the history row can hold has a fixed sentence; an unknown one gets an honest fixed fallback
134
134
  * that names the code and guesses nothing. `null` when there is no ending (still running, waiting, or no history row and not died).
135
- * @param {{outcome: string|null, died?: boolean, line: number|null, destination: string|null, canResume: boolean, home?: string, skipReason?: string}} f
135
+ * @param {{outcome: string|null, died?: boolean, line: number|null, destination: string|null, canResume: boolean, home?: string, skipReason?: string, anywayOffered?: boolean}} f
136
136
  * @returns {{reason: string, next: string, rows?: Array<[string, string]>}|null}
137
137
  */
138
138
  export function endedWords(f) {
139
139
  const {
140
- outcome, died = false, line, destination, canResume, home, skipReason,
140
+ outcome, died = false, line, destination, canResume, home, skipReason, anywayOffered = true,
141
141
  } = f;
142
142
  const resumeOrAgain = canResume ? 'Resume from the Chat card.' : RERUN_NEXT;
143
143
  if (died) return { reason: 'It stopped with no ending recorded.', next: 'See the Audit / logs tab for the last thing it did.' };
@@ -146,7 +146,7 @@ export function endedWords(f) {
146
146
  case 'complete':
147
147
  return { reason: 'Goal met.', next: destination ? `The result is in ${tilde(destination, home)}.` : 'The result is in the step cards below.' };
148
148
  case 'skipped':
149
- return { reason: `Skipped: ${typeof skipReason === 'string' && skipReason !== '' ? skipReason : 'the ticket did not match'}. Nothing was spent.`, next: 'Nothing to do. Run it anyway from the ticket list in the Result tab.' };
149
+ return { reason: `Skipped: ${typeof skipReason === 'string' && skipReason !== '' ? skipReason : 'the ticket did not match'}. Nothing was spent.`, next: anywayOffered === false ? 'Nothing to do.' : 'Nothing to do. Run it anyway from the ticket list in the Result tab.' };
150
150
  case 'stopped':
151
151
  return { reason: 'Stopped by you.', next: resumeOrAgain };
152
152
  case 'cap-halt':
package/src/try-checks.js CHANGED
@@ -4,8 +4,12 @@
4
4
  import { createHash } from 'node:crypto';
5
5
  import { serializeArtifact } from './ask.js';
6
6
  import { labelled } from './checkwords.js';
7
+ import { sheetRowKey } from './sheetrows.js';
8
+ import { listLinesOf, partByOf } from './checklistsign.js';
7
9
 
8
10
  export const EVERY_STEP = 'every step';
11
+ /** the words of the two checks every step has (#1 and #2 below): the Audit's "Always checked" rows, the plan card's and the Job tab's "Always checked" fold */
12
+ export const EVERY_STEP_TEXTS = Object.freeze(["the output exists and isn't empty", 'the model said done: true']);
9
13
 
10
14
  /** The size words of a byte count: `412 B`, `7.9 KB`, `1.2 MB`. @param {number} n */
11
15
  export function sizeWords(n) {
@@ -42,17 +46,26 @@ export function outputRecord(step, artifact) {
42
46
  /**
43
47
  * #3 and up: the close's own checks. A softgreen close carries each of its checks; a green close is one check over all its cited fields; a close that
44
48
  * judged nothing (`unparseable`, `crash`) is one check that could not run, with that third outcome as its result.
45
- * @param {any} step @param {any} artifact @param {{verdict: string, red?: string|null, checks?: Array<{text:string, ok:boolean, result:string|null}>}} closed
49
+ * @param {any} step @param {any} artifact @param {{verdict: string, red?: string|null, checks?: Array<{text:string, ok:boolean, result:string|null}>}} closed @param {any[]} [checkList] the signed list (M16): a line on it tags its checks
46
50
  */
47
- export function closeRecords(step, artifact, closed) {
48
- const rows = factRecords(step, artifact, closed);
51
+ export function closeRecords(step, artifact, closed, checkList = undefined) {
52
+ // M16 item 5: a check of a list line carries `by`, the row's own (`you` / `agent` / `default`); the Audit draws the tag from it. Any other line keeps the words it has.
53
+ const decl = Array.isArray(checkList) ? { checkList } : undefined;
54
+ const listed = decl !== undefined && listLinesOf(decl).has(step?.fromLine);
55
+ const hasCited = step?.close?.class === 'green' && !!step?.close?.cited;
56
+ const by = (/** @type {number} */ idx, /** @type {'you'|'agent'|'default'} */ fallback) => (listed ? { by: partByOf(decl, step.fromLine, idx) ?? fallback, part: idx } : {});
57
+ const rows = factRecords(step, artifact, closed, listed ? (/** @type {number} */ idx) => partByOf(decl, step.fromLine, idx) : undefined, checkList).map((r) => (listed && hasCited && r.n === 3 ? { ...r, text: String(r.text).replace(/ \[agent\]$/, ''), ...by(0, 'agent') } : r));
49
58
  // M10 am22 (1): the picks on a fact line are rows after the fact rows, each judged on the answer's text
50
59
  const picks = Array.isArray(/** @type {any} */ (closed).pickChecks) ? /** @type {any} */ (closed).pickChecks : [];
51
- return [...rows, ...picks.map((/** @type {any} */ c, i) => ({ n: rows.length + 3 + i, text: labelled(c.text, 'picked'), ok: c.ok, result: c.result, source: lineSource(step) }))];
60
+ const pickRows = picks.map((/** @type {any} */ c, /** @type {number} */ i) => ({ n: rows.length + 3 + i, text: listed ? c.text : labelled(c.text, 'picked'), ok: c.ok, result: c.result, source: lineSource(step), ...by((hasCited ? 1 : 0) + i, 'you') }));
61
+ // M16 R7: the numbers tie of a text line is one more row
62
+ const tie = /** @type {any} */ (closed).numbersCheck;
63
+ const picked = Array.isArray(step?.close?.picked) ? step.close.picked.length : Array.isArray(step?.close?.shape?.picked) ? step.close.shape.picked.length : 0;
64
+ return [...rows, ...pickRows, ...(tie ? [{ n: rows.length + pickRows.length + 3, text: tie.text, ok: tie.ok, result: tie.result, source: lineSource(step), ...by((hasCited ? 1 : 0) + picked, 'default') }] : [])];
52
65
  }
53
66
 
54
- /** @param {any} step @param {any} artifact @param {any} closed */
55
- function factRecords(step, artifact, closed) {
67
+ /** @param {any} step @param {any} artifact @param {any} closed @param {((idx: number) => string|null)} [partBy] set for a list line (M16): its softgreen picks carry the row's `by` instead of a label @param {any[]} [checkList] the signed list: a sheet row on it gives its check's `by` */
68
+ function factRecords(step, artifact, closed, partBy = undefined, checkList = undefined) {
56
69
  const source = lineSource(step);
57
70
  if (closed.verdict === 'unparseable' || closed.verdict === 'crash') {
58
71
  return [{
@@ -61,9 +74,12 @@ function factRecords(step, artifact, closed) {
61
74
  }
62
75
  if (step?.close?.class === 'green' && Array.isArray(step?.close?.sheet) && Array.isArray(closed.checks)) {
63
76
  // M10b piece 2: each signed sheet check is its own row, worded by `sheetCheckSentence`, judged by bareguard
64
- return closed.checks.map((c, i) => ({
65
- n: 3 + i, text: labelled(c.text, 'agent'), ok: c.ok, result: c.result, source,
66
- }));
77
+ // hamr 2026-11-14: a plan whose list has the sheet's rows draws each check with the `by` of its row (`~` = you, `!` = agent); an older plan keeps `[agent]`
78
+ return closed.checks.map((c, i) => {
79
+ const row = Array.isArray(checkList) ? checkList.find((/** @type {any} */ r) => r?.kind === 'sheet' && r.key === sheetRowKey(step.fromLine, String(c.id))) : undefined;
80
+ if (row && (row.by === 'you' || row.by === 'agent')) return { n: 3 + i, text: c.text, ok: c.ok, result: c.result, source, by: row.by, part: row.part.part };
81
+ return { n: 3 + i, text: labelled(c.text, 'agent'), ok: c.ok, result: c.result, source };
82
+ });
67
83
  }
68
84
  if (step?.close?.class === 'green' && step?.close?.cited) {
69
85
  const n = Array.isArray(artifact?.results) ? artifact.results.length : 0;
@@ -78,7 +94,10 @@ function factRecords(step, artifact, closed) {
78
94
  }];
79
95
  }
80
96
  // M10 am22 (4): a softgreen check is the person's when it is one of their picks, the drafter's otherwise; the one-key row is code's own and carries no label
81
- return (closed.checks ?? []).map((c, i) => ({
82
- n: 3 + i, text: /** @type {any} */ (c).id === 'keys' ? c.text : labelled(c.text, /^pick\d+$/.test(String(/** @type {any} */ (c).id)) ? 'picked' : 'agent'), ok: c.ok, result: c.result, source,
83
- }));
97
+ return (closed.checks ?? []).map((c, i) => {
98
+ const id = String(/** @type {any} */ (c).id);
99
+ const pk = /^pick(\d+)$/.exec(id);
100
+ if (partBy !== undefined) return { n: 3 + i, text: c.text, ok: c.ok, result: c.result, source, ...(pk ? { by: partBy(Number(pk[1]) - 1) ?? 'agent', part: Number(pk[1]) - 1 } : {}) };
101
+ return { n: 3 + i, text: id === 'keys' ? c.text : labelled(c.text, pk ? 'picked' : 'agent'), ok: c.ok, result: c.result, source };
102
+ });
84
103
  }
package/src/types.js CHANGED
@@ -253,6 +253,7 @@
253
253
  * @property {string|null} [red]
254
254
  * @property {string[]} [reds]
255
255
  * @property {Array<{id:string, text:string, ok:boolean, result:string|null}>} [checks] a softgreen close: every check it ran (M4d am29 item 2)
256
+ * @property {{text: string, ok: boolean, result: string|null}} [numbersCheck] the numbers tie of a text line (M16 R7): beside the class's own verdict
256
257
  * @property {{part: any, check: any, results?: unknown}} [cited] a cited green close (M10 piece 4): the fact part and the check's own answer, for the run's cited-check record
257
258
  * @property {{inputs: Array<{name:string, sha256:string}>, claims: unknown, checks: Array<{id:string, text:string, ok:boolean, result:string|null}>}} [sheetRecord] a sheet close (M10b piece 2): what the run's sheet-check record keeps
258
259
  */
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @param {any} declaration the signed plan @param {any[]} diary the run's `checks` rows (src/diary.js readChecks) @param {{items?: string[], by?: Record<string, string>}|null} notChecked the sign row's Not-checked block
3
+ * @param {{lines?: any[], csvRoles?: string[]}} [sheet] the signed job lines and CSV roles: a plan whose list has sheet rows (M16 am4) shows them here, tagged by where each comes from (hamr 2026-11-14)
4
+ * @returns {{checks: AuditCheckRow[], notChecked: AuditCheckRow[], always: AuditCheckRow[]}|null} null for a plan with no list (it keeps its own Audit rows)
5
+ * @typedef {{text: string, by: 'you'|'agent'|'default'|null, result: 'passed'|'failed'|'none'|'not-checked'}} AuditCheckRow
6
+ */
7
+ export function auditChecksOf(declaration: any, diary: any[], notChecked: {
8
+ items?: string[];
9
+ by?: Record<string, string>;
10
+ } | null, { lines: jobLines, csvRoles }?: {
11
+ lines?: any[];
12
+ csvRoles?: string[];
13
+ }): {
14
+ checks: AuditCheckRow[];
15
+ notChecked: AuditCheckRow[];
16
+ always: AuditCheckRow[];
17
+ } | null;
18
+ /** the words of a row no result was recorded for: never "passed" */
19
+ export const AUDIT_NO_RESULT: "no result recorded";
20
+ export type AuditCheckRow = {
21
+ text: string;
22
+ by: "you" | "agent" | "default" | null;
23
+ result: "passed" | "failed" | "none" | "not-checked";
24
+ };
@@ -88,6 +88,21 @@ export function readProseFile(file: any): {
88
88
  * @returns {string|null}
89
89
  */
90
90
  export function draftKeyRefusal(slot: string, env: Record<string, string | undefined>): string | null;
91
+ /**
92
+ * The ONE place a plan folder is claimed: its parent made if needed, then the folder itself, exclusively (an existing path throws EEXIST). `draftToDir` claims the folder of a draft with it and the
93
+ * panel claims the folder of a plan made by a Drop or an Add (src/planrebuild.js).
94
+ * @param {string} dir
95
+ */
96
+ export function claimPlanDir(dir: string): void;
97
+ /**
98
+ * The ONE writer of a plan folder's files: each `name` -> text, in the order given (a draft writes `spec.hash` last, so a folder with one is whole). `opts` is `writeFileSync`'s own
99
+ * (the panel's session files are exclusive, 0600).
100
+ * @param {string} dir @param {Record<string, string>} files @param {{flag?: string, mode?: number}} [opts]
101
+ */
102
+ export function writePlanFiles(dir: string, files: Record<string, string>, opts?: {
103
+ flag?: string;
104
+ mode?: number;
105
+ }): void;
91
106
  /**
92
107
  * Draft into `dir`. $0 refusals (return {ok:false, wrote:false}, nothing on disk): bad key,
93
108
  * unreadable/blank prose, prose that contains the key, missing inputs / bad signed text, dir
@@ -98,7 +113,7 @@ export function draftKeyRefusal(slot: string, env: Record<string, string | undef
98
113
  * Test seam: `provider`/`rates`/`modelId` are injected; without them a live provider is built.
99
114
  * `onResult({ ok })` (M4d am32): called once, after the spend is booked and just before the result files are written (the CLI gives its monthly hold back there).
100
115
  */
101
- export function draftToDir({ proseFile, dir, root, name, slot, model, draftThinking, keyNames, env, provider, rates, modelId, noQuestions, onResult, fetchPage, leftRules, checkPicks, carriedPicks, proseRead, flowType, mcpServer, mcpPick, mcpServers, }: {
116
+ export function draftToDir({ proseFile, dir, root, name, slot, model, draftThinking, keyNames, env, provider, rates, modelId, noQuestions, onResult, fetchPage, leftRules, checkPicks, carriedPicks, carriedChoices, carriedSheetDropped, proseRead, flowType, mcpServer, mcpPick, mcpServers, }: {
102
117
  proseFile: any;
103
118
  dir: any;
104
119
  root: any;
@@ -117,6 +132,8 @@ export function draftToDir({ proseFile, dir, root, name, slot, model, draftThink
117
132
  leftRules: any;
118
133
  checkPicks: any;
119
134
  carriedPicks: any;
135
+ carriedChoices: any;
136
+ carriedSheetDropped: any;
120
137
  proseRead: any;
121
138
  flowType?: "mcp" | "plain" | "tickets" | undefined;
122
139
  mcpServer?: string | undefined;
@@ -0,0 +1,37 @@
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>, pairRule?: number}} 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
+ pairRule?: number;
37
+ };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The words a Not-checked row says. A rule the person left, wrote in their own words, or left with no pick keeps fwd's signed table (M10 am16 (5): src/pagedropwords.js), the words the plan card and the
3
+ * Audit already had; any other reason is the block's own (what code could not build and why).
4
+ * @param {string|null|undefined} reason @param {{cantAsked?: boolean}} [row]
5
+ */
6
+ export function notCheckedWords(reason: string | null | undefined, row?: {
7
+ cantAsked?: boolean;
8
+ }): string;
9
+ /** a countable part as the picked check the softgreen close runs: its own fields, the rule named `rule` (the inverse of the block's partOfPick) @param {Record<string, any>} part */
10
+ export function pickedOf(part: Record<string, any>): {
11
+ rule: any;
12
+ };
13
+ /**
14
+ * @param {{declaration: Record<string, any>, block: import('./checkblock.js').CheckBlock, lines: {n: number, guardrail?: string|null}[], lineSet: Set<number>}} o
15
+ * `lineSet` = the lines the block was given; `lines` = the signed lines (a guardrail decides the class)
16
+ * @returns {{declaration: Record<string, any>, notChecked: string[], notCheckedBy: Record<string, 'you'|'agent'|'default'>, built: Set<number>}} `built` = the lines that got a check from the block (a red naming one of them is a fault of the build)
17
+ */
18
+ export function assembleFromBlock({ declaration, block, lines, lineSet }: {
19
+ declaration: Record<string, any>;
20
+ block: import("./checkblock.js").CheckBlock;
21
+ lines: {
22
+ n: number;
23
+ guardrail?: string | null;
24
+ }[];
25
+ lineSet: Set<number>;
26
+ }): {
27
+ declaration: Record<string, any>;
28
+ notChecked: string[];
29
+ notCheckedBy: Record<string, "you" | "agent" | "default">;
30
+ built: Set<number>;
31
+ };
32
+ /** what a row says when its check cannot ride a line that has no guardrail of its own (the class of a line comes from its guardrail) */
33
+ export const NO_GUARDRAIL_WORDS: "This line has no guardrail of yours, so a check on it cannot be signed; you judge it at the Ask.";
@@ -0,0 +1,83 @@
1
+ /** the tail of a revise turn that follows refused edits: each refusal's own reason and nothing else (bareloop renderRejectBlock) @param {string[]} reds */
2
+ export function renderRejectBlock(reds: string[], cap?: number): string;
3
+ /**
4
+ * Is this validator red about a check the BLOCK built (R2)? It names a line the block gave a check to (`builtLines`, from the red's own line number) and is about a close the code wrote: the quote check, a
5
+ * picked check, the numbers tie, the class, the list or the picked-lines record; or it is the cited words' own `line N:` red. A red on a step's primitives, reads, emits or an ask names none of those.
6
+ * @param {string} red @param {number[]} builtLines the lines the red names that the block built a check on
7
+ */
8
+ export function isBuildFault(red: string, builtLines: number[]): boolean;
9
+ /**
10
+ * The block of a draft (M16 item 2): the person's `~` rules and `$` defaults, then the look's facts, then the picks the person made (kept from the last draft, and just answered), reconciled once.
11
+ * Fresh answers go through `carry` like the kept ones (the draft is a child process: the answer comes back as a pick or a left rule), and are not marked "kept".
12
+ * `scoped`: the rules the pick path owns (src/checkpick.js offerRules over the block's lines); one the record folded into another ask (a broken pair's partner) is neither asked nor given the old check (bareloop authorjob.js@v0.56.0).
13
+ * @param {{leaveOut?: {line: number, rule: number}[], texts: Record<string, string>, jobLines: any[], look: {facts: any[], dropped: any[]}, kept: {picks: any[], left: any[], askRules: any[]}, fresh: {picks: any[], left: {line: number, rule: number}[]}, asks: boolean, countScope: (t: string) => boolean, scoped?: {line: number, rule: number}[]}} o
14
+ */
15
+ export function setUpBlock({ texts, jobLines, look, kept, fresh, asks, countScope, scoped, leaveOut }: {
16
+ leaveOut?: {
17
+ line: number;
18
+ rule: number;
19
+ }[];
20
+ texts: Record<string, string>;
21
+ jobLines: any[];
22
+ look: {
23
+ facts: any[];
24
+ dropped: any[];
25
+ };
26
+ kept: {
27
+ picks: any[];
28
+ left: any[];
29
+ askRules: any[];
30
+ };
31
+ fresh: {
32
+ picks: any[];
33
+ left: {
34
+ line: number;
35
+ rule: number;
36
+ }[];
37
+ };
38
+ asks: boolean;
39
+ countScope: (t: string) => boolean;
40
+ scoped?: {
41
+ line: number;
42
+ rule: number;
43
+ }[];
44
+ }): import("./checkblock.js").CheckBlock;
45
+ /** the `add` pre-edits of the ledger-suggest call (bareloop authorjob.js@v0.56.0: a count or a phrase; anything else is not an edit) @param {any[]} extra */
46
+ export function ledgerEdits(extra: any[]): any[];
47
+ /**
48
+ * M16 item 4 ("Tickets `ticketFilter` and `ticketWatch` stay as they are"): the rules of a Tickets job that are not the block's. Before M16 only a count guardrail of such a job (it signs a
49
+ * ticket page input, which routes its guardrails: src/checkpick.js codeScope) was picked or asked; every other rule ("priority P1 only", "run a ticket again when its state changes") was the
50
+ * declaration's own typed ticketFilter / ticketWatch, never asked and never listed as Not checked. A rule the look tied to a fact is still the block's.
51
+ * @param {string} flowType @param {{n: number, rules?: string[]}[]} jobLines @param {{line: number, forRule?: number}[]} facts @returns {{line: number, rule: number}[]}
52
+ */
53
+ export function ticketLeaveOut(flowType: string, jobLines: {
54
+ n: number;
55
+ rules?: string[];
56
+ }[], facts: {
57
+ line: number;
58
+ forRule?: number;
59
+ }[]): {
60
+ line: number;
61
+ rule: number;
62
+ }[];
63
+ /** the cap of refusals one revise turn carries (bareloop REVISE_RED_CAP) */
64
+ export const REVISE_RED_CAP: 20;
65
+ export function buildFaultWords(reds: string[]): string;
66
+ export function pickEdits(rows: {
67
+ line: number;
68
+ rule: number;
69
+ check: Record<string, any> | null;
70
+ }[], blockLines: Set<number>): {
71
+ op: string;
72
+ line: number;
73
+ rules: number[];
74
+ check: Record<string, any> | null;
75
+ }[];
76
+ export function repairedEditsReadable(value: any): any;
77
+ export function editRecord(rec: {
78
+ edits: any[];
79
+ }): {
80
+ refusedBecause?: any;
81
+ op: any;
82
+ accepted: boolean;
83
+ }[];
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @param {string} prose the job's signed text (or the draft's prose)
3
+ * @param {any} [declaration] the declaration, once there is one. Before it exists nothing in fwd says which line reads a sheet (sheetLineBlocks reads the steps' `reads` / `close.sheet`),
4
+ * so a sheet line is then given as a step line; the caller passes the declaration whenever it has one.
5
+ * @param {number[]} [tiedSheetLines] lines whose `~` rule the sheet look (src/sheetlook.js) tied to a real column: sheet lines before there is a declaration (M16 R6); they stay on fwd's sheet path
6
+ * @returns {{ok: true, jobLines: {n: number, text: string, rules: string[]}[], skipped: {ask: number[], send: number[], sheet: number[]}}|{ok: false, reds: string[]}}
7
+ */
8
+ export function blockJobLines(prose: string, declaration?: any, tiedSheetLines?: number[]): {
9
+ ok: true;
10
+ jobLines: {
11
+ n: number;
12
+ text: string;
13
+ rules: string[];
14
+ }[];
15
+ skipped: {
16
+ ask: number[];
17
+ send: number[];
18
+ sheet: number[];
19
+ };
20
+ } | {
21
+ ok: false;
22
+ reds: string[];
23
+ };
24
+ /** a block over step lines only, with no `$` cited default (M16 am1). `texts`: label -> frozen text. */
25
+ export function newJobBlock({ texts, jobLines, asks, countScope }: {
26
+ texts: any;
27
+ jobLines: any;
28
+ asks?: boolean | undefined;
29
+ countScope?: ((t: string) => boolean) | undefined;
30
+ }): CheckBlock;
31
+ import { CheckBlock } from './checkblock.js';
@@ -0,0 +1,41 @@
1
+ /** every whole-output word number in a guardrail ("under 600 words" -> [600]); a "<n> words each" / "per section" size is never listed here @param {unknown} g @returns {number[]} */
2
+ export function guardrailWordNumbers(g: unknown): number[];
3
+ /** every standalone number in a guardrail's own text (digits not joined to letters) @param {unknown} g @returns {number[]} */
4
+ export function guardrailStandaloneNumbers(g: unknown): number[];
5
+ /** the "<n> words each" / "<n> words per section" size, or null @param {unknown} g @returns {number|null} */
6
+ export function guardrailWordsPerSection(g: unknown): number | null;
7
+ /** the first "<N> sections" in a guardrail (digits, or one..ten), or null @param {unknown} g @returns {number|null} */
8
+ export function guardrailSectionCount(g: unknown): number | null;
9
+ /** the first "<N> bullets / list items / items / lines / points" in a guardrail (digits, or one..ten), or null @param {unknown} g @returns {number|null} */
10
+ export function guardrailItemCount(g: unknown): number | null;
11
+ /**
12
+ * Keep a suggestion only if its rule is on bareguard's list, it carries only that rule's own fields, every number in it is a number the guardrail names and every word in it
13
+ * is a word of the guardrail. Anything else is dropped, with the reason. `none` is a drop with the reason `none`.
14
+ * @param {string} guardrail @param {any} sug the model's entry for this guardrail
15
+ * @returns {{kept: true, check: Record<string, any>}|{kept: false, why: string}}
16
+ */
17
+ export function keepOrDrop(guardrail: string, sug: any): {
18
+ kept: true;
19
+ check: Record<string, any>;
20
+ } | {
21
+ kept: false;
22
+ why: string;
23
+ };
24
+ /**
25
+ * The check CODE proposes for a count rule when the call yields none (R10, ours; fwd has no such fallback): a bullets / list-items / points count -> listItems N (exact; "at most / up to / no more than / fewer than / under / below" -> maxListItems, "at least / minimum / no fewer than / more than" -> minListItems, F315), a lines count ->
26
+ * maxLines N, ONE word number -> minWords N when the rule says "at least / minimum / more than", else maxWords N. A section count names no sections, so none is built; a rule naming two different counts ("3 bullets under 80 words") is not built either; a rule with
27
+ * several word numbers or a range ("between 100 and 200 words") is not guessed. The result passes `keepOrDrop`, so every number is one the rule names.
28
+ * @param {string} text @returns {Record<string, any>|null}
29
+ */
30
+ export function countCheck(text: string): Record<string, any> | null;
31
+ /** a part of a rubric-step stage, from a pick: the check's own fields, the rule's words, and the `~` rule numbers it carries out @param {Record<string, any>} check @param {string} text @param {number[]} rules */
32
+ export function partOfPick(check: Record<string, any>, text: string, rules: number[]): {
33
+ rules: number[];
34
+ text: string;
35
+ class: string;
36
+ check: any;
37
+ };
38
+ export { plainWords };
39
+ export function isCountable(g: unknown): boolean;
40
+ export function sameRuleWords(a: unknown, b: unknown): boolean;
41
+ import { plainWords } from './checkwords.js';
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @param {import('./checkblock.js').CheckBlock} block
3
+ * @returns {{rows: {key: string, line: number, by: string, state: string, text: string, reason: string|null, drop: boolean}[], suggested: {key: string, line: number, text: string, dropped?: boolean}[]}}
4
+ */
5
+ export function cardOfBlock(block: import("./checkblock.js").CheckBlock): {
6
+ rows: {
7
+ key: string;
8
+ line: number;
9
+ by: string;
10
+ state: string;
11
+ text: string;
12
+ reason: string | null;
13
+ drop: boolean;
14
+ }[];
15
+ suggested: {
16
+ key: string;
17
+ line: number;
18
+ text: string;
19
+ dropped?: boolean;
20
+ }[];
21
+ };