fwdloop 0.22.0 → 0.24.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 (63) hide show
  1. package/bin/fwdloop +31 -8
  2. package/package.json +2 -2
  3. package/src/ask.js +34 -4
  4. package/src/attemptdiff.js +118 -0
  5. package/src/audit-fold.js +2 -0
  6. package/src/authoring.js +36 -2
  7. package/src/canrun.js +5 -0
  8. package/src/checked.js +14 -3
  9. package/src/citedcheck.js +16 -1
  10. package/src/citedwords.js +36 -2
  11. package/src/closers.js +13 -223
  12. package/src/config.js +5 -1
  13. package/src/csv.js +69 -12
  14. package/src/declaration.js +64 -6
  15. package/src/drafter.js +43 -17
  16. package/src/flowmodel.js +56 -1
  17. package/src/learn.js +952 -0
  18. package/src/learnstore.js +346 -0
  19. package/src/model-step.js +15 -21
  20. package/src/pagedry.js +3 -4
  21. package/src/pagefetch.js +9 -2
  22. package/src/pagerules.js +28 -5
  23. package/src/panel/author.js +2 -1
  24. package/src/panel/authorcard.js +9 -2
  25. package/src/panel/data.js +80 -17
  26. package/src/panel/index.html +186 -12
  27. package/src/panel/result.js +6 -0
  28. package/src/redact.js +6 -6
  29. package/src/runner.js +151 -24
  30. package/src/sheet-record.js +57 -0
  31. package/src/sheetblock.js +170 -0
  32. package/src/sheetchecks.js +206 -0
  33. package/src/sheetclaims.js +78 -0
  34. package/src/sheetoffer.js +125 -0
  35. package/src/sheetrun.js +105 -0
  36. package/src/thinking.js +11 -0
  37. package/src/try-checks.js +6 -0
  38. package/src/types.js +1 -9
  39. package/types/ask.d.ts +8 -2
  40. package/types/attemptdiff.d.ts +38 -0
  41. package/types/checked.d.ts +9 -3
  42. package/types/citedwords.d.ts +14 -0
  43. package/types/closers.d.ts +6 -31
  44. package/types/csv.d.ts +25 -4
  45. package/types/declaration.d.ts +6 -1
  46. package/types/drafter.d.ts +28 -9
  47. package/types/flowmodel.d.ts +36 -0
  48. package/types/learn.d.ts +576 -0
  49. package/types/learnstore.d.ts +168 -0
  50. package/types/model-step.d.ts +19 -30
  51. package/types/pagerules.d.ts +7 -0
  52. package/types/panel/authorcard.d.ts +2 -1
  53. package/types/panel/data.d.ts +2 -1
  54. package/types/panel/result.d.ts +1 -1
  55. package/types/runner.d.ts +19 -6
  56. package/types/sheet-record.d.ts +24 -0
  57. package/types/sheetblock.d.ts +116 -0
  58. package/types/sheetchecks.d.ts +70 -0
  59. package/types/sheetclaims.d.ts +26 -0
  60. package/types/sheetoffer.d.ts +25 -0
  61. package/types/sheetrun.d.ts +35 -0
  62. package/types/thinking.d.ts +11 -0
  63. package/types/types.d.ts +16 -11
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The tool schema of `close.sheet`: a list of bareguard cells / table checks. Every field is a field of bareguard's vocabulary; every column-bearing field
3
+ * (`column keyColumn groupColumn result a b from to cell where[].column dateFormats[].column`) is an enum of the sheet's exact header. `covers` is fwdloop's own field
4
+ * (which `~` rules of the job line the check covers), kept and signed.
5
+ * @param {Record<string, {header: string[]}>} tables the drafting copy's table of each CSV input role
6
+ * @returns {Record<string, any>|null} null when there is no sheet with a header to pick from
7
+ */
8
+ export function sheetChecksProp(tables: Record<string, {
9
+ header: string[];
10
+ }>): Record<string, any> | null;
11
+ /**
12
+ * Every op of the cells and table rules with its summary, what it requires and allows, its claim shape and bareguard's worked example check. Generated from the
13
+ * vocabulary; a new op bareguard adds shows up here by itself.
14
+ * @returns {string[]} lines for the system prompt
15
+ */
16
+ export function sheetOpsBrief(): string[];
17
+ /**
18
+ * The rules the validator enforces on `close.sheet`, as lines for the drafter (every one of them is a refusal at $0 in src/declaration.js / src/sheetchecks.js).
19
+ * @param {string[]} roles the CSV input roles @returns {string[]}
20
+ */
21
+ export function sheetOfferRules(roles: string[]): string[];
22
+ /** @param {unknown} rule @returns {boolean} true for the `use the column 'X' for 'Y'` rule an agreed column ask writes ({@link columnRuleWords}) */
23
+ export function isColumnChoiceRule(rule: unknown): boolean;
24
+ /** The comparisons of a `where` condition. bareguard publishes them only inside the `where` description (no list), so this is the one copy; a test proves each is named there. */
25
+ export const WHERE_CMPS: readonly string[];
@@ -0,0 +1,35 @@
1
+ /** The sheet inputs any step's `close.sheet` reads, once each, in order. @param {any[]} steps @returns {string[]} */
2
+ export function sheetRolesOf(steps: any[]): string[];
3
+ /**
4
+ * bareguard's `tableSha` of the run's frozen CSV `<runDir>/inputs/<name>` (its table from src/csv.js `sheetTable`), read through the one safe gateway; null when the copy
5
+ * cannot be read or bareguard cannot read it as a table (a ragged row, a repeated header).
6
+ * @param {string} runDir @param {string} name the frozen file's name @returns {string|null}
7
+ */
8
+ export function tableShaOfFrozen(runDir: string, name: string): string | null;
9
+ /**
10
+ * What a sheet check reads in a run: the run's OWN frozen copy of each sheet its checks name, as bareguard's table, and the `tableSha` recorded in `inputs.json` at
11
+ * the run's start. The table is NOT compared here: bareguard compares it to the recorded sha when it checks (and stops if it differs).
12
+ * @param {string} runDir @param {any[]} checks the step's `close.sheet`
13
+ * @returns {{ok: true, tables: Record<string, {header: string[], rows: any[]}>, inputs: Array<{name: string, sha256: string}>}|{ok: false, red: string}}
14
+ */
15
+ export function readRunSheets(runDir: string, checks: any[]): {
16
+ ok: true;
17
+ tables: Record<string, {
18
+ header: string[];
19
+ rows: any[];
20
+ }>;
21
+ inputs: Array<{
22
+ name: string;
23
+ sha256: string;
24
+ }>;
25
+ } | {
26
+ ok: false;
27
+ red: string;
28
+ };
29
+ /**
30
+ * The close of a green step that reads a sheet. `sheet` = `readRunSheets`' answer. `artifact` is the step's typed answer (its claim boxes). Gaps come from bareguard
31
+ * (`renderGaps`: row numbers and counts, a data problem first); each signed check is also listed with its own pass or fail for the Checked list.
32
+ * @param {any[]} checks the step's `close.sheet` @param {unknown} artifact @param {ReturnType<typeof readRunSheets>|null|undefined} sheet
33
+ * @returns {Promise<import('./types.js').CloseVerdict>}
34
+ */
35
+ export function closeSheet(checks: any[], artifact: unknown, sheet: ReturnType<typeof readRunSheets> | null | undefined): Promise<import("./types.js").CloseVerdict>;
@@ -50,6 +50,17 @@ export function stepThinkingMode({ boxOn, attempt }: {
50
50
  boxOn: boolean;
51
51
  attempt: number;
52
52
  }): "on" | "off";
53
+ /**
54
+ * M8 am7 item 2: the ONE owner of whether a step's try is handed the earlier runs' block. The places thinking switches on, but NOT the Chat "Thinking on" box:
55
+ * a retry (2nd or later try), a redo at an ask (numbered after the step's last try, so 2nd or later), and a rerun (the fresh run's first step, which starts
56
+ * from the human's rerun reason). A step's plain first try never gets it, whatever the box says.
57
+ * @param {{attempt: number, rerunReason: string|null}} a `rerunReason`: the reason this try starts from when it is a fresh run's first try, else null
58
+ * @returns {boolean}
59
+ */
60
+ export function stepHintsWanted({ attempt, rerunReason }: {
61
+ attempt: number;
62
+ rerunReason: string | null;
63
+ }): boolean;
53
64
  /** The sentence under a greyed "Thinking on" box (amendment 7 item 2). */
54
65
  export const THINKING_FIXED_SAY: "can't change this for this model";
55
66
  /** The note beside the Chat "Thinking on" box, before any draft, for a model bareagent has not checked (M4d am11 item 2). */
package/types/types.d.ts CHANGED
@@ -255,17 +255,6 @@ export type ExecutorContext = {
255
255
  reads: Record<string, any>;
256
256
  gap: string | null;
257
257
  };
258
- /**
259
- * A green-class field value: `value` is the number/ISO-date/text claimed;
260
- * `cite` resolves it (src/closers.js's own grammar).
261
- */
262
- export type GreenField = {
263
- value: string | number;
264
- cite: string;
265
- };
266
- export type GreenArtifact = {
267
- fields: Record<string, GreenField>;
268
- };
269
258
  export type SoftgreenArtifact = {
270
259
  text: string;
271
260
  lines?: string[];
@@ -294,6 +283,22 @@ export type CloseVerdict = {
294
283
  check: any;
295
284
  results?: unknown;
296
285
  } | undefined;
286
+ /**
287
+ * a sheet close (M10b piece 2): what the run's sheet-check record keeps
288
+ */
289
+ sheetRecord?: {
290
+ inputs: Array<{
291
+ name: string;
292
+ sha256: string;
293
+ }>;
294
+ claims: unknown;
295
+ checks: Array<{
296
+ id: string;
297
+ text: string;
298
+ ok: boolean;
299
+ result: string | null;
300
+ }>;
301
+ } | undefined;
297
302
  };
298
303
  /**
299
304
  * One row appended to `runs/<run-id>/audit.jsonl` (M2 scope item 9).