fwdloop 0.35.2 → 0.37.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 (104) hide show
  1. package/README.md +1 -1
  2. package/bin/fwdloop +5 -2
  3. package/package.json +3 -3
  4. package/src/action-stop.js +1 -1
  5. package/src/auditchecks.js +41 -9
  6. package/src/authoring.js +78 -20
  7. package/src/blockasks.js +10 -12
  8. package/src/blockassemble.js +49 -43
  9. package/src/blockdraft.js +4 -2
  10. package/src/blockpick.js +10 -0
  11. package/src/canrun.js +2 -1
  12. package/src/cardlist.js +28 -5
  13. package/src/checkblock.js +610 -64
  14. package/src/checked.js +28 -33
  15. package/src/checklistsign.js +2 -1
  16. package/src/checklook.js +45 -0
  17. package/src/checkrows.js +202 -0
  18. package/src/cited-record.js +2 -2
  19. package/src/citedcheck.js +53 -12
  20. package/src/citedwords.js +7 -4
  21. package/src/closers.js +49 -2
  22. package/src/declaration.js +26 -4
  23. package/src/drafter.js +86 -62
  24. package/src/factwords.js +7 -4
  25. package/src/globprefix.js +26 -0
  26. package/src/model-step.js +22 -4
  27. package/src/pageask.js +6 -4
  28. package/src/pagedropwords.js +3 -11
  29. package/src/pagedry.js +75 -1
  30. package/src/pagefetch.js +11 -6
  31. package/src/pagelook.js +2 -1
  32. package/src/pagerules.js +8 -2
  33. package/src/panel/author.js +20 -8
  34. package/src/panel/authorcard.js +3 -3
  35. package/src/panel/data.js +3 -2
  36. package/src/panel/index.html +176 -41
  37. package/src/panel/result.js +40 -3
  38. package/src/pickrecord.js +14 -0
  39. package/src/planrebuild.js +55 -19
  40. package/src/ratelimit.js +117 -0
  41. package/src/report.js +216 -0
  42. package/src/rowresults.js +111 -0
  43. package/src/rubricstep.js +65 -2
  44. package/src/runner.js +61 -9
  45. package/src/send.js +19 -82
  46. package/src/shapebuild.js +281 -0
  47. package/src/shapelook.js +91 -0
  48. package/src/shapemenu.js +64 -0
  49. package/src/shaperesult.js +104 -0
  50. package/src/shaperows.js +263 -0
  51. package/src/shapewords.js +140 -0
  52. package/src/sheetbuild.js +41 -29
  53. package/src/sheetclaims.js +49 -1
  54. package/src/sheetfind.js +8 -0
  55. package/src/sheetlook.js +11 -1
  56. package/src/sheetrows.js +10 -64
  57. package/src/ticketrows.js +1 -1
  58. package/src/try-checks.js +39 -6
  59. package/src/types.js +1 -0
  60. package/src/whole-job.js +108 -16
  61. package/types/action-stop.d.ts +1 -1
  62. package/types/auditchecks.d.ts +13 -2
  63. package/types/authoring.d.ts +24 -4
  64. package/types/blockasks.d.ts +6 -10
  65. package/types/blockassemble.d.ts +13 -13
  66. package/types/blockdraft.d.ts +3 -2
  67. package/types/blockpick.d.ts +4 -0
  68. package/types/cardlist.d.ts +18 -2
  69. package/types/checkblock.d.ts +278 -28
  70. package/types/checked.d.ts +15 -6
  71. package/types/checklook.d.ts +36 -0
  72. package/types/checkrows.d.ts +119 -0
  73. package/types/citedcheck.d.ts +4 -2
  74. package/types/closers.d.ts +10 -1
  75. package/types/drafter.d.ts +8 -4
  76. package/types/globprefix.d.ts +5 -0
  77. package/types/model-step.d.ts +43 -2
  78. package/types/pageask.d.ts +5 -3
  79. package/types/pagedropwords.d.ts +0 -1
  80. package/types/pagedry.d.ts +27 -0
  81. package/types/pagefetch.d.ts +3 -2
  82. package/types/pagerules.d.ts +4 -0
  83. package/types/panel/result.d.ts +19 -2
  84. package/types/pickrecord.d.ts +10 -0
  85. package/types/ratelimit.d.ts +59 -0
  86. package/types/report.d.ts +46 -0
  87. package/types/rowresults.d.ts +28 -0
  88. package/types/rubricstep.d.ts +21 -0
  89. package/types/runner.d.ts +3 -1
  90. package/types/send.d.ts +13 -12
  91. package/types/shapebuild.d.ts +97 -0
  92. package/types/shapelook.d.ts +76 -0
  93. package/types/shapemenu.d.ts +40 -0
  94. package/types/shaperesult.d.ts +40 -0
  95. package/types/shaperows.d.ts +102 -0
  96. package/types/shapewords.d.ts +43 -0
  97. package/types/sheetbuild.d.ts +31 -13
  98. package/types/sheetclaims.d.ts +16 -0
  99. package/types/sheetfind.d.ts +1 -0
  100. package/types/sheetrows.d.ts +5 -36
  101. package/types/ticketrows.d.ts +1 -1
  102. package/types/try-checks.d.ts +2 -1
  103. package/types/types.d.ts +4 -0
  104. package/types/whole-job.d.ts +69 -3
@@ -33,6 +33,7 @@ export function outputRecord(step: {
33
33
  * #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
34
34
  * judged nothing (`unparseable`, `crash`) is one check that could not run, with that third outcome as its result.
35
35
  * @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
36
+ * @param {any[]} [jobLines] the signed job lines (M19 am11: the words of a list line's field rows read the person's rule)
36
37
  */
37
38
  export function closeRecords(step: any, artifact: any, closed: {
38
39
  verdict: string;
@@ -42,7 +43,7 @@ export function closeRecords(step: any, artifact: any, closed: {
42
43
  ok: boolean;
43
44
  result: string | null;
44
45
  }>;
45
- }, checkList?: any[]): any[];
46
+ }, checkList?: any[], jobLines?: any[]): any[];
46
47
  export const EVERY_STEP: "every step";
47
48
  /** 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 */
48
49
  export const EVERY_STEP_TEXTS: readonly string[];
package/types/types.d.ts CHANGED
@@ -291,6 +291,10 @@ export type CloseVerdict = {
291
291
  check: any;
292
292
  results?: unknown;
293
293
  } | undefined;
294
+ /**
295
+ * a line with an itemShape close (M19 S5): bareguard's own gaps of the items check (names, counts and bounds, never a value)
296
+ */
297
+ shapeGaps?: any[] | undefined;
294
298
  /**
295
299
  * a sheet close (M10b piece 2): what the run's sheet-check record keeps
296
300
  */
@@ -15,15 +15,44 @@ export function wholeJobAskIndex({ steps, askLines, sendLines }: {
15
15
  sendLines: Map<number, any>;
16
16
  }): number;
17
17
  /**
18
- * @param {{ steps: { fromLine: number, goal: string, emits?: string }[], askLines: Map<number, any>, lastAskIndex: number,
19
- * readResult: (id: string) => ({ ok: true, value: any } | { ok: false, missing: true } | { ok: false, missing: false, red: string }) }} p
18
+ * Is the prose of this step checked by code (M15 am3 item 2: `### The answer` instead of the not-checked heading)? Only when code really checked the step's own text (a green close with a words-per-section
19
+ * or picked check on it) AND the signed list holds no Not checked `~` rule on the line. A non-empty / `happened` check alone is no prose check, nor is a sheet or quote check (they check cells and quotes).
20
+ * @param {any} step @param {any[]|null|undefined} [checkList] the plan's signed list (`declaration.checkList`)
21
+ * @returns {boolean}
22
+ */
23
+ export function proseCheckedOf(step: any, checkList?: any[] | null | undefined): boolean;
24
+ /**
25
+ * What the report needs besides the steps: the signed lines' own words (the `~` rules), the run's frozen sheets and which sheet checks passed. Read once from the run folder.
26
+ * @param {{ runDir: string, steps: any[], jobLines: any[]|null|undefined, checkList?: any[]|null }} p
27
+ * @returns {{ ok: true, jobLines: any[], checkList: any[]|null, tables: Record<string, any>, okIdsOf: (n: number) => Set<string>|null } | { ok: false, red: string }}
28
+ */
29
+ export function reportContextOf({ runDir, steps, jobLines, checkList }: {
30
+ runDir: string;
31
+ steps: any[];
32
+ jobLines: any[] | null | undefined;
33
+ checkList?: any[] | null;
34
+ }): {
35
+ ok: true;
36
+ jobLines: any[];
37
+ checkList: any[] | null;
38
+ tables: Record<string, any>;
39
+ okIdsOf: (n: number) => Set<string> | null;
40
+ } | {
41
+ ok: false;
42
+ red: string;
43
+ };
44
+ /**
45
+ * @param {{ steps: { fromLine: number, goal: string, emits?: string, close?: any }[], askLines: Map<number, any>, lastAskIndex: number,
46
+ * readResult: (id: string) => ({ ok: true, value: any } | { ok: false, missing: true } | { ok: false, missing: false, red: string }),
47
+ * context: ReturnType<typeof reportContextOf>, redPrefix?: string }} p `redPrefix` is `ask: ` (an Ask job's words, unchanged); M15 am4 gives a job with no Ask `send: `
20
48
  * @returns {{ ok: true, value: { text: string } } | { ok: false, red: string }}
21
49
  */
22
- export function wholeJobText({ steps, askLines, lastAskIndex, readResult }: {
50
+ export function wholeJobText({ steps, askLines, lastAskIndex, readResult, context, redPrefix }: {
23
51
  steps: {
24
52
  fromLine: number;
25
53
  goal: string;
26
54
  emits?: string;
55
+ close?: any;
27
56
  }[];
28
57
  askLines: Map<number, any>;
29
58
  lastAskIndex: number;
@@ -38,6 +67,8 @@ export function wholeJobText({ steps, askLines, lastAskIndex, readResult }: {
38
67
  missing: false;
39
68
  red: string;
40
69
  });
70
+ context: ReturnType<typeof reportContextOf>;
71
+ redPrefix?: string;
41
72
  }): {
42
73
  ok: true;
43
74
  value: {
@@ -47,6 +78,40 @@ export function wholeJobText({ steps, askLines, lastAskIndex, readResult }: {
47
78
  ok: false;
48
79
  red: string;
49
80
  };
81
+ /**
82
+ * M15 am3 item 6: the body the send writes. A plan whose last Ask shows the whole job (`wholeIdx` >= 0) was accepted AS that text: the body is `{text}` exactly, never rebuilt. A plan signed before
83
+ * M13 am9 (or a job with no Ask) sends the one step right before the send: its section is written from the accepted artifact, the line being that step's own (or, past an Ask, the step the Ask read).
84
+ * M15 am4: a job with no signed Ask (`askLines.size === 0`, no whole-job Ask) writes every work line before the send, in line order: the whole-job text over the steps before the send, the step right before it
85
+ * read from `content` (what the person accepted), the earlier ones from the run's saved outputs (`readResult`). A missing or unreadable earlier output refuses by name, in `send: ` words (never `ask: `).
86
+ * @param {{ content: any, wholeIdx: number, steps: any[], sendIndex: number, askLines: Map<number, any>, context: ReturnType<typeof reportContextOf>,
87
+ * readResult?: (id: string) => ({ ok: true, value: any } | { ok: false, missing: true } | { ok: false, missing: false, red: string }) }} p
88
+ * @returns {{ ok: true, body: string } | { ok: false, red: string }}
89
+ */
90
+ export function sendBodyOf({ content, wholeIdx, steps, sendIndex, askLines, context, readResult }: {
91
+ content: any;
92
+ wholeIdx: number;
93
+ steps: any[];
94
+ sendIndex: number;
95
+ askLines: Map<number, any>;
96
+ context: ReturnType<typeof reportContextOf>;
97
+ readResult?: (id: string) => ({
98
+ ok: true;
99
+ value: any;
100
+ } | {
101
+ ok: false;
102
+ missing: true;
103
+ } | {
104
+ ok: false;
105
+ missing: false;
106
+ red: string;
107
+ });
108
+ }): {
109
+ ok: true;
110
+ body: string;
111
+ } | {
112
+ ok: false;
113
+ red: string;
114
+ };
50
115
  /**
51
116
  * M13 am9 item 4: the plan shows the last Ask as reading every step. Code sets the Ask's `reads` to every work step's emits before it (the nearest one first, so a
52
117
  * redo still re-runs the step just before the Ask; the rest in job order). Only for the Ask right before the action; any other plan comes back as it was.
@@ -68,3 +133,4 @@ export function readEveryStep<S extends {
68
133
  line: number;
69
134
  }[];
70
135
  }): S[];
136
+ export function lineRulesOf(jl: any): string[];