strom-research 1.36.0-beta.4 → 1.36.0-beta.6
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.cs.md +16 -10
- package/CHANGELOG.de.md +19 -12
- package/CHANGELOG.md +17 -11
- package/CHANGELOG.pl.md +18 -11
- package/assets/method/core.md +2 -1
- package/dist/brief/brief.js +1 -1
- package/dist/cli/human.js +61 -12
- package/dist/cli/menu-links.js +6 -17
- package/dist/cli/menu-research.js +2 -2
- package/dist/cli/menu-waiting.js +6 -6
- package/dist/commands/analysis.js +3 -2
- package/dist/commands/document.js +20 -8
- package/dist/commands/readers.js +184 -0
- package/dist/commands/session.js +22 -3
- package/dist/commands/web.js +3 -2
- package/dist/core/browserhelp.js +1 -1
- package/dist/core/document.js +23 -5
- package/dist/core/errors.js +14 -0
- package/dist/core/readchoice.js +3 -0
- package/dist/core/readprovider.js +148 -0
- package/dist/core/session.js +2 -4
- package/dist/core/tree.js +1 -1
- package/dist/core/webgate.js +26 -1
- package/package.json +1 -1
package/CHANGELOG.cs.md
CHANGED
|
@@ -7,7 +7,7 @@ Změny každé verze ve zkratce. Úplné poznámky a instalační řádky jsou n
|
|
|
7
7
|
|
|
8
8
|
## 1.36.0
|
|
9
9
|
|
|
10
|
-
*Připravuje se: bety do 1.36.0-beta.
|
|
10
|
+
*Připravuje se: bety do 1.36.0-beta.6. Oddíl bude úplný s vydáním.*
|
|
11
11
|
|
|
12
12
|
- **Zkouška hromadného ověření hned:** úkoly zkoušky hromadného ověření (`strom verify bulk --try`) stojí na začátku
|
|
13
13
|
fronty – vezme je příští sezení – a aplikace Strom je dá zpracovat hned, každý úkol jedno sezení, odkazem, který úkoly
|
|
@@ -54,15 +54,21 @@ Změny každé verze ve zkratce. Úplné poznámky a instalační řádky jsou n
|
|
|
54
54
|
záznam ve výzkumu je tak jednou přečetl), už tam potichu nevypíná prohlížeč agenta: `strom doctor`, `strom run` i
|
|
55
55
|
`strom allow archive` řeknou, od kdy, proč a co říká seznam, Co čeká i aplikace Strom se člověka jednou zeptají, zda
|
|
56
56
|
úroveň ponechat, nebo vzít podmínky archivu (`strom allow archive <host> --keep` nebo `--level <úroveň>`), a pak se do
|
|
57
|
-
fronty vrátí jen úkoly, které nová úroveň otevře;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
fronty vrátí jen úkoly, které nová úroveň otevře; kde člověk archiv svolil „přes prohlížeč“, kontrola stránky tam
|
|
58
|
+
agenta posílá do jeho prohlížeče místo ke svolení, které už platí; na stahovač či archiv zapsaný přísněji než seznam
|
|
59
|
+
se upozorní; úkol oddělený příkazem `strom task audit --fix` jmenuje snímky knihy jejím názvem, bez ID a slovesa;
|
|
60
|
+
`strom task wait --images` zadané znovu pro tutéž knihu snímky spojí (jiná kniha se odmítne: jedna kniha na úkol); dvě
|
|
61
|
+
zkoušky hromadného ověření po sobě jdou v pořadí zadání, starší první; brána limitů předplatného je přečte za vteřinu
|
|
62
|
+
či dvě, bez procházení uložených konverzací na počítači; v aplikaci Strom ukazuje každá citace rodokmenu znovu svůj
|
|
63
|
+
vlastní řádek rodokmenu (ukazatel vytvořený importem zůstává stranou) a číslo snímku známé jen z evidovaných skenů je
|
|
64
|
+
tak označené, aby ho aplikace k umístění přidala, aniž by z něj vystřihla číslo jiného snímku. `strom pack` a `strom
|
|
65
|
+
trees remove` jmenují skeny z archivů jako skeny (které jdou s sebou, které se vynechají) a záloha před odstraněním
|
|
66
|
+
řekne, že v ní jsou rodinné fotky a originály.
|
|
67
|
+
V terminálu jmenují otázka a varianty hypotézy lidi a rodiny, které uvádějí kódem, jménem s kódem (v Co čeká i když
|
|
68
|
+
aplikace Strom žádá o rozhodnutí) a agent je tak i píše; jméno napsané před kódem – osoby nebo partnerů rodiny – se
|
|
69
|
+
nikdy neopakuje.
|
|
70
|
+
Běhy vedle sebe v jednom stromu („spustit další vedle něj“, konverzace vedle běhu): běh, jehož další úkol těsně před
|
|
71
|
+
začátkem vzal jiný, pokračuje dalším volným úkolem místo konce celého běhu; žádný úkol se nevezme dvakrát.
|
|
66
72
|
|
|
67
73
|
## 1.35.0
|
|
68
74
|
|
package/CHANGELOG.de.md
CHANGED
|
@@ -7,7 +7,7 @@ Die Änderungen jeder Version in Kürze. Die vollständigen Hinweise und die Ins
|
|
|
7
7
|
|
|
8
8
|
## 1.36.0
|
|
9
9
|
|
|
10
|
-
*In Vorbereitung: die Betas bis 1.36.0-beta.
|
|
10
|
+
*In Vorbereitung: die Betas bis 1.36.0-beta.6. Der Abschnitt ist mit dem Release vollständig.*
|
|
11
11
|
|
|
12
12
|
- **Ein Versuch der Sammelprüfung sofort:** Die Aufgaben eines Versuchs der Sammelprüfung (`strom verify bulk --try`)
|
|
13
13
|
stehen am Anfang der Warteschlange – die nächste Sitzung nimmt sie –, und die Strom-App lässt sie sofort bearbeiten,
|
|
@@ -62,17 +62,24 @@ Die Änderungen jeder Version in Kürze. Die vollständigen Hinweise und die Ins
|
|
|
62
62
|
stillschweigend ab: `strom doctor`, `strom run` und `strom allow archive` sagen, seit wann, warum und was die Liste
|
|
63
63
|
sagt, Was wartet und die Strom-App fragen die Person einmal, ob die Stufe bleibt oder die Bedingungen des Archivs
|
|
64
64
|
gelten (`strom allow archive <host> --keep` oder `--level <Stufe>`), danach kehren nur die Aufgaben zurück, die die
|
|
65
|
-
neue Stufe öffnet;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
neue Stufe öffnet; wo die Person ein Archiv „über den Browser“ erlaubt hat, verweist die Prüfung einer Seite dort den
|
|
66
|
+
Agenten auf seinen Browser statt auf die bereits erteilte Erlaubnis; vor einem Downloader oder Archiv, das strenger
|
|
67
|
+
als die Liste eingetragen ist, wird gewarnt; eine mit `strom task audit --fix` abgetrennte Aufgabe nennt die Bilder
|
|
68
|
+
des Buchs mit dessen Titel, ohne ID und Verb; `strom task wait --images` erneut für dasselbe Buch angegeben, fügt
|
|
69
|
+
dessen Bilder zusammen (ein anderes Buch wird abgelehnt: ein Buch je Aufgabe); zwei Versuche der Sammelprüfung
|
|
70
|
+
nacheinander kommen in der Reihenfolge, in der sie angefordert wurden, der ältere zuerst; die Bedingung der Abo-Limits
|
|
71
|
+
liest sie in ein, zwei Sekunden, ohne die auf dem Computer gespeicherten Unterhaltungen zu durchsuchen; in der
|
|
72
|
+
Strom-App zeigt jede Quellenangabe eines Stammbaums wieder ihre eigene Zeile des Stammbaums (ein Verweis, den ein
|
|
73
|
+
Import angelegt hat, bleibt außen vor), und eine nur aus den erfassten Scans bekannte Bildnummer ist als solche
|
|
74
|
+
gekennzeichnet, sodass die App sie zur Fundstelle hinzufügt, ohne die Nummer eines anderen Bildes daraus zu entfernen.
|
|
75
|
+
`strom pack` und `strom trees remove` nennen die Scans der Archive als Scans (welche mitgehen, welche weggelassen
|
|
76
|
+
werden), und die Sicherung vor dem Entfernen sagt, dass sie die Fotos und Originale der Familie enthält.
|
|
77
|
+
Im Terminal nennen die Frage und die Varianten einer Hypothese die Personen und Familien, die sie mit ihrer ID angeben,
|
|
78
|
+
mit Namen und ID (unter „Was wartet“ und wenn die Strom-App um eine Entscheidung bittet), und der Agent schreibt sie
|
|
79
|
+
auch so; ein vor der ID geschriebener Name – einer Person oder der Partner einer Familie – wird nie doppelt genannt.
|
|
80
|
+
Läufe nebeneinander in einem Stammbaum („einen weiteren daneben starten“, eine Unterhaltung neben einem Lauf): ein
|
|
81
|
+
Lauf, dessen nächste Aufgabe kurz vor dem Beginn ein anderer übernommen hat, macht mit der nächsten freien Aufgabe
|
|
82
|
+
weiter, statt den ganzen Lauf zu beenden; keine Aufgabe wird zweimal übernommen.
|
|
76
83
|
|
|
77
84
|
## 1.35.0
|
|
78
85
|
|
package/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,7 @@ The changes of each version in short. The full notes and the install lines are o
|
|
|
7
7
|
|
|
8
8
|
## 1.36.0
|
|
9
9
|
|
|
10
|
-
*In preparation: the betas up to 1.36.0-beta.
|
|
10
|
+
*In preparation: the betas up to 1.36.0-beta.6. The section is complete with the release.*
|
|
11
11
|
|
|
12
12
|
- **A try of the bulk verification at once:** the tasks of a try of the bulk verification (`strom verify bulk --try`)
|
|
13
13
|
stand first in the queue — the next session takes them — and the Strom app can have them worked on at once, one
|
|
@@ -56,16 +56,22 @@ The changes of each version in short. The full notes and the install lines are o
|
|
|
56
56
|
research's record read them so once) no longer shuts the agent's browser there quietly: `strom doctor`, `strom run`
|
|
57
57
|
and `strom allow archive` say since when, why and what the list says, What waits and the Strom app ask the person once
|
|
58
58
|
whether to keep it or take the archive's terms (`strom allow archive <host> --keep` or `--level <level>`), after which
|
|
59
|
-
only the tasks the new level opens come back to the queue;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
only the tasks the new level opens come back to the queue; where the person allowed an archive "through the browser",
|
|
60
|
+
the agent's check of a page there points to the agent's browser rather than to the permission given already; a
|
|
61
|
+
downloader or an archive recorded stricter than the list is warned of; a task split off by `strom task audit --fix`
|
|
62
|
+
names the book's images by the book's title, without its ID and a verb; `strom task wait --images` given again for the
|
|
63
|
+
same book joins its images (another book's are refused: one book per task); two tries of the bulk verification in a
|
|
64
|
+
row come in the order they were asked, the older first; the gate of the subscription's limits reads them in a second
|
|
65
|
+
or two, without going through the conversations kept on the computer; in the Strom app each citation of a family tree
|
|
66
|
+
shows its own line of the tree again (a pointer an import made stays out), and an image's number known only from the
|
|
67
|
+
registered scans is marked as such, so that the app adds it to the location without cutting another image's number out
|
|
68
|
+
of it. `strom pack` and `strom trees remove` name the archives' scans as scans (which go along, which are left out),
|
|
69
|
+
and the backup before a removal says it holds the family's photos and originals.
|
|
70
|
+
In the terminal a hypothesis's question and variants name the people and families they give by ID by their names with
|
|
71
|
+
the ID (in What waits and when the Strom app asks to decide one), and the agent writes them so too; a name written before
|
|
72
|
+
the ID — a person's, or the partners' of a family — is never said twice.
|
|
73
|
+
Runs side by side on one tree ("start another one beside it", a conversation beside a run): a run whose next task another
|
|
74
|
+
took just before it began goes on with the next free task instead of ending the whole run; no task is taken twice.
|
|
69
75
|
|
|
70
76
|
## 1.35.0
|
|
71
77
|
|
package/CHANGELOG.pl.md
CHANGED
|
@@ -7,7 +7,7 @@ Zmiany każdej wersji w skrócie. Pełne informacje o wydaniach i polecenia inst
|
|
|
7
7
|
|
|
8
8
|
## 1.36.0
|
|
9
9
|
|
|
10
|
-
*W przygotowaniu: bety do 1.36.0-beta.
|
|
10
|
+
*W przygotowaniu: bety do 1.36.0-beta.6. Sekcja będzie kompletna z wydaniem.*
|
|
11
11
|
|
|
12
12
|
- **Próba zbiorczej weryfikacji od razu:** zadania próby zbiorczej weryfikacji (`strom verify bulk --try`) stoją na
|
|
13
13
|
początku kolejki – weźmie je następna sesja – a aplikacja Strom pozwala przerobić je od razu, każde zadanie w jednej
|
|
@@ -56,16 +56,23 @@ Zmiany każdej wersji w skrócie. Pełne informacje o wydaniach i polecenia inst
|
|
|
56
56
|
wpis w badaniu raz tak je odczytał), nie wyłącza już tam po cichu przeglądarki agenta: `strom doctor`, `strom run` i
|
|
57
57
|
`strom allow archive` mówią, od kiedy, dlaczego i co mówi lista, Co czeka i aplikacja Strom pytają osobę raz, czy
|
|
58
58
|
zachować poziom, czy przyjąć warunki archiwum (`strom allow archive <host> --keep` lub `--level <poziom>`), po czym do
|
|
59
|
-
kolejki wracają tylko zadania, które nowy poziom otwiera;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
kolejki wracają tylko zadania, które nowy poziom otwiera; tam, gdzie osoba zezwoliła na archiwum „przez przeglądarkę”,
|
|
60
|
+
sprawdzenie strony kieruje agenta do jego przeglądarki zamiast do zgody, która już obowiązuje; przed konektorem lub
|
|
61
|
+
archiwum zapisanym surowiej niż lista strom ostrzega; zadanie wydzielone przez `strom task audit --fix` nazywa skany
|
|
62
|
+
księgi jej tytułem, bez ID i czasownika; `strom task wait --images` podane ponownie dla tej samej księgi łączy jej
|
|
63
|
+
skany (inna księga jest odrzucana: jedna księga na zadanie); dwie próby zbiorczej weryfikacji po sobie idą w
|
|
64
|
+
kolejności zlecenia, starsza pierwsza; warunek limitów subskrypcji odczytuje je w sekundę lub dwie, bez przeglądania
|
|
65
|
+
rozmów zapisanych na komputerze; w aplikacji Strom każdy przypis drzewa genealogicznego znów pokazuje własny wiersz
|
|
66
|
+
drzewa (odnośnik utworzony przez import pozostaje na boku), a numer skanu znany tylko z zarejestrowanych skanów jest
|
|
67
|
+
tak oznaczony, by aplikacja dodała go do lokalizacji, nie wycinając z niej numeru innego skanu. `strom pack` i `strom
|
|
68
|
+
trees remove` nazywają skany z archiwów skanami (które idą razem, które są pominięte), a kopia zapasowa przed
|
|
69
|
+
usunięciem mówi, że zawiera rodzinne zdjęcia i oryginały.
|
|
70
|
+
W terminalu pytanie i warianty hipotezy nazywają osoby i rodziny podane identyfikatorem imieniem z identyfikatorem
|
|
71
|
+
(w Co czeka i gdy aplikacja Strom prosi o rozstrzygnięcie), a agent też tak je pisze; imię zapisane przed
|
|
72
|
+
identyfikatorem – osoby lub partnerów rodziny – nigdy nie powtarza się.
|
|
73
|
+
Przebiegi obok siebie w jednym drzewie („uruchomić kolejnego obok niego”, rozmowa obok przebiegu): przebieg, którego
|
|
74
|
+
następne zadanie tuż przed rozpoczęciem wziął inny, kontynuuje następnym wolnym zadaniem zamiast kończyć cały
|
|
75
|
+
przebieg; żadne zadanie nie jest brane dwa razy.
|
|
69
76
|
|
|
70
77
|
## 1.35.0
|
|
71
78
|
|
package/assets/method/core.md
CHANGED
|
@@ -86,7 +86,8 @@ conclusion so the next researcher can follow it.
|
|
|
86
86
|
words only. An older open hypothesis you work on that has none gets them
|
|
87
87
|
then (`strom hypothesis list --unlinked`). A variant's letter stays its
|
|
88
88
|
claim's: a claim that would connect other people is a new variant
|
|
89
|
-
(`strom hypothesis variant H… "<claim>"`).
|
|
89
|
+
(`strom hypothesis variant H… "<claim>"`). The question and claims name
|
|
90
|
+
people by name and ID ("the son of Jan Lhoták (P0118)"), never the ID alone.
|
|
90
91
|
- **The user decides a hypothesis**; you propose it once the records point
|
|
91
92
|
to one variant: `strom hypothesis propose H… --variant B --decision "…"`
|
|
92
93
|
(none holds: `--abandon`), and go on — unless the user lets you decide
|
package/dist/brief/brief.js
CHANGED
|
@@ -988,7 +988,7 @@ export function browserRules(sites, alone, task) {
|
|
|
988
988
|
"- strom watches it, and the built-in browser of Claude's desktop app the same way (the same hook before each page). That one, Codex's browser (in the terminal strom watches it by the addresses its code names, once the person confirmed strom's hooks in Codex; the ChatGPT app's runs through ChatGPT's cloud and strom does not watch it) and the desktop apps' computer use (strom does not watch it) strom does not recommend: never of your own accord (strom doc R12). Only when the person explicitly asks for them: the person's choice — say in one sentence whether strom watches that way and what the site's terms say; never a way round them, never a check whether a person is there.",
|
|
989
989
|
"- Use it without asking where a connector (strom fetch), WebFetch and WebSearch lead nowhere — never where they led nowhere because the site refused strom (401/403/429) or its terms forbid or restrict automation; images only through strom fetch.",
|
|
990
990
|
"- As gently as strom fetch: the site's terms and robots.txt, its pace and hourly cap (strom connector show; else a page at a time, 2 s apart at least), only the pages the task needs, nothing ahead. A site that forbids automated access: never through the browser, never a way round.",
|
|
991
|
-
`- A site that forbids automation, refused strom, or restricts it without the person's permission "through the browser" (strom net web --check <url> says it): no connector, no browser — another way to the same records (another archive or fonds of the jurisdiction, the parish, an index, secondary sources), the search recorded (strom search add … --result inconclusive --note "<host>: …"); only if the source stays necessary: strom task wait ${task ?? "T…"} --check <url> --on "<what the person checks there>"${alone ? ", then close the session" : ""}.`,
|
|
991
|
+
`- A site that forbids automation, refused strom, or restricts it without the person's permission "through the browser" (strom net web --check <url> --browser says it): no connector, no browser — another way to the same records (another archive or fonds of the jurisdiction, the parish, an index, secondary sources), the search recorded (strom search add … --result inconclusive --note "<host>: …"); only if the source stays necessary: strom task wait ${task ?? "T…"} --check <url> --on "<what the person checks there>"${alone ? ", then close the session" : ""}.`,
|
|
992
992
|
...(alone
|
|
993
993
|
? [
|
|
994
994
|
"- Nobody answers in a run: no AskUserQuestion, no switch_browser. Several browsers connected, none selected: list_connected_browsers, then select_browser — onThisComputer, else isLocal.",
|
package/dist/cli/human.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// they are shown.
|
|
5
5
|
import { MONTHS } from "../core/gdate.js";
|
|
6
6
|
import { ui } from "./ui.js";
|
|
7
|
-
import { displayName } from "../core/people.js";
|
|
7
|
+
import { currentName, displayName } from "../core/people.js";
|
|
8
8
|
import { foldText } from "../core/text.js";
|
|
9
9
|
import { houseHasWord } from "../core/house.js";
|
|
10
10
|
const MONTH_PL = {
|
|
@@ -158,6 +158,62 @@ function namesOne(word, names) {
|
|
|
158
158
|
return word.length >= k && word.slice(0, k) === n.slice(0, k);
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
|
+
/** The words of a person's given name, folded; none given: the words of their whole name. */
|
|
162
|
+
function givenWords(p) {
|
|
163
|
+
const given = foldText(currentName(p).given).split(/[^\p{L}\p{M}\p{N}]+/u).filter((w) => w.length >= 2);
|
|
164
|
+
return given.length ? given : nameWords(p);
|
|
165
|
+
}
|
|
166
|
+
/** Can each partner be told by a word of their own (no word naming two of them)? */
|
|
167
|
+
function eachByOwnWord(words, partners, used = new Set()) {
|
|
168
|
+
if (!partners.length)
|
|
169
|
+
return true;
|
|
170
|
+
const [names, ...rest] = partners;
|
|
171
|
+
return words.some((w, i) => !used.has(i) && namesOne(w, names) && eachByOwnWord(words, rest, new Set([...used, i])));
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Whether the text before a person's ID ends with their name (the two words before it, declined too); before a family's,
|
|
175
|
+
* with the given names of all its partners, each by a word of its own (two words each and a word between them: "Jan +
|
|
176
|
+
* Anna F0001", "Jana Lhotáka a Anny Lhotové F0001") — a surname two partners share never names both.
|
|
177
|
+
*/
|
|
178
|
+
function namedBefore(tree, id, before) {
|
|
179
|
+
const r = tree.get(id);
|
|
180
|
+
const people = r?.type === "person" ? [r] : r?.type === "family" ? r.partners.map((x) => tree.get(x)).filter((x) => x?.type === "person") : [];
|
|
181
|
+
if (!people.length)
|
|
182
|
+
return false;
|
|
183
|
+
// the words before the ID (letters only, none of them an ID)
|
|
184
|
+
const words = foldText(before.slice(-60 * people.length)).split(/[^\p{L}\p{M}\p{N}]+/u).filter(Boolean).slice(-3 * people.length + 1).filter((w) => !/^[pfsbn]\d{4,}$/u.test(w));
|
|
185
|
+
if (people.length === 1)
|
|
186
|
+
return words.slice(-2).some((w) => namesOne(w, nameWords(people[0])));
|
|
187
|
+
return eachByOwnWord(words, people.map(givenWords));
|
|
188
|
+
}
|
|
189
|
+
/** A person or a family of the research by name with its ID: "Jan Lhoták (P0001)", "Jan Lhoták + Anna Lhotová (F0001)". */
|
|
190
|
+
export function whoSaid(tree, id) {
|
|
191
|
+
const r = tree.get(id);
|
|
192
|
+
if (r?.type === "person")
|
|
193
|
+
return `${displayName(r)} (${id})`;
|
|
194
|
+
if (r?.type === "family") {
|
|
195
|
+
const names = r.partners.map((p) => tree.get(p)).filter((p) => p?.type === "person").map(displayName);
|
|
196
|
+
return names.length ? `${names.join(" + ")} (${id})` : id;
|
|
197
|
+
}
|
|
198
|
+
return id;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* What an agent wrote of a hypothesis (its question, a variant's claim), for the person: the people and families it
|
|
202
|
+
* names by ID by their names with the ID, as the tree's changes beside it say them ("syn P0118" → "syn Jan Lhoták
|
|
203
|
+
* (P0118)"). A person's ID right after their name keeps the name as written ("Jana Lhotáka P0118", "… [P0118]" →
|
|
204
|
+
* "Jana Lhotáka (P0118)"); an ID the research has not stays as it is.
|
|
205
|
+
*/
|
|
206
|
+
export function humanClaim(tree, text) {
|
|
207
|
+
return text.replace(/([[(])?(?<![\p{L}\p{M}\p{N}])([PF]\d{4,})(?![\p{L}\p{M}\p{N}])([\])])?/gu, (all, open, id, close, at) => {
|
|
208
|
+
const r = tree.get(id);
|
|
209
|
+
if (r?.type !== "person" && r?.type !== "family")
|
|
210
|
+
return all;
|
|
211
|
+
// one bracket alone is the text's own: kept around what is said
|
|
212
|
+
const paired = !!open && !!close && (open === "[") === (close === "]");
|
|
213
|
+
const [lead, tail] = paired ? ["", ""] : [open ?? "", close ?? ""];
|
|
214
|
+
return `${lead}${namedBefore(tree, id, text.slice(0, at)) ? `(${id})` : whoSaid(tree, id)}${tail}`;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
161
217
|
/**
|
|
162
218
|
* What the agent wrote into a task, for the user: the records it names by ID by their names ("S0001" → its title).
|
|
163
219
|
* `asWritten`: a person's ID right after their name in the text stays the bare ID in brackets ("Václava Nováka P0001" →
|
|
@@ -165,15 +221,7 @@ function namesOne(word, names) {
|
|
|
165
221
|
* after their name, as strom writes it ("Karel Němec [P0001]"), stays as it is either way.
|
|
166
222
|
*/
|
|
167
223
|
export function humanTask(tree, text, lang, o = {}) {
|
|
168
|
-
const named = (id, before) =>
|
|
169
|
-
const p = tree.get(id);
|
|
170
|
-
if (p?.type !== "person")
|
|
171
|
-
return false;
|
|
172
|
-
// the two words before the ID (letters only, none of them an ID)
|
|
173
|
-
const words = foldText(before.slice(-60)).split(/[^\p{L}\p{M}\p{N}]+/u).filter(Boolean).slice(-2).filter((w) => !/^[pfsbn]\d{4,}$/u.test(w));
|
|
174
|
-
const names = nameWords(p);
|
|
175
|
-
return words.some((w) => namesOne(w, names));
|
|
176
|
-
};
|
|
224
|
+
const named = (id, before) => namedBefore(tree, id, before);
|
|
177
225
|
const name = (id) => {
|
|
178
226
|
const r = tree.get(id);
|
|
179
227
|
if (!r)
|
|
@@ -187,12 +235,13 @@ export function humanTask(tree, text, lang, o = {}) {
|
|
|
187
235
|
return r.title;
|
|
188
236
|
};
|
|
189
237
|
// A list of IDs as a list of names, each once (two sessions of one day read as one).
|
|
190
|
-
|
|
238
|
+
// already in brackets ("… [F0001]"): the bare ID inside them, never "[[F0001]]"
|
|
239
|
+
const names = (ids, at, bracketed = false) => o.asWritten && !ids.includes(",") && named(ids, text.slice(0, at)) ? (bracketed ? ids : `[${ids}]`) : [...new Set(ids.split(", ").map(name))].join(", ");
|
|
191
240
|
return text.replace(/(\[)?\b([PFSBN]\d{4,}\b(?:, [PFSBN]\d{4,}\b)*)(\])?/g, (all, open, ids, close, at) => {
|
|
192
241
|
// a person's ID in brackets as strom writes it ("Karel Němec [P0001]"): kept after their name, else their name in its place
|
|
193
242
|
if (open && close && !ids.includes(",") && tree.get(ids)?.type === "person")
|
|
194
243
|
return named(ids, text.slice(0, at)) ? all : name(ids);
|
|
195
|
-
return `${open ?? ""}${names(ids, at + (open ? 1 : 0))}${close ?? ""}`;
|
|
244
|
+
return `${open ?? ""}${names(ids, at + (open ? 1 : 0), !!open && !!close)}${close ?? ""}`;
|
|
196
245
|
});
|
|
197
246
|
}
|
|
198
247
|
/**
|
package/dist/cli/menu-links.js
CHANGED
|
@@ -7,7 +7,7 @@ import fs from "node:fs";
|
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { outOfAnswers, translator } from "./menu-parts.js";
|
|
9
9
|
import { askPaths, directionTasks, offerChat, setDirection } from "./menu-research.js";
|
|
10
|
-
import { humanCost, humanDay, humanTask, humanWhen } from "./human.js";
|
|
10
|
+
import { humanClaim, humanCost, humanDay, humanTask, humanWhen, whoSaid } from "./human.js";
|
|
11
11
|
import { lines, truncate } from "./format.js";
|
|
12
12
|
import { isArchive } from "../core/mode.js";
|
|
13
13
|
import { actsAsArchive, kindOf } from "../core/state.js";
|
|
@@ -796,24 +796,13 @@ export async function hypothesisDo(ctx, run, lang, root, id, how = "decide", var
|
|
|
796
796
|
out(ctx, t("ui.link.hypothesis.notInApp", { id: h.id }));
|
|
797
797
|
else if (picked)
|
|
798
798
|
return hypothesisPicked(ctx, run, lang, root, h, how, variant);
|
|
799
|
-
if (!(await asks(ctx, lang, root, t(h.state === "open" ? "ui.link.what.hypothesis.decide" : "ui.link.what.hypothesis.change", { question: truncate(h.question, 120) }))))
|
|
799
|
+
if (!(await asks(ctx, lang, root, t(h.state === "open" ? "ui.link.what.hypothesis.decide" : "ui.link.what.hypothesis.change", { question: truncate(humanClaim(tree, h.question), 120) }))))
|
|
800
800
|
return false;
|
|
801
801
|
const { decideHypothesis } = await import("./menu-waiting.js");
|
|
802
802
|
return decideHypothesis(ctx, run, lang, root, h.id);
|
|
803
803
|
}
|
|
804
804
|
/** People a decision joins to the tree from which the terminal says how many (the app's K1.4: "a large part of the tree"). */
|
|
805
805
|
export const HYPOTHESIS_BIG_JOIN = 50;
|
|
806
|
-
/** A person or a family as the person reads it: the name and the ID ("Josef Lhoták (P0001)", "Václav Lhoták + Marie Lhotová (F0001)"). */
|
|
807
|
-
function whoSaid(tree, id) {
|
|
808
|
-
const r = tree.get(id);
|
|
809
|
-
if (r?.type === "person")
|
|
810
|
-
return `${displayName(r)} (${id})`;
|
|
811
|
-
if (r?.type === "family") {
|
|
812
|
-
const names = r.partners.map((p) => tree.get(p)).filter((p) => p?.type === "person").map(displayName);
|
|
813
|
-
return names.length ? `${names.join(" + ")} (${id})` : id;
|
|
814
|
-
}
|
|
815
|
-
return id;
|
|
816
|
-
}
|
|
817
806
|
/** One link of a variant in the research language — into the family it went to, when there is one. */
|
|
818
807
|
function linkSaid(t, tree, l, family) {
|
|
819
808
|
if (l.kind === "child") {
|
|
@@ -904,7 +893,7 @@ async function hypothesisPicked(ctx, run, lang, root, h, how, label) {
|
|
|
904
893
|
const tree = Tree.open(root, ctx.env);
|
|
905
894
|
const archive = actsAsArchive(tree);
|
|
906
895
|
const p = archive ? undefined : h.proposal;
|
|
907
|
-
out(ctx, ["", ` ${h.id} · ${h.question}`, ...h.variants.map((v) => ` ${v.label}) ${truncate(v.claim, 110)}`), ...(h.state !== "open" ? [` ${decidedLine(t, tree, h, lang)}`] : []), ""].join("\n"));
|
|
896
|
+
out(ctx, ["", ` ${h.id} · ${humanClaim(tree, h.question)}`, ...h.variants.map((v) => ` ${v.label}) ${truncate(humanClaim(tree, v.claim), 110)}`), ...(h.state !== "open" ? [` ${decidedLine(t, tree, h, lang)}`] : []), ""].join("\n"));
|
|
908
897
|
const why = async (fallback) => {
|
|
909
898
|
const said = (await ctx.ask(t("ui.link.hypothesis.why", { reason: fallback }))).trim();
|
|
910
899
|
return said === "0" ? undefined : said || fallback;
|
|
@@ -922,7 +911,7 @@ async function hypothesisPicked(ctx, run, lang, root, h, how, label) {
|
|
|
922
911
|
if (h.state === "decided" && h.chosen === v.label)
|
|
923
912
|
return stop(ctx, `${decidedLine(t, tree, h, lang)} ${t("ui.link.hypothesis.nothing")}`);
|
|
924
913
|
const n = branchJoined(tree, h, v);
|
|
925
|
-
const what = t(h.state === "open" ? "ui.link.what.hypothesis.pick" : "ui.link.what.hypothesis.repick", { id: h.id, variant: v.label, claim: truncate(v.claim, 110) });
|
|
914
|
+
const what = t(h.state === "open" ? "ui.link.what.hypothesis.pick" : "ui.link.what.hypothesis.repick", { id: h.id, variant: v.label, claim: truncate(humanClaim(tree, v.claim), 110) });
|
|
926
915
|
// the earlier link stays (other work stands on it) and the new one cannot be written: said first, cancel suggested
|
|
927
916
|
const stays = changeWarning(lang, tree, h, v);
|
|
928
917
|
// a variant that connects nothing, and nothing of an earlier decision on the tree to take off: only the decision is
|
|
@@ -1001,13 +990,13 @@ export async function acceptProposals(ctx, run, lang, root, ids) {
|
|
|
1001
990
|
const line = (h) => {
|
|
1002
991
|
const p = h.proposal;
|
|
1003
992
|
if (p.abandon || !p.variant)
|
|
1004
|
-
return [` ${t("ui.link.accept.none", { id: h.id, question: truncate(h.question, 80) })}`];
|
|
993
|
+
return [` ${t("ui.link.accept.none", { id: h.id, question: truncate(humanClaim(tree, h.question), 80) })}`];
|
|
1005
994
|
const v = h.variants.find((x) => x.label === p.variant);
|
|
1006
995
|
const warn = changeWarning(lang, tree, h, v);
|
|
1007
996
|
if (warn)
|
|
1008
997
|
stays = true;
|
|
1009
998
|
const n = v && !warn ? branchJoined(tree, h, v) : 0;
|
|
1010
|
-
return [` ${t("ui.link.accept.variant", { id: h.id, variant: p.variant, claim: truncate(v?.claim ?? "", 80) })}${n ? ` ${t("ui.link.accept.joins", { n })}` : ""}`, ...(warn ? [` ${warn}`] : [])];
|
|
999
|
+
return [` ${t("ui.link.accept.variant", { id: h.id, variant: p.variant, claim: truncate(humanClaim(tree, v?.claim ?? ""), 80) })}${n ? ` ${t("ui.link.accept.joins", { n })}` : ""}`, ...(warn ? [` ${warn}`] : [])];
|
|
1011
1000
|
};
|
|
1012
1001
|
if (!take.length)
|
|
1013
1002
|
return stop(ctx, [t("ui.link.accept.nothing"), ...said].join("\n"));
|
|
@@ -16,7 +16,7 @@ import { displayName, lifespan } from "../core/people.js";
|
|
|
16
16
|
import { DEATH_AFTER_YEARS, unprovenPeople } from "../core/review.js";
|
|
17
17
|
import { planSync, readTreeFile, receivedAll, receivedSince, SYNC_INBOX } from "../core/sync.js";
|
|
18
18
|
import { undoSending } from "./menu-links.js";
|
|
19
|
-
import { humanWhen } from "./human.js";
|
|
19
|
+
import { humanClaim, humanWhen } from "./human.js";
|
|
20
20
|
import { truncate } from "./format.js";
|
|
21
21
|
import { appSendsChanges, stromAppState } from "../core/stromapp.js";
|
|
22
22
|
import { UNPROVEN_BATCH } from "../commands/research.js";
|
|
@@ -590,7 +590,7 @@ async function personHypotheses(ctx, run, lang, root, person) {
|
|
|
590
590
|
if (!all.length)
|
|
591
591
|
return;
|
|
592
592
|
const state = (h) => t(h.state === "open" ? (h.proposal && !actsAsArchive(tree) ? "ui.review.hypothesis.proposed" : "ui.review.hypothesis.open") : h.state === "decided" ? "ui.review.hypothesis.decided" : "ui.review.hypothesis.abandoned");
|
|
593
|
-
const i = await ctx.choose(t("ui.review.hypotheses.title"), all.map((h) => ({ label: `${h.id} · ${state(h)} · ${truncate(h.question, 70)}` })), all.length, { back: t("ui.browse.back") });
|
|
593
|
+
const i = await ctx.choose(t("ui.review.hypotheses.title"), all.map((h) => ({ label: `${h.id} · ${state(h)} · ${truncate(humanClaim(tree, h.question), 70)}` })), all.length, { back: t("ui.browse.back") });
|
|
594
594
|
if (i === undefined)
|
|
595
595
|
return;
|
|
596
596
|
await decideHypothesis(ctx, run, lang, root, all[i].id);
|
package/dist/cli/menu-waiting.js
CHANGED
|
@@ -30,7 +30,7 @@ import { agentDecided } from "../core/hypolinks.js";
|
|
|
30
30
|
import { normId } from "../core/records.js";
|
|
31
31
|
import { actsAsArchive } from "../core/state.js";
|
|
32
32
|
import { branchOf } from "../core/offline.js";
|
|
33
|
-
import { eventName, humanDay, humanTask } from "./human.js";
|
|
33
|
+
import { eventName, humanClaim, humanDay, humanTask } from "./human.js";
|
|
34
34
|
import { provenReviewSince, provenToReview } from "../core/provenfix.js";
|
|
35
35
|
import { conflictTitle, displayName, lifespan } from "../core/people.js";
|
|
36
36
|
import { claimOf, isEditConflict, sideText } from "../core/conflicts.js";
|
|
@@ -129,9 +129,9 @@ function daysSince(iso, now = Date.now()) {
|
|
|
129
129
|
function sentWords(t, lang, iso) {
|
|
130
130
|
return `${t("ui.wait.sentline", { day: humanDay(iso, lang), ago: ago(t, iso) })}${daysSince(iso) > NO_REPLY_DAYS ? ` · ${t("ui.wait.noreply", { days: NO_REPLY_DAYS })}` : ""}`;
|
|
131
131
|
}
|
|
132
|
-
/** What a thing is, short: a task's words as written, its records named (a person's ID after their name only bracketed). */
|
|
132
|
+
/** What a thing is, short: a task's words as written, its records named (a person's ID after their name only bracketed); a hypothesis's question its people named. */
|
|
133
133
|
function short(tree, lang, w) {
|
|
134
|
-
return w.task ? humanTask(tree, w.item.what, lang, { asWritten: true }) : w.item.what;
|
|
134
|
+
return w.task ? humanTask(tree, w.item.what, lang, { asWritten: true }) : w.hypothesis ? humanClaim(tree, w.item.what) : w.item.what;
|
|
135
135
|
}
|
|
136
136
|
const sentAtOf = (w) => String(w.item.sentAt ?? w.item.at);
|
|
137
137
|
/** The places of a list, in its order (the items of one place stand together). */
|
|
@@ -654,9 +654,9 @@ export async function decideHypothesis(ctx, run, lang, root, id) {
|
|
|
654
654
|
out([
|
|
655
655
|
"",
|
|
656
656
|
` ${h.id} · ${kindWord(t, "hypothesis")}${since ? ` · ${t("ui.wait.since", { day: humanDay(since, lang) })}` : ""}`,
|
|
657
|
-
` ${h.question}`,
|
|
657
|
+
` ${humanClaim(tree, h.question)}`,
|
|
658
658
|
...now,
|
|
659
|
-
...h.variants.map((v) => ` ${v.label}) ${v.claim}`),
|
|
659
|
+
...h.variants.map((v) => ` ${v.label}) ${humanClaim(tree, v.claim)}`),
|
|
660
660
|
...(proposed ? ["", ` ${proposed}`, ...(p.reason ? [` ${t("ui.wait.hypothesis.again", { reason: p.reason })}`] : [])] : []),
|
|
661
661
|
].join("\n"));
|
|
662
662
|
// a change the tree cannot follow (the earlier link stays, other work stands on it; the new one is not written): said
|
|
@@ -670,7 +670,7 @@ export async function decideHypothesis(ctx, run, lang, root, id) {
|
|
|
670
670
|
};
|
|
671
671
|
// another variant, or none holds — and why: the decision's words; a decided one decided again: the reason too
|
|
672
672
|
const otherwise = async () => {
|
|
673
|
-
const v = await ctx.choose(t("ui.wait.hypothesis.pick"), [...h.variants.map((x) => ({ label: `${x.label}) ${truncate(x.claim, 70)}` })), { label: t("ui.wait.hypothesis.none") }], h.variants.length + 1, { back: t("ui.browse.back") });
|
|
673
|
+
const v = await ctx.choose(t("ui.wait.hypothesis.pick"), [...h.variants.map((x) => ({ label: `${x.label}) ${truncate(humanClaim(tree, x.claim), 70)}` })), { label: t("ui.wait.hypothesis.none") }], h.variants.length + 1, { back: t("ui.browse.back") });
|
|
674
674
|
if (v === undefined)
|
|
675
675
|
return undefined;
|
|
676
676
|
if (v < h.variants.length && !(await goesOn(h.variants[v])))
|
|
@@ -838,10 +838,11 @@ register({
|
|
|
838
838
|
group: "analysis",
|
|
839
839
|
tree: true,
|
|
840
840
|
writes: true,
|
|
841
|
+
description: 'The question and each claim name the people of the tree by name with the ID ("Jan Lhoták (P0001)"), never the ID alone: the user decides by reading them.',
|
|
841
842
|
args: [{ name: "question", description: 'e.g. "Who was the father of Marie?"', required: true }],
|
|
842
843
|
options: [
|
|
843
844
|
{ name: "about", type: "string", multiple: true, value: "<who>", description: "person/record concerned (repeatable)" },
|
|
844
|
-
{ name: "variant", type: "string", multiple: true, value: "<A: claim>", description: 'a variant, e.g. "A:
|
|
845
|
+
{ name: "variant", type: "string", multiple: true, value: "<A: claim>", description: 'a variant, e.g. "A: the son of Jan Lhoták (P0001)" — a person of the tree by name with the ID (repeat)' },
|
|
845
846
|
{ name: "note", type: "string", value: "<text>", description: "short note" },
|
|
846
847
|
],
|
|
847
848
|
run(ctx, { args, opts }) {
|
|
@@ -908,7 +909,7 @@ register({
|
|
|
908
909
|
description: "A variant's letter stays one claim's (the Strom app remembers it): a claim that changes whom it would connect is a new variant.",
|
|
909
910
|
args: [
|
|
910
911
|
{ name: "hypothesis", description: "hypothesis ID (H0001)", required: true },
|
|
911
|
-
{ name: "claim", description: 'the claim, e.g. "the son of
|
|
912
|
+
{ name: "claim", description: 'the claim, e.g. "the son of Jan Lhoták (P0001)" — a person of the tree by name with the ID (or "C: …" with its letter)', required: true },
|
|
912
913
|
],
|
|
913
914
|
examples: ['strom hypothesis variant H0001 "syn Josefa z čp. 12"'],
|
|
914
915
|
run(ctx, { args }) {
|
|
@@ -23,7 +23,8 @@ import { verifyFast } from "../core/integrity.js";
|
|
|
23
23
|
import { addReaders } from "../core/session.js";
|
|
24
24
|
import { READER_MINUTES_HELP } from "../core/reader.js";
|
|
25
25
|
import { stamp } from "../core/net.js";
|
|
26
|
-
import { readerAgent,
|
|
26
|
+
import { readerAgent, readTeam } from "./readers.js";
|
|
27
|
+
import { readProvider } from "../core/readprovider.js";
|
|
27
28
|
import { RUNNERS } from "../runners/index.js";
|
|
28
29
|
import { EFFORTS } from "../agents/effort.js";
|
|
29
30
|
import { ownModel } from "../agents/models.js";
|
|
@@ -32,7 +33,7 @@ import { catalog } from "../core/phrases.js";
|
|
|
32
33
|
import { readerDefault } from "../core/readchoice.js";
|
|
33
34
|
import { heldAgainst, keepSourceReading, notAgain, originalPages, readingOfSource } from "../core/sourceread.js";
|
|
34
35
|
import { askOfReading } from "./source-reading.js";
|
|
35
|
-
import { alive, APP_READ_FROM, backBefore, beforeOf, buildResult, cancelPath, DOC_NEXT, DOC_PAGES, DOC_VIEWS, aboutFor, docPrompt, endState, FINAL_STATES, listReadings, loadState, newReadId, nextVersion, parseRegion, READ_ID, reportPath, resultPath, saveState, shownName, SMALL_PX, withoutDocNext, words, } from "../core/document.js";
|
|
36
|
+
import { alive, APP_READ_FROM, backBefore, beforeOf, buildResult, cancelPath, DOC_NEXT, linesPath, DOC_PAGES, DOC_VIEWS, aboutFor, docPrompt, endState, FINAL_STATES, listReadings, loadState, newReadId, nextVersion, parseRegion, READ_ID, reportPath, resultPath, saveState, shownName, SMALL_PX, withoutDocNext, words, } from "../core/document.js";
|
|
36
37
|
/** How often a reading at work looks whether it was cancelled (strom document cancel, from another process). */
|
|
37
38
|
const CANCEL_LOOK_MS = 500;
|
|
38
39
|
/** The image types a document is read from: a photo, a scan, a PDF (HEIC and PDF converted for the reader). */
|
|
@@ -125,6 +126,16 @@ function withOf(ctx, tree, opts) {
|
|
|
125
126
|
const str = (v) => (typeof v === "string" ? v.trim() : undefined);
|
|
126
127
|
const one = (at, agent, model, effort, like) => {
|
|
127
128
|
const pre = at ? "--blind-" : "--";
|
|
129
|
+
// a reading service (core/readprovider.ts): its model as asked (none: its own), no effort; the transcript alone
|
|
130
|
+
const service = readProvider(agent, ctx.env);
|
|
131
|
+
if (service?.kind === "service") {
|
|
132
|
+
if (!at && !opts.source)
|
|
133
|
+
throw new UsageError(`${service.title} reads the transcript alone: it is the second, blind reader of a document (--blind-agent ${agent}), or reads a source again (--source)`, { code: "read.with", params: { at: String(at), field: "agent" }, hint: `strom document read … --readers 2 --blind-agent ${agent}` });
|
|
134
|
+
if (effort)
|
|
135
|
+
throw new UsageError(`${service.title} takes no effort`, { code: "read.with", params: { at: String(at), field: "effort" }, hint: `leave ${pre}effort out` });
|
|
136
|
+
const m = model ?? (like?.agent === agent ? (like.model ?? "") : "");
|
|
137
|
+
return { agent, ...(m ? { model: m } : {}) };
|
|
138
|
+
}
|
|
128
139
|
if (!RUNNERS[agent])
|
|
129
140
|
throw new UsageError(`no reader of the agent "${agent.slice(0, 40)}"`, { code: "read.with", params: { at: String(at), field: "agent" }, hint: `${pre}agent ${Object.keys(RUNNERS).filter((a) => a !== "script").join("|")}` });
|
|
130
141
|
const dflt = like && like.agent === agent ? { model: like.model ?? "", effort: like.effort ?? "" } : readerDefault(tree, ctx.settings, agent, research);
|
|
@@ -378,7 +389,8 @@ async function readWith(ctx, tree, s, opts, only) {
|
|
|
378
389
|
return finish(ctx, tree, s, []);
|
|
379
390
|
}
|
|
380
391
|
// each reader as asked (s.with: the first, the blind one — its own agent, model, effort), else the research's readers
|
|
381
|
-
|
|
392
|
+
// (an agent's readers, or a reading service's: core/readprovider.ts)
|
|
393
|
+
const teamOf = (r) => readTeam(ctx, tree, shared, "document", "1", opts, undefined, { stem: s.id, ...(r ? { with: r } : {}) });
|
|
382
394
|
const first = only === "blind" ? undefined : teamOf(s.with?.[0]);
|
|
383
395
|
const blind = s.readers > 1 ? (first && sameReader(s.with?.[0], s.with?.[1]) ? first : teamOf(s.with?.[1])) : undefined;
|
|
384
396
|
const team = (first ?? blind);
|
|
@@ -415,12 +427,12 @@ async function readWith(ctx, tree, s, opts, only) {
|
|
|
415
427
|
return;
|
|
416
428
|
const n = next++;
|
|
417
429
|
const by = (job.blind ? blind : first);
|
|
418
|
-
s = { ...s, reports: [...s.reports, { n, group: job.group, blind: job.blind, version: s.version, agent: by.agent, ...(by.model ? { model: by.model } : {}), ...(by.effort ? { effort: by.effort } : {}), began: now() }] };
|
|
430
|
+
s = { ...s, reports: [...s.reports, { n, group: job.group, blind: job.blind, version: s.version, agent: by.agent, ...(by.model ? { model: by.model } : {}), ...(by.effort ? { effort: by.effort } : {}), ...(by.kind ? { kind: by.kind } : {}), began: now() }] };
|
|
419
431
|
saveState(tree.root, s);
|
|
420
432
|
const mine = viewsBy.get(by).filter((v) => s.groups[job.group].includes(v.n));
|
|
421
433
|
const files = mine.flatMap((v) => [v.view, ...(v.parts ?? []).map((x) => x.view)]);
|
|
422
434
|
const head = `# Document ${s.id} · reader ${n}${job.blind ? " (blind)" : ""}\n\nPages: ${mine.map((v) => v.n).join(", ")}\n\n${DOC_NEXT}\n`;
|
|
423
|
-
const r = await by.read(String(n), files, `Document ${s.id}`, (report) => docPrompt({ pages: mine, report, lang: s.lang, note: s.note, blind: job.blind, source: about && aboutFor(about, by.agent, by.model) }), { head, signal: stop.signal });
|
|
435
|
+
const r = await by.read(String(n), files, `Document ${s.id}`, (report) => docPrompt({ pages: mine, report, lang: s.lang, note: s.note, blind: job.blind, source: about && aboutFor(about, by.agent, by.model) }), { head, signal: stop.signal, doc: { pages: mine, source: about } });
|
|
424
436
|
try {
|
|
425
437
|
fs.writeFileSync(r.report, withoutDocNext(fs.readFileSync(r.report, "utf8")).replace(/\n*$/u, "\n"));
|
|
426
438
|
}
|
|
@@ -429,7 +441,7 @@ async function readWith(ctx, tree, s, opts, only) {
|
|
|
429
441
|
}
|
|
430
442
|
s = {
|
|
431
443
|
...s,
|
|
432
|
-
reports: s.reports.map((x) => (x.n === n ? { ...x, outcome: r.outcome, ended: now(), ...(r.costUsd !== undefined ? { usd: r.costUsd } : {}), ...(r.costPartial || r.costUsd === undefined ? { partial: true } : {}), ...(r.resumeAt ? { resets: r.resumeAt } : {}), ...(r.modelRejected ? { rejected: "model" } : {}) } : x)),
|
|
444
|
+
reports: s.reports.map((x) => (x.n === n ? { ...x, outcome: r.outcome, ended: now(), ...(r.costUsd !== undefined ? { usd: r.costUsd } : {}), ...(r.costPartial || (r.costUsd === undefined && r.credits === undefined) ? { partial: true } : {}), ...(r.credits !== undefined ? { credits: r.credits } : {}), ...(r.resumeAt ? { resets: r.resumeAt } : {}), ...(r.modelRejected ? { rejected: "model" } : {}) } : x)),
|
|
433
445
|
};
|
|
434
446
|
saveState(tree.root, s);
|
|
435
447
|
};
|
|
@@ -544,7 +556,7 @@ function finish(ctx, tree, s, ran, spent, back = false) {
|
|
|
544
556
|
persist();
|
|
545
557
|
}
|
|
546
558
|
const session = spent?.runs ? addReaders(tree, ctx.env, ctx.refs, { usd: spent.usd, runs: spent.runs, partial: spent.partial }) : undefined;
|
|
547
|
-
const files = [resultPath(tree.root, s.id), ...s.reports.
|
|
559
|
+
const files = [resultPath(tree.root, s.id), ...s.reports.flatMap((r) => [reportPath(tree.root, s.id, r.n), linesPath(tree.root, s.id, r.n)])].filter((f) => fs.existsSync(f)).map((f) => tree.relative(f));
|
|
548
560
|
tree.commit(`Reading of a document ${s.id}${back ? ", read again and cancelled" : ""}${s.version > 1 ? `, version ${s.version}` : ""}: ${s.state}${result.entries.length ? `, ${counted(result.entries.length, "entry", "entries")}` : ""}${kept ? ` — ${kept.id} read again from its original, ${kept.agree === "same" ? "alike its transcript" : "differs from its transcript"}` : ""}`, [...files, ...(session || kept ? ["data"] : [])]);
|
|
549
561
|
});
|
|
550
562
|
}
|
|
@@ -617,7 +629,7 @@ function whoSaid(r) {
|
|
|
617
629
|
const who = r.readers.who;
|
|
618
630
|
if (!who?.length)
|
|
619
631
|
return undefined;
|
|
620
|
-
const one = (w, i) => `${[w.agent, w.model, w.effort].filter(Boolean).join(" · ")}${i > 0 ? " (blind)" : ""}${w.ran === false ? " — not read to an end" : ""}`;
|
|
632
|
+
const one = (w, i) => `${[w.agent, w.model, w.effort].filter(Boolean).join(" · ")}${w.kind === "service" ? ` (a reading service: the transcript alone${w.credits !== undefined ? `, ${w.credits} credits` : ""})` : ""}${i > 0 ? " (blind)" : ""}${w.ran === false ? " — not read to an end" : ""}`;
|
|
621
633
|
return `who: ${who.map(one).join(" / ")}`;
|
|
622
634
|
}
|
|
623
635
|
/** A source read again from its original: whether the new reading is alike its transcript, where not and the task. */
|