strom-research 1.38.0-beta.4 → 1.38.0-beta.5

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 CHANGED
@@ -7,20 +7,24 @@ Změny každé verze ve zkratce. Úplné poznámky a instalační řádky jsou n
7
7
 
8
8
  ## 1.38.0
9
9
 
10
- *Připravuje se: bety do 1.38.0-beta.4. Oddíl bude úplný s vydáním.*
10
+ *Připravuje se: bety do 1.38.0-beta.5. Oddíl bude úplný s vydáním.*
11
11
 
12
12
  - **Přehlednější menu v terminálu:** každá obrazovka říká, kde je (Strom › Nastavení › Údržba), volby jako
13
13
  `[1] Popisek stav`, přepínač s tím, jak je teď a na co přepne, zpět vždy poslední jako `[0]` (i cesta stahovače v
14
14
  Nastavení → Archivy), výzva říká, co udělá Enter, a příkaz k opsání stojí na vlastním řádku; v terminálu, který to
15
15
  umí, jsou klávesy a příkazy zvýrazněné. Kde má pracovat agent, stojí první fronta úkolů s tím, co je v ní na řadě;
16
16
  jen jedna linie výzkumu je o krok dál.
17
- - **Nastavení výzkumu v historii slovy:** nastavení změněné z aplikace nebo z menu se v posledních změnách ukáže
18
- názvem a hodnotou v jazyce výzkumu („Vypnuto ve výzkumu: Dotaz před tříděním materiálu“), už ne jako klíč
17
+ - **Materiál roztříděný jednou, nastavení výzkumu slovy:** soubor, kterému poslední třídění navrhlo název, druh,
18
+ datum nebo osoby a který je už má podle návrhu, se počítá za hotový a znovu se netřídí; co člověk o návrhu rozhodl
19
+ v aplikaci Strom (přijato, odmítnuto a proč), zůstane u třídění. Nastavení změněné z aplikace nebo z menu se
20
+ v posledních změnách ukáže názvem a hodnotou v jazyce výzkumu („Vypnuto ve výzkumu: Dotaz před tříděním materiálu“), už ne jako klíč
19
21
  (`sort.confirm`).
20
22
  - **Agent se zorientuje s méně pokusy:** `strom place find <jméno>` a `strom place <jméno>` navedou na
21
23
  `strom place list <jméno>`; `strom source list --note <text>` vypíše jedním voláním prameny, jejichž poznámka něco
22
24
  říká (třeba že adresu dal rejstřík); `strom media view` vysvětluje, jak si prohlédnout obrázek registrovaný jen po
23
- částech a jeho výřez.
25
+ částech a jeho výřez; u eBadatelny (SOA Praha) se agent drží limitů archivu, platných pro člověka
26
+ i automatizovaný systém (nejvýš 2 snímky za sekundu, jeden ZIP naráz, 10 ZIPů za 24 hodin), a nikdy nenavrhne cestu,
27
+ jak je obejít.
24
28
  - **Zápisy člověka v terminálu už neodmítá převzaté sezení agenta:** když sezení agenta převzal jiný běh, zápisy
25
29
  člověka v terminálu a v menu (Údržba → Místo na disku, `strom tidy`, `strom history align`…) prošly až po týdnu; teď
26
30
  projdou hned. Agent, jehož sezení bylo, je odmítnut dál.
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.38.0
9
9
 
10
- *In Vorbereitung: die Betas bis 1.38.0-beta.4. Der Abschnitt ist mit dem Release vollständig.*
10
+ *In Vorbereitung: die Betas bis 1.38.0-beta.5. Der Abschnitt ist mit dem Release vollständig.*
11
11
 
12
12
  - **Ein übersichtlicheres Menü im Terminal:** jeder Bildschirm sagt, wo er ist (Strom › Einstellungen › Wartung), die
13
13
  Auswahlen als `[1] Bezeichnung Stand`, ein Schalter mit seinem jetzigen Stand und wohin er umschaltet, zurück
@@ -15,13 +15,17 @@ Die Änderungen jeder Version in Kürze. Die vollständigen Hinweise und die Ins
15
15
  Enter tut, und ein Befehl zum Abschreiben steht in einer eigenen Zeile; in einem Terminal, das es kann, sind Tasten
16
16
  und Befehle hervorgehoben. Wo ein Agent arbeiten soll, steht die Aufgabenliste zuerst mit dem, was darin als
17
17
  Nächstes kommt; nur eine Linie der Forschung liegt einen Schritt weiter.
18
- - **Einstellungen der Forschung im Verlauf in Worten:** eine in der App oder im Menü geänderte Einstellung erscheint
19
- in den letzten Änderungen mit Namen und Wert in der Sprache der Forschung („In der Forschung ausgeschaltet:
18
+ - **Material einmal sortiert, Einstellungen der Forschung in Worten:** eine Datei, der die letzte Sortierung einen
19
+ Titel, eine Art, ein Datum oder Personen vorschlug und die sie schon wie vorgeschlagen hat, gilt als erledigt und
20
+ wird nicht neu sortiert; was der Mensch in der Strom-App über einen Vorschlag entschied (übernommen, abgelehnt und
21
+ warum), bleibt bei der Sortierung. Eine in der App oder im Menü geänderte Einstellung erscheint in den letzten Änderungen mit Namen und Wert in der Sprache der Forschung („In der Forschung ausgeschaltet:
20
22
  Rückfrage vor dem Sortieren des Materials“), nicht mehr als Schlüssel (`sort.confirm`).
21
23
  - **Der Agent findet sich mit weniger Versuchen zurecht:** `strom place find <Name>` und `strom place <Name>` führen
22
24
  zu `strom place list <Name>`; `strom source list --note <Text>` listet mit einem Aufruf die Quellen, deren Notiz
23
25
  etwas sagt (etwa dass ein Register die Adresse gab); `strom media view` erklärt, wie ein nur in Teilen registriertes
24
- Bild und ein Ausschnitt davon anzusehen sind.
26
+ Bild und ein Ausschnitt davon anzusehen sind; bei der eBadatelna (SOA Praha) hält sich der Agent an die Grenzen
27
+ des Archivs, die für Menschen und automatisierte Systeme gleich gelten (höchstens 2 Bilder pro Sekunde, ein ZIP auf
28
+ einmal, 10 ZIPs in 24 Stunden), und schlägt nie einen Weg an ihnen vorbei vor.
25
29
  - **Einträge eines Menschen im Terminal nicht mehr wegen einer übernommenen Agenten-Sitzung abgelehnt:** wurde die
26
30
  Sitzung eines Agenten von einem anderen Lauf übernommen, gingen die eigenen Einträge im Terminal und im Menü
27
31
  (Wartung → Speicherplatz, `strom tidy`, `strom history align`…) erst nach einer Woche durch; jetzt sofort. Der
package/CHANGELOG.md CHANGED
@@ -7,20 +7,24 @@ The changes of each version in short. The full notes and the install lines are o
7
7
 
8
8
  ## 1.38.0
9
9
 
10
- *In preparation: the betas up to 1.38.0-beta.4. The section is complete with the release.*
10
+ *In preparation: the betas up to 1.38.0-beta.5. The section is complete with the release.*
11
11
 
12
12
  - **A clearer menu in the terminal:** every screen says where it is (Strom › Settings › Maintenance), its options as
13
13
  `[1] Label state`, a switch with how it is now and what it switches to, back last as `[0]` (also the way a
14
14
  downloader takes in Settings → Archives), the prompt says what Enter does, and a command to type stands on a line of
15
15
  its own; on a terminal that can, keys and commands are highlighted. Where an agent is to work, the task queue stands
16
16
  first with what is next in it; one line of the research alone is a step further.
17
- - **A research's settings said in words in its history:** a setting changed from the app or the menu shows in the
18
- recent changes by its name and value in the research's language ("Turned off in the research: Question before the
17
+ - **Material sorted once, a research's settings in words:** a file whose last sorting proposed a title, kind, date or
18
+ people and which already has them as proposed counts as done and is not sorted again; what the person decided on a
19
+ proposal in the Strom app (taken over, refused, and why) is kept with the sorting. A setting changed from the app or
20
+ the menu shows in the recent changes by its name and value in the research's language ("Turned off in the research: Question before the
19
21
  material is sorted"), no longer as its key (`sort.confirm`).
20
22
  - **The agent finds its way with fewer tries:** `strom place find <name>` and `strom place <name>` point to
21
23
  `strom place list <name>`; `strom source list --note <text>` lists in one call the sources whose note says something
22
24
  (that a register gave the address, for one); `strom media view` says how to look at an image registered only in
23
- parts, and at a crop of it.
25
+ parts, and at a crop of it; at eBadatelna (SOA Praha) the agent keeps to the archive's limits for a person and an
26
+ automated system alike (at most 2 images a second, one ZIP at a time, 10 ZIPs in 24 hours) and never suggests a way
27
+ past them.
24
28
  - **A person's writes in the terminal no longer refused for an agent's session:** where an agent's session was taken
25
29
  over by another run, the person's own writes in the terminal and the menu (Maintenance → Disk space, `strom tidy`,
26
30
  `strom history align`…) passed only a week later; they pass at once. The agent whose session it was is still
package/CHANGELOG.pl.md CHANGED
@@ -7,20 +7,24 @@ Zmiany każdej wersji w skrócie. Pełne informacje o wydaniach i polecenia inst
7
7
 
8
8
  ## 1.38.0
9
9
 
10
- *W przygotowaniu: bety do 1.38.0-beta.4. Sekcja będzie kompletna z wydaniem.*
10
+ *W przygotowaniu: bety do 1.38.0-beta.5. Sekcja będzie kompletna z wydaniem.*
11
11
 
12
12
  - **Bardziej przejrzyste menu w terminalu:** każdy ekran mówi, gdzie jest (Strom › Ustawienia › Konserwacja), opcje
13
13
  jako `[1] Etykieta stan`, przełącznik z tym, jak jest teraz i na co przełącza, powrót zawsze na końcu jako `[0]`
14
14
  (także sposób pobierania w Ustawienia → Archiwa), wiersz wyboru mówi, co robi Enter, a polecenie do przepisania stoi
15
15
  w osobnym wierszu; w terminalu, który to potrafi, klawisze i polecenia są wyróżnione. Tam, gdzie ma pracować agent,
16
16
  pierwsza stoi kolejka zadań z tym, co jest w niej następne; tylko jedna linia badania jest krok dalej.
17
- - **Ustawienia badania w historii słowami:** ustawienie zmienione w aplikacji lub w menu pokazuje się w ostatnich
18
- zmianach nazwą i wartością w języku badania („Wyłączono w badaniu: Pytanie przed sortowaniem materiałów”), już nie
17
+ - **Materiał posortowany raz, ustawienia badania słowami:** plik, któremu ostatnie sortowanie zaproponowało tytuł,
18
+ rodzaj, datę lub osoby i który ma je już zgodnie z propozycją, liczy się jako gotowy i nie jest sortowany ponownie;
19
+ to, co człowiek zdecydował o propozycji w aplikacji Strom (przyjęto, odrzucono i dlaczego), zostaje przy
20
+ sortowaniu. Ustawienie zmienione w aplikacji lub w menu pokazuje się w ostatnich zmianach nazwą i wartością w języku badania („Wyłączono w badaniu: Pytanie przed sortowaniem materiałów”), już nie
19
21
  jako klucz (`sort.confirm`).
20
22
  - **Agent odnajduje się przy mniejszej liczbie prób:** `strom place find <nazwa>` i `strom place <nazwa>` kierują do
21
23
  `strom place list <nazwa>`; `strom source list --note <tekst>` wypisuje jednym wywołaniem źródła, których notatka
22
24
  coś mówi (na przykład że adres dał rejestr); `strom media view` wyjaśnia, jak obejrzeć obraz zarejestrowany tylko w
23
- częściach i jego wycinek.
25
+ częściach i jego wycinek; przy eBadatelnie (SOA Praha) agent trzyma się limitów archiwum, jednakowych dla człowieka
26
+ i systemu automatycznego (najwyżej 2 skany na sekundę, jeden ZIP naraz, 10 ZIP-ów w ciągu 24 godzin), i nigdy nie
27
+ proponuje sposobu ich obejścia.
24
28
  - **Zapisy człowieka w terminalu nie są już odrzucane z powodu przejętej sesji agenta:** gdy sesję agenta przejął inny
25
29
  przebieg, zapisy człowieka w terminalu i w menu (Konserwacja → Miejsce na dysku, `strom tidy`,
26
30
  `strom history align`…) przechodziły dopiero po tygodniu; teraz od razu. Agent, do którego sesja należała, jest
@@ -52,7 +52,7 @@
52
52
  "quoteFrom": "reply",
53
53
  "replied": "2026-11-12",
54
54
  "robots": "User-agent: rodokmen · Disallow: / · User-agent: ClaudeBot · Disallow: / · User-agent: GPTBot · Disallow: / · User-agent: Amazonbot · Disallow: / · User-agent: * · Disallow: /d/ · Disallow: /a/ (since 2 November 2026; https://ebadatelna.soapraha.cz/robots.txt)",
55
- "checked": "2026-11-12",
55
+ "checked": "2026-11-27",
56
56
  "browserOnly": true,
57
57
  "termsPage": "https://soapraha.gov.cz/castokladenedotazy/",
58
58
  "termsPageSays": "Prohlížení digitálních studijních kopií je umožněno všem bez nutnosti registrace. Registrovaní uživatelé však mají navíc možnost stahování celých archiválií v ZIP balíčcích",
@@ -60,7 +60,7 @@
60
60
  "/d/",
61
61
  "/a/"
62
62
  ],
63
- "scope": "by hand only: its robots.txt names AI agents (ClaudeBot, GPTBot) and keeps every robot off its digitised records (/d/, /a/) — not through the agent's browser either; the person opens and saves the image, the agent reads the saved file (the archive's reply of 2026-11-12: no reason to restrict an AI agent's use of an image the person saved by hand; its technical measures are not final); the permanent link of an image is the address in the browser's address bar while it is shown — cite that",
63
+ "scope": "by hand only: its robots.txt names AI agents (ClaudeBot, GPTBot) and keeps every robot off its digitised records (/d/, /a/) — not through the agent's browser either; the person opens and saves the image, the agent reads the saved file (the archive's reply of 2026-11-12: no reason to restrict an AI agent's use of an image the person saved by hand); its limits from one IP address, for a person and an automated system alike (the archive's reply of 2026-11-27; the measures may still change): at most 2 images a second, a ZIP at most one at a time and at most 10 ZIPs in 24 hours — never suggest a way past them (more ZIPs in a day, several at once, images faster); the permanent link of an image is the address in the browser's address bar while it is shown — cite that",
64
64
  "wholeBook": {
65
65
  "how": "offered",
66
66
  "says": "Prohlížení digitálních studijních kopií je umožněno všem bez nutnosti registrace. Registrovaní uživatelé však mají navíc možnost stahování celých archiválií v ZIP balíčcích",
@@ -150,9 +150,9 @@ function writeAllowed(what, sub, act, rest, fifth, n, body) {
150
150
  // closed, and sorted by the agent at once when asked (K3.15: sort.confirm the app's dialog, as on the computer)
151
151
  return only(n === 3 && act === "done", "batch");
152
152
  case "material":
153
- // a sort asked, one cancelled (K3.15)
153
+ // a sort asked, one cancelled (K3.15); what the person decided of its proposals (spec 147 K2)
154
154
  if (sub === "sort")
155
- return only(n === 2 || (n === 4 && rest === "cancel"), "material.sort");
155
+ return only(n === 2 || (n === 4 && (rest === "cancel" || rest === "decided")), "material.sort");
156
156
  return only(n === 2 && (sub === "assign" || sub === "hide" || sub === "edit" || sub === "delete"), "material");
157
157
  case "read":
158
158
  // a record read at once, read again, a reading cancelled (K3.15)
@@ -24,7 +24,7 @@ import { stromLauncher } from "./self.js";
24
24
  import { StromError } from "./errors.js";
25
25
  import { alive } from "./document.js";
26
26
  import { appReadLimits, limitReached, noteAsked, readAccepts } from "./live-read.js";
27
- import { APP_SORT_FROM, appSort, cancelSort, checkSortAsk, counted, listSorts, loadSort, queueRun, queueSort, refuseUnsigned, RUN_ID, runForApp, runParts, saveSort, signCounted, SORT_FINAL, SORT_MOST_FILES, SORT_QUEUE_MAX, SORT_RUN_MOST_FILES, sortCancelPath, sortCost, sortForApp, sortOrder, unstartableAppSort, unstartableSaid, } from "./sort.js";
27
+ import { APP_SORT_FROM, appSort, cancelSort, checkSortAsk, counted, decideSort, listSorts, loadSort, queueRun, queueSort, refuseUnsigned, RUN_ID, runForApp, runParts, saveSort, shownSort, signCounted, SORT_DECIDED, SORT_FINAL, SORT_MOST_FILES, SORT_QUEUE_MAX, SORT_RUN_MOST_FILES, sortCancelPath, sortCost, sortForApp, sortOrder, unstartableAppSort, unstartableSaid, } from "./sort.js";
28
28
  /** A body of the most files of a run (SORT_RUN_MOST_FILES IDs) with the longest text of the person's, and room to spare. */
29
29
  const BODY_MAX = 64 * 1024;
30
30
  /** A sort the bridge started: when its strom has not said it at work by then, started again (at most START_TRIES). */
@@ -76,6 +76,8 @@ export class AppSorts {
76
76
  this.show(res, act);
77
77
  else if (req.method === "POST" && act && rest === "cancel")
78
78
  this.cancel(req, res, origin, act);
79
+ else if (req.method === "POST" && act && rest === "decided")
80
+ this.decided(req, res, origin, act);
79
81
  else
80
82
  return false;
81
83
  return true;
@@ -210,6 +212,40 @@ export class AppSorts {
210
212
  this.dispatch();
211
213
  }));
212
214
  }
215
+ /**
216
+ * POST /material/sort/<id>/decided {ids, how: accepted|refused|open} (spec 147 K2, feature material.decided): what the
217
+ * person decided of the proposals of files of a sort done — kept in the sort's record, nothing written to the research;
218
+ * a run's id: each file in its part. → {id, decided: [{id, how, at}]} (of a run: its parts' decisions).
219
+ */
220
+ decided(req, res, origin, id) {
221
+ if (!origin) {
222
+ req.resume();
223
+ return this.json(res, 403, refusal("only the Strom app may say what was decided of a sort", "app.only"));
224
+ }
225
+ this.body(req, (body) => this.b.safely(req, res, () => {
226
+ const key = this.key();
227
+ const sorts = RUN_ID.test(id) ? runParts(this.b.root, key, id) : [loadSort(this.b.root, id)].filter((s) => !!s && appSort(key, s));
228
+ if (!sorts.length)
229
+ return this.json(res, 404, this.none(id));
230
+ const ids = Array.isArray(body?.ids) ? [...new Set(body.ids)] : undefined;
231
+ const how = body?.how;
232
+ if (!ids?.length || ids.length > SORT_RUN_MOST_FILES || !ids.every((x) => typeof x === "string") || !(how === "open" || SORT_DECIDED.includes(how)))
233
+ return this.json(res, 400, refusal(`the body: {ids: [I…] (files of the sort), how: ${SORT_DECIDED.join("|")}|open}`, "material.body"));
234
+ const notDone = sorts.find((s) => shownSort(s).state !== "done" && ids.some((x) => s.files.includes(x)));
235
+ if (notDone)
236
+ return this.json(res, 409, refusal(`the sort ${notDone.id} is ${shownSort(notDone).state}, not done: nothing of it to decide yet`, "sort.state", { state: shownSort(notDone).state }));
237
+ const stray = ids.find((x) => !sorts.some((s) => s.files.includes(x)));
238
+ if (stray)
239
+ return this.json(res, 400, refusal(`${stray.slice(0, 40)} is no file of the sort ${id.slice(0, 40)}`, "material.body", { id: stray.slice(0, 40) }));
240
+ const now = new Date();
241
+ const out = sorts.map((s) => {
242
+ const mine = ids.filter((x) => s.files.includes(x));
243
+ return mine.length ? decideSort(this.b.root, s, mine, how, now) : s;
244
+ });
245
+ this.b.note(`${id}: ${ids.length} file${ids.length === 1 ? "" : "s"} of its proposals ${how === "open" ? "open again" : how} in the Strom app`);
246
+ this.json(res, 200, { id, decided: out.flatMap((s) => s.decided ?? []) });
247
+ }));
248
+ }
213
249
  /** POST /material/sort/<id>/cancel: a queued one cancelled at once, one at work stopped by its strom. */
214
250
  cancel(req, res, origin, id) {
215
251
  req.resume();
package/dist/core/live.js CHANGED
@@ -223,8 +223,12 @@
223
223
  // `of` (spec 102 K1.14, feature material.sourceOf): the sources the file is the source of
224
224
  // (made or sorted from it, cut out of or with an image of the same content), the people
225
225
  // citing them named in `people` too. `left` (feature material.left): {at, sort, why:
226
- // nothing-said|nothing-new|dropped, said?} — the last sort done that took it proposed nothing
227
- // of it (from the sorts kept here; a later proposal takes it off). `sameAs` (feature
226
+ // nothing-said|nothing-new|dropped|accepted|refused, said?} — the last sort done that took it
227
+ // proposed nothing of it, or the file took over all it proposed (accepted: the title, kind and
228
+ // date proposed, the people proposed — none too; spec 147 K1), or the person decided of its
229
+ // proposal (accepted|refused, POST /material/sort/<id>/decided; spec 147 K2) — accepted and
230
+ // refused only with feature material.accepted (from the sorts kept here, counted as read; a
231
+ // later proposal takes it off). `sameAs` (feature
228
232
  // material.sameAs): the oldest other file of the same content (SHA-256). ?trees=1 (feature
229
233
  // material.trees, spec 117 K2.1): the family trees' files too, kind "tree" — an input of a family
230
234
  // tree (GEDCOM, the app's JSON) with its bytes, never one a sync sent nor an old import without
@@ -289,6 +293,12 @@
289
293
  // files, filesDone, parts: [{id, part, state, files, filesDone?}], waiting?: {why: read.app |
290
294
  // limit | …, retry?}} (ended: cancelled when a part was cancelled, else done when a part is done, else failed);
291
295
  // POST …/<run-…>/cancel: its parts not done stopped, {id, state, cancelled}
296
+ // POST <token>/material/sort/<id|run-…>/decided {ids: [I…], how: accepted|refused|open} (spec 147
297
+ // K2, feature material.decided): what the person decided of the proposals of a sort done, kept
298
+ // in its record (nothing written to the research; open takes it back) → {id, decided: [{id, how,
299
+ // at}]}; GET of a sort done says them too (decided). Such a file is left (why accepted|refused)
300
+ // until a later sort proposes something of it. Refused 404 sort.none, 409 sort.state {state}
301
+ // (not done), 400 material.body (no ids, a file not of the sort, another how), 403 app.only.
292
302
  // POST <token>/source/retract a source deleted by the person (spec 117 K1.1–K1.7, R4, J7; feature source.retract),
293
303
  // in the app's dialog, in two steps: {sources: [S…] (1–50), dryRun: true} → {sources, dryRun:
294
304
  // true, impacts: [{id, title, input?, counts: {persons: 0, names, events, families, stories},
@@ -2044,12 +2054,12 @@ export function tagMatches(req, tag) {
2044
2054
  const MEDIA_REF_UNKNOWN = "sync.media-ref-unknown";
2045
2055
  /** How many hashes POST /media/known takes at once. */
2046
2056
  export const MEDIA_KNOWN_MAX = 5000;
2047
- export const BRIDGE_FEATURES = ["sync.again", "sync.undoneSince", "sync.takenBack", "sync.conflictEdit", "sync.since", "sync.ids", "family.noCouple", "family.alone", "adopt.transfer", "adopt.empty", "material.list", "person.titles", "media.codes", "hypothesis.links", "status.recent", "spend.readers", "hypothesis.intree", "archive.permission", "task.check", "waiting.groups", "waiting.sent", "waiting.note", "batch.kept", "live.end", "whats.new", "terminal.choice", "person.marriedSurname", "phone", "read.now", "read.sync", "excerpt.get", "log.sources", "material.assign", "material.thumb", "seal.foreign", "tree.state", "disk.full", "tree.notDownloaded", "sync.removed", "tree.kind", "experiments", "experiments.off", "experiments.link", "experiments.split", "history.events", "history.hide", "experiments.pace", "history.first", "history.regions", "history.hide.all", "history.skip", "history.map", "history.delete", "history.delete.restore", "stories.history", "history.place", "surnames.suggest", "surnames.read", "lineage.read", "duplicates.judge", "quality.dismiss", "quality.read", "person.primary", "fixes.list", "fixes.towns", "history.back", "places.identify", "places.answer", "places.undo", "tasks.offLine", "status.busy", "history.kinds", "history.align", "places.nameKinds", "directions.edit", "directions.order", "directions.found", "directions.people", "directions.places", "offLine.branches", "queue.own", "story.sources", "queue.page", "status.parts", "waiting.answer", "browser.state", "working.place", "working.family", "working.helps", "hypotheses.decide", "sources.confirm", "read.sourceTask", "read.sourceTask.unsure", "read.choose", "read.choices.now", "read.source", "read.sourceEntry", "read.blindText", "read.kinds", "read.variantKind", "read.readerState", "live.idle", "live.stop", "live.start", "sources.proposal", "sources.proposal.undo", "origin", "origin.ids", "verify", "verify.bulk", "facts.confirm", "verify.stop", "ged.stale", "facts.confirm.value", "ged.etag", "ged.imagesByHash", "hypothesis.decide.link", "hypotheses.accept.link", "sources.fields", "sources.split", "queue.search", "queue.next", "work.link", "run.tasks", "queue.kind", "work.tasks", "verify.tryFirst", "event.share", "citations.order", "sync.notWritten.codes", "citations.main", "citations.remove", "books", "media.app", "material.links", "material.edit", "material.uses", "material.sort", "tasks.audit", "handoffs", "material.sourceOf", "material.left", "material.sameAs", "material.sortRun", "material.delete", "inbox.aside", "source.retract", "material.trees", "census", "house", "house.material", "house.confirm", "house.import", "house.auto", "house.request", "house.chat", "house.look", "name-status", "task.holds", "archive.holds", "media.queued", "media.known", "intake.auto", "run.lines", "run.agents", "run.stop", "run.limit", "directions.move", "sync.mediaRef", "person.contact", "media.list", "media.list.source", "waiting.gain", "sort.confirm", "working.saving", "waiting.retry", "sort.confirm.app", "run.confirm", "finds", "finds.person", "glance", "people.search"];
2057
+ export const BRIDGE_FEATURES = ["sync.again", "sync.undoneSince", "sync.takenBack", "sync.conflictEdit", "sync.since", "sync.ids", "family.noCouple", "family.alone", "adopt.transfer", "adopt.empty", "material.list", "person.titles", "media.codes", "hypothesis.links", "status.recent", "spend.readers", "hypothesis.intree", "archive.permission", "task.check", "waiting.groups", "waiting.sent", "waiting.note", "batch.kept", "live.end", "whats.new", "terminal.choice", "person.marriedSurname", "phone", "read.now", "read.sync", "excerpt.get", "log.sources", "material.assign", "material.thumb", "seal.foreign", "tree.state", "disk.full", "tree.notDownloaded", "sync.removed", "tree.kind", "experiments", "experiments.off", "experiments.link", "experiments.split", "history.events", "history.hide", "experiments.pace", "history.first", "history.regions", "history.hide.all", "history.skip", "history.map", "history.delete", "history.delete.restore", "stories.history", "history.place", "surnames.suggest", "surnames.read", "lineage.read", "duplicates.judge", "quality.dismiss", "quality.read", "person.primary", "fixes.list", "fixes.towns", "history.back", "places.identify", "places.answer", "places.undo", "tasks.offLine", "status.busy", "history.kinds", "history.align", "places.nameKinds", "directions.edit", "directions.order", "directions.found", "directions.people", "directions.places", "offLine.branches", "queue.own", "story.sources", "queue.page", "status.parts", "waiting.answer", "browser.state", "working.place", "working.family", "working.helps", "hypotheses.decide", "sources.confirm", "read.sourceTask", "read.sourceTask.unsure", "read.choose", "read.choices.now", "read.source", "read.sourceEntry", "read.blindText", "read.kinds", "read.variantKind", "read.readerState", "live.idle", "live.stop", "live.start", "sources.proposal", "sources.proposal.undo", "origin", "origin.ids", "verify", "verify.bulk", "facts.confirm", "verify.stop", "ged.stale", "facts.confirm.value", "ged.etag", "ged.imagesByHash", "hypothesis.decide.link", "hypotheses.accept.link", "sources.fields", "sources.split", "queue.search", "queue.next", "work.link", "run.tasks", "queue.kind", "work.tasks", "verify.tryFirst", "event.share", "citations.order", "sync.notWritten.codes", "citations.main", "citations.remove", "books", "media.app", "material.links", "material.edit", "material.uses", "material.sort", "tasks.audit", "handoffs", "material.sourceOf", "material.left", "material.sameAs", "material.accepted", "material.decided", "material.sortRun", "material.delete", "inbox.aside", "source.retract", "material.trees", "census", "house", "house.material", "house.confirm", "house.import", "house.auto", "house.request", "house.chat", "house.look", "name-status", "task.holds", "archive.holds", "media.queued", "media.known", "intake.auto", "run.lines", "run.agents", "run.stop", "run.limit", "directions.move", "sync.mediaRef", "person.contact", "media.list", "media.list.source", "waiting.gain", "sort.confirm", "working.saving", "waiting.retry", "sort.confirm.app", "run.confirm", "finds", "finds.person", "glance", "people.search"];
2048
2058
  /**
2049
2059
  * What only a research with its agent here does (accepts.read: none in an archive, nor where it waits for its agent);
2050
2060
  * finds: what an agent found, which an archive never says (GET finds answers none there).
2051
2061
  */
2052
- const AGENT_FEATURES = new Set(["material.sort", "run.lines", "run.agents", "run.stop", "run.limit", "directions.move", "sort.confirm", "sort.confirm.app", "run.confirm", "finds", "finds.person", "house.import", "house.request", "house.chat"]);
2062
+ const AGENT_FEATURES = new Set(["material.sort", "material.decided", "run.lines", "run.agents", "run.stop", "run.limit", "directions.move", "sort.confirm", "sort.confirm.app", "run.confirm", "finds", "finds.person", "house.import", "house.request", "house.chat"]);
2053
2063
  const withoutAgent = (features) => features.filter((f) => !AGENT_FEATURES.has(f));
2054
2064
  /**
2055
2065
  * The sample research (strom demo, spec 143 K2.2): looked through as a research, but nothing that starts or offers an
@@ -25,8 +25,12 @@ import { storedBytes } from "./appmedia.js";
25
25
  import { listSorts } from "./sort.js";
26
26
  /** How many of the people citing a source `of` names (all of them counted). */
27
27
  export const CITED_SHOWN = 5;
28
- /** Why a file the agent sorted is left (`left`): its reader said nothing of it, all it proposed is there or was left out. */
29
- export const LEFT_WHY = ["nothing-said", "nothing-new", "dropped"];
28
+ /**
29
+ * Why a file the agent sorted is left (`left`): its reader said nothing of it, all it proposed is there or was left out
30
+ * (SORT_UNPROPOSED); the file took over its proposal, or the person took it or turned it down in the Strom app (spec 147,
31
+ * feature material.accepted).
32
+ */
33
+ export const LEFT_WHY = ["nothing-said", "nothing-new", "dropped", "accepted", "refused"];
30
34
  /** The kinds of material the app shows (`kind`): what sorting found, a record being a source. */
31
35
  export { MATERIAL_KINDS };
32
36
  const KIND_OF_SORT = { source: "record", document: "document", photo: "photo" };
@@ -299,7 +303,7 @@ export function material(tree, shared, only = {}) {
299
303
  ...(i.source ? { source: i.source } : {}),
300
304
  ...(hidden ? { hidden } : {}),
301
305
  uses: { excerpts: used.excerpts.length, sources: used.sources.map((x) => x.id), tasks: used.tasks.length, of: used.of },
302
- ...((left ??= leftBySorts(tree.root)).has(i.id) ? { left: left.get(i.id) } : {}),
306
+ ...((left ??= leftBySorts(tree)).has(i.id) ? { left: left.get(i.id) } : {}),
303
307
  ...(firstOf.get(i.sha).id !== i.id ? { sameAs: firstOf.get(i.sha).id } : {}),
304
308
  here: !!file && fs.existsSync(file),
305
309
  });
@@ -325,22 +329,54 @@ export function material(tree, shared, only = {}) {
325
329
  }
326
330
  /**
327
331
  * The files the agent left (MaterialFile.left), by the sorts kept here, oldest first: each file by the last sort done
328
- * that took it — left when it proposed nothing of it for a reason of LEFT_WHY; a reader that ended without a word of it,
329
- * or did not end well, leaves it to be sent again.
332
+ * that took it — left when the person decided of its proposal in the Strom app (accepted, refused: spec 147 K2), when it
333
+ * proposed nothing of it for a reason of LEFT_WHY, when the file took over all it proposed (accepted, spec 147 K1); a
334
+ * reader that ended without a word of it, or did not end well, or a proposal not taken (yet) leaves it to be sent again.
330
335
  */
331
- export function leftBySorts(root, sorts = listSorts(root)) {
336
+ export function leftBySorts(tree, sorts = listSorts(tree.root)) {
332
337
  const out = new Map();
333
338
  for (const s of sorts.filter((x) => x.state === "done").sort((a, b) => a.since.localeCompare(b.since) || a.id.localeCompare(b.id))) {
334
339
  for (const id of s.files) {
340
+ const d = s.decided?.find((x) => x.id === id);
335
341
  const u = s.unproposed?.find((x) => x.id === id);
336
- if (u && LEFT_WHY.includes(u.why))
342
+ const p = s.proposals?.find((x) => x.id === id);
343
+ if (d && LEFT_WHY.includes(d.how))
344
+ out.set(id, { at: d.at, sort: s.id, why: d.how });
345
+ else if (u && LEFT_WHY.includes(u.why))
337
346
  out.set(id, { at: s.since, sort: s.id, why: u.why, ...(u.said ? { said: u.said } : {}) });
347
+ else if (p && takenOver(tree, p))
348
+ out.set(id, { at: s.since, sort: s.id, why: "accepted" });
338
349
  else
339
350
  out.delete(id);
340
351
  }
341
352
  }
342
353
  return out;
343
354
  }
355
+ /**
356
+ * Whether a file took over what a sort proposed of it (spec 147 K1), as it is now: each of its title, kind and date the
357
+ * same as proposed, each person proposed among its people — a proposal of no person too; one of a file not of the family:
358
+ * the file hidden. A proposal of none of these (only a couple, an event, a source, a back) is never taken over by itself.
359
+ */
360
+ function takenOver(tree, p) {
361
+ const i = tree.get(p.id);
362
+ if (!i || i.type !== "input" || i.retracted)
363
+ return false;
364
+ if (p.unrelated)
365
+ return i.state === "skipped";
366
+ const persons = (p.links ?? []).filter((l) => l.type === "person").map((l) => live(tree, l.ref));
367
+ if (p.title === undefined && p.kind === undefined && p.date === undefined && !persons.length)
368
+ return false;
369
+ if (p.title !== undefined && i.title !== p.title)
370
+ return false;
371
+ if (p.kind !== undefined && (i.materialKind ?? (i.sorted ? KIND_OF_SORT[i.sorted.as] : undefined)) !== p.kind)
372
+ return false;
373
+ if (p.date !== undefined && i.date !== p.date)
374
+ return false;
375
+ if (!persons.length)
376
+ return true;
377
+ const has = new Set(materialPersons(tree, i));
378
+ return persons.every((x) => has.has(x));
379
+ }
344
380
  /** The names of people as the research knows them, shortly with their years: for the app, which may not have them yet. */
345
381
  export function peopleOf(tree, ids) {
346
382
  const out = {};
package/dist/core/sort.js CHANGED
@@ -69,6 +69,12 @@ export const SORT_UNSIGNED = "unsigned";
69
69
  * a word of it (left-out); its reader did not end well (reader-failed, with its outcome).
70
70
  */
71
71
  export const SORT_UNPROPOSED = ["nothing-said", "nothing-new", "dropped", "left-out", "reader-failed"];
72
+ /**
73
+ * What the person decided of a file's proposal in the Strom app (spec 147 K2, POST /material/sort/<id>/decided): took it
74
+ * (accepted, as it was or changed) or turned it down (refused) — the file is not sent to be sorted again unless the person
75
+ * chooses it. `open` takes the decision back.
76
+ */
77
+ export const SORT_DECIDED = ["accepted", "refused"];
72
78
  export function newSortId(now = new Date()) {
73
79
  return `sort-${now.toISOString().replace(/[-:T]/gu, "").slice(0, 14)}-${crypto.randomBytes(2).toString("hex")}`;
74
80
  }
@@ -873,6 +879,24 @@ export function unproposedOf(files, raw, kept, readers) {
873
879
  }
874
880
  return out;
875
881
  }
882
+ /**
883
+ * The person's decisions of files of a sort done (spec 147 K2): each file one of the sort's, its last decision kept, `open`
884
+ * taking one back. Kept in the sort's record beside the research (written whole); the sort as it is now.
885
+ */
886
+ export function decideSort(root, s, ids, how, now = new Date()) {
887
+ const take = new Set(ids);
888
+ const decided = (s.decided ?? []).filter((d) => !take.has(d.id));
889
+ if (how !== "open")
890
+ for (const id of take)
891
+ decided.push({ id, how, at: now.toISOString() });
892
+ const out = { ...s };
893
+ if (decided.length)
894
+ out.decided = decided;
895
+ else
896
+ delete out.decided;
897
+ saveSort(root, out);
898
+ return out;
899
+ }
876
900
  /** A sort as the Strom app is given it (GET /material/sort/<id>): its proposals checked again against the research now. */
877
901
  export function sortForApp(tree, s) {
878
902
  const now = shownSort(s);
@@ -882,7 +906,7 @@ export function sortForApp(tree, s) {
882
906
  files: now.files,
883
907
  at: now.at,
884
908
  ...runOf(now),
885
- ...(now.state === "done" ? { proposals: keptProposals(tree, now.files, now.proposals ?? []).proposals, ...(now.unproposed?.length ? { unproposed: now.unproposed } : {}) } : {}),
909
+ ...(now.state === "done" ? { proposals: keptProposals(tree, now.files, now.proposals ?? []).proposals, ...(now.unproposed?.length ? { unproposed: now.unproposed } : {}), ...(now.decided?.length ? { decided: now.decided } : {}) } : {}),
886
910
  ...(now.state === "working" ? { filesDone: now.filesDone ?? 0 } : {}),
887
911
  ...(now.reason ? { reason: now.reason } : {}),
888
912
  };
package/dist/core/tree.js CHANGED
@@ -32,7 +32,7 @@ export const TREE_FILE = "strom.json";
32
32
  export const SEAL_FOREIGN = "seal.foreign";
33
33
  // between releases the candidate being made (a bridge run from the sources says what it is: the Strom app goes by it);
34
34
  // at a release the release's own (package.json)
35
- export const VERSION = "1.38.0-beta.4";
35
+ export const VERSION = "1.38.0-beta.5";
36
36
  /** What a new research is settled with from the start: nothing an older strom counted otherwise to set right in it. */
37
37
  export const NEW_TREE_SETTLED = ["readers-1", "proven-originals-1", "origins-1", "verify-originals-1", "origins-tree-1", "name-status-1"];
38
38
  const GITIGNORE = `# Strom Research — local state and large files are not versioned
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strom-research",
3
- "version": "1.38.0-beta.4",
3
+ "version": "1.38.0-beta.5",
4
4
  "stromDoc": "eafa9851e80b366627b5c3f238d82f882dcd070d",
5
5
  "description": "Genealogical research toolkit for AI coding agents",
6
6
  "type": "module",