bareloop 0.48.0 → 0.50.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.
- package/CHANGELOG.md +49 -0
- package/README.md +6 -2
- package/bareloop.context.md +15 -11
- package/package.json +3 -3
- package/src/authorflow.js +4 -0
- package/src/bundlerun.js +1 -1
- package/src/cli.js +9 -8
- package/src/facts.js +54 -6
- package/src/factwords.js +12 -1
- package/src/inputlook.js +6 -1
- package/src/launcher.js +77 -7
- package/src/pagedropwords.js +9 -3
- package/src/pagedry.js +98 -13
- package/src/pagefetch.js +75 -12
- package/src/pagemap.js +32 -6
- package/src/pagerules.js +208 -24
- package/src/panel/authorsession.js +5 -1
- package/src/panel/index.html +4 -3
- package/src/rubricstep.js +36 -5
- package/src/source.js +3 -3
- package/types/authorflow.d.ts +8 -0
- package/types/facts.d.ts +27 -2
- package/types/factwords.d.ts +6 -1
- package/types/inputlook.d.ts +2 -0
- package/types/launcher.d.ts +37 -2
- package/types/pagedry.d.ts +30 -1
- package/types/pagefetch.d.ts +31 -4
- package/types/pagemap.d.ts +1 -0
- package/types/pagerules.d.ts +13 -1
- package/types/rubricstep.d.ts +2 -1
- package/types/source.d.ts +12 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,55 @@ All notable changes to bareloop are documented here. Format:
|
|
|
5
5
|
[SemVer](https://semver.org/spec/v2.0.0.html). Pre-1.0: **minor** = a ladder rung or
|
|
6
6
|
feature lands, **patch** = docs, fixes, scaffolding.
|
|
7
7
|
|
|
8
|
+
## [0.50.0] - 2026-10-28
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **A date in a signed language and a decimal comma can be a fact (F249).** A `date` fact may sign `lang` (`en de fr es it pt nl`) and a `number` or `money` fact `decimal` (`","`); the page-word map may now name `date` and `number` and give `lang` / `decimal`, and is told a label must appear once on its page line and sit right before the value. A signed `lang` whose month names are not on the page, or a `decimal: ","` with no comma-decimal amount on the page, is left under Not checked with a plain reason.
|
|
13
|
+
- **A currency sign is filed by how the page writes it (F249).** A sign glued to the number (`29,99€`, `€399`) is read as a currency, a sign after a space (`29,99 €`) as a unit, and both when the page writes both, whichever box the AI listed it in; a sign legally in both boxes is no longer dropped as listed twice, and a sign listed twice whose page form needs one box says which box it kept.
|
|
14
|
+
- **A page-form fact's claim text is written as the quote spells the value (F249).** For a fact that signs `lang` or `decimal` the worker's value stays canonical (`2026-10-26`, `1057.65`, bareguard's typed binding) but the text bareguard scans for numbers is now the quote's own spelling (`26 October 2026`, `1.057,65`), taken from bareguard's evidence span, so a correct value is no longer red on "the number is not in the quote". Facts that sign neither are checked once, as before.
|
|
15
|
+
- **The "can it read" check follows the forms a price fact signs (F249).** For a money fact that signs `decimal: ","` the check now finds its candidate lines with the comma, the `.` or space thousands marks and a glued or spaced sign (`48,49€`, `UVP: 1.057,65 €`, `1 089€`), and hands the checker the canonical amount (`48.49`, `1057.65`, `1089`); before, `48,49` read as 4849 and a good page was left under Not checked. Grading is still bareguard's own.
|
|
16
|
+
- **A fact named "last updated" is no longer refused as a count (F249).** "One result is one record; ask for N results instead" fired on any name holding "last"; "last" followed directly by a word ending in "ed" ("last updated", "last modified") now passes. "last flight", "latest", "next" and every other counting name are refused as before.
|
|
17
|
+
- **A drafter that drops a fact's `lang` or `decimal` is refused at $0 (F249).** When the page look gave a fact a `lang` or `decimal`, the signed fact must sign the same value; otherwise validation reds with `the fact "released" must sign lang "de", as the page look found. Nothing spent.`, instead of signing an ISO-only date or a point-decimal that reds at run time.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **bareguard `^0.26.0` to `^0.27.0`.** Its page forms (a date in a signed language, a decimal comma, a currency sign glued after the number) are what the Added entries above build on; an existing signed spec reads as before.
|
|
22
|
+
- **barebrowse `^0.24.1` to `^0.25.0`.** A consent popup that shows 1-3 seconds after load is now closed on the first read of a page, so a page behind a late popup reads as the page. bareloop still asks for the same `act` read; barebrowse's new data mode is not used yet.
|
|
23
|
+
- **A money unit listed twice is refused in plain words.** Units that are the same once marks (`**`, `__`) and spaces are removed (`**pp**` and `pp`) now stop at the $0 signing pre-flight naming the fact and both units, instead of bareguard's raw error; bareloop's own partial copy of that rule is gone.
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- **A page line with a very long run of digits no longer slows drafting.** The price-mark read, its trailing-mark trim and the comma-decimal page check are now linear (a 40,000-digit line took about 2 seconds, now milliseconds); what they return is unchanged.
|
|
28
|
+
- **A page that loads only its menus, or times out, is fetched up to 3 times.** A web address whose page came back as just the site's header and menus (seen on a Dell laptop page, fine on the next try) used to stop drafting at once. Now the whole fetch is tried again, with a fresh browser and a 3 second pause, up to 3 attempts in all; only a menus-only page or a timeout is retried (a refused address, a bot check, any other load error or an empty page stops on the first try). If all 3 fail the stop reads the same with "(tried 3 times)" added. One attempt still waits at most 90 seconds, so a page that keeps timing out can take about 4.5 minutes before it stops.
|
|
29
|
+
- **A money fact's decimal mark is picked by code from how the page writes its prices.** The mark comes from the amounts next to the fact's currency sign (a comma and two digits, like "1.058,47 €"), so a fact the page-map AI signed without a decimal, or with the wrong one, still reads (live: Dell de-de laptops).
|
|
30
|
+
- **Panel: a `~` rule line in "The job" box shows `~` in the gutter, as fwdloop does.** Numbering is unchanged.
|
|
31
|
+
- **A price form that reads no amount on the page is dropped before the same-value rule.** A unit such as "ohne MwSt." sitting alone on its own line has no amount next to it, so it is now dropped first and the form that does read ("€") is kept, instead of the whole price fact falling to Not checked (seen live on Dell de-de laptops).
|
|
32
|
+
- **A page that loads only its site menus is re-read on the same open page until it settles.** The page is read again every 2 seconds for up to 20 seconds before a try counts as failed. A failed fetch now records what each try saw (size, time, the first 300 characters, secret-masked) in the draft log.
|
|
33
|
+
- **A blank word in the AI's page answer is left out.** An empty or spaces-only entry in a fact's words, currencies or units names nothing; it is dropped when the answer is read, with no note, and a list left empty counts as absent. It no longer shows as `"" is not written on the page.`.
|
|
34
|
+
- **A `~` rule whose fact is checked no longer also shows under Not checked.** The blank unit above made the page-read note unreadable to the splitter, so a kept fact's word notes were listed as Not checked; they now sit under how the page was read. A rule whose fact really drops still shows under Not checked.
|
|
35
|
+
|
|
36
|
+
## [0.49.0] - 2026-10-26
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- **A launcher `6 update` option (and `bareloop update`).** It asks npm for the newest bareloop only when you press it (nothing goes online at start or in the background). Newest: `You have the newest bareloop (X).` A newer one: `bareloop Y is out. You have X.` and `Update now? (y/n)`; `y` runs `npm install -g bareloop@latest` and says to pick 3 restart (from the menu) or to run `bareloop restart` (typed as `bareloop update`), `n` leaves it. The install gives up after 5 minutes: its npm child is ended and the same "The update did not finish" line shows. If npm cannot be reached: `Could not reach npm to check. Try again later.`
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- **A page fetch's browser no longer outlives bareloop.** If bareloop is killed or crashes while reading a web address, the browser it started now exits with it (barebrowse 0.24.1; Firefox needs `setpriv`, Chromium needs nothing). Old leftover browser folders in `/tmp` are cleaned on the next fetch.
|
|
45
|
+
- **"yes, " in front of your own reading is no longer signed.** When a question about a `~` rule is answered "yes, check it as departure between 05:00 and 21:59", the rule now reads "check it as departure between 05:00 and 21:59". A leading "yes," or "agree:" (the word, then a comma or colon) is dropped from the signed `~` rule and the rest is kept word for word; any other start is kept whole; a bare "yes" or "agree" still accepts the reading, and a yes in the middle of a sentence is left alone. "yes, drop it" on a rule the page cannot check drops it. (F240)
|
|
46
|
+
- **Two money units that differ only in spaces are one unit.** Page rules now trim and collapse spaces in each listed unit (so "US dollars" and " US dollars" become one), and a spec that still carries such a pair is refused at no cost in bareloop's own words ("the units are not repeated") instead of by bareguard 0.26.
|
|
47
|
+
- **A time label the run cannot read is now Not checked (F236, F237).** A time fact is read against the page by the same checker the run uses before it is signed. If the page never shows a time right after the label (for example "Departure time" on a page that writes "Departure time:"), the fact is left out and shown under Not checked: `the page never shows a time right after "Departure time", so it is not checked.` It only catches a label that can never read; a label that reads a wrong time is kept and left to you at Accept.
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- **Menu numbers.** The panel line gains `6 update`; the job line is now `7 export 8 run 9 resume 10 history`. `5 install` with nothing to do now says `Already set up. This does not update bareloop. Pick 6 update for that.`
|
|
52
|
+
- **barebrowse `^0.21.0` to `^0.24.1`.** No change to how bareloop calls it.
|
|
53
|
+
- **bareguard `^0.25.1` to `^0.26.0`.** Its one break for bareloop is the money-unit rule above; the new table rules (`cells`, `table`, `diff`) are not used here.
|
|
54
|
+
- **Piped input never installs on `bareloop update`.** The rule was "no terminal never installs", but the command always had an asker, so `echo y | bareloop update` (or a pipe into the menu's `6`) ran `npm install -g`. When stdin is not a terminal it now prints `To update: npm install -g bareloop@latest` and exits 0.
|
|
55
|
+
- **"agree with the shown price" is no longer cut to "with the shown price".** The F240 lead-word strip first also took a bare space, then a hyphen or dash, as a separator, so it ate real words ("yes or no questions only" signed as "or no questions only", "yes-no questions only" as "no questions only"). Now only a leading `yes` or `agree` directly followed by a comma or colon is dropped from the signed `~` rule; any other start is kept whole.
|
|
56
|
+
|
|
8
57
|
## [0.48.0] - 2026-10-25
|
|
9
58
|
|
|
10
59
|
### Added
|
package/README.md
CHANGED
|
@@ -24,6 +24,10 @@ bareloop finds that path for you. Write your problem in plain language, as steps
|
|
|
24
24
|
|
|
25
25
|
The harness (budget, time, what it may touch) and the judge both sit **outside** the agent loop. The agent can't judge itself. Every run is recorded, so you can audit it and replay it at $0 and see exactly what happened.
|
|
26
26
|
|
|
27
|
+
<p align="center">
|
|
28
|
+
<img src="https://raw.githubusercontent.com/hamr0/bareloop/main/docs/media/panel-walkthrough.gif" alt="The bareloop panel: write a job, the runs list, a rubric run waiting for Accept, its Result, Audit and signed Job, then a repo run ready to merge" width="900">
|
|
29
|
+
</p>
|
|
30
|
+
|
|
27
31
|
## Two kinds of jobs
|
|
28
32
|
|
|
29
33
|
**Deterministic (code)**: code decides. Tests pass, the linter is quiet, the build exits clean. If no check exists yet, say what you need and the agent builds that check first.
|
|
@@ -137,8 +141,8 @@ cd ./my-job.bareloop && npm install
|
|
|
137
141
|
bareloop run "my-job (run-3)" --repo /path/to/checkout --approve <bundleHash printed above>
|
|
138
142
|
```
|
|
139
143
|
|
|
140
|
-
Bare `bareloop` is one menu: the panel (1 start, 2 stop, 3 restart, 4 status, 5 install) and the jobs
|
|
141
|
-
(
|
|
144
|
+
Bare `bareloop` is one menu: the panel (1 start, 2 stop, 3 restart, 4 status, 5 install, 6 update) and the jobs
|
|
145
|
+
(7 export, 8 run, 9 resume, 10 history), each asking for what it needs. `update` checks npm only when you press it and offers to install the newer version. `export` only ships a run that
|
|
142
146
|
already earned a real green, and only repo jobs for now. The first `run` on a new machine asks you to
|
|
143
147
|
approve the bundle's printed hash; once that run goes green, later runs need no re-approval as long
|
|
144
148
|
as the bundle stays unchanged. Every run works in its own fresh git worktree, commits a green on its
|
package/bareloop.context.md
CHANGED
|
@@ -738,7 +738,7 @@ attempt PLUS its close. Unpriced is never free: a null cost is a `pricing-red` s
|
|
|
738
738
|
never retried, and the ladder is otherwise ONE retry (`JUDGE_ATTEMPTS`) — after that a broken
|
|
739
739
|
judge is an instrument stop, never a red about the tree.
|
|
740
740
|
|
|
741
|
-
**The rulebook, and what each rule can raise** (`JUDGE_RULES` in `src/judged.js`; every rule carries a plain-words `means` the case-proposal prompt renders, so a proposed practice case never expects a red the rule cannot raise). The judge only POINTS (quotes lines verbatim); code does every check; unsure is red; the judge never says pass/fail. Quotes are matched by bareguard's `quoteIn(..., {wholeLines:true})` (`wholeLines` arrived in bareguard 0.21; bareloop now needs `^0.
|
|
741
|
+
**The rulebook, and what each rule can raise** (`JUDGE_RULES` in `src/judged.js`; every rule carries a plain-words `means` the case-proposal prompt renders, so a proposed practice case never expects a red the rule cannot raise). The judge only POINTS (quotes lines verbatim); code does every check; unsure is red; the judge never says pass/fail. Quotes are matched by bareguard's `quoteIn(..., {wholeLines:true})` (`wholeLines` arrived in bareguard 0.21; bareloop now needs `^0.26.0`): a contiguous run of whole artifact lines, so a bare fragment cannot pass by hiding in a longer line, while a dropped leading `* ` of a JSDoc tag line still matches. `has-doc` checks only that a JSDoc block sits directly above the function (read off the artifact by `docBlockAbove`; the judge's quote is a pointer that must lie inside that block), so a documented function never breaks it. **`says-what`** (the doc's description must say more than the function's own name) reds when the described prose, minus a fixed list of function words and the name's own words (camel/snake/kebab, light inflections, and a prefix echo such as `init`/`initialize` when the shorter word is at least 4 letters), leaves nothing; no description, or an unlocatable quote, reds. It catches a pure name echo only ("Returns the total." for `getTotal` passes), and with NO doc block at all it stays silent and leaves the red to `has-doc` (the card is not required to carry both). `params` reds a declared parameter with no tag, an `@param` naming no parameter (each destructured slot absorbs one unmatched root tag), and, when the doc names any field of a simple destructured parameter, a missing field; `@param options` alone for `{ x, y }` passes. `returns` reds a returning function with no `@returns`. A practice case that expects a `has-doc` red on a function that has a block is refused as a legality red before any call (`validateCalibrationSet`).
|
|
742
742
|
|
|
743
743
|
**A judged stage may only judge files inside the job's write fence** (`judgedOutsideFence`, `src/authoring.js`, called from `validateDeclaration`, which every door reaches: the authoring revise loop, `validateCloseDecl` at signing and runner pre-flight, and `validateJob` for hand-written or reused specs). A path outside `writeScope` reds `judged-outside-write-scope` at draft time, because a finding on a file the run is fenced out of can never be fixed. With no fence to compare against (the plain-folder deferral) the rule is not run.
|
|
744
744
|
|
|
@@ -3293,8 +3293,8 @@ same seam `tests/planrun-*.test.js` uses. `deps` also accepts `env`, `stdout`, `
|
|
|
3293
3293
|
`now`, `stdin` — omit any of them and the real `process.*` equivalent is used.
|
|
3294
3294
|
|
|
3295
3295
|
Bare `bareloop` (no sub-command) is the **launcher menu** (PANEL-BUILD.md addendum L, `src/launcher.js`): two header lines, then
|
|
3296
|
-
`panel: 1 start 2 stop 3 restart 4 status 5 install`, `jobs:
|
|
3297
|
-
`bareloop start | stop | restart | status | install`), from one function:
|
|
3296
|
+
`panel: 1 start 2 stop 3 restart 4 status 5 install 6 update`, `jobs: 7 export 8 run 9 resume 10 history`, `q quit`. The header is printed first by EVERY call (menu and each of
|
|
3297
|
+
`bareloop start | stop | restart | status | install | update`), from one function:
|
|
3298
3298
|
|
|
3299
3299
|
```
|
|
3300
3300
|
bareloop 0.47.0 · installed ✓ · panel running at http://127.0.0.1:4701
|
|
@@ -3318,10 +3318,11 @@ changes them, and a piped or `NO_COLOR` run prints the plain words above (the th
|
|
|
3318
3318
|
`--yes` skips it. Not running: `Panel not running.`, exit 0. Several found: all stopped, `N panels stopped.`. Any other option (e.g. `--port`) is refused in plain words. Runs are separate processes and keep going.
|
|
3319
3319
|
- **`bareloop status`** → header plus `pid N · version X · N draft(s) open · N schedule(s) on`. Exit 0 running, 3 not running. A panel whose version differs from the CLI's shows `(version X — stop and start to use Y)` after its URL in the header (yellow on a terminal).
|
|
3320
3320
|
- **`bareloop install`** → creates only what is missing (folder mode 700, `.env` with the keys-file comment lines, mode 600, `config.json`); never reads a key value;
|
|
3321
|
-
`Already
|
|
3321
|
+
`Already set up. This does not update bareloop. Pick 6 update for that.` when there is nothing to add. Needs node >= 22.
|
|
3322
|
+
- **`bareloop update`** (menu 6; `updateCmd` in `src/launcher.js`, one function for both doors; PRD v1.116) → the ONLY launcher command that goes online, and only when pressed: `GET https://registry.npmjs.org/bareloop/latest` (global `fetch`, 5 s deadline; nothing goes online at start, in the panel or in the background). Versions compare numerically (major.minor.patch). Newest: `You have the newest bareloop (X).` Newer: `bareloop Y is out. You have X.` then `Update now? (y/n) ` on the menu's asker; `y`/`yes` runs `npm install -g bareloop@latest` (no shell, output shown; a 300 s deadline ends the npm child with SIGTERM and counts as not finished) and prints `Updated to Y. Then pick 3 restart.` (from the menu) or `Updated to Y. Then run bareloop restart.` (typed as `bareloop update`), or on a non-zero exit / spawn error `The update did not finish. Run it yourself: npm install -g bareloop@latest` (exit 1); `n`/`no`/`q` prints `Not updated. To update later: npm install -g bareloop@latest`; an empty Enter or other text asks once more, a second ends as `n`; with no terminal (piped or redirected stdin, even if the pipe says `y`; `terminal: false` from `src/cli.js`) or no asker it never installs and prints `To update: npm install -g bareloop@latest`. Any registry failure (timeout, offline, non-200, bad JSON, no version): `Could not reach npm to check. Try again later.`, exit 1. Test seams: `deps.launcher.npmFetch`, `npmSpawn`, `npmDeadlineMs`.
|
|
3322
3323
|
|
|
3323
|
-
**One menu (PRD v1.114, F245).** Bare `bareloop` prints the header, then `panel: 1 start 2 stop 3 restart 4 status 5 install`, `jobs:
|
|
3324
|
-
(typed flags skip the question): **export** lists the green runs as numbered `job (run-N)` names, then asks the output folder; **run** asks the bundle (the last 10 known bundles are listed newest first, numbered, as run name + folder; a number picks one, a run name or a folder reaches an older one; none known: `No exported bundles yet. Export one with
|
|
3324
|
+
**One menu (PRD v1.114, F245).** Bare `bareloop` prints the header, then `panel: 1 start 2 stop 3 restart 4 status 5 install 6 update`, `jobs: 7 export 8 run 9 resume 10 history` and `q quit`. Each job command asks for what it needs
|
|
3325
|
+
(typed flags skip the question): **export** lists the green runs as numbered `job (run-N)` names, then asks the output folder; **run** asks the bundle (the last 10 known bundles are listed newest first, numbered, as run name + folder; a number picks one, a run name or a folder reaches an older one; none known: `No exported bundles yet. Export one with 7.` and it ends), the repo, then
|
|
3325
3326
|
the `$` cap and the time cap (Enter keeps the signed ones); **resume** lists the stopped / capped bundle runs the engine would resume, then offers more money / time; **history** asks the bundle and prints what `bareloop history <bundle>` prints.
|
|
3326
3327
|
`q` at any question ends the command cleanly (nothing run, exit `0`). A required question answered with an empty Enter is asked once more; a second empty Enter ends that command with a plain line (nothing chosen, nothing run), exit `0`. `interview`, `author`, `replay` and `runs backfill` are no longer commands
|
|
3327
3328
|
(`node scripts/run-replay.mjs`, `scripts/run-interview.mjs`, `scripts/run-author.mjs` run from a source checkout; the library functions the panel uses stay). `run-u` is still dispatched by name (`bareloop run-u <flags…>`: the panel spawns it) but is listed nowhere.
|
|
@@ -4456,23 +4457,26 @@ A **Rubric** job whose first Input is the full path of a FILE (not a repo folder
|
|
|
4456
4457
|
|
|
4457
4458
|
### Required facts — a line that finds, lists or looks something up (Part 1b, `src/facts.js`, `docs/product/ITEM33-BUILD.md` "Addendum 2026-10-13" and "Part 1c", PRD item 33 RF1–RF22)
|
|
4458
4459
|
|
|
4459
|
-
Check what the person asked for, not what the worker chose to write. bareloop needs bareguard `^0.
|
|
4460
|
+
Check what the person asked for, not what the worker chose to write. bareloop needs bareguard `^0.27.0` (`cited` + `decides`, bind-only and `text` decides, word-edge anchors; 0.24 lets money currency/unit be lists, ruling #65; bareloop facts now carry them, see "Currency and unit lists" below; 0.25 returns `full.evidence`, the spans the Result tab marks, see `rubric-evidence`).
|
|
4460
4461
|
|
|
4461
4462
|
- **The part.** A `rubric-step` stage's `params.parts` may hold ONE part of `class: "fact"` (a line that finds, lists or looks up): `{ text, class: "fact", source: <input label>, facts: [{ name, shape, unit? | currency?, phrase?, anchor?, until?, rule?, aiProposal? }], count?: { min?, max? }, rules?: [n], covers?: [n] }`. `shape` is `money | number | date | time | phrase | text`; `rule` is `{ op: lt | lte | gt | gte, value }` or `{ op: "between", lo, hi }` (not on `text` or `phrase`); `money` names at least one of `unit` (the input's own words, e.g. `"US dollars"`) or `currency` (`$ € £`), and may name both, each one value or a list (below); `phrase` carries the fixed `phrase` the quote must contain; `anchor` / `until` are labels copied VERBATIM from the input. A fact name is letters, spaces, `_` or `-` only (it is written into the claim text bareguard scans for numbers). A line with a fact part has no word, section or claim-count parts (a drafting red). Code fills `tested` (the early-test evidence) and `sample` (what the drafter saw of a big input) into the signed part; a model-written one is replaced.
|
|
4462
4463
|
- **The step file.** `output/steps/<n>.json` of a facts line is `{ "results": [ { "quote": "...", "values": { "<fact name>": "<value as the quote writes it>" } } ] }` — no free text, no `cites`. ONE quote per result holds all its facts, so a worker cannot mix a price from one result with a time from another. `buildStepSpec` makes one bareguard `cited` check with `decides` (the fact's index is its `d<j>` key; a phrase fact is a presence decide and takes no value). The claim text is written by CODE from the values (`name: value; ...`); a `count` becomes `min` / `max` on the number of results. Every value is compared by shape and exactly (`8:15 AM` equals `08:15`, `389` equals `389.00`); a red names the result and the fact in plain words (`plainFactItem`). A JSON number in `values` is read as the string it prints as.
|
|
4463
4464
|
- **No record cutting (Part 1c).** A fact part carries no `record`, `tested` or `sample` (a `record` field is an unknown-field red). The worker's brief says "one quote per result, copied from that result's own text" (bareguard's quote cap of 4000 characters stays its own). Drafting does not grade: it only proves each fact CAN be checked (below).
|
|
4464
4465
|
- **Repeat rule (Part 1c M1, M4).** On a fact line asking for N results (`count.min`), `checkFactWords` (`src/factwords.js`, the one owner) refuses at $0 an anchor label the label list counts fewer than N times (`rubric-fact-label-rare`) and a `phrase` fact whose words `countPhrase` finds in the input fewer than N times (`rubric-fact-phrase-rare`); count 1 or none keeps a once-only one legal. `RUBRIC_RULES` states both.
|
|
4465
4466
|
- **The look, then the draft (Part 1c; the default look is now the page-word map, next bullet).** For a rubric job on files, `authorCloseForJob` runs the look (`lookFn`, default `runPageMap`; the older search-and-read `runInputLook` in `src/authorscout.js`, pure parts in `src/inputlook.js`, is unwired from the default path) on the frozen input text BEFORE the confirm turn and the draft, when a `provider` is present (`lookFn: null` = no look; a panel test that replaces `generate` gets none unless it passes `lookFn`). Read-only by construction: tools `search_input` / `read_input` over in-memory text, `LOOK_ROUNDS` 8, a reserved final round whose only tool is the strict answer form `report_look`, spend metered into the drafting book (`calls` absorbed like the repo scout's). Its report (facts with a label picked from the list, prose lines, not-found entries) is verified by code (`verifyLookReport`: a label off the list, an unknown shape/line/input, or a phrase not in the source is moved to not-found, named) and rendered into the drafter's prompt (`renderLookReport`); a failed or reportless look is an ABSENT survey and stops drafting at $0 (`scout-absent`, "the first look at your repo or input did not complete"). Every place, date or name in the job line is a fact too, bound to the label before it (a direction = phrase facts `Leaves <place>` / `arrives at <place>`); prose lines and their `~` limits are not looked up.
|
|
4466
|
-
- **The page-word map (idea A core, `src/pagemap.js`, `src/pagerules.js`, `docs/product/ITEM33-BUILD.md` "Addendum 2026-10-18 — Idea A core").** The default `lookFn` is `runPageMap`: ONE AI call per page input (the job's drafter identity, thinking off, booked per call into `draft-log.jsonl`, cap checked before each call) maps the job to the page's OWN words as `{"facts":[{name, from, shape: place|money|time|phrase, words, currency?, unit?}]}`; it takes the old look's arguments and returns the same envelope. Plain code then keeps or drops each word (`applyPageRules(text, mapping, jobLines)` -> `{ facts, dropped }`, pure, ported from the frozen POC): found-on-page (count >= 1), N2 (a label written 2+ times inside one page line is unusable), R1 (a second label stays only if it reads the same values as the first), U1 (a label the page writes AFTER the number, "EUR 490 total", becomes a unit; a label with no number either side is dropped), R1L (a unit/currency form stays only if it reads the same numbers as the primary form; units first; before R1L the forms are sorted by code - a sign is a currency, any other form a unit, whichever box the AI used), S1 (a fact name that counts results is refused; two facts may not share shape AND label). After the rules, `dryReadMoney` (`src/pagedry.js`, called by `runPageMap`) grades an honest claim on every result line with the run's own checker; a money fact that reads none is left under Not checked (`reads-no-result`); then `dryReadPhrases` reads each kept phrase fact against those same result lines (the lines the job's kept money facts read) and drops a phrase found in none of them whole as `phrase-no-result` (Not checked: `"Rome" is on the page but in none of its results, so it is not checked.`); with no kept money fact the result lines are unknown and phrase facts pass untouched. The AI never grades; the answer is read strictly (no JSON repair): a malformed or truncated answer is retried ONCE, twice is the plain stop "The AI's answer about the page was not readable twice. Nothing was signed." (an ABSENT survey; a draft is not a run, so no Resume); one retry on a transport error (booked unpriced, so `spendComplete=false`) or a 429 (the vendor's stated wait). The scrubbed raw answer rides each call into `draft-log.jsonl` (`call.raw`), unsigned, so a run can be replayed at $0. A drafted fact may use only words the map KEPT: a signed anchor, closing label, unit or currency that was dropped is the red `rubric-fact-word-dropped` with the drop's reason, and an anchor must be a kept label (`rubric-fact-label-off-list`, now against the kept set).
|
|
4467
|
-
- **
|
|
4467
|
+
- **The page-word map (idea A core, `src/pagemap.js`, `src/pagerules.js`, `docs/product/ITEM33-BUILD.md` "Addendum 2026-10-18 — Idea A core").** The default `lookFn` is `runPageMap`: ONE AI call per page input (the job's drafter identity, thinking off, booked per call into `draft-log.jsonl`, cap checked before each call) maps the job to the page's OWN words as `{"facts":[{name, from, shape: place|money|time|date|number|phrase, words, currency?, unit?, lang?, decimal?}]}`; it takes the old look's arguments and returns the same envelope. Plain code then keeps or drops each word (`applyPageRules(text, mapping, jobLines)` -> `{ facts, dropped }`, pure, ported from the frozen POC): found-on-page (count >= 1), N2 (a label written 2+ times inside one page line is unusable), R1 (a second label stays only if it reads the same values as the first), U1 (a label the page writes AFTER the number, "EUR 490 total", becomes a unit; a label with no number either side is dropped), R1L (a unit/currency form stays only if it reads the same numbers as the primary form; units first; before R1L the forms are sorted by code - a sign is a currency, any other form a unit, whichever box the AI used), S1 (a fact name that counts results is refused - "last updated" / "last modified" name when a thing changed and are not counting names; two facts may not share shape AND label). After the rules, `dryReadMoney` (`src/pagedry.js`, called by `runPageMap`) grades an honest claim on every result line with the run's own checker; a money fact that reads none is left under Not checked (`reads-no-result`); then `dryReadPhrases` reads each kept phrase fact against those same result lines (the lines the job's kept money facts read) and drops a phrase found in none of them whole as `phrase-no-result` (Not checked: `"Rome" is on the page but in none of its results, so it is not checked.`); with no kept money fact the result lines are unknown and phrase facts pass untouched. The AI never grades; the answer is read strictly (no JSON repair; a blank entry in `words`, `currency` or `unit` - empty or only spaces - is left out at parse with no note, a list left empty is absent, and the rest of the fact stands): a malformed or truncated answer is retried ONCE, twice is the plain stop "The AI's answer about the page was not readable twice. Nothing was signed." (an ABSENT survey; a draft is not a run, so no Resume); one retry on a transport error (booked unpriced, so `spendComplete=false`) or a 429 (the vendor's stated wait). The scrubbed raw answer rides each call into `draft-log.jsonl` (`call.raw`), unsigned, so a run can be replayed at $0. A drafted fact may use only words the map KEPT: a signed anchor, closing label, unit or currency that was dropped is the red `rubric-fact-word-dropped` with the drop's reason, and an anchor must be a kept label (`rubric-fact-label-off-list`, now against the kept set).
|
|
4468
|
+
- **Page forms: `lang` and `decimal` (bareguard 0.27, `src/facts.js`, `src/pagerules.js`).** A `date` fact may sign `lang` (`en de fr es it pt nl`: the language of the month names the page writes; absent = ISO `2026-10-26` only) and a `number` or `money` fact may sign `decimal` (`"."` or `","`; absent = `.`). Both ride the signed decide unchanged and are refused on any other shape. The worker writes the CANONICAL value for such a fact (a date as `YYYY-MM-DD`, an amount with a point and no thousands marks); code writes the claim text as the quote spells the value (`full.evidence`'s value span from a first check of the same file, then a second check with the text written so), so bareguard's number scan compares like with like. Only a fact that signs `lang` or `decimal` takes the second pass; every other fact's claim text is the worker's value, as before. Before a fact is signed, page rules drop it to Not checked when a signed `lang` has no full month name of that language on the page (`lang-not-on-page`) or a signed `decimal: ","` has no comma-decimal amount on the page (`decimal-not-on-page`; a thousands-grouped count such as `133,330` is not one).
|
|
4469
|
+
- **Sign by page form, and the dry read (F249, `src/pagerules.js`, `src/pagedry.js`).** A currency sign is filed by how the page writes it next to the number, in the lines that hold the fact's label (the whole page when it has none): glued to the number (`29,99€`, `€399`) = `currency`, after a space (`29,99 €`) = `unit`, both when the page writes both (bareguard 0.27 accepts the same symbol in both boxes and counts the same amount as one price); the box the AI listed it in does not matter. `dryReadMoney` finds candidate lines in every form the fact signs (a decimal comma, `.` or space thousands, a glued or spaced sign) and passes the checker the canonical amount.
|
|
4470
|
+
- **Currency and unit lists (idea A core, `src/facts.js`).** A money fact's `unit` and `currency` may each be one string (every spec signed before lists) or a non-empty list: at most 3 currencies (`$ € £` only; a code like `EUR` is a unit) and 10 units, none repeated (two units that are the same once `**`, `__` and extra spaces are removed are one unit, bareguard 0.26+: the signing pre-flight asks bareguard at $0 and, when it refuses such a list, says in plain words which fact lists the same unit twice and to keep one - `dupUnitWords`, `src/rubricstep.js`), a unit at most 100 characters, enforced by our own plain reds before bareguard is asked. A string reads exactly as a one-element list and is never rewritten, so an old signed spec keeps its bytes and hash. The first listed form is the primary one in the plan row and the worker brief; others read "or". `checkFactWords` requires EVERY listed unit and sign to be on the page.
|
|
4468
4471
|
- **No silent drop (idea A core, `src/pagedropwords.js`, `withDropNotes` in `src/rubricstep.js`).** Every word, fact or `~` rule the page rules drop is shown as Not checked with a plain sentence from ONE table (no other file writes a drop reason). Before validation `withDropNotes` appends to the declaration: `closeDecl.refused` `{ line, rule, reason }` for a dropped fact whose `~` rule no part carries (never a line-level refusal; a rule the drafter already listed is not listed twice), and one line in `closeDecl.notes` for any other drop, including a word cut from a fact that is still checked. Those word-level lines are not "Not checked": `splitReadNotes` / `isReadNote` (`src/pagedropwords.js`) sort a row whose every sentence only says which written form of a still-checked fact was not used (not on the page, listed twice, not the same values, list limits, and an `s1` copy of a fact that is still signed) into `readNotes`, shown in their own fold "How the page was read · N" right after Not checked (plan card, Job tab, Result tab `readNotes`, CLI confirm menu) and not counted in it; a whole fact left out (`no-label`, `reads-no-result`, `phrase-no-result`, an `s1` copy of an unsigned fact) stays Not checked. The signed fact names come from `signedFactNames(closeDecl)` (older specs too) or the look at the confirm turn (`plan.signedFacts`). The confirm card gets the same lines (`plan.notChecked`) before drafting is paid for, and the drafter's look block says `NOT CHECKED (rule n)` / `LEFT OUT`. Nothing about this changes a signed spec's verdict rules; it is the Not checked list, in the person's words.
|
|
4472
|
+
- **Time facts get the dry read (F236/F237, `dryReadTimes` in `src/pagedry.js`, called by `runPageMap` between the money and phrase dry reads).** For each kept time fact with a label, the candidate lines are every page line holding a label word with a clock time (H:MM or HH:MM, optional AM/PM) somewhere after it; each is graded as an honest claim (quote = the line, value = its first time after the label, fact `{shape:'time', anchor: label}`, no window) by the run's own `gradeStep`. A fact with no green line is dropped whole as `reads-no-time` and stays Not checked: `the page never shows a time right after "<label>", so it is not checked.` (rendered like its neighbours: `line 1: "<the ~ rule>" — the page never shows a time right after "Departure time", so it is not checked.`). It catches an impossible label only; a label that reads a wrong time is kept and left to the person at Accept. Other shapes, and a time fact with no label word, pass through untouched.
|
|
4469
4473
|
- **Labels are picked, never typed (`src/labelscan.js`).** `scanLabels(text)` lists, per shape (money, number, date, time, text), the words right before each value with counts (top 40 per shape; one generic scan, no per-site table; a page reader's `[ref=N]` tags are ignored). `labelOnList(scan, shape, idOrText)` is the one test (id or exact words, white-space blind). The look and the drafter pick labels only from the list shown in the prompt (`renderLabelList`). Fact-line reds are plain sentences; the confirm step and the drafter share one rule text (`RUBRIC_RULES`), and the drafter's per-shape field guide is generated from bareguard's `rubricVocabulary`.
|
|
4470
4474
|
- **Found-once check (`src/factwords.js`, `checkDeclarationWords`, run after validation in `authorClose`).** Every anchor must be on the input's label list for its shape, and every `until`, phrase and unit must be in the source once (white-space blind: U+202F, U+00A0; phrases whole-word, case-blind). A miss is a red naming the word and the input: `rubric-fact-label-off-list`, `rubric-fact-word-missing`, `rubric-fact-unread` (an input that cannot be read is a red, never a skipped check). Nothing is graded; finding and grading are the run's and the close's job.
|
|
4471
4475
|
- **No silently dropped rule (RF16).** When a close holds a fact part or any part with `rules`, every `~` rule of every job line must be carried out by a part (its number in the part's `rules`, 1 = the first `~` rule) or listed in `refused` as `{ line, rule, reason }`, or its whole line refused; a rule that is none is a $0 red (`rubric-rule-dropped`). `refused` entries may now carry `rule`. A number the person did not write (a bound not found in the line's own words) must be marked `aiProposal: true` (the card says "AI's proposal — check it"), and an AI-proposed time limit must be `between`, never one-sided (RF17).
|
|
4472
4476
|
- **The prose step.** A line that writes keeps its word / section / line counts. When any fact line comes BEFORE it, code puts one `numbersFromFacts` part on it (`withFactBindings`; the model never writes it, and a missing or wrong one is a drafting red): every number in `text` must appear in a quote of those fact lines' step files (bareguard's `numbersInQuote`: token match, not canonical, so `v0.41.0` is one token). The card says, under Not checked, `line N: what the text says — you judge it at Accept`. At the close, a tied earlier line whose step file does not exist yet (the seed read, before any worker wrote) is a normal red ("line N's answer is not there yet"), never an instrument stop; only an unreadable file is a stop.
|
|
4473
4477
|
- **The plan card.** One code-worded row per fact under its line, read by the one reader (`checksOfClose` / `factRows`) the confirm card, the Job tab (`planFromSpec`) and the sign-time `planMatchesClose` share, e.g. `fact · price — money in US dollars, at most 450 US dollars, after "Price", quoted from "Flights"`, then the count row. A `~` rule the drafter listed as not checked reads `line N: "<rule as written>" — <reason>`.
|
|
4474
4478
|
- **The worker brief.** `rubricGoal({ ..., closeDecl })` adds a code-written brief per line (`lineBriefs`): a facts line gets its facts and its count; a text line that follows gets "every number must be copied exactly as written in a quote you wrote for job line N". `stepFileContract()` names both shapes.
|
|
4475
|
-
- **Web addresses as inputs (Part 1c, `src/pagefetch.js`, `src/source.js`).** An Inputs line may be `label: https://...` (also a rubric card's FIRST line; `looksLikeRubricInput`). `fetchPageText(url)` calls barebrowse `connect({ incognito: true, blockPrivateNetwork: true })` (`CONNECT_OPTIONS`) → `goto` → `waitForNetworkIdle({ idle: 1500, timeout: 20000 })` (bounded; a page that never settles is read as it stands) → `snapshot({ mode: 'act' })`, always closing the browser, with our own 90 s deadline (L1: a load-time `browse()` snapshot gave 77,951, 8,801 or 719 characters of the same results page; L2: a page whose text outside the banner / navigation / contentinfo landmarks is under `MIN_CONTENT_CHARS` = 100 (`pageContentChars`) is a stop too, "only the site's own header and menus", and an input with no content never reaches the look or an early ask: the survey is ABSENT, "holds nothing to read", nothing spent); an empty or under-200-character page (`MIN_PAGE_CHARS`), a bot challenge, an unreachable address, a credentialed or secret-shaped address, or a page carrying a secret shape is a plain-words $0 stop on its line. `proveRubricInputs({ ..., fetchUrl })` freezes the page text under `input/<label>.txt` and records `url` on the manifest input row. A FRESH `run-u --spec` start (not `--resume` / `--door` / `--decide`) calls `refreezeUrlInputs`: it fetches every recorded address again, writes that text into the prepared tree, commits it as the new seed and rewrites `source.json` (new `sha256` and `seed`, `draftSha256` keeps what the look saw) BEFORE the worker starts (inside `execute`, AFTER the run's row is listed with its pid and cap, so the Runs list shows it while the page loads; the Run tab reads "fetching the page…" until `source.json` carries `refrozenAt`), so quotes are checked against the run's copy and the worker reads it, never the live page. A failed or empty fetch stops the run (the row is settled at $0 as `failed` with the plain reason, `refused before start`, and the monthly claim is freed), "The run did not start. Nothing spent." A rubric job on a URL or file is recognised by the signed spec's verdict type on a Reuse and on a scheduled fire (`startSession`, `src/panel/authorroutes.js`), so line 1 is not proved as a repo path; a fresh job reads it from the card. Plan card (L3): `settlePersonsWords` (called in `authorClose` before validation) unmarks AI's proposal on a limit made of the person's own numbers, swaps in the one explicit positive time range the person wrote, and drops a `refused` entry for a `~` rule a part of its line carries; the look's fact may carry `forRule` (a rule it numbered from its own knowledge, marked AI's proposal), which removes that rule from the look's not-found list so it is not asked. Test seams: `fetchPageText(url, { connect })`, `deps.fetchUrl` (`run-u`), `deps.fetchUrl` / `deps.lookFn` (`createSession`).
|
|
4479
|
+
- **Web addresses as inputs (Part 1c, `src/pagefetch.js`, `src/source.js`).** An Inputs line may be `label: https://...` (also a rubric card's FIRST line; `looksLikeRubricInput`). `fetchPageText(url)` calls barebrowse `connect({ incognito: true, blockPrivateNetwork: true })` (`CONNECT_OPTIONS`) → `goto` → `waitForNetworkIdle({ idle: 1500, timeout: 20000 })` (bounded; a page that never settles is read as it stands) → `snapshot({ mode: 'act' })`, always closing the browser, with our own 90 s deadline per attempt (L1: a load-time `browse()` snapshot gave 77,951, 8,801 or 719 characters of the same results page; L2: a page whose text outside the banner / navigation / contentinfo landmarks is under `MIN_CONTENT_CHARS` = 100 (`pageContentChars`) is a stop too, "only the site's own header and menus", and an input with no content never reaches the look or an early ask: the survey is ABSENT, "holds nothing to read", nothing spent). **Retries:** a header-only snapshot is first re-read on the same open page every 2 s (`SETTLE_INTERVAL_MS`) for up to 20 s (`SETTLE_BUDGET_MS`) before the attempt counts as header-only; the whole fetch (fresh browser each time, 3 s pause, `RETRY_WAIT_MS`) is then tried up to 3 times in all (`FETCH_ATTEMPTS`), but ONLY a header-only page or a timeout is retried - a refused or private address, a bot challenge, any other load error, an empty page and a non-text answer stop on the first try. When all attempts fail the stop reads the same with "(tried 3 times)" added, and the panel's drafting appends a `page-fetch-attempts` line (`no`, `attempts: [{chars, ms, head}]` of the header-only tries, secret-masked) to `draft-log.jsonl`. An empty or under-200-character page (`MIN_PAGE_CHARS`), a bot challenge, an unreachable address, a credentialed or secret-shaped address, or a page carrying a secret shape is a plain-words $0 stop on its line. `proveRubricInputs({ ..., fetchUrl })` freezes the page text under `input/<label>.txt` and records `url` on the manifest input row. A FRESH `run-u --spec` start (not `--resume` / `--door` / `--decide`) calls `refreezeUrlInputs`: it fetches every recorded address again, writes that text into the prepared tree, commits it as the new seed and rewrites `source.json` (new `sha256` and `seed`, `draftSha256` keeps what the look saw) BEFORE the worker starts (inside `execute`, AFTER the run's row is listed with its pid and cap, so the Runs list shows it while the page loads; the Run tab reads "fetching the page…" until `source.json` carries `refrozenAt`), so quotes are checked against the run's copy and the worker reads it, never the live page. A failed or empty fetch stops the run (the row is settled at $0 as `failed` with the plain reason, `refused before start`, and the monthly claim is freed), "The run did not start. Nothing spent." A rubric job on a URL or file is recognised by the signed spec's verdict type on a Reuse and on a scheduled fire (`startSession`, `src/panel/authorroutes.js`), so line 1 is not proved as a repo path; a fresh job reads it from the card. Plan card (L3): `settlePersonsWords` (called in `authorClose` before validation) unmarks AI's proposal on a limit made of the person's own numbers, swaps in the one explicit positive time range the person wrote, and drops a `refused` entry for a `~` rule a part of its line carries; the look's fact may carry `forRule` (a rule it numbered from its own knowledge, marked AI's proposal), which removes that rule from the look's not-found list so it is not asked. Test seams: `fetchPageText(url, { connect })`, `deps.fetchUrl` (`run-u`), `deps.fetchUrl` / `deps.lookFn` (`createSession`).
|
|
4476
4480
|
- **Ask at once, only about intent (I1; the asks are now code-forced from the page map, see "The look reads, code asks" below).** A `~` rule the look cannot tie to a kept page word becomes a question worded by code (`askableFromLook`, `src/pagemap.js`: line and rule named), asked before the confirm turn through the existing question gate (`answerQuestions`; `normalizeQuestions` caps it at `MAX_QUESTIONS`); the answer is a new `~` rule on that line. A rubric job on files never offers the piecemeal try-3 question; its failed-draft stop (`draftStopText({ wholeJob: true })`) says to review the whole job and submit it again.
|
|
4477
4481
|
- **Known limits (documented, not built around).** Airport codes like SFO have no stable label on a flight page: direction is checkable only through the full airport names the page uses. An unanchored `text` fact cannot tell which field a value sits in. `am` / `pm` in lower case and `9:27AM` are malformed times; `v0.41.0` is one token. A fact step's quote proves the value is in a real record, not that it is the RIGHT record: "the cheapest" and "the last 3" are Not checked. Verified on real files only; the live proof (DeepSeek, both jobs through the panel) has not been run.
|
|
4478
4482
|
|
|
@@ -4503,5 +4507,5 @@ For an integrating agent reading a run's record:
|
|
|
4503
4507
|
- **`draft-log.jsonl` `human` rows** `{no, source: confirm | look | try-3, question, answer, line?, at}`; the answer is secret-masked before it is written and the row exists only when the question was answered.
|
|
4504
4508
|
- **Money line** `moneyWithDraft(spendCore, draftUsd, budgetUsd, draftComplete, runUsd)`: `$run run + $draft drafting = $total of $cap`; without `runUsd` the sum is omitted. The panel's own spelling is `panelMoney2` (`src/panelmoney.js`, one Node owner; `src/panel/index.html` carries a pinned browser copy): 2 decimals from a cent up, 4 decimals for a real amount under a cent (`$0.0054`), `<$0.0001` below that, exact zero `$0.00`, null `unknown`; the CLI's `money()` keeps its own 4 decimals.
|
|
4505
4509
|
- Not built from the signed spec (see the Part 5 commits): the early ask about a number the AI made (T1), because the data it needs does not exist at that point; T1 is replaced by Part 5b below. The "fetching the page…" state (Q2) was built after the run-start refetch moved to after the run is listed: the sign progress list shows the step (`settleFetchingStep`, `src/panel/authorroutes.js`) and a listed run with no log yet reads "fetching the page… the run has not started yet" (`startingStub`, `webFetchState`), both read from `source.json`'s `refrozenAt`.
|
|
4506
|
-
- **The look reads, code asks (PRD v1.107 Part 5b; `src/pagemap.js`).** A map fact on a `time` or `money` shape may carry an optional `reading: {op, value | lo, hi}` (the signed-rule `op` set; a time bound is a string, a money bound a number); any other `reading` makes the whole map answer malformed (no repair). `askableFromLook(look, jobLines)` sorts every `~` rule: a kept page word carries it (no ask); a `reading` whose bound is NOT in the person's own words (`boundInWords`, the same test as `rubric-fact-unmarked`; it reads the words by kind, F242: a number bound is said only as a bare number or an amount's number, a time bound only as a time token with the hour's leading zero ignored, a date bound only as a date token, never a piece of a token) asks `Your line N says "<rule>". I read it as: <fact> <ruleWords>. Agree?`; a rule no kept fact carries asks `... I can't check this on the page. Drop it?`. Readings come first, then can't-check asks. `agree` (or `yes`) writes the reading as a `~` rule in plain words, so the bound is the person's own and the fact signs plain; a typed answer is the `~` rule instead; `drop it` on a can't-check ask adds no rule and leaves it Not checked. `MAX_QUESTIONS` is 3: more asks than that stops the draft before the confirm turn (stop `look-asks-too-many`, no extra spend) with `tooManyAsksText`, a code-written list of every ask and its reading. Asks carry `ask: 'reading' | 'cant-check'` (and `reading` for the agree text) through `normalizeQuestions`.
|
|
4510
|
+
- **The look reads, code asks (PRD v1.107 Part 5b; `src/pagemap.js`).** A map fact on a `time` or `money` shape may carry an optional `reading: {op, value | lo, hi}` (the signed-rule `op` set; a time bound is a string, a money bound a number); any other `reading` makes the whole map answer malformed (no repair). `askableFromLook(look, jobLines)` sorts every `~` rule: a kept page word carries it (no ask); a `reading` whose bound is NOT in the person's own words (`boundInWords`, the same test as `rubric-fact-unmarked`; it reads the words by kind, F242: a number bound is said only as a bare number or an amount's number, a time bound only as a time token with the hour's leading zero ignored, a date bound only as a date token, never a piece of a token) asks `Your line N says "<rule>". I read it as: <fact> <ruleWords>. Agree?`; a rule no kept fact carries asks `... I can't check this on the page. Drop it?`. Readings come first, then can't-check asks. `agree` (or `yes`) writes the reading as a `~` rule in plain words, so the bound is the person's own and the fact signs plain; a typed answer is the `~` rule instead (F240: a leading agree word directly followed by a comma or colon, as in `yes, check it as ...` or `agree: ...`, is stripped by `stripAgreeLead` in `src/pagemap.js` before the rule is signed; a bare space, a hyphen or any dash after the word is not a separator, so `yes-no questions only` is kept whole); `drop it` on a can't-check ask adds no rule and leaves it Not checked. `MAX_QUESTIONS` is 3: more asks than that stops the draft before the confirm turn (stop `look-asks-too-many`, no extra spend) with `tooManyAsksText`, a code-written list of every ask and its reading. Asks carry `ask: 'reading' | 'cant-check'` (and `reading` for the agree text) through `normalizeQuestions`.
|
|
4507
4511
|
- **The fit check (F243, `src/fitcheck.js`; `docs/product/ITEM33-BUILD.md` "Addendum 2026-10-21 — fit check build spec").** Rubric jobs only, once, after the inputs are frozen and the content gate passes and BEFORE the look; it runs only when the caller passes the answer seam `fitAsk` to `authorCloseForJob` (the panel; the CLI door and any test without it never run it; `fitFn: null` = no check). `runFitCheck` makes ONE AI call (the drafter identity, the drafting thinking rule, label `fit-check`, cap checked before the call) that splits each job line (no `~` rules) into asks copied from that line and quotes the page for each; plain code (`decideFit`) decides: an ask is found only if `found` is true AND its quote is on an input (whitespace and case ignored), a found-with-off-page-quote is `madeUp` and counts as not found, a reply with an ask not copied from its line or a line with no ask is malformed (one retry). All found = `fits` (nothing shown); any not found = `ask`: one question through the panel `ask` seam (`I found X of Y of your asks on this page. Not found: <ask> (line N), .... Type go on to keep drafting, or anything else to stop and change the job or the page.`); `go on` continues to the look, anything else stops `fit-stopped` (plain words in `draftStopText`), no answer is `confirm-abandoned`. The answer is not a `~` rule and changes nothing in the job. Failure is OPEN: a cut, two unreadable replies, a failed call or a cap stop is `absent`, chat says "The fit check did not finish; drafting goes on." and drafting goes on. The result is one `fit-check` row in `draft-log.jsonl`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bareloop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.0",
|
|
4
4
|
"description": "Workflows that earn their own design, with receipts — agent-authored workflows for repeated, long, verifiable jobs that improve across runs under an un-gameable gate.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"bare-agent": "^0.52.0",
|
|
31
|
-
"barebrowse": "^0.
|
|
32
|
-
"bareguard": "^0.
|
|
31
|
+
"barebrowse": "^0.25.0",
|
|
32
|
+
"bareguard": "^0.27.0",
|
|
33
33
|
"litectx": "^0.32.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
package/src/authorflow.js
CHANGED
|
@@ -863,6 +863,8 @@ export const PARAM_SCHEMAS = Object.freeze({
|
|
|
863
863
|
additionalProperties: false,
|
|
864
864
|
},
|
|
865
865
|
aiProposal: { type: 'boolean', description: 'true when the rule\'s number is YOURS (made out of the person\'s words), not one the person wrote' },
|
|
866
|
+
lang: { enum: ['en', 'de', 'fr', 'es', 'it', 'pt', 'nl'], description: 'date only: the language the input writes the month name in; leave it out for a date written 2026-10-26. Copy it from the look' },
|
|
867
|
+
decimal: { enum: ['.', ','], description: 'number or money only: the mark the input writes before the decimals; leave it out for "." Copy it from the look' },
|
|
866
868
|
},
|
|
867
869
|
required: ['name', 'shape'],
|
|
868
870
|
additionalProperties: false,
|
|
@@ -1445,6 +1447,8 @@ export const REQUIRED_FACTS_BRIEF = 'REQUIRED FACTS — what a line that finds,
|
|
|
1445
1447
|
+ 'Copy the forms the look gives for the fact, in its order (the first is the main one); a form the look does not give is refused at $0.\n'
|
|
1446
1448
|
+ ' - A word the look lists under NOT CHECKED or LEFT OUT is never used in a fact - not as a label, a closing label, a unit or a currency - and is refused at $0 with the reason if you do. '
|
|
1447
1449
|
+ 'A fact or ~ rule listed under NOT CHECKED is not turned into a check: code lists it under Not checked for the person, so you do not write it into "refused" yourself.\n'
|
|
1450
|
+
+ ' - A date fact whose look line gives a "lang" is signed with that lang, and a number or money fact whose look line gives a "decimal" is signed with that decimal; copy it exactly (a fact that does not is refused at $0, nothing spent). "lang" goes on a date only and "decimal" on a number or money only. '
|
|
1451
|
+
+ 'For such a fact the worker writes the value in one canonical form (a date as YYYY-MM-DD, an amount with a point before the decimals), not as the quote writes it. A fact the look lists under NOT CHECKED for its month names or its decimal comma is not signed.\n'
|
|
1448
1452
|
+ ' - When one result holds several values of one kind (leaves / arrives, subtotal / total) give the fact an anchor, the label that sits right before the value you mean.\n'
|
|
1449
1453
|
+ ' - Set aiProposal true on a fact whose number you made out of their words.\n'
|
|
1450
1454
|
+ RUBRIC_RULES + '\n'
|
package/src/bundlerun.js
CHANGED
|
@@ -73,7 +73,7 @@ export async function bundleMain(args, {
|
|
|
73
73
|
let guided = guidedIn;
|
|
74
74
|
if (bundleDirArg === undefined) {
|
|
75
75
|
if (!askable || !ask) return usage();
|
|
76
|
-
const r = await askBundle({ ask, out, ...(home === undefined ? {} : { home }), none: 'No exported bundles yet. Export one with
|
|
76
|
+
const r = await askBundle({ ask, out, ...(home === undefined ? {} : { home }), none: 'No exported bundles yet. Export one with 7.', cancelled: 'No bundle chosen, nothing run.' });
|
|
77
77
|
if ('end' in r) return 0;
|
|
78
78
|
bundleDirArg = r.ref;
|
|
79
79
|
guided = true;
|
package/src/cli.js
CHANGED
|
@@ -37,7 +37,7 @@ import { bundleMain } from './bundlerun.js';
|
|
|
37
37
|
// rather than re-parsing argv a second time here keeps exactly one code
|
|
38
38
|
// path for the flag grammar; `src/cli.js` only supplies the deps shape
|
|
39
39
|
// (`out`/`err`/`env`) this command's own callers already use.
|
|
40
|
-
import { startCmd, stopCmd, restartCmd, statusCmd, installCmd, menuCmd } from './launcher.js';
|
|
40
|
+
import { startCmd, stopCmd, restartCmd, statusCmd, installCmd, updateCmd, menuCmd } from './launcher.js';
|
|
41
41
|
import { askBundle, resolveBundleRef, listResumableBundleRuns, RECENT_BUNDLES } from './bundleref.js';
|
|
42
42
|
import { makePaint } from './tty-colour.js';
|
|
43
43
|
import { main as runUMain } from './userrun.js';
|
|
@@ -228,7 +228,7 @@ async function doHistory(args, { out, err, cwd, ask, canAsk, deps }) {
|
|
|
228
228
|
let bundleDirArg = args[0];
|
|
229
229
|
if (!bundleDirArg) {
|
|
230
230
|
if (!canAsk) { err('usage: bareloop history <bundle>'); return 1; }
|
|
231
|
-
const r = await askBundle({ ask, out, ...(home === undefined ? {} : { home }), none: 'No exported bundles yet. Export one with
|
|
231
|
+
const r = await askBundle({ ask, out, ...(home === undefined ? {} : { home }), none: 'No exported bundles yet. Export one with 7.', cancelled: 'No bundle chosen, nothing shown.' });
|
|
232
232
|
if ('end' in r) return 0;
|
|
233
233
|
bundleDirArg = r.ref;
|
|
234
234
|
}
|
|
@@ -271,11 +271,11 @@ function doRuns(_args, { out, deps }) {
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
/**
|
|
274
|
-
* The launcher doors (L, PANEL-BUILD.md addendum 2026-10-24): the bare `bareloop` menu and `start | stop | status | install`. All logic is
|
|
274
|
+
* The launcher doors (L, PANEL-BUILD.md addendum 2026-10-24): the bare `bareloop` menu and `start | stop | status | install | update`. All logic is
|
|
275
275
|
* `src/launcher.js`; this only supplies the home (the SAME one `main` resolved for the keys file and config.json) and the line reader.
|
|
276
276
|
* `deps.launcher` is the test seam for every OS touch (ports, spawn, kill, opener, clock).
|
|
277
|
-
* @param {string} cmd 'menu' | 'start' | 'stop' | 'status' | 'install' @param {string[]} rest
|
|
278
|
-
* @param {any} deps @param {{ out: (s: string) => void, err: (s: string) => void, ask: (q: string) => Promise<string
|
|
277
|
+
* @param {string} cmd 'menu' | 'start' | 'stop' | 'status' | 'install' | 'update' @param {string[]} rest
|
|
278
|
+
* @param {any} deps @param {{ out: (s: string) => void, err: (s: string) => void, ask: (q: string) => Promise<string>, canAsk: boolean }} io @param {string|undefined} home
|
|
279
279
|
* @returns {Promise<number>}
|
|
280
280
|
*/
|
|
281
281
|
async function runLauncher(cmd, rest, deps, io, home) {
|
|
@@ -290,12 +290,13 @@ async function runLauncher(cmd, rest, deps, io, home) {
|
|
|
290
290
|
resume: () => doResumeMenu(jobCtx),
|
|
291
291
|
history: () => doHistory([], jobCtx),
|
|
292
292
|
};
|
|
293
|
-
const d = { home, jobs, ask, paint: makePaint(deps.stdout ?? process.stdout, rawEnv), paintErr: makePaint(deps.stderr ?? process.stderr, rawEnv), ...(deps.launcher ?? {}) };
|
|
293
|
+
const d = { home, jobs, ask, terminal: io.canAsk, paint: makePaint(deps.stdout ?? process.stdout, rawEnv), paintErr: makePaint(deps.stderr ?? process.stderr, rawEnv), ...(deps.launcher ?? {}) };
|
|
294
294
|
if (cmd === 'start') return startCmd(io, d);
|
|
295
295
|
if (cmd === 'stop') return stopCmd(rest, io, d);
|
|
296
296
|
if (cmd === 'restart') return restartCmd(rest, io, d);
|
|
297
297
|
if (cmd === 'status') return statusCmd(io, d);
|
|
298
298
|
if (cmd === 'install') return installCmd(io, d);
|
|
299
|
+
if (cmd === 'update') return updateCmd(io, d);
|
|
299
300
|
return menuCmd(io, d);
|
|
300
301
|
}
|
|
301
302
|
|
|
@@ -340,7 +341,7 @@ async function mainInner(argv, deps, holder) {
|
|
|
340
341
|
if (keys.warning && cmd && ['run', 'run-u', 'panel'].includes(cmd)) err(`WARNING: ${keys.warning}`);
|
|
341
342
|
const launcherHome = keys.home ?? deps.runlistHome;
|
|
342
343
|
if (!cmd) return runLauncher('menu', [], { ...deps, stdout }, ctx, launcherHome);
|
|
343
|
-
if (cmd === 'start' || cmd === 'stop' || cmd === 'restart' || cmd === 'status' || cmd === 'install') return runLauncher(cmd, rest, { ...deps, stdout }, ctx, launcherHome);
|
|
344
|
+
if (cmd === 'start' || cmd === 'stop' || cmd === 'restart' || cmd === 'status' || cmd === 'install' || cmd === 'update') return runLauncher(cmd, rest, { ...deps, stdout }, ctx, launcherHome);
|
|
344
345
|
// the old form (`export <jobs/x.json> --registry <dir> --out <dir>`) is the bench's; the new one is by run name
|
|
345
346
|
if (cmd === 'export') return rest.includes('--registry') ? doExport(rest, ctx) : doExportRun(rest, ctx);
|
|
346
347
|
if (cmd === 'run') return bundleMain(rest, { ...ctx, keysHome: keys.home, parseFlags, printReds });
|
|
@@ -365,6 +366,6 @@ async function mainInner(argv, deps, holder) {
|
|
|
365
366
|
// and spine/gate-audit reads over `127.0.0.1` only. `deps.runlistHome`
|
|
366
367
|
// rides through the same injectable seam `run`/`run-u` already use.
|
|
367
368
|
if (cmd === 'panel') return panelMain(rest, { out, err, runlistHome: deps.runlistHome, env: deps.env });
|
|
368
|
-
err(`unknown command ${JSON.stringify(cmd)} — one of: export, run, history, runs, panel, start, stop, restart, status, install`);
|
|
369
|
+
err(`unknown command ${JSON.stringify(cmd)} — one of: export, run, history, runs, panel, start, stop, restart, status, install, update`);
|
|
369
370
|
return 1;
|
|
370
371
|
}
|
package/src/facts.js
CHANGED
|
@@ -18,7 +18,11 @@ export const FACT_OPS = Object.freeze(['lt', 'lte', 'gt', 'gte', 'between']);
|
|
|
18
18
|
/** bareguard signs at most this many decides on one `cited` check */
|
|
19
19
|
export const MAX_FACTS = 10;
|
|
20
20
|
/** every field a fact may carry */
|
|
21
|
-
const FACT_FIELDS = Object.freeze(['name', 'shape', 'unit', 'currency', 'phrase', 'anchor', 'until', 'rule', 'aiProposal']);
|
|
21
|
+
const FACT_FIELDS = Object.freeze(['name', 'shape', 'unit', 'currency', 'phrase', 'anchor', 'until', 'rule', 'aiProposal', 'lang', 'decimal']);
|
|
22
|
+
/** the languages whose month names bareguard 0.27 reads on a `date` fact (its `lang`), each with the name a person reads; absent `lang` = ISO YYYY-MM-DD only */
|
|
23
|
+
export const FACT_LANGS = Object.freeze({ en: 'English', de: 'German', fr: 'French', es: 'Spanish', it: 'Italian', pt: 'Portuguese', nl: 'Dutch' });
|
|
24
|
+
/** the decimal marks a number or money fact may sign (bareguard 0.27 `decimal`); absent = "." */
|
|
25
|
+
export const FACT_DECIMALS = Object.freeze(['.', ',']);
|
|
22
26
|
/** every field a part of class `fact` may carry (the shared ones are checked by rubricStepShapeReds) */
|
|
23
27
|
export const FACT_PART_FIELDS = Object.freeze(['source', 'facts', 'count']);
|
|
24
28
|
/** a fact's name appears in the claim text bareguard scans for numbers, so it carries letters only (no digit can red the claim) */
|
|
@@ -97,7 +101,6 @@ export function factShapeReds(part, w, red) {
|
|
|
97
101
|
const list = asList(us);
|
|
98
102
|
if (list.length > MAX_UNITS) red('invalid-value', `${fw}.unit`, `at most ${MAX_UNITS} units (${list.length} given)`);
|
|
99
103
|
else if (list.some((u) => u.length > MAX_UNIT_CHARS)) red('invalid-value', `${fw}.unit`, `a unit is at most ${MAX_UNIT_CHARS} characters`);
|
|
100
|
-
else if (new Set(list).size !== list.length) red('invalid-value', `${fw}.unit`, 'the units are not repeated');
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
if (has('currency')) {
|
|
@@ -109,6 +112,14 @@ export function factShapeReds(part, w, red) {
|
|
|
109
112
|
else if (new Set(list).size !== list.length) red('invalid-value', `${fw}.currency`, 'the currencies are not repeated');
|
|
110
113
|
}
|
|
111
114
|
}
|
|
115
|
+
if (has('lang')) {
|
|
116
|
+
if (f.shape !== 'date') red('invalid-value', `${fw}.lang`, 'only a date fact carries lang (the language the page writes its month names in); leave it out for a date written 2026-10-26');
|
|
117
|
+
else if (typeof f.lang !== 'string' || !Object.hasOwn(FACT_LANGS, f.lang)) red('invalid-value', `${fw}.lang`, `one of ${Object.keys(FACT_LANGS).join(' | ')}`);
|
|
118
|
+
}
|
|
119
|
+
if (has('decimal')) {
|
|
120
|
+
if (f.shape !== 'number' && f.shape !== 'money') red('invalid-value', `${fw}.decimal`, 'only a number or money fact carries decimal (the mark the page writes before the decimals)');
|
|
121
|
+
else if (!FACT_DECIMALS.includes(f.decimal)) red('invalid-value', `${fw}.decimal`, 'one of "." | ","');
|
|
122
|
+
}
|
|
112
123
|
if (f.shape === 'phrase') {
|
|
113
124
|
if (!nonEmpty(f.phrase)) red('invalid-value', `${fw}.phrase`, 'the fixed words the quote must contain, copied from the input');
|
|
114
125
|
for (const k of ['anchor', 'until', 'rule']) if (has(k)) red('invalid-value', `${fw}.${k}`, 'a phrase is fixed words the quote must contain; it has no anchor, until or rule');
|
|
@@ -147,6 +158,8 @@ export function factDecides(part) {
|
|
|
147
158
|
const d = { valueKind: f.shape };
|
|
148
159
|
if (f.shape === 'money') { if (f.unit !== undefined) d.unit = f.unit; if (f.currency !== undefined) d.currency = f.currency; }
|
|
149
160
|
if (f.anchor !== undefined) d.anchor = f.anchor;
|
|
161
|
+
if (f.lang !== undefined) d.lang = f.lang;
|
|
162
|
+
if (f.decimal !== undefined) d.decimal = f.decimal;
|
|
150
163
|
if (f.until !== undefined) d.until = f.until;
|
|
151
164
|
if (f.rule) {
|
|
152
165
|
d.op = f.rule.op;
|
|
@@ -161,11 +174,17 @@ export function factDecides(part) {
|
|
|
161
174
|
* from the values the worker gave (the worker writes no claim text): `name: value; name: value`. A phrase fact contributes its
|
|
162
175
|
* own signed words. A result that is not an object, or has no string quote, still becomes a claim — an empty one — so
|
|
163
176
|
* bareguard reds it by name rather than the result vanishing.
|
|
164
|
-
*
|
|
177
|
+
*
|
|
178
|
+
* A fact that signs a page form (`lang` or `decimal`) carries a CANONICAL value ("2026-10-26", "1057.65": bareguard's typed binding, `values.d<j>`),
|
|
179
|
+
* but bareguard's number scan compares the claim TEXT with the quote's own digits, so the text must spell the value the way the quote does
|
|
180
|
+
* ("26 October 2026", "1.057,65"). That spelling is `asWritten[result][fact index]`: the value span bareguard itself reported for that quote
|
|
181
|
+
* ({@link writtenSpans}); a fact with no span there reads the value the worker gave.
|
|
182
|
+
* @param {any} part @param {unknown} results @param {(Record<number, string>|undefined)[]} [asWritten]
|
|
183
|
+
* @returns {{claim: string, quote: string, values?: Record<string, string>}[]}
|
|
165
184
|
*/
|
|
166
|
-
export function factClaims(part, results) {
|
|
185
|
+
export function factClaims(part, results, asWritten = []) {
|
|
167
186
|
const list = Array.isArray(results) ? results : [];
|
|
168
|
-
return list.map((/** @type {any} */ r) => {
|
|
187
|
+
return list.map((/** @type {any} */ r, /** @type {number} */ i) => {
|
|
169
188
|
const given = isRec(r) && isRec(r.values) ? r.values : null;
|
|
170
189
|
/** @type {Record<string, string>} */
|
|
171
190
|
const values = {};
|
|
@@ -176,12 +195,36 @@ export function factClaims(part, results) {
|
|
|
176
195
|
const v = given && Object.hasOwn(given, f.name) ? given[f.name] : undefined;
|
|
177
196
|
// a JSON number is the value as written ("389"): converted, never repaired; anything else is left for bareguard to red
|
|
178
197
|
const s = typeof v === 'number' && Number.isFinite(v) ? String(v) : v;
|
|
179
|
-
if (typeof s === 'string') { values[`d${j}`] = s; said.push(`${f.name}: ${s}`); } else if (s !== undefined) { /** @type {any} */ (values)[`d${j}`] = s; }
|
|
198
|
+
if (typeof s === 'string') { values[`d${j}`] = s; said.push(`${f.name}: ${asWritten[i]?.[j] ?? s}`); } else if (s !== undefined) { /** @type {any} */ (values)[`d${j}`] = s; }
|
|
180
199
|
});
|
|
181
200
|
return { claim: said.join('; '), quote: isRec(r) && typeof r.quote === 'string' ? r.quote : '', values };
|
|
182
201
|
});
|
|
183
202
|
}
|
|
184
203
|
|
|
204
|
+
/**
|
|
205
|
+
* Where bareguard read each page-form fact's value inside each quote, as the quote spells it: from `checkStep`'s `full.evidence` (one entry per
|
|
206
|
+
* claim: `text` = the normalized quote the decides ran on, `spans` = where each decide read its anchor, value and unit/currency). Only a fact that
|
|
207
|
+
* signs `lang` or `decimal` is looked up; the span is the decide's `value` span (the one equal to the claim's own value when bareguard flags it).
|
|
208
|
+
* @param {any} part @param {any[]|undefined} evidence @returns {(Record<number, string>|undefined)[]} per claim index
|
|
209
|
+
*/
|
|
210
|
+
export function writtenSpans(part, evidence) {
|
|
211
|
+
/** @type {(Record<number, string>|undefined)[]} */
|
|
212
|
+
const out = [];
|
|
213
|
+
for (const e of Array.isArray(evidence) ? evidence : []) {
|
|
214
|
+
if (!isRec(e) || !Number.isInteger(e.claim) || typeof e.text !== 'string' || !Array.isArray(e.spans)) continue;
|
|
215
|
+
/** @type {Record<number, string>} */
|
|
216
|
+
const row = {};
|
|
217
|
+
part.facts.forEach((/** @type {any} */ f, /** @type {number} */ j) => {
|
|
218
|
+
if (f.lang === undefined && f.decimal === undefined) return;
|
|
219
|
+
const mine = e.spans.filter((/** @type {any} */ sp) => isRec(sp) && sp.decide === j && sp.role === 'value' && Number.isInteger(sp.start) && Number.isInteger(sp.end));
|
|
220
|
+
const sp = mine.find((/** @type {any} */ x) => x.matched === true) ?? mine[0];
|
|
221
|
+
if (sp) row[j] = e.text.slice(sp.start, sp.end);
|
|
222
|
+
});
|
|
223
|
+
if (Object.keys(row).length) out[e.claim] = row;
|
|
224
|
+
}
|
|
225
|
+
return out;
|
|
226
|
+
}
|
|
227
|
+
|
|
185
228
|
/** @param {unknown} n @param {string} shape @param {any} f @returns {string} one bound, as the person would say it */
|
|
186
229
|
function sayBound(n, shape, f) {
|
|
187
230
|
if (shape === 'money') return moneyAs(f, /** @type {string|number} */ (n), false);
|
|
@@ -219,6 +262,8 @@ export function factSentence(f, source) {
|
|
|
219
262
|
if (f.shape === 'phrase') bits.push('phrase', `must say "${f.phrase}"`);
|
|
220
263
|
else {
|
|
221
264
|
bits.push(f.shape === 'money' ? `money in ${moneyForms(f).join(' or ')}` : f.shape);
|
|
265
|
+
if (f.lang !== undefined) bits.push(`month names in ${FACT_LANGS[/** @type {keyof typeof FACT_LANGS} */ (f.lang)] ?? f.lang}`);
|
|
266
|
+
if (f.decimal === ',') bits.push('decimal comma');
|
|
222
267
|
if (f.rule) bits.push(ruleWords(f));
|
|
223
268
|
else if (f.anchor === undefined) bits.push('as the quote writes it');
|
|
224
269
|
if (f.anchor !== undefined) bits.push(f.until !== undefined ? `the words after "${f.anchor}" up to "${f.until}"` : `after "${f.anchor}"`);
|
|
@@ -237,6 +282,9 @@ export function factBrief(f) {
|
|
|
237
282
|
/** @type {string[]} */
|
|
238
283
|
const bits = [f.shape === 'money' ? `an amount in ${moneyForms(f).join(' or ')}` : `a ${f.shape}`];
|
|
239
284
|
if (f.shape === 'text') bits[0] = 'words';
|
|
285
|
+
// a fact that signs a page form is read in that form, but the value the worker writes is canonical (bareguard's typed binding): say so
|
|
286
|
+
if (f.lang !== undefined) bits.push(`write the date as YYYY-MM-DD (the quote writes it with ${FACT_LANGS[/** @type {keyof typeof FACT_LANGS} */ (f.lang)] ?? f.lang} month names)`);
|
|
287
|
+
if (f.decimal === ',') bits.push('write the amount with a point before the decimals and no thousands marks, e.g. 1057.65 (the quote writes a comma before the decimals)');
|
|
240
288
|
if (f.anchor !== undefined) bits.push(f.until !== undefined ? `the words right after "${f.anchor}" up to "${f.until}"` : `right after "${f.anchor}"`);
|
|
241
289
|
if (f.rule) bits.push(`must be ${ruleWords(f)}`);
|
|
242
290
|
return `${f.name} — ${bits.join(', ')}`;
|
package/src/factwords.js
CHANGED
|
@@ -53,7 +53,7 @@ const listOf = (shape) => /** @type {any} */ (['money', 'number', 'date', 'time'
|
|
|
53
53
|
* What the page-word map (src/pagemap.js) KEPT and DROPPED for one input: the sets the second proof reads. A look from the old search-and-read
|
|
54
54
|
* path has no `dropped` list, so it gives null and the label is proved against the code-made list as before.
|
|
55
55
|
* @param {{facts?: any[], dropped?: (import('./pagerules.js').Dropped & {source?: string})[]}|null|undefined} look @param {string} source
|
|
56
|
-
* @returns {{labels: Set<string>, units: Set<string>, currencies: Set<string>, words: Set<string>, dropped: Map<string, import('./pagerules.js').Dropped
|
|
56
|
+
* @returns {{labels: Set<string>, units: Set<string>, currencies: Set<string>, words: Set<string>, dropped: Map<string, import('./pagerules.js').Dropped>, forms: {labels: Set<string>, lang?: string, decimal?: string}[]}|null}
|
|
57
57
|
*/
|
|
58
58
|
export function keptSetOf(look, source) {
|
|
59
59
|
if (!look || !Array.isArray(look.dropped)) return null;
|
|
@@ -68,6 +68,8 @@ export function keptSetOf(look, source) {
|
|
|
68
68
|
currencies: set(facts.flatMap((f) => f.currency ?? [])),
|
|
69
69
|
words: set(facts.flatMap((f) => [...f.words, ...(f.unit ?? []), ...(f.currency ?? [])])),
|
|
70
70
|
dropped,
|
|
71
|
+
forms: facts.filter((f) => f.shape !== 'phrase' && (f.lang !== undefined || f.decimal !== undefined))
|
|
72
|
+
.map((f) => ({ labels: new Set(f.words.map((w) => normLabel(String(w)))), lang: f.lang, decimal: f.decimal })),
|
|
71
73
|
};
|
|
72
74
|
}
|
|
73
75
|
|
|
@@ -119,6 +121,15 @@ export function checkFactWords({ part, text, line, scan = scanLabels(text), kept
|
|
|
119
121
|
red('rubric-fact-label-rare', `${who}: the label ${JSON.stringify(row.label)} is in the input "${src}" only ${row.count} time${row.count === 1 ? '' : 's'}, but this line asks for ${n} results, so a label that sits in each result must be there at least ${n} times. Pick a label from the list that is counted ${n} or more times.`);
|
|
120
122
|
}
|
|
121
123
|
}
|
|
124
|
+
// a look fact that carries lang / decimal: the signed fact must sign the same, or a drafter that drops it signs a fact that reds at run time
|
|
125
|
+
if (kept && f.anchor !== undefined && f.shape !== 'phrase') {
|
|
126
|
+
const mine = kept.forms.filter((k) => k.labels.has(normLabel(String(f.anchor))));
|
|
127
|
+
if (mine.length && !mine.some((k) => (k.lang === undefined || k.lang === f.lang) && (k.decimal === undefined || k.decimal === (f.decimal ?? '.')))) {
|
|
128
|
+
const k = mine[0];
|
|
129
|
+
const [field, value] = k.lang !== undefined && k.lang !== f.lang ? ['lang', k.lang] : ['decimal', k.decimal];
|
|
130
|
+
reds.push({ code: 'rubric-fact-form-unsigned', detail: `line ${line}: the fact ${JSON.stringify(f.name)} must sign ${field} ${JSON.stringify(value)}, as the page look found. Nothing spent.` });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
122
133
|
if (f.until !== undefined) dropRed('closing label', f.until);
|
|
123
134
|
if (f.until !== undefined && countExact(text, f.until) < 1) red('rubric-fact-word-missing', `${who}: ${JSON.stringify(f.until)} is not in the input "${src}". Copy the closing words from the input, or leave them out.`);
|
|
124
135
|
if (f.shape === 'phrase' && typeof f.phrase === 'string') {
|
package/src/inputlook.js
CHANGED
|
@@ -149,7 +149,7 @@ export function lookPrompt({ jobLines, labels, lists }) {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
/** @typedef {{line: number, name: string, shape: string, source: string, label?: string, labelId?: string, value?: string, phrase?: string, example: string, rule?: any, aiProposal?: boolean, forRule?: number, reading?: import('./pagerules.js').Reading,
|
|
152
|
-
* words?: string[], labels?: string[], unit?: string[], currency?: string[]}} LookFact `words` / `labels` / `unit` / `currency`: what the page-word map kept (idea A core) */
|
|
152
|
+
* words?: string[], labels?: string[], unit?: string[], currency?: string[], lang?: string, decimal?: string}} LookFact `words` / `labels` / `unit` / `currency`: what the page-word map kept (idea A core) */
|
|
153
153
|
/** @typedef {{line: number, rule?: number, words?: string, why: string}} LookNotFound */
|
|
154
154
|
/** @typedef {{facts: LookFact[], prose: {line: number, text?: string}[], notFound: LookNotFound[], dropped?: import('./pagerules.js').Dropped[]}} LookReport */
|
|
155
155
|
|
|
@@ -168,6 +168,8 @@ export function lookFactOf(k, source) {
|
|
|
168
168
|
else { out.labels = [...k.words]; if (k.words.length) out.label = k.words[0]; }
|
|
169
169
|
if (k.unit) out.unit = [...k.unit];
|
|
170
170
|
if (k.currency) out.currency = [...k.currency];
|
|
171
|
+
if (k.lang !== undefined) out.lang = k.lang;
|
|
172
|
+
if (k.decimal !== undefined) out.decimal = k.decimal;
|
|
171
173
|
if (k.forRule !== undefined) out.forRule = k.forRule;
|
|
172
174
|
if (k.reading) out.reading = { ...k.reading };
|
|
173
175
|
return out;
|
|
@@ -251,6 +253,9 @@ export function renderLookReport(report) {
|
|
|
251
253
|
else bits.push('no label (read by its unit or sign alone)');
|
|
252
254
|
if (f.unit?.length) bits.push(`unit ${quote(f.unit)}`);
|
|
253
255
|
if (f.currency?.length) bits.push(`currency ${quote(f.currency)}`);
|
|
256
|
+
// a page form the page rules proved is on the page: the drafter signs it as given, never a guess (the run reads that form and no other)
|
|
257
|
+
if (f.lang !== undefined) bits.push(`lang ${JSON.stringify(f.lang)} (the page writes the month name in this language: sign it as the fact's lang)`);
|
|
258
|
+
if (f.decimal !== undefined) bits.push(`decimal ${JSON.stringify(f.decimal)} (the page writes this mark before the decimals: sign it as the fact's decimal)`);
|
|
254
259
|
}
|
|
255
260
|
} else if (f.phrase !== undefined) bits.push(`the quote must say ${JSON.stringify(f.phrase)}`);
|
|
256
261
|
else if (f.label !== undefined) bits.push(`label ${JSON.stringify(f.label)} (id ${f.labelId})`);
|