fwdloop 0.38.0 → 0.40.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 (129) hide show
  1. package/README.md +6 -9
  2. package/bin/fwdloop +21 -19
  3. package/package.json +1 -1
  4. package/src/ask.js +70 -148
  5. package/src/audit-fold.js +6 -5
  6. package/src/auditchecks.js +6 -4
  7. package/src/authoring.js +32 -60
  8. package/src/blockasks.js +2 -1
  9. package/src/blockassemble.js +15 -3
  10. package/src/blockdraft.js +2 -2
  11. package/src/blockpick.js +42 -16
  12. package/src/books.js +237 -12
  13. package/src/checkblock.js +24 -44
  14. package/src/checklistsign.js +25 -3
  15. package/src/checklook.js +3 -1
  16. package/src/checkpick.js +6 -77
  17. package/src/cited-source.js +4 -4
  18. package/src/citedcheck.js +6 -11
  19. package/src/citedwords.js +9 -8
  20. package/src/closers.js +9 -6
  21. package/src/declaration.js +14 -49
  22. package/src/diary.js +23 -1
  23. package/src/draft-steps.js +11 -1
  24. package/src/drafter.js +18 -12
  25. package/src/draftfiles.js +127 -0
  26. package/src/draftspend.js +165 -17
  27. package/src/flow.js +42 -87
  28. package/src/flowmodel.js +1 -1
  29. package/src/index.js +3 -2
  30. package/src/inside.js +106 -0
  31. package/src/jsonl-append.js +33 -1
  32. package/src/learn.js +1 -1
  33. package/src/learnstore.js +20 -22
  34. package/src/line-checks.js +1 -1
  35. package/src/liveness.js +3 -0
  36. package/src/mcp-use.js +8 -9
  37. package/src/memo.js +13 -16
  38. package/src/model-step.js +2 -2
  39. package/src/page-words.js +8 -0
  40. package/src/pageask.js +8 -3
  41. package/src/pagebits.js +8 -1
  42. package/src/pagedropwords.js +1 -1
  43. package/src/pagerules.js +6 -3
  44. package/src/panel/author.js +99 -75
  45. package/src/panel/authorcard.js +21 -8
  46. package/src/panel/authorflows.js +3 -3
  47. package/src/panel/authorresume.js +3 -3
  48. package/src/panel/authorstart.js +15 -16
  49. package/src/panel/authortrigger.js +43 -70
  50. package/src/panel/data.js +186 -188
  51. package/src/panel/index.html +139 -115
  52. package/src/panel/jobgrid.js +3 -7
  53. package/src/panel/result.js +7 -10
  54. package/src/panel/resume.js +4 -3
  55. package/src/panel/scheduler.js +9 -9
  56. package/src/panel/server.js +8 -4
  57. package/src/panel/spawn.js +22 -11
  58. package/src/panel/tickets.js +2 -2
  59. package/src/pickrecord.js +51 -31
  60. package/src/placerule.js +3 -4
  61. package/src/plain-checks.js +1 -1
  62. package/src/planrebuild.js +19 -19
  63. package/src/primitives.js +1 -1
  64. package/src/provider.js +1 -1
  65. package/src/reasons.js +25 -0
  66. package/src/runfile.js +26 -2
  67. package/src/runner.js +57 -105
  68. package/src/runvalues.js +47 -24
  69. package/src/schedule-choices.js +41 -0
  70. package/src/schedule-shape.js +39 -0
  71. package/src/schedule.js +9 -8
  72. package/src/setup.js +20 -36
  73. package/src/shaperows.js +2 -2
  74. package/src/sheetblock.js +2 -2
  75. package/src/sheetbuild.js +5 -5
  76. package/src/sheetrun.js +4 -5
  77. package/src/summary-words.js +2 -1
  78. package/src/thinking.js +5 -2
  79. package/src/ticketrows.js +7 -28
  80. package/src/trigger-clock.js +9 -23
  81. package/src/trigger-files.js +30 -22
  82. package/src/trigger-tickets.js +15 -14
  83. package/src/try-checks.js +2 -1
  84. package/src/types.js +2 -0
  85. package/types/ask.d.ts +25 -20
  86. package/types/authoring.d.ts +7 -42
  87. package/types/blockpick.d.ts +1 -1
  88. package/types/books.d.ts +380 -4
  89. package/types/checkblock.d.ts +1 -23
  90. package/types/checklist.d.ts +3 -3
  91. package/types/checklistsign.d.ts +7 -0
  92. package/types/checkpick.d.ts +0 -21
  93. package/types/citedwords.d.ts +7 -4
  94. package/types/closers.d.ts +1 -0
  95. package/types/declaration.d.ts +4 -14
  96. package/types/diary.d.ts +14 -1
  97. package/types/draft-steps.d.ts +7 -0
  98. package/types/drafter.d.ts +1 -1
  99. package/types/draftfiles.d.ts +89 -0
  100. package/types/draftspend.d.ts +74 -0
  101. package/types/flow.d.ts +32 -54
  102. package/types/index.d.ts +3 -3
  103. package/types/inside.d.ts +71 -0
  104. package/types/jsonl-append.d.ts +20 -0
  105. package/types/learnstore.d.ts +0 -2
  106. package/types/liveness.d.ts +1 -0
  107. package/types/page-words.d.ts +6 -0
  108. package/types/pageask.d.ts +2 -0
  109. package/types/pagebits.d.ts +3 -0
  110. package/types/pagerules.d.ts +1 -0
  111. package/types/panel/author.d.ts +7 -3
  112. package/types/panel/authorcard.d.ts +0 -6
  113. package/types/panel/authorflows.d.ts +4 -4
  114. package/types/panel/authortrigger.d.ts +16 -2
  115. package/types/panel/data.d.ts +50 -16
  116. package/types/panel/spawn.d.ts +18 -2
  117. package/types/pickrecord.d.ts +29 -0
  118. package/types/reasons.d.ts +23 -0
  119. package/types/runfile.d.ts +14 -0
  120. package/types/runner.d.ts +6 -38
  121. package/types/runvalues.d.ts +17 -2
  122. package/types/schedule-choices.d.ts +9 -0
  123. package/types/schedule-shape.d.ts +15 -0
  124. package/types/sheetbuild.d.ts +1 -1
  125. package/types/thinking.d.ts +1 -0
  126. package/types/ticketrows.d.ts +0 -9
  127. package/types/trigger-clock.d.ts +3 -2
  128. package/types/trigger-files.d.ts +15 -4
  129. package/types/types.d.ts +8 -0
@@ -9,7 +9,8 @@ import { createMCPBridge, discoverServers } from 'bare-agent/mcp';
9
9
 
10
10
  import { configForServer, remoteRefusal, mcpStartOpts, startRefusal, firstLine, isDeviceLogin } from './ticket-mcp.js';
11
11
  import { parseTicketList, isTicketNumber, TICKET_MAX } from './ticket-shape.js';
12
- import { appendSeen, readSeen, queueOf } from './trigger-files.js';
12
+ import { queueOf } from './trigger-files.js';
13
+ import { appendTriggerLedger, readTriggerLedger } from './jsonl-append.js';
13
14
 
14
15
  /** A look every 15 minutes, fixed (item 8). */
15
16
  export const TICKET_LOOK_MS = 15 * 60_000;
@@ -142,12 +143,12 @@ export async function lookTickets({
142
143
 
143
144
  /** The numbers a signing has a baseline or an arrived row for. @param {string} ledger @param {string} sig */
144
145
  export function seenNumbers(ledger, sig) {
145
- return new Set(readSeen(ledger, sig).filter((r) => (r.kind === 'baseline' || r.kind === 'arrived') && Number.isInteger(/** @type {any} */ (r).number)).map((r) => /** @type {any} */ (r).number));
146
+ return new Set(readTriggerLedger(ledger, sig).filter((r) => (r.kind === 'baseline' || r.kind === 'arrived') && Number.isInteger(/** @type {any} */ (r).number)).map((r) => /** @type {any} */ (r).number));
146
147
  }
147
148
  /** Last-seen watched values per number: the newest baseline/arrived row's. @param {string} ledger @param {string} sig @returns {Map<number, {state: string, labels: string[]}>} */
148
149
  export function lastSeen(ledger, sig) {
149
150
  const m = new Map();
150
- for (const r of /** @type {any[]} */ (readSeen(ledger, sig))) if ((r.kind === 'baseline' || r.kind === 'arrived') && r.watch) m.set(r.number, r.watch);
151
+ for (const r of /** @type {any[]} */ (readTriggerLedger(ledger, sig))) if ((r.kind === 'baseline' || r.kind === 'arrived') && r.watch) m.set(r.number, r.watch);
151
152
  return m;
152
153
  }
153
154
  /** Has this signing had its first look (its baseline written)? @param {string} ledger @param {string} sig */
@@ -159,7 +160,7 @@ export function lookProblemOf(rows) {
159
160
  const last = /** @type {any[]} */ (rows).findLast((r) => r.kind === 'unreadable' || r.kind === 'looked' || r.kind === 'baseline' || r.kind === 'arrived');
160
161
  return last?.kind === 'unreadable' ? { at: last.at, why: String(last.why ?? 'it could not read the list') } : null;
161
162
  }
162
- export const hasBaseline = (ledger, sig) => readSeen(ledger, sig).some((r) => r.kind === 'baseline');
163
+ export const hasBaseline = (ledger, sig) => readTriggerLedger(ledger, sig).some((r) => r.kind === 'baseline');
163
164
 
164
165
  /**
165
166
  * Write what a look found, once. First look: a `baseline` row per ticket on the page (never runs). Later: an `arrived` row per new ticket, oldest first (its arrival
@@ -169,50 +170,50 @@ export const hasBaseline = (ledger, sig) => readSeen(ledger, sig).some((r) => r.
169
170
  */
170
171
  export function recordLook(ledger, sig, look, at) {
171
172
  if (!look.ok) {
172
- appendSeen(ledger, /** @type {any} */ ({ id: `unreadable:${at}`, kind: 'unreadable', sha: `unreadable:${at}`, name: '', size: 0, at, why: look.error }), sig);
173
+ appendTriggerLedger(ledger, /** @type {any} */ ({ id: `unreadable:${at}`, kind: 'unreadable', sha: `unreadable:${at}`, name: '', size: 0, at, why: look.error }), sig);
173
174
  return { arrived: [], unreadable: look.error };
174
175
  }
175
176
  // a look that read, after one that could not: one `looked` row ends the problem even when nothing is new (the only look row that is not found tickets)
176
177
  // M13 piece 7 (9.7): ticket numbers over the cap were ignored by the look; ONE reason is recorded on the same row
177
178
  const note = look.ignored?.length ? `ignored ${look.ignored.length} ticket number${look.ignored.length === 1 ? '' : 's'} over ${TICKET_MAX.toLocaleString('en-US')}: ${look.ignored.slice(0, 5).join(', ')}` : null;
178
- if (note !== null || lookProblemOf(readSeen(ledger, sig))) appendSeen(ledger, /** @type {any} */ ({ id: `looked:${at}`, kind: 'looked', sha: `looked:${at}`, name: '', size: 0, at, ...(note !== null ? { why: note } : {}) }), sig);
179
+ if (note !== null || lookProblemOf(readTriggerLedger(ledger, sig))) appendTriggerLedger(ledger, /** @type {any} */ ({ id: `looked:${at}`, kind: 'looked', sha: `looked:${at}`, name: '', size: 0, at, ...(note !== null ? { why: note } : {}) }), sig);
179
180
  const arrived = [];
180
181
  const watch = (/** @type {{state: string, labels: string[]}} */ w) => ({ state: w.state, labels: w.labels });
181
182
  if (look.first) {
182
183
  for (const i of [...look.found].reverse()) {
183
184
  if (look.cut !== undefined && i.number > look.cut) {
184
185
  // M13 piece 5 (F114f): above the number the first green run read = it came in after that run began, so it runs once the schedule is on
185
- appendSeen(ledger, /** @type {any} */ ({
186
+ appendTriggerLedger(ledger, /** @type {any} */ ({
186
187
  id: `arrived:ticket:${i.number}`, kind: 'arrived', sha: `ticket:${i.number}`, name: `#${i.number}`, path: `#${i.number}`, size: 0, at, number: i.number, watch: watch(i),
187
188
  }), sig);
188
189
  arrived.push(i.number);
189
190
  continue;
190
191
  }
191
- appendSeen(ledger, /** @type {any} */ ({
192
+ appendTriggerLedger(ledger, /** @type {any} */ ({
192
193
  id: `baseline:ticket:${i.number}`, kind: 'baseline', sha: `ticket:${i.number}`, name: `#${i.number}`, path: `#${i.number}`, size: 0, at, number: i.number, watch: watch(i),
193
194
  }), sig);
194
195
  }
195
196
  return { arrived, unreadable: null };
196
197
  }
197
198
  for (const i of [...look.found].reverse()) {
198
- appendSeen(ledger, /** @type {any} */ ({
199
+ appendTriggerLedger(ledger, /** @type {any} */ ({
199
200
  id: `arrived:ticket:${i.number}`, kind: 'arrived', sha: `ticket:${i.number}`, name: `#${i.number}`, path: `#${i.number}`, size: 0, at, number: i.number, watch: watch(i),
200
201
  }), sig);
201
202
  arrived.push(i.number);
202
203
  }
203
204
  for (const c of look.changed) {
204
- const rows = readSeen(ledger, sig);
205
+ const rows = readTriggerLedger(ledger, sig);
205
206
  if (queueOf(rows).some((q) => /** @type {any} */ (q).number === c.number)) {
206
207
  // already waiting: the queued run reads the ticket as it is when it starts, so no second run. Advance the last-seen value (a `baseline` row, same writer) so the
207
208
  // next look does not re-fire this same change once that run has started; a LATER change still differs from it and arrives once.
208
209
  const b = rows.filter((r) => r.kind === 'baseline' && /** @type {any} */ (r).number === c.number).length;
209
- appendSeen(ledger, /** @type {any} */ ({
210
+ appendTriggerLedger(ledger, /** @type {any} */ ({
210
211
  id: `baseline:ticket:${c.number}:${b}`, kind: 'baseline', sha: `ticket:${c.number}`, name: `#${c.number}`, path: `#${c.number}`, size: 0, at, number: c.number, watch: watch(c),
211
212
  }), sig);
212
213
  continue;
213
214
  }
214
215
  const n = rows.filter((r) => r.kind === 'arrived' && /** @type {any} */ (r).number === c.number).length;
215
- appendSeen(ledger, /** @type {any} */ ({
216
+ appendTriggerLedger(ledger, /** @type {any} */ ({
216
217
  id: `arrived:ticket:${c.number}:${n}`, kind: 'arrived', sha: `ticket:${c.number}:${n}`, name: `#${c.number}`, path: `#${c.number}`, size: 0, at, number: c.number, watch: watch(c), reason: c.reason,
217
218
  }), sig);
218
219
  arrived.push(c.number);
@@ -227,11 +228,11 @@ export function recordLook(ledger, sig, look, at) {
227
228
  * @returns {{ok: true} | {ok: false, say: string}}
228
229
  */
229
230
  export function recordAnyway(ledger, sig, a, at) {
230
- const rows = readSeen(ledger, sig);
231
+ const rows = readTriggerLedger(ledger, sig);
231
232
  if (queueOf(rows).some((q) => /** @type {any} */ (q).number === a.number)) return { ok: false, say: `Ticket #${a.number} is already queued. Nothing more was queued.` };
232
233
  const n = rows.filter((r) => r.kind === 'arrived' && /** @type {any} */ (r).number === a.number).length;
233
234
  const watch = lastSeen(ledger, sig).get(a.number);
234
- appendSeen(ledger, /** @type {any} */ ({
235
+ appendTriggerLedger(ledger, /** @type {any} */ ({
235
236
  id: `arrived:ticket:${a.number}:${n}`, kind: 'arrived', sha: `ticket:${a.number}:${n}`, name: `#${a.number}`, path: `#${a.number}`, size: 0, at, number: a.number, ...(watch ? { watch } : {}), reason: a.reason, anyway: true,
236
237
  }), sig);
237
238
  return { ok: true };
package/src/try-checks.js CHANGED
@@ -4,6 +4,7 @@
4
4
  import { createHash } from 'node:crypto';
5
5
  import { serializeArtifact } from './ask.js';
6
6
  import { labelled } from './checkwords.js';
7
+ import { noJudgment } from './closers.js';
7
8
  import { sheetRowKey } from './sheetrows.js';
8
9
  import { listLinesOf, partByOf } from './checklistsign.js';
9
10
  import { rowResultsOf } from './rowresults.js';
@@ -74,7 +75,7 @@ export function closeRecords(step, artifact, closed, checkList = undefined, jobL
74
75
  /** @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` @param {any[]} [jobLines] */
75
76
  function factRecords(step, artifact, closed, partBy = undefined, checkList = undefined, jobLines = undefined) {
76
77
  const source = lineSource(step);
77
- if (closed.verdict === 'unparseable' || closed.verdict === 'crash') {
78
+ if (noJudgment(closed.verdict)) {
78
79
  return [{
79
80
  n: 3, text: 'the close could run', ok: false, result: closed.verdict, source,
80
81
  }];
package/src/types.js CHANGED
@@ -222,6 +222,8 @@
222
222
  * @property {Record<string, any>} declaration
223
223
  * @property {Signature} signature
224
224
  * @property {Record<string, string>} classes
225
+ * @property {string} [proseText] only on `readRunJobCopy`: the verified copy's own bytes (prose.txt)
226
+ * @property {string} [declarationText] only on `readRunJobCopy`: the verified copy's own bytes (declaration.json)
225
227
  */
226
228
 
227
229
  /**
package/types/ask.d.ts CHANGED
@@ -29,24 +29,6 @@ export function stripControl(text: any): string;
29
29
  /** The status for a decision word read from disk, or undefined for anything that is not one of the table's OWN
30
30
  * entries ("constructor", "toString" and the rest of Object.prototype read as unrecognised). */
31
31
  export function decisionStatus(decision: any): any;
32
- /**
33
- * @param {{ timeoutMs?: number, pollMs?: number, clock?: () => string, writeLine?: (line:string) => void }} [opts]
34
- * @returns {(opts:{question:string, evidence:unknown, runDir:string, ttlMs?: number}) => Promise<{decision:string, reason?:string}>}
35
- */
36
- export function makeFileAskStep({ timeoutMs, pollMs, clock, writeLine, }?: {
37
- timeoutMs?: number;
38
- pollMs?: number;
39
- clock?: () => string;
40
- writeLine?: (line: string) => void;
41
- }): (opts: {
42
- question: string;
43
- evidence: unknown;
44
- runDir: string;
45
- ttlMs?: number;
46
- }) => Promise<{
47
- decision: string;
48
- reason?: string;
49
- }>;
50
32
  /**
51
33
  * @param {any} ask the parsed ask.json object (or its `evidence` field's
52
34
  * container — pass the whole ask so a missing `evidence` key is itself a
@@ -90,10 +72,12 @@ export function sha256Hex(serialised: string): string;
90
72
  * M4c-fix amendment 1 (a): why a saved `answer.json` is not a usable answer for the open ask `openAskId`, or `null`
91
73
  * when it is usable. The resume refuses each of these by name before it consumes the file, so without a way aside
92
74
  * the file would block every new answer (`answerAsk`'s exclusive create).
93
- * @param {string} text the file's text @param {string} openAskId
75
+ * @param {Extract<ReturnType<typeof readSavedAnswer>, {ok: true}>} saved `readSavedAnswer`'s result (the one reader of the file) @param {string} openAskId
94
76
  * @returns {string|null}
95
77
  */
96
- export function brokenAnswerWhy(text: string, openAskId: string): string | null;
78
+ export function brokenAnswerWhy(saved: Extract<ReturnType<typeof readSavedAnswer>, {
79
+ ok: true;
80
+ }>, openAskId: string): string | null;
97
81
  /**
98
82
  * Move `answer.json` aside as a record: `answer.<askId>.<kind>.<n>.json`, `n` the first free number. Write-once:
99
83
  * the new name is created with a hard link (`EEXIST` = taken, try the next), then the old name is removed — never
@@ -115,6 +99,23 @@ export function setAsideAnswer(runDir: string, askId: string, kind: "broken" | "
115
99
  * @returns {string}
116
100
  */
117
101
  export function effectiveExpiresAt(runDir: string, askId: string, original: string): string;
102
+ /**
103
+ * M20 am3e item 15: the ONE reader of a run's `ask.json`, as found, through the safe gateway: `{ok: false, missing, red}` when the gateway gives nothing (missing, a symlink,
104
+ * outside the folder), else `{ok: true, value, parseError}`: `value` is the parsed JSON as it is (any shape), `parseError` the parser's message when the text is not JSON
105
+ * (`value` is then undefined). It applies nothing: each caller keeps its own refusal words and its own `withReopen` step (`readAsk` in src/runner.js is this plus
106
+ * `withReopen`, null on any trouble).
107
+ * @param {string} runDir
108
+ * @returns {{ok: false, missing: boolean, red?: string}|{ok: true, value: any, parseError: string|null}}
109
+ */
110
+ export function readAskFile(runDir: string): {
111
+ ok: false;
112
+ missing: boolean;
113
+ red?: string;
114
+ } | {
115
+ ok: true;
116
+ value: any;
117
+ parseError: string | null;
118
+ };
118
119
  /**
119
120
  * An `ask.json`-shaped object as every reader should see it: `expiresAt` is the effective deadline, and `waitMs`
120
121
  * is the signed wait the ask was parked with (its own `expiresAt` minus `askedAt`, written from the signed ttl),
@@ -251,8 +252,12 @@ export function listArchivedAsks(runDir: string): {
251
252
  archived: false;
252
253
  why: string;
253
254
  };
255
+ /** M20 am8a: the decisions that need a reason, as a list (the panel hands it to the page, which asks it instead of spelling them) */
256
+ export const REASON_DECISIONS: readonly string[];
257
+ export function needsReason(decision: unknown): boolean;
254
258
  export namespace DECISION_STATUS {
255
259
  let accept: string;
256
260
  let redo: string;
257
261
  let rerun: string;
258
262
  }
263
+ import { readSavedAnswer } from './books.js';
@@ -18,43 +18,13 @@ export function specHash({ proseText, declarationText, inputFactsText, readoutTe
18
18
  red: string;
19
19
  };
20
20
  /**
21
- * The questions a plan folder raised and the answers on disk, READ from its files — the ONE reader (the panel's phase reader, the sign
22
- * checks and the page all use it). `questions` = [{ k, line, question, answer|null }], `open` = those with no answer. A blank or unreadable
23
- * answer file counts as no answer. No questions file = `{ questions: [], open: [] }`.
24
- * @param {string} planDir
25
- * A question the page look raised (M10 piece 3) also carries `source: 'look'`, `ask` ('reading' | 'cant-check'), `ruleNo`, `ruleText` and `proposal`; an answer file carries `at`.
26
- * @returns {{ questions: {k:number, line:number, question:string, answer:string|null, at?:string, rule?:string|null, choice?:'agree'|'drop'|'rule'|'column', source?:string, ask?:string, ruleNo?:number, ruleText?:string, proposal?:string|null, check?:Record<string, any>, pairRule?:number, columns?:string[], readings?:Record<string,string>}[], open: {k:number, line:number, question:string, answer:null}[] }}
21
+ * The flow name a draft will sign as: the `name` in `target.json` of a plan folder (`planDir`, read through the safe gateway). A string that is not empty,
22
+ * else null (no file, not JSON, not an object, no name, a name that is empty or not a string).
23
+ * @param {string} planDir @returns {string|null}
27
24
  */
28
- export function readQuestions(planDir: string): {
29
- questions: {
30
- k: number;
31
- line: number;
32
- question: string;
33
- answer: string | null;
34
- at?: string;
35
- rule?: string | null;
36
- choice?: "agree" | "drop" | "rule" | "column";
37
- source?: string;
38
- ask?: string;
39
- ruleNo?: number;
40
- ruleText?: string;
41
- proposal?: string | null;
42
- check?: Record<string, any>;
43
- pairRule?: number;
44
- columns?: string[];
45
- readings?: Record<string, string>;
46
- }[];
47
- open: {
48
- k: number;
49
- line: number;
50
- question: string;
51
- answer: null;
52
- }[];
53
- };
25
+ export function readTargetName(planDir: string): string | null;
54
26
  /** The ONE check that a plan folder with questions is not signable (CLI sign, the page's sign route and signDraft all call it). null = fine. @param {string} planDir */
55
27
  export function questionsRefusal(planDir: string): "A question the plan raised is still open. Answer it in the panel (fwdloop panel), then sign the plan it drafts after your answers. Nothing was signed." | "This plan raised questions, and your answers went into a newer plan. Sign the newest plan, not this one. Nothing was signed." | null;
56
- /** Literal (never RegExp) key scrub; a secret under 8 chars is skipped so it can't blank ordinary text. */
57
- export function scrub(text: any, secrets: any): any;
58
28
  /** Count files directly inside `dir` that contain a secret literally. */
59
29
  export function sweepForSecrets(dir: any, secrets: any): number;
60
30
  /** Exact signed TTL with its unit, never rounded: 2h / 30m / 20s / 1500ms (the largest unit that divides it exactly). */
@@ -132,7 +102,7 @@ export function writePlanFiles(dir: string, files: Record<string, string>, opts?
132
102
  * Test seam: `provider`/`rates`/`modelId` are injected; without them a live provider is built.
133
103
  * `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).
134
104
  */
135
- export function draftToDir({ proseFile, dir, root, name, slot, model, draftThinking, keyNames, env, provider, rates, modelId, noQuestions, onResult, fetchPage, leftRules, columnAnswers, carriedColumns, checkPicks, carriedPicks, carriedChoices, carriedSheetDropped, carriedShapeDropped, proseRead, flowType, mcpServer, mcpPick, mcpServers, actionMode, }: {
105
+ export function draftToDir({ proseFile, dir, root, name, slot, model, draftThinking, keyNames, env, provider, rates, modelId, noQuestions, onResult, onStepLine, fetchPage, leftRules, columnAnswers, carriedColumns, checkPicks, carriedPicks, carriedChoices, carriedSheetDropped, carriedShapeDropped, proseRead, flowType, mcpServer, mcpPick, mcpServers, actionMode, }: {
136
106
  proseFile: any;
137
107
  dir: any;
138
108
  root: any;
@@ -147,6 +117,7 @@ export function draftToDir({ proseFile, dir, root, name, slot, model, draftThink
147
117
  modelId: any;
148
118
  noQuestions?: boolean | undefined;
149
119
  onResult: any;
120
+ onStepLine: any;
150
121
  fetchPage: any;
151
122
  leftRules: any;
152
123
  columnAnswers: any;
@@ -157,7 +128,7 @@ export function draftToDir({ proseFile, dir, root, name, slot, model, draftThink
157
128
  carriedSheetDropped: any;
158
129
  carriedShapeDropped: any;
159
130
  proseRead: any;
160
- flowType?: "tickets" | "mcp" | "plain" | undefined;
131
+ flowType?: "mcp" | "plain" | "tickets" | undefined;
161
132
  mcpServer?: string | undefined;
162
133
  mcpPick?: any;
163
134
  mcpServers?: string[] | undefined;
@@ -276,20 +247,14 @@ export function signDraft({ dir, approve, signedBy, signedAt, env, keyNames, ses
276
247
  runDir?: undefined;
277
248
  modelPick?: undefined;
278
249
  };
279
- export const SPEC_HASH_FILE: "spec.hash";
280
250
  /** The one folder under the flows root where the panel keeps its draft folders (M4e). Starts with a dot, so it is never a flow name. */
281
251
  export const PANEL_DRAFTS_DIR: ".drafts";
282
- /** Written when the end sweep finds a key in the draft dir; sign refuses a dir that has it. */
283
- export const LEAK_MARKER_FILE: "scrub-leak.red";
284
252
  /** M4e amendments 24/25: the drafter's questions (written once by `fwdloop draft`), each human answer (`answer-<k>.json`, written once by the panel),
285
253
  * and the drafter's own "not checked" reading (information only; never in the readout, so never in the hash). */
286
- export const QUESTIONS_FILE: "questions.json";
287
- export const NOT_CHECKED_FILE: "not-checked.json";
288
254
  /** M10: the drafting copy of each web page input is kept in this folder of the draft folder (a run freezes its own, never this one). */
289
255
  export const PAGES_DIR: "pages";
290
256
  /** M10 item 3: what the page-word look kept and dropped, per page input (the map the AI named, the kept facts with their readings, every drop). Not signed. */
291
257
  export const PAGE_LOOK_FILE: "page-look.json";
292
- export function ANSWER_FILE(k: any): string;
293
258
  export function SIGN_LINE(dir: any, hash: any): string;
294
259
  export const OPEN_QUESTION_SAY: "A question the plan raised is still open. Answer it in the panel (fwdloop panel), then sign the plan it drafts after your answers. Nothing was signed.";
295
260
  export const ANSWERED_QUESTION_SAY: "This plan raised questions, and your answers went into a newer plan. Sign the newest plan, not this one. Nothing was signed.";
@@ -6,7 +6,7 @@ export function guardrailStandaloneNumbers(g: unknown): number[];
6
6
  export function guardrailWordsPerSection(g: unknown): number | null;
7
7
  /** the first "<N> sections" in a guardrail (digits, or one..ten), or null @param {unknown} g @returns {number|null} */
8
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} */
9
+ /** the first "<N> bullets / list items / items / lines / points" in a guardrail (digits, or one..ten; not a price like "$5 per item" or a decimal), or null @param {unknown} g @returns {number|null} */
10
10
  export function guardrailItemCount(g: unknown): number | null;
11
11
  /**
12
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