fwdloop 0.37.0 → 0.39.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 (140) hide show
  1. package/README.md +5 -19
  2. package/bin/fwdloop +51 -29
  3. package/package.json +1 -1
  4. package/src/ask.js +70 -148
  5. package/src/audit-fold.js +5 -4
  6. package/src/auditchecks.js +6 -4
  7. package/src/authoring.js +36 -64
  8. package/src/blockasks.js +2 -1
  9. package/src/blockassemble.js +7 -9
  10. package/src/blockdraft.js +2 -2
  11. package/src/blockpick.js +5 -5
  12. package/src/books.js +217 -12
  13. package/src/checkblock.js +25 -55
  14. package/src/checked.js +2 -3
  15. package/src/checklistsign.js +26 -5
  16. package/src/checklook.js +3 -1
  17. package/src/checkpick.js +5 -76
  18. package/src/cited-source.js +4 -4
  19. package/src/citedcheck.js +6 -11
  20. package/src/citedwords.js +9 -8
  21. package/src/closers.js +9 -6
  22. package/src/declaration.js +22 -55
  23. package/src/diary.js +23 -1
  24. package/src/draft-steps.js +11 -1
  25. package/src/drafter.js +28 -23
  26. package/src/draftfiles.js +127 -0
  27. package/src/draftspend.js +165 -17
  28. package/src/flow.js +42 -87
  29. package/src/flowmodel.js +1 -1
  30. package/src/index.js +3 -2
  31. package/src/inside.js +86 -0
  32. package/src/isrec.js +2 -0
  33. package/src/jsonl-append.js +33 -1
  34. package/src/learn.js +1 -1
  35. package/src/learnstore.js +20 -22
  36. package/src/line-checks.js +2 -3
  37. package/src/liveness.js +3 -0
  38. package/src/mcp-use.js +8 -9
  39. package/src/memo.js +13 -16
  40. package/src/minrule.js +16 -0
  41. package/src/model-step.js +3 -3
  42. package/src/page-words.js +8 -0
  43. package/src/pageask.js +8 -3
  44. package/src/pagebits.js +8 -1
  45. package/src/pagedropwords.js +1 -1
  46. package/src/pagerules.js +6 -3
  47. package/src/panel/author.js +121 -78
  48. package/src/panel/authorcard.js +21 -8
  49. package/src/panel/authorflows.js +3 -3
  50. package/src/panel/authorresume.js +3 -3
  51. package/src/panel/authorstart.js +15 -16
  52. package/src/panel/authortrigger.js +43 -70
  53. package/src/panel/data.js +125 -168
  54. package/src/panel/index.html +154 -63
  55. package/src/panel/jobgrid.js +3 -7
  56. package/src/panel/result.js +7 -10
  57. package/src/panel/resume.js +4 -3
  58. package/src/panel/scheduler.js +9 -9
  59. package/src/panel/server.js +8 -4
  60. package/src/panel/spawn.js +22 -11
  61. package/src/panel/tickets.js +2 -2
  62. package/src/pickrecord.js +51 -31
  63. package/src/placerule.js +3 -4
  64. package/src/planrebuild.js +19 -19
  65. package/src/primitives.js +1 -1
  66. package/src/provider.js +1 -1
  67. package/src/reasons.js +25 -0
  68. package/src/report.js +2 -1
  69. package/src/runfile.js +26 -2
  70. package/src/runner.js +57 -105
  71. package/src/runvalues.js +47 -24
  72. package/src/schedule-choices.js +41 -0
  73. package/src/schedule-shape.js +39 -0
  74. package/src/schedule.js +9 -8
  75. package/src/setup.js +20 -36
  76. package/src/shaperows.js +2 -2
  77. package/src/sheet-record.js +1 -2
  78. package/src/sheetblock.js +3 -4
  79. package/src/sheetbuild.js +5 -5
  80. package/src/sheetchecks.js +1 -2
  81. package/src/sheetclaims.js +1 -2
  82. package/src/sheetoffer.js +1 -1
  83. package/src/sheetrun.js +5 -7
  84. package/src/summary-words.js +2 -1
  85. package/src/thinking.js +5 -2
  86. package/src/ticketrows.js +8 -30
  87. package/src/trigger-clock.js +9 -23
  88. package/src/trigger-files.js +30 -22
  89. package/src/trigger-tickets.js +15 -14
  90. package/src/try-checks.js +2 -1
  91. package/src/types.js +2 -0
  92. package/types/ask.d.ts +25 -20
  93. package/types/authoring.d.ts +8 -42
  94. package/types/blockassemble.d.ts +0 -1
  95. package/types/blockpick.d.ts +1 -1
  96. package/types/books.d.ts +256 -4
  97. package/types/checkblock.d.ts +2 -25
  98. package/types/checklist.d.ts +3 -3
  99. package/types/checklistsign.d.ts +7 -0
  100. package/types/checkpick.d.ts +0 -21
  101. package/types/citedwords.d.ts +7 -4
  102. package/types/closers.d.ts +1 -0
  103. package/types/declaration.d.ts +4 -14
  104. package/types/diary.d.ts +14 -1
  105. package/types/draft-steps.d.ts +7 -0
  106. package/types/drafter.d.ts +3 -2
  107. package/types/draftfiles.d.ts +89 -0
  108. package/types/draftspend.d.ts +74 -0
  109. package/types/flow.d.ts +32 -54
  110. package/types/index.d.ts +3 -3
  111. package/types/inside.d.ts +58 -0
  112. package/types/isrec.d.ts +1 -0
  113. package/types/jsonl-append.d.ts +20 -0
  114. package/types/learnstore.d.ts +0 -2
  115. package/types/liveness.d.ts +1 -0
  116. package/types/minrule.d.ts +6 -0
  117. package/types/page-words.d.ts +6 -0
  118. package/types/pageask.d.ts +2 -0
  119. package/types/pagebits.d.ts +3 -0
  120. package/types/pagerules.d.ts +1 -0
  121. package/types/panel/author.d.ts +7 -3
  122. package/types/panel/authorcard.d.ts +0 -6
  123. package/types/panel/authorflows.d.ts +4 -4
  124. package/types/panel/authortrigger.d.ts +16 -2
  125. package/types/panel/data.d.ts +36 -11
  126. package/types/panel/spawn.d.ts +18 -2
  127. package/types/pickrecord.d.ts +29 -0
  128. package/types/reasons.d.ts +23 -0
  129. package/types/runfile.d.ts +14 -0
  130. package/types/runner.d.ts +6 -38
  131. package/types/runvalues.d.ts +17 -2
  132. package/types/schedule-choices.d.ts +9 -0
  133. package/types/schedule-shape.d.ts +15 -0
  134. package/types/sheetbuild.d.ts +1 -1
  135. package/types/sheetclaims.d.ts +0 -1
  136. package/types/thinking.d.ts +1 -0
  137. package/types/ticketrows.d.ts +0 -9
  138. package/types/trigger-clock.d.ts +3 -2
  139. package/types/trigger-files.d.ts +15 -4
  140. package/types/types.d.ts +8 -0
@@ -39,7 +39,7 @@ export function buildSheetLine({ line, tables, suggestions }: {
39
39
  * then Not checked with the no-pick sentence, never silently nothing). A suggestion that names no sheet line, or is not an object, is refused and listed with its helper.
40
40
  * @param {{lines: {n: number, text?: string, rules?: string[], guardrail?: string, rule?: string}[], tables: Record<string, {header: string[], rows: any[]}>, suggestions: any[]}} o
41
41
  * @returns {Promise<{built: Record<number, Awaited<ReturnType<typeof buildSheetLine>>>, checks: any[], notChecked: Record<string, string>, refused: {line: number|null, helper: string, why: string}[]}>}
42
- * `notChecked`: `line N: "rule"` -> the refusal that named it (or `NO_VALUE_WHY`), for each rule of a sheet line that no check holds
42
+ * `notChecked`: `line N: "rule"` -> the refusal that named it (or `REASON.noPick`), for each rule of a sheet line that no check holds
43
43
  */
44
44
  export function buildSheetChecks({ lines, tables, suggestions }: {
45
45
  lines: {
@@ -39,5 +39,4 @@ export function sheetTotalLines(checks: any[], claims: any, tables: Record<strin
39
39
  cells: string[];
40
40
  }[];
41
41
  }>): string[];
42
- export function isRec(v: unknown): boolean;
43
42
  export const ROW_MATH_OPS: readonly string[];
@@ -63,5 +63,6 @@ export function stepHintsWanted({ attempt, rerunReason }: {
63
63
  }): boolean;
64
64
  /** The sentence under a greyed "Thinking on" box (amendment 7 item 2). */
65
65
  export const THINKING_FIXED_SAY: "can't change this for this model";
66
+ export function isThinkingMode(mode: unknown): boolean;
66
67
  /** The note beside the Chat "Thinking on" box, before any draft, for a model bareagent has not checked (M4d am11 item 2). */
67
68
  export const THINKING_UNVERIFIED_SAY: "thinking off (not verified for this model)";
@@ -49,13 +49,4 @@ export function withTicketRows({ declaration, lines }: {
49
49
  declaration: any;
50
50
  tickets: ReturnType<typeof ticketRowsOf>;
51
51
  };
52
- /**
53
- * The proof of a plan whose list has ticket rows (a plan with none is not examined): a built ticket row needs the declaration's field, and a field the declaration holds needs a built row for it.
54
- * @param {any} declaration @returns {string[]}
55
- */
56
- export function ticketListReds(declaration: any): string[];
57
- /** @type {readonly ('ticketFilter'|'ticketWatch')[]} */
58
- export const TICKET_FIELDS: readonly ("ticketFilter" | "ticketWatch")[];
59
- /** the Not-checked reason of a ticket rule no legal value was suggested for (the block's own noPick sentence is used by the caller's words) */
60
- export const NO_VALUE_WHY: "No check was picked for it, so you judge it at Accept.";
61
52
  export function ticketRowKey(line: number, rule: number, field: string): string;
@@ -20,8 +20,6 @@ export function due(schedule: Schedule, rows: ClockRow[], now: number): Due;
20
20
  * @returns {number}
21
21
  */
22
22
  export function nextSlot(schedule: Schedule, afterMs: number): number;
23
- /** @param {string} file @param {string} [sig] M9 am20: only the rows of that schedule signing (the one schedule ledger carries every signing's rows); absent = every row @returns {ClockRow[]} every row on disk that parses, oldest first; a missing file is no rows; a line a crash tore mid-append is skipped (`appendOnce` starts each append on a fresh line, so it never glues onto the next row). */
24
- export function readRows(file: string, sig?: string): ClockRow[];
25
23
  /** The trigger was set at `now`: no slot before this ever fires. M13 piece 5: `ticketN` = the highest ticket number the first green run read; a ticket schedule's first look baselines only tickets up to it. @param {string} file @param {number} now @param {string} [sig] @param {number} [ticketN] */
26
24
  export function armTrigger(file: string, now: number, sig?: string, ticketN?: number): void;
27
25
  /**
@@ -34,6 +32,9 @@ export function recordFire(file: string, d: Due, now: number, sig?: string): voi
34
32
  /** @typedef {{fire:boolean, catchUp:boolean, missed:number, slot?:number}} Due */
35
33
  /** A slot seen MORE than this after its set time is a catch-up (M9 am2 item 1). Exactly this late is on time. */
36
34
  export const GRACE_MS: 120000;
35
+ /** M20 am6: the one list of clock schedule kinds, and the one question "is this a clock kind" */
36
+ export const CLOCK_KINDS: readonly string[];
37
+ export function isClockKind(kind: unknown): boolean;
37
38
  export type Schedule = {
38
39
  kind: "daily" | "weekdays";
39
40
  hour: number;
@@ -1,7 +1,3 @@
1
- /** Every row that parses; a line a crash tore mid-append is skipped (it counts as not written). `appendSeen` starts each append on a fresh line, so a torn line can never glue onto the next row. @param {string} file @param {string} [sig] M9 am20: only the rows of that schedule signing (the one schedule ledger carries every signing's rows); absent = every row @returns {SeenRow[]} */
2
- export function readSeen(file: string, sig?: string): SeenRow[];
3
- /** The ONE appender: write-once by id within a signing (a second row with the same id is not written). Starts on a fresh line when the file does not end in a newline (a torn last line). @param {string} file @param {SeenRow} row @param {string} [sig] stamped on the row @returns {boolean} written */
4
- export function appendSeen(file: string, row: SeenRow, sig?: string): boolean;
5
1
  /** Arrived rows are never overwritten: the 2nd arrival of a sha (after a drop) gets its own id. @param {string} ledger @param {ToRun & {name?:string}} item @param {number} at the scheduler's clock, never the file's mtime @param {string} [sig] */
6
2
  export function recordArrived(ledger: string, item: ToRun & {
7
3
  name?: string;
@@ -46,6 +42,18 @@ export function recheck(item: {
46
42
  * @param {'new'|'updated'} mode @param {string} target
47
43
  */
48
44
  export function checkTarget(mode: "new" | "updated", target: string): void;
45
+ /**
46
+ * Is a file or folder trigger's target usable now? The words say what is wrong, without the closing "Nothing was changed."; null = fine. A file that does not exist yet may arrive
47
+ * (`checkTarget` allows it), but its folder must be there: a typo is caught now, not never.
48
+ * @param {{kind: 'file-updated', path: string}|{kind: 'new-file', folder: string}} trigger @returns {string|null}
49
+ */
50
+ export function fileTriggerWhy(trigger: {
51
+ kind: "file-updated";
52
+ path: string;
53
+ } | {
54
+ kind: "new-file";
55
+ folder: string;
56
+ }): string | null;
49
57
  /**
50
58
  * M9 am16: does a trigger on this target still watch this file? New: the file sits directly in the same (real) folder. Updated: it is the same (real) file. False when the target cannot be resolved.
51
59
  * @param {'new'|'updated'} mode @param {string} target @param {string} filePath a queued file's path as the watcher recorded it (a real path)
@@ -69,6 +77,9 @@ export function createFileTrigger({ mode, target, ledger, sig }: {
69
77
  /** @typedef {{id:string, kind:'baseline'|'arrived'|'ran'|'dropped', sha:string, name:string, size:number, at:number, path?:string, why?:string, of?:string, sig?:string}} SeenRow */
70
78
  /** @typedef {{path:string, sha:string, size:number}} ToRun */
71
79
  /** @typedef {{path:string, why:string}} Refused */
80
+ /** M20 am7: the one list of file schedule kinds, and the one question "is this a file kind" */
81
+ export const FILE_KINDS: readonly string[];
82
+ export function isFileKind(kind: unknown): boolean;
72
83
  /** Consecutive polls with the same size and mtime before a file is taken. (Two matches in a row = taken on the third sighting.) */
73
84
  export const STABLE_POLLS: 2;
74
85
  export function recordRan(ledger: string, item: {
package/types/types.d.ts CHANGED
@@ -237,6 +237,14 @@ export type ReadFlowOk = {
237
237
  declaration: Record<string, any>;
238
238
  signature: Signature;
239
239
  classes: Record<string, string>;
240
+ /**
241
+ * only on `readRunJobCopy`: the verified copy's own bytes (prose.txt)
242
+ */
243
+ proseText?: string | undefined;
244
+ /**
245
+ * only on `readRunJobCopy`: the verified copy's own bytes (declaration.json)
246
+ */
247
+ declarationText?: string | undefined;
240
248
  };
241
249
  export type ReadFlowRed = {
242
250
  ok: false;