strom-research 1.31.0-beta.5 → 1.31.0-beta.7

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,7 +7,7 @@ Změny každé verze ve zkratce. Úplné poznámky a instalační řádky jsou n
7
7
 
8
8
  ## 1.31.0
9
9
 
10
- *Připravuje se: bety do 1.31.0-beta.5. Oddíl bude úplný s vydáním.*
10
+ *Připravuje se: bety do 1.31.0-beta.7. Oddíl bude úplný s vydáním.*
11
11
 
12
12
  - **`strom repair` už neodstraní práci, kterou poškozená historie skrývá.** Když se dá historie gitu výzkumu číst, ale
13
13
  je starší než jeho záznamy (cloudový disk vrátil starší `.git`, vedle něj kopie iCloudu jako `index 2`), `strom
@@ -74,7 +74,7 @@ Změny každé verze ve zkratce. Úplné poznámky a instalační řádky jsou n
74
74
  nich dohledá. PAGE nikdy neřekne dvě čísla snímku ani folia: jmenuje-li starší umístění jiné číslo než pole, platí v
75
75
  ní pole (umístění samo zůstane), a `strom source edit` i `show` navrhnou zbytek umístění. Starší prameny se do polí
76
76
  rozdělí najednou příkazem `strom source split`: náhled, čím by se každý stal (umístění, v němž se nic nerozpozná,
77
- zůstane, jak je), rozdělení zapíše uživatel s `--apply` jedním krokem a jedním se i vrátí (`--undo`); agent ho jen
77
+ zůstane, jak je, až tři taková ukáže, jak stojí), rozdělení zapíše uživatel s `--apply` jedním krokem a jedním se i vrátí (`--undo`); agent ho jen
78
78
  nabídne. Rozdělit se dá i z aplikace Strom, která to nabízí (funkce mostu `sources.split`): náhled řekne, kolik
79
79
  pramenů, rozdělení se zapíše na kliknutí uživatele jedním krokem podle toho náhledu a vrátí se celé. Folio, snímek
80
80
  nebo signaturu, které uživatel smaže v aplikaci Strom, jež tato pole uchovává, smaže i výzkum (vrátí se se
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.31.0
9
9
 
10
- *In Vorbereitung: die Betas bis 1.31.0-beta.5. Der Abschnitt ist mit dem Release vollständig.*
10
+ *In Vorbereitung: die Betas bis 1.31.0-beta.7. Der Abschnitt ist mit dem Release vollständig.*
11
11
 
12
12
  - **`strom repair` entfernt keine Arbeit mehr, die eine beschädigte Historie verbirgt.** Ist die Git-Historie einer
13
13
  Forschung lesbar, aber älter als ihre Datensätze (ein Cloud-Laufwerk hat ein älteres `.git` zurückgelegt, daneben
@@ -86,7 +86,7 @@ Die Änderungen jeder Version in Kürze. Die vollständigen Hinweise und die Ins
86
86
  oder Folionummern: nennt eine ältere Fundstelle eine andere als das Feld, gilt darin das Feld (die Fundstelle selbst
87
87
  bleibt), und `strom source edit` und `show` schlagen den Rest der Fundstelle vor. Ältere Quellen werden mit `strom
88
88
  source split` auf einmal in die Felder aufgeteilt: eine Vorschau, was aus jeder würde (eine Fundstelle, in der
89
- nichts erkannt wird, bleibt, wie sie ist), die Aufteilung schreibt der Benutzer mit `--apply` als einen Schritt und
89
+ nichts erkannt wird, bleibt, wie sie ist, bis zu drei solche zeigt sie, wie sie stehen), die Aufteilung schreibt der Benutzer mit `--apply` als einen Schritt und
90
90
  macht sie als einen rückgängig (`--undo`); ein Agent bietet sie nur an. Die Aufteilung geht auch aus einer
91
91
  Strom-App, die sie anbietet (Brückenfunktion `sources.split`): ihre Vorschau sagt, wie viele Quellen, die Aufteilung
92
92
  wird auf den Klick des Benutzers als ein Schritt nach dieser Vorschau geschrieben und ganz zurückgenommen. Ein
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.31.0
9
9
 
10
- *In preparation: the betas up to 1.31.0-beta.5. The section is complete with the release.*
10
+ *In preparation: the betas up to 1.31.0-beta.7. The section is complete with the release.*
11
11
 
12
12
  - **`strom repair` no longer removes work a damaged history hides.** When a research's git history is readable but
13
13
  older than its records (a cloud drive put back an older `.git`, iCloud's copies such as `index 2` beside it), `strom
@@ -76,7 +76,7 @@ The changes of each version in short. The full notes and the install lines are o
76
76
  again by them. A PAGE never says two image or folio numbers: when an older locator names another than the field, the
77
77
  field's (the locator itself kept), and `strom source edit` and `show` propose the locator's rest. Older sources are
78
78
  split into the fields at once by `strom source split`: a preview of what each would become (a locator in which
79
- nothing is recognised stays as it is), written by the user with `--apply` as one step and undone as one (`--undo`);
79
+ nothing is recognised stays as it is, up to three such shown as they stand), written by the user with `--apply` as one step and undone as one (`--undo`);
80
80
  an agent only offers it. The split is done from a Strom app that offers it too (bridge feature `sources.split`): its
81
81
  preview says how many sources, the split is written on the user's click as one step on that preview and taken back
82
82
  whole. A folio, image or call number the user removes in a Strom app that keeps these fields is removed in the
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.31.0
9
9
 
10
- *W przygotowaniu: bety do 1.31.0-beta.5. Sekcja będzie kompletna z wydaniem.*
10
+ *W przygotowaniu: bety do 1.31.0-beta.7. Sekcja będzie kompletna z wydaniem.*
11
11
 
12
12
  - **`strom repair` nie usuwa już pracy ukrytej przez uszkodzoną historię.** Gdy historię gita badania da się odczytać,
13
13
  ale jest starsza niż jego rekordy (dysk w chmurze przywrócił starszy `.git`, obok kopie iCloud takie jak `index 2`),
@@ -78,7 +78,8 @@ Zmiany każdej wersji w skrócie. Pełne informacje o wydaniach i polecenia inst
78
78
  przy zapisie i po nich odnajduje link, który już się nie otwiera. PAGE nigdy nie podaje dwóch numerów skanu ani
79
79
  folio: gdy starsza lokalizacja wymienia inny numer niż pole, obowiązuje w niej pole (sama lokalizacja zostaje), a
80
80
  `strom source edit` i `show` proponują resztę lokalizacji. Starsze źródła rozdziela się na pola naraz poleceniem
81
- `strom source split`: podgląd, czym stałoby się każde (lokalizacja, w której nic nie rozpoznano, zostaje bez zmian),
81
+ `strom source split`: podgląd, czym stałoby się każde (lokalizacja, w której nic nie rozpoznano, zostaje bez zmian,
82
+ do trzech takich pokazuje tak, jak stoją),
82
83
  podział zapisuje użytkownik z `--apply` jednym krokiem i jednym się go cofa (`--undo`); agent tylko go proponuje.
83
84
  Podział można zrobić także z aplikacji Strom, która go oferuje (funkcja mostu `sources.split`): jej podgląd mówi,
84
85
  ile źródeł, podział zapisuje się po kliknięciu użytkownika jednym krokiem według tego podglądu i cofa w całości.
@@ -50,8 +50,8 @@ register({
50
50
  const undos = splitUndos(tree);
51
51
  const shown = opts.all ? plan.split : plan.split.slice(0, SHOWN);
52
52
  return {
53
- text: lines(plan.split.length ? `would split the locator of ${counted(plan.split.length, "source")} into folio and image (nothing written):` : "nothing to split: no locator names a folio or image a field does not give", ...shown.map(oneLine), plan.split.length > shown.length ? ` … ${plan.split.length - shown.length} more (--all, or --json)` : undefined, plan.unrecognized ? `unrecognised, stay as they are: ${counted(plan.unrecognized, "source")}` : undefined, plan.split.length ? "to write it: strom source split --apply — the person's, in their terminal (an agent offers it, never runs it)" : undefined, ...undos.map((u) => `to undo: strom source split --undo ${u.id} (${counted(u.sources, "source")}, ${u.at.slice(0, 10)})`)),
54
- data: { split: plan.split, count: plan.split.length, unrecognized: plan.unrecognized, nothing: plan.nothing, undos, plan: splitMark(plan) },
53
+ text: lines(plan.split.length ? `would split the locator of ${counted(plan.split.length, "source")} into folio and image (nothing written):` : "nothing to split: no locator names a folio or image a field does not give", ...shown.map(oneLine), plan.split.length > shown.length ? ` … ${plan.split.length - shown.length} more (--all, or --json)` : undefined, plan.unrecognized ? `unrecognised, stay as they are: ${counted(plan.unrecognized, "source")}${plan.unrecognizedExamples.length ? ` — ${plan.unrecognizedExamples.map((t) => JSON.stringify(t)).join(", ")}${plan.unrecognized > plan.unrecognizedExamples.length ? ", …" : ""}` : ""}` : undefined, plan.split.length ? "to write it: strom source split --apply — the person's, in their terminal (an agent offers it, never runs it)" : undefined, ...undos.map((u) => `to undo: strom source split --undo ${u.id} (${counted(u.sources, "source")}, ${u.at.slice(0, 10)})`)),
54
+ data: { split: plan.split, count: plan.split.length, unrecognized: plan.unrecognized, unrecognizedExamples: plan.unrecognizedExamples, nothing: plan.nothing, undos, plan: splitMark(plan) },
55
55
  };
56
56
  },
57
57
  });
package/dist/core/live.js CHANGED
@@ -200,8 +200,8 @@
200
200
  // history.align.undone, 400 history.align.body
201
201
  // GET <token>/sources/split[?all=1] what splitting the older sources' locators into folio and image would do (strom
202
202
  // source split --json): {split [{source, title, before {locator?, folio?, image?}, after {…}}]
203
- // (the first 10, ?all=1 every one), count, unrecognized, nothing, undos [{id, at, sources}], plan
204
- // (its mark)} — read only; 409 source.split.archive, 503 research.busy (feature sources.split)
203
+ // (the first 10, ?all=1 every one), count, unrecognized, unrecognizedExamples (up to 3 of their
204
+ // locators, the location's text alone), nothing, undos [{id, at, sources}], plan (its mark)} — read only; 409 source.split.archive, 503 research.busy (feature sources.split)
205
205
  // POST <token>/sources/split {plan}: done on the person's click after that preview, as the user's (strom source split
206
206
  // --apply --plan): {done {split: n}, undo, head, parent} — nothing else of the tree changes; 409
207
207
  // source.split.plan with the preview as it is now, 409 source.split.archive, 400 source.split.body
@@ -5133,7 +5133,7 @@ export function serveLive(root, env) {
5133
5133
  /** What splitting the older sources' locators would do, as GET /sources/split answers it: the first ten (as strom source split shows them), or every one. */
5134
5134
  const splitPreview = (tree, all = false) => {
5135
5135
  const plan = splitPlan(tree);
5136
- return { split: all ? plan.split : plan.split.slice(0, 10), count: plan.split.length, unrecognized: plan.unrecognized, nothing: plan.nothing, undos: splitUndos(tree), plan: splitMark(plan) };
5136
+ return { split: all ? plan.split : plan.split.slice(0, 10), count: plan.split.length, unrecognized: plan.unrecognized, unrecognizedExamples: plan.unrecognizedExamples, nothing: plan.nothing, undos: splitUndos(tree), plan: splitMark(plan) };
5137
5137
  };
5138
5138
  /** Nobody researches here (an archive, a research waiting for its agent): its sources are not split from the app. */
5139
5139
  const splitArchive = () => refusal("nobody researches here: the sources' locators are not split from the app", "source.split.archive");
@@ -15,6 +15,8 @@ import { StromError, UsageError } from "./errors.js";
15
15
  export const SOURCE_SPLIT_FILE = "quality/source-split.json";
16
16
  /** How many splits can be undone, each by its own ID (the oldest go first). */
17
17
  const UNDO_KEPT = 5;
18
+ /** How many unrecognised locators the preview shows. */
19
+ const EXAMPLES = 3;
18
20
  const place = (s) => ({
19
21
  ...(s.locator?.trim() ? { locator: s.locator } : {}),
20
22
  ...(s.folio?.trim() ? { folio: s.folio } : {}),
@@ -50,7 +52,7 @@ export function splitMark(plan) {
50
52
  }
51
53
  /** What the split would do in the research now (nothing written). */
52
54
  export function splitPlan(tree) {
53
- const out = { split: [], unrecognized: 0, nothing: 0 };
55
+ const out = { split: [], unrecognized: 0, unrecognizedExamples: [], nothing: 0 };
54
56
  const media = (id) => tree.get(id);
55
57
  for (const s of tree.list("source")) {
56
58
  if (s.retracted || !s.locator?.trim())
@@ -60,10 +62,14 @@ export function splitPlan(tree) {
60
62
  out.split.push({ source: s.id, title: s.title, before: place(s), after });
61
63
  else {
62
64
  const found = recognizeLocation(s.locator);
63
- if (found.folio || found.image)
65
+ if (found.folio || found.image || s.folio?.trim() || sourceImage(s, media))
64
66
  out.nothing++;
65
- else
67
+ else {
66
68
  out.unrecognized++;
69
+ const text = s.locator.trim().normalize("NFC");
70
+ if (out.unrecognizedExamples.length < EXAMPLES && !out.unrecognizedExamples.includes(text))
71
+ out.unrecognizedExamples.push(text);
72
+ }
67
73
  }
68
74
  }
69
75
  return out;
package/dist/core/sync.js CHANGED
@@ -757,6 +757,8 @@ function citedDetails(sources, facts) {
757
757
  // a location given field by field has its rest where the file says it (none: none), never a citation's
758
758
  if (!s.page && !s.structured && c.page)
759
759
  s.page = c.page;
760
+ else if (!s.page && s.structured && c.page && s.citedPage === undefined)
761
+ s.citedPage = c.page;
760
762
  if (!s.date && c.date)
761
763
  s.date = c.date;
762
764
  if (s.quay === undefined && c.quay !== undefined)
@@ -3179,9 +3181,10 @@ const SOURCE_FIELDS = ["folio", "image", "callNumber"];
3179
3181
  * keeps them (`fieldsKept`; an older app never sends them, which removes nothing), each a value of the research's own
3180
3182
  * (not its images' numbers, not its book's call number) that the app was given as it is now, and that the file does not
3181
3183
  * name elsewhere: a folio or image the location names (an app given the PAGE alone has it there), a call number the
3182
- * location or the source's note names (an app before 3.27.0-beta.5 read CALN into its note as "Call number: …" and
3183
- * keeps it there once it keeps the fields, until the research's file is loaded again — the field it never had). A
3184
- * field the file still names is no field the user removed; an empty field the app was not given removes nothing.
3184
+ * whole location is, or a line of the source's note gives under its label (an app before 3.27.0-beta.5 read CALN into
3185
+ * its note as "Call number: …" and keeps it there once it keeps the fields, until the research's file is loaded again —
3186
+ * the field it never had); a short call number ("2") inside a PAGE ("no. 2") or the note's own words is no such line.
3187
+ * A field the file still names is no field the user removed; an empty field the app was not given removes nothing.
3185
3188
  */
3186
3189
  function removedFields(incoming, inc, b, mine) {
3187
3190
  if (!incoming.fieldsKept)
@@ -3193,22 +3196,30 @@ function removedFields(incoming, inc, b, mine) {
3193
3196
  return [];
3194
3197
  if (field !== "callNumber" && location && locatorOverlap({ locator: location, [field]: own })?.[field])
3195
3198
  return [];
3196
- if (field === "callNumber" && [inc.pageLine, inc.page, inc.note].some((t) => namesWords(t, own)))
3199
+ if (field === "callNumber" && ([inc.pageLine, inc.page].some((t) => isValue(t, own)) || noteCallNumbers(inc.note).some((t) => isValue(t, own))))
3197
3200
  return [];
3198
3201
  return [{ field, was: own }];
3199
3202
  });
3200
3203
  }
3201
- /** Whether a text names a value: its words, one after another, among the text's (any script, any accent, NFD or not). */
3202
- function namesWords(text, value) {
3203
- const words = (s) => foldText(s).match(/[\p{L}\p{M}\p{N}]+/gu) ?? [];
3204
- const want = words(value);
3205
- const have = text ? words(text) : [];
3206
- if (!want.length)
3207
- return false;
3208
- for (let i = 0; i + want.length <= have.length; i++)
3209
- if (want.every((w, j) => have[i + j] === w))
3210
- return true;
3211
- return false;
3204
+ /** A text's words (any script, any accent, NFD or not). */
3205
+ const valueWords = (s) => (s ? foldText(s).match(/[\p{L}\p{M}\p{N}]+/gu) ?? [] : []);
3206
+ /** Whether a text is a value as a whole: the same words, in their order (a short call number inside a PAGE is not). */
3207
+ function isValue(text, value) {
3208
+ const want = valueWords(value);
3209
+ const have = valueWords(text);
3210
+ return want.length > 0 && want.length === have.length && want.every((w, i) => have[i] === w);
3211
+ }
3212
+ /** The labels of a call number an app before 3.27.0-beta.5 wrote into a source's note, in each of its languages. */
3213
+ const CALL_NUMBER_LABELS = new Set(["signatura", "call number", "signatur", "sygnatura"]);
3214
+ /** The call numbers a source's note names on a line of its own ("Signatura: Lhota 12", "Call number: …"). */
3215
+ function noteCallNumbers(note) {
3216
+ const out = [];
3217
+ for (const line of (note ?? "").split(/\r?\n/u)) {
3218
+ const m = line.match(/^\s*([^:]+?)\s*:\s*(.+?)\s*$/u);
3219
+ if (m && CALL_NUMBER_LABELS.has(valueWords(m[1]).join(" ")))
3220
+ out.push(m[2]);
3221
+ }
3222
+ return out;
3212
3223
  }
3213
3224
  /** A note's line of a field the user removed in the app ("folio: removed in the app (fol. 12v)"). */
3214
3225
  const removedLine = (lang, r) => `${phrase(lang, `sync.reading.${r.field}`)}: ${phrase(lang, "sync.reading.removed", { was: r.was })}`;
@@ -3246,7 +3257,9 @@ function planSources(tree, incoming, ours, base, push, readings, edits) {
3246
3257
  if (!incoming.sources?.size)
3247
3258
  return map;
3248
3259
  const live = tree.list("source").filter((s) => !s.retracted);
3249
- const pageOf = (s) => s.locator ?? ours.sources?.get(s.id)?.page;
3260
+ // where in the book the research gives the app a source: its locator, else its first citation's page (a source given
3261
+ // field by field with none of its own: an app before 3.27.0-beta.5 gave it that one, its own split of a source by it)
3262
+ const pageOf = (s) => s.locator ?? ours.sources?.get(s.id)?.page ?? ours.sources?.get(s.id)?.citedPage;
3250
3263
  for (const [key, inc] of incoming.sources) {
3251
3264
  let mine = key.startsWith("x:") ? undefined : tree.get(key);
3252
3265
  for (let hops = 0; mine?.mergedInto && hops < 10; hops++)
@@ -3284,7 +3297,7 @@ function planSources(tree, incoming, ours, base, push, readings, edits) {
3284
3297
  const set = mine.recordset ? tree.get(mine.recordset) : undefined;
3285
3298
  const was = {
3286
3299
  text: [b.text, o?.text, mine.transcript],
3287
- page: [b.page, b.pageLine, o?.page, o?.pageLine, mine.locator, composedPage(mine, tree.lang), ...cited],
3300
+ page: [b.page, b.pageLine, b.citedPage, o?.page, o?.pageLine, o?.citedPage, mine.locator, composedPage(mine, tree.lang), ...cited],
3288
3301
  folio: [b.folio, o?.folio, mine.folio],
3289
3302
  image: [b.image, o?.image, sourceImage(mine, (id) => tree.get(id))?.value],
3290
3303
  callNumber: [b.callNumber, o?.callNumber, sourceCallNumber(mine, set)],
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.31.0-beta.5";
35
+ export const VERSION = "1.31.0-beta.7";
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"];
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.31.0-beta.5",
3
+ "version": "1.31.0-beta.7",
4
4
  "stromDoc": "f9ad9cd5851455e5bdf7b93b7d80907bedc20e79",
5
5
  "description": "Genealogical research toolkit for AI coding agents",
6
6
  "type": "module",