strom-research 1.23.0 → 1.24.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.cs.md +31 -0
  2. package/CHANGELOG.de.md +35 -0
  3. package/CHANGELOG.md +34 -0
  4. package/assets/lang/cs.json +20 -5
  5. package/assets/lang/de.json +20 -5
  6. package/dist/agents/models.js +46 -1
  7. package/dist/brief/history.js +44 -8
  8. package/dist/cli/main.js +14 -4
  9. package/dist/cli/menu-links.js +35 -0
  10. package/dist/cli/ui.js +16 -5
  11. package/dist/commands/fixchecks.js +132 -8
  12. package/dist/commands/fixes.js +2 -31
  13. package/dist/commands/history.js +27 -1
  14. package/dist/commands/links.js +10 -1
  15. package/dist/commands/output.js +5 -2
  16. package/dist/commands/read.js +1 -1
  17. package/dist/commands/readers.js +7 -3
  18. package/dist/commands/session.js +3 -1
  19. package/dist/commands/setup.js +16 -1
  20. package/dist/commands/sources.js +1 -1
  21. package/dist/commands/sync.js +6 -0
  22. package/dist/core/age.js +2 -1
  23. package/dist/core/changelog.js +13 -0
  24. package/dist/core/excerpt.js +2 -1
  25. package/dist/core/git.js +8 -0
  26. package/dist/core/import.js +11 -2
  27. package/dist/core/integrity.js +5 -0
  28. package/dist/core/lineages.js +147 -0
  29. package/dist/core/links.js +21 -2
  30. package/dist/core/live.js +53 -13
  31. package/dist/core/pastevents.js +18 -2
  32. package/dist/core/phrases.js +4 -0
  33. package/dist/core/placeadopt.js +288 -0
  34. package/dist/core/scanlink.js +60 -0
  35. package/dist/core/stromapp.js +20 -0
  36. package/dist/core/sync.js +43 -1
  37. package/dist/core/tree.js +22 -1
  38. package/dist/core/update.js +26 -2
  39. package/dist/gedcom/export.js +29 -6
  40. package/dist/gedcom/validate.js +7 -4
  41. package/dist/runners/antigravity.js +14 -11
  42. package/dist/runners/claude.js +2 -2
  43. package/dist/runners/codex.js +69 -61
  44. package/dist/runners/grok.js +2 -2
  45. package/dist/runners/opencode.js +2 -2
  46. package/dist/runners/room.js +112 -0
  47. package/dist/runners/runner.js +7 -0
  48. package/package.json +5 -2
package/dist/cli/ui.js CHANGED
@@ -552,7 +552,7 @@ export const UI = {
552
552
  "ui.timing": "How long each step took (the line to send when strom is slow):",
553
553
  "ui.doc.place": "where the research lies",
554
554
  "ui.doc.place.cloud": "{where}: in {what} — each file strom looks at may come over the network first",
555
- "ui.doc.place.online": "of {looked} files looked at, {online} are kept only online (each downloaded whole when opened)",
555
+ "ui.doc.place.online": "of {looked, plural, one {# file looked at} other {# files looked at}}, {online, plural, one {# is} other {# are}} kept only online (each downloaded whole when opened)",
556
556
  "ui.doc.place.network": "{where}: on a network drive ({what}) — each file strom looks at is read over the network, with thousands of scans slowly",
557
557
  "ui.doc.place.cloud.fix": "the folder kept always on this device (OneDrive: in the folder's menu “Always keep on this device”), or the research moved to a disk of this computer (strom setup in a terminal moves it along); strom itself downloads nothing",
558
558
  "ui.doc.place.network.fix": "the research moved to a disk of this computer (strom setup in a terminal moves it along)",
@@ -575,6 +575,8 @@ export const UI = {
575
575
  "ui.doc.knows": "agents know strom",
576
576
  "ui.doc.level": "the agent may",
577
577
  "ui.doc.model": "model",
578
+ "ui.doc.model.own.weak": "no model chosen for the research: {agent} works with its own, {model} — a fast or small one, too weak for old handwriting",
579
+ "ui.doc.model.own.refused": "no model chosen for the research: {agent} works with its own, {model}, which is not in its list for this account — it would refuse it",
578
580
  "ui.doc.shortcut": "desktop shortcut",
579
581
  "ui.doc.links": "links from the Strom app",
580
582
  "ui.doc.links.ours": "yes",
@@ -1355,6 +1357,10 @@ export const UI = {
1355
1357
  "ui.sync.do.surname": "written as decided in the app",
1356
1358
  "ui.sync.do.surname.kept": "stays as the research has it",
1357
1359
  "ui.sync.do.surname.report": "nothing changes",
1360
+ "ui.sync.lineage.founder": "{n}. Lineage: {name} begins a lineage of their own",
1361
+ "ui.sync.lineage.nocarry": "{n}. Lineage: {name} carries no lineage",
1362
+ "ui.sync.lineage.none": "{n}. Lineage: {name} as computed again",
1363
+ "ui.sync.do.lineage": "written as set in the app",
1358
1364
  "ui.sync.do.part": "added to the fact, citing the tree sent",
1359
1365
  "ui.sync.do.part.user": "the edit wins (the research's in its history)",
1360
1366
  "ui.sync.do.person.cite": "their name cites it (a lead until the research reads the record)",
@@ -1723,6 +1729,10 @@ export const UI = {
1723
1729
  "ui.check.streetplaces": "{n, plural, one {# fact holds} other {# facts hold}} a street or a house number in the place",
1724
1730
  "ui.error.tree.not-downloaded": "{n, plural, one {# file} other {# files}} of the research not downloaded from iCloud yet (the first: {first}) — nothing written",
1725
1731
  "ui.error.tree.not-downloaded.hint": "open the research's folder in Finder and download them (or take the folder out of iCloud Drive), then run it again — not strom repair",
1732
+ "ui.error.tree.changed-outside": "the research's data was changed outside strom ({n, plural, one {# problem} other {# problems}}): nothing written",
1733
+ "ui.error.tree.changed-outside.hint": "strom verify (details)\nstrom repair (restores the last sealed state)",
1734
+ "ui.error.tree.changed-outside.keys.hint": "strom verify (details)\nstrom repair, then strom seal adopt (undoes only what was done outside strom — the work of both keys of this computer stays)",
1735
+ "ui.error.tree.changed-outside.terminal.hint": "strom verify (details)\nin a terminal of its own: strom repair, then strom seal adopt — it sees both keys and undoes only what was done outside strom",
1726
1736
  "ui.export.file": "{file} ({for}) — {persons, plural, one {# person} other {# persons}} · {families, plural, one {# family} other {# families}} · {facts, plural, one {# fact} other {# facts}} · {sources, plural, one {# source} other {# sources}}{skipped}",
1727
1737
  "ui.export.for.strom": "for the Strom app",
1728
1738
  "ui.export.for.strom.images": "for the Strom app, with images",
@@ -2667,7 +2677,7 @@ export const UI = {
2667
2677
  "ui.history.pace.default": " (default)",
2668
2678
  "ui.history.pace.later": "To change how often later: strom config set experiments.historyPace sometimes|rare|idle.",
2669
2679
  "ui.history.pace.off": "off — not looked for",
2670
- "ui.setup.history": "The events of history at the ancestors' places too — wars, epidemics, censuses, changes of the state (the agent looks for them between the sessions of the family research)? How often:",
2680
+ "ui.setup.history": "The events of history at the ancestors' places too — wars, epidemics, censuses, changes of the state (the agent looks for them between the sessions of the family research)? For every research on this computer. How often:",
2671
2681
  "ui.alone.history": "History: {state}",
2672
2682
  "ui.alone.places": "History of each place, by itself: {state}",
2673
2683
  "ui.alone.places.about": "The history of each place with coordinates and its surroundings — fires, floods, battles nearby, the estate, the parish, the school — looked for by itself, one place at a time at the pace of the history, the places of the most people first. A place looked for once is not looked for again. A single place is looked for whenever asked for, also with this off.",
@@ -2677,10 +2687,10 @@ export const UI = {
2677
2687
  "ui.alone.regions.tree": "History of the regions in this research: {state}",
2678
2688
  "ui.alone.placeHistory.tree": "History of the places in this research: {state}",
2679
2689
  "ui.alone.tree.about": "For this research alone, before this computer's settings. What was found stays.",
2680
- "ui.history.offer": "New in this version: the events of history at the ancestors' places — wars, epidemics, censuses, changes of the state, each with its source; the Strom app shows them in the course of each life. Not looked for yet, nothing turns on by itself.",
2690
+ "ui.history.offer": "New in this version: the events of history at the ancestors' places — wars, epidemics, censuses, changes of the state, each with its source; the Strom app shows them in the course of each life. Not looked for yet, nothing turns on by itself. The choice holds for every research on this computer.",
2681
2691
  "ui.history.offer.no": "not now — nothing turns on",
2682
- "ui.history.offer.later": "Not looked for. Later: Settings → The agent working alone → History, or from the Strom app.",
2683
- "ui.history.offer.on": "History looked for: {pace}. To change how often: Settings → The agent working alone → History, or from the Strom app.",
2692
+ "ui.history.offer.later": "Not looked for. Later: Settings → The agent working alone → History, or from the Strom app. For one research alone: Settings → The agent working alone → History of the regions in this research (in the menu of that research), or strom config set experiments.history on --for-tree.",
2693
+ "ui.history.offer.on": "History looked for in every research on this computer: {pace}. To change how often: Settings → The agent working alone → History, or from the Strom app. For one research alone: Settings → The agent working alone → History of the regions in this research (in the menu of that research), or strom config set experiments.history off --for-tree.",
2684
2694
  "ui.consent.history.pace": "Look for the events of history more often — {pace}? It takes more of the agent's time and the plan's usage.",
2685
2695
  "ui.consent.history.tree": "Look for the events of history of the regions at the places of this research — wars, epidemics, censuses, changes of the state? The agent looks for them now and then between the sessions of the family research, and it takes its time and the plan's usage.",
2686
2696
  "ui.consent.placeHistory": "Look for the history of a place and its surroundings when it is asked for, in every research on this computer — fires, floods, battles nearby, the estate, the parish, the school? Each place asked for is one session of the agent; it takes its time and the plan's usage.",
@@ -2709,6 +2719,7 @@ export const UI = {
2709
2719
  "ui.link.experiment.archive": "Nothing of history is looked for while the research is kept as an archive. Nothing was done.",
2710
2720
  "ui.link.experiment.waiting": "Nobody works on this research on this computer, so nothing of history is looked for. Nothing was done.",
2711
2721
  "ui.link.what.history.place": "look for the history of {place} and its surroundings — fires, floods, battles nearby, the estate, the parish, the school",
2722
+ "ui.link.what.fixes.undo": "put back what the fix \"{name}\" set right",
2712
2723
  "ui.link.history.place.minutes": "One session of the agent, about {from}–{to} minutes; it takes the agent's time and the plan's usage.",
2713
2724
  "ui.link.history.place.usd": "Such sessions here cost {from}–{to} so far.",
2714
2725
  "ui.link.history.place.done": "The history of {place} and its surroundings is first in the queue.",
@@ -25,18 +25,24 @@ import { foldText } from "../core/text.js";
25
25
  import { loadReadings } from "./readings.js";
26
26
  import { isArchive } from "../core/mode.js";
27
27
  import { ui } from "../cli/ui.js";
28
- import { readerAgent } from "./readers.js";
28
+ import { readerAgentOf } from "./readers.js";
29
+ import { calibrationLabel } from "../core/viewsizes.js";
30
+ import { BATCH } from "../core/reader.js";
29
31
  import { calibrationKey, fits, keyOf, loadAliases, resolveKey, splitKey, UNKNOWN_KEY } from "../core/modelkey.js";
30
32
  import { sameLineNewer } from "../agents/models.js";
31
33
  import { kinship } from "../core/kin.js";
32
34
  import { listReadings, loadState, resultPath } from "../core/document.js";
33
- import { participantNames } from "../core/participants.js";
34
- import { appShapeFixes } from "../core/appshapefix.js";
35
- import { streetPlaceFixes } from "../core/streetfix.js";
35
+ import { nameRewritesDone, participantNames } from "../core/participants.js";
36
+ import { appShapeFixes, appShapesDone } from "../core/appshapefix.js";
37
+ import { streetPlaceFixes, streetPlacesDone } from "../core/streetfix.js";
36
38
  /** The agent and model of strom read's readers here now, and the shared folder. */
37
39
  export function fixEnv(ctx, tree) {
38
- const agent = readerAgent(ctx, tree);
39
- return { shared: ctx.settings.shared()?.value, reader: { agent, model: ctx.settings.models(agent, tree.config).vision } };
40
+ return fixEnvOf(ctx.settings, ctx.env, tree);
41
+ }
42
+ /** The same without a command's context (the bridge): its settings and environment. */
43
+ export function fixEnvOf(settings, env, tree) {
44
+ const agent = readerAgentOf(settings, env, tree);
45
+ return { shared: settings.shared()?.value, reader: { agent, model: settings.models(agent, tree.config).vision } };
40
46
  }
41
47
  // ── the first check: a blind reading of a crop read from the whole image, reduced ───────────────────────────────
42
48
  /**
@@ -696,6 +702,7 @@ export const PARTICIPANT_NAMES = {
696
702
  const f = participantNames(tree);
697
703
  return { items: [], exact: 0, estimated: 0, unjudged: 0, readings: 0, rewrites: f.rewrites, unsplit: f.unsplit };
698
704
  },
705
+ applied: (tree) => nameRewritesDone(tree).length,
699
706
  };
700
707
  // ── what an older strom took for the user's edit in a send of the Strom app ──────────────────────────────────────
701
708
  /**
@@ -710,6 +717,7 @@ export const APP_SHAPES = {
710
717
  remedy: "rewrite",
711
718
  unit: "finding",
712
719
  detect: (tree) => ({ items: [], exact: 0, estimated: 0, unjudged: 0, readings: 0, rewrites: appShapeFixes(tree) }),
720
+ applied: (tree) => appShapesDone(tree).length,
713
721
  };
714
722
  // ── a street or a house number in the place of a fact ────────────────────────────────────────────────────────────
715
723
  /**
@@ -728,6 +736,7 @@ export const STREET_PLACES = {
728
736
  const f = streetPlaceFixes(tree);
729
737
  return { items: [], exact: 0, estimated: 0, unjudged: 0, readings: 0, rewrites: f.fixes, unsplit: f.left.length, left: f.left };
730
738
  },
739
+ applied: (tree) => streetPlacesDone(tree).length,
731
740
  };
732
741
  /** Every check strom knows, the oldest fix first. */
733
742
  export const FIX_CHECKS = [BLIND_REDUCED, NEW_MODEL, PARTICIPANT_NAMES, APP_SHAPES, STREET_PLACES];
@@ -756,11 +765,11 @@ export function decide(tree, id, decision) {
756
765
  tree.updateConfig(decisionChange(id, decision), { op: "fix.decide", summary: decision ? `fix ${id}: ${decision}` : `fix ${id}: asked again` });
757
766
  }
758
767
  /** The change of strom.json a decision makes (in an operation of its own, or in the one of the fix it goes with). */
759
- export function decisionChange(id, decision) {
768
+ export function decisionChange(id, decision, o = {}) {
760
769
  return (c) => {
761
770
  const all = { ...(c.fixes ?? {}) };
762
771
  if (decision)
763
- all[id] = { decision, at: new Date().toISOString(), version: VERSION };
772
+ all[id] = { decision, at: new Date().toISOString(), version: VERSION, ...(o.undone && decision === "declined" ? { undone: true } : {}) };
764
773
  else
765
774
  delete all[id];
766
775
  if (Object.keys(all).length)
@@ -1064,3 +1073,118 @@ export function fixesDoctorLine(tree, env, lang, keep = true) {
1064
1073
  fix: `strom fixes show ${s.check.id}`,
1065
1074
  };
1066
1075
  }
1076
+ // ── the places read together, and what a check's texts say beside its counts ─────────────────────────────────────
1077
+ /**
1078
+ * The places read together as their earlier reading read them: the images of one reading with the same question, part
1079
+ * and blindness are one strom read again (its batches as strom read makes them); a document alone.
1080
+ */
1081
+ export function readsOf(items) {
1082
+ const out = new Map();
1083
+ for (const i of items) {
1084
+ const key = i.document ? `doc|${i.key}` : [i.reading, i.question, i.crop ?? "", i.blind ? "blind" : "", i.context ?? ""].join("|");
1085
+ out.set(key, [...(out.get(key) ?? []), i]);
1086
+ }
1087
+ return [...out.values()];
1088
+ }
1089
+ /** The readers the places take: a document read by two takes two; a reading of more images than a batch, more. */
1090
+ export const readersOf = (items) => readsOf(items).reduce((n, g) => n + (g[0].document ? (g[0].readers ?? 1) : Math.ceil(g.length / BATCH)), 0);
1091
+ /** "Claude Code · claude-opus-5-5" — "model unknown" where nothing says. */
1092
+ export const fixModelText = (t, key) => (key === UNKNOWN_KEY ? t("ui.fixes.model.unknown") : calibrationLabel(key, t("ui.settings.model.own")));
1093
+ /** What a check's texts say beside its counts: the version that fixed it; of new-model the models before and now. */
1094
+ export function fixTextValues(t, s) {
1095
+ const m = s.found.models;
1096
+ if (!m)
1097
+ return { since: s.check.since };
1098
+ return {
1099
+ since: s.check.since,
1100
+ now: fixModelText(t, m.now),
1101
+ before: m.before.map((b) => `${fixModelText(t, b.key)} (${t("ui.fixes.readings", { n: b.readings })})`).join(", "),
1102
+ newer: m.newer ? t("ui.fixes.new-model.newer") : "",
1103
+ };
1104
+ }
1105
+ // ── for the Strom app (the bridge's GET /fixes) ─────────────────────────────────────────────────────────────────
1106
+ /** The languages a fix's title and summary are given to the app in. */
1107
+ export const APP_FIX_LANGS = ["cs", "en", "de"];
1108
+ /** One check as the app shows it: what it is, what it found here, its state, whether strom fixes undo takes it back. */
1109
+ /** At most this many IDs of each kind in an app's fix (`count` says how many it found). */
1110
+ export const APP_FIX_TARGETS = 200;
1111
+ /** The records a check's findings are of, by their kind: the owners of what it rewrites, the sources and images it reads again. */
1112
+ export function fixTargets(f) {
1113
+ const ids = new Set();
1114
+ for (const r of (f.rewrites ?? []))
1115
+ for (const id of [r.owner, r.record])
1116
+ if (id)
1117
+ ids.add(id);
1118
+ for (const l of f.left ?? [])
1119
+ ids.add(l.owner);
1120
+ for (const i of f.items) {
1121
+ for (const s of i.sources)
1122
+ ids.add(s);
1123
+ if (i.media)
1124
+ ids.add(i.media);
1125
+ for (const p of i.document?.persons ?? [])
1126
+ ids.add(p);
1127
+ }
1128
+ const kinds = [["persons", "P"], ["families", "F"], ["places", "L"], ["sources", "S"], ["media", "M"]];
1129
+ const out = {};
1130
+ for (const [kind, prefix] of kinds) {
1131
+ const of = [...ids].filter((id) => new RegExp(`^${prefix}\\d+$`, "u").test(id)).sort();
1132
+ if (of.length)
1133
+ out[kind] = of.slice(0, APP_FIX_TARGETS);
1134
+ }
1135
+ return Object.keys(out).length ? out : undefined;
1136
+ }
1137
+ /**
1138
+ * strom's fixes of this research for the app: each check, what it found, its state and what it would take — free, as
1139
+ * strom fixes says it (no agent, no network, nothing written: what waits is not kept, the readings' cost only estimated
1140
+ * from the earlier readers here). Where nobody researches (`archive`: an archive, a research waiting for its agent) only
1141
+ * the checks that rewrite by rules — nothing of an agent said. A check that cannot look here is left out.
1142
+ */
1143
+ export function fixesForApp(tree, settings, env, o) {
1144
+ const fenv = fixEnvOf(settings, env, tree);
1145
+ const rev = fixesStamp(tree, fenv);
1146
+ const checks = o.archive ? FIX_CHECKS.filter((c) => c.remedy === "rewrite") : FIX_CHECKS;
1147
+ const fixes = checks.flatMap((check) => {
1148
+ let s;
1149
+ try {
1150
+ s = fixStates(tree, fenv, { checks: [check], keep: false })[0];
1151
+ }
1152
+ catch {
1153
+ return [];
1154
+ }
1155
+ const said = (key, values) => Object.fromEntries(APP_FIX_LANGS.map((lang) => {
1156
+ const t = (k, v = {}) => ui(lang, k, v);
1157
+ return [lang, t(key, values?.(t))];
1158
+ }));
1159
+ const summary = !s.found.models && check.id === "new-model" ? said(`ui.fixes.${check.id}.idle`) : said(`ui.fixes.${check.id}.what`, (t) => fixTextValues(t, s));
1160
+ const count = check.unit === "reading" ? s.found.readings : foundCount(s.found);
1161
+ const applied = check.applied?.(tree) ?? 0;
1162
+ const found = foundCount(s.found);
1163
+ const targets = fixTargets(s.found);
1164
+ const cost = check.remedy === "rewrite"
1165
+ ? "free"
1166
+ : found
1167
+ ? estimateFix(tree.root, { agent: fenv.reader.agent, model: fenv.reader.model, calls: readersOf(s.found.items), parallel: settings.readParallel(tree.config) }).level
1168
+ : undefined;
1169
+ return [
1170
+ {
1171
+ id: check.id,
1172
+ title: said(`ui.fixes.${check.id}.name`),
1173
+ summary,
1174
+ unit: check.unit,
1175
+ count,
1176
+ ...(s.found.unsplit ? { left: s.found.unsplit } : {}),
1177
+ state: s.state,
1178
+ undoable: applied > 0,
1179
+ ...(applied ? { applied } : {}),
1180
+ ...(s.decision ? { at: s.decision.at } : {}),
1181
+ ...(s.decision?.undone ? { undone: true } : {}),
1182
+ ...(targets ? { targets } : {}),
1183
+ ...(cost ? { cost } : {}),
1184
+ since: check.since,
1185
+ paid: check.paid,
1186
+ },
1187
+ ];
1188
+ });
1189
+ return { rev, fixes };
1190
+ }
@@ -14,7 +14,7 @@ import { isArchive } from "../core/mode.js";
14
14
  import { refuseInArchive } from "../core/state.js";
15
15
  import { create } from "../core/records.js";
16
16
  import { phrase } from "../core/phrases.js";
17
- import { compareDocuments, compareReadings, checksHere, decide, decisionChange, decisionKeyOf, foundCount, estimateFix, fixCheck, fixEnv, fixStates, FIX_CHECKS, loadDocResult, byReading, defaultStage, readBefore, stagesOf, } from "./fixchecks.js";
17
+ import { compareDocuments, compareReadings, checksHere, decide, decisionChange, decisionKeyOf, foundCount, estimateFix, fixCheck, fixEnv, fixStates, FIX_CHECKS, loadDocResult, byReading, defaultStage, readBefore, readersOf, readsOf, fixModelText as modelText, fixTextValues as textValues, stagesOf, } from "./fixchecks.js";
18
18
  import { VERSION } from "../core/tree.js";
19
19
  import { applyNameRewrites, nameRewritesDone, undoNameRewrites } from "../core/participants.js";
20
20
  import { applyAppShapes, appShapesDone, undoAppShapes } from "../core/appshapefix.js";
@@ -26,7 +26,6 @@ import { Settings } from "../core/config.js";
26
26
  import { RUNNERS } from "../runners/index.js";
27
27
  import { loadReadings } from "./readings.js";
28
28
  import { pool } from "./read.js";
29
- import { BATCH } from "../core/reader.js";
30
29
  import { readerAgent } from "./readers.js";
31
30
  import { which } from "../core/which.js";
32
31
  /** Readings read first, to try it on. */
@@ -34,20 +33,6 @@ export const FIX_TRY = 3;
34
33
  /** Readings shown as examples. */
35
34
  const EXAMPLES = 5;
36
35
  export const FIX_ORIGIN = "fix:";
37
- /**
38
- * The places read together as their earlier reading read them: the images of one reading with the same question, part
39
- * and blindness are one strom read again (its batches as strom read makes them); a document alone.
40
- */
41
- function readsOf(items) {
42
- const out = new Map();
43
- for (const i of items) {
44
- const key = i.document ? `doc|${i.key}` : [i.reading, i.question, i.crop ?? "", i.blind ? "blind" : "", i.context ?? ""].join("|");
45
- out.set(key, [...(out.get(key) ?? []), i]);
46
- }
47
- return [...out.values()];
48
- }
49
- /** The readers the places take: a document read by two takes two; a reading of more images than a batch, more. */
50
- const readersOf = (items) => readsOf(items).reduce((n, g) => n + (g[0].document ? (g[0].readers ?? 1) : Math.ceil(g.length / BATCH)), 0);
51
36
  /** The reader of strom read here now: the agent asked (--agent, else the research's), its model for handwriting. */
52
37
  function readerNow(ctx, tree, model) {
53
38
  const agent = readerAgent(ctx, tree);
@@ -81,8 +66,6 @@ const stateText = (t, s) => s.state === "pending"
81
66
  : s.state === "nothing"
82
67
  ? t("ui.fixes.state.nothing")
83
68
  : t(`ui.fixes.state.${s.state}`, { date: s.decision.at.slice(0, 10) });
84
- /** "Claude Code · claude-opus-5-5" — "model unknown" where nothing says. */
85
- const modelText = (t, key) => (key === UNKNOWN_KEY ? t("ui.fixes.model.unknown") : calibrationLabel(key, t("ui.settings.model.own")));
86
69
  const REASONS = ["unclear", "differ", "conflict", "unconfirmed"];
87
70
  /** "3 readings (7 places)": the readings of these places and the places, always both. */
88
71
  const partText = (t, items) => t("ui.fixes.part", { readings: new Set(items.map((i) => i.reading)).size, count: items.length });
@@ -118,18 +101,6 @@ function exampleText(t, g) {
118
101
  estimated: g.some((x) => x.estimated) ? ` · ${t("ui.fixes.estimated")}` : "",
119
102
  });
120
103
  }
121
- /** What a check's texts say beside its counts: the version that fixed it; of new-model the models before and now. */
122
- function textValues(t, s) {
123
- const m = s.found.models;
124
- if (!m)
125
- return { since: s.check.since };
126
- return {
127
- since: s.check.since,
128
- now: modelText(t, m.now),
129
- before: m.before.map((b) => `${modelText(t, b.key)} (${t("ui.fixes.readings", { n: b.readings })})`).join(", "),
130
- newer: m.newer ? t("ui.fixes.new-model.newer") : "",
131
- };
132
- }
133
104
  /**
134
105
  * Many found, not all of them useful: what the narrower stages alone would take — the disputed readings, then with the
135
106
  * direct line (byReading puts them first).
@@ -834,7 +805,7 @@ register({
834
805
  personOnly(ctx, t, w.askUndo, set, "ui.fixes.person.decide");
835
806
  const key = decisionKeyOf(tree, check, fixEnv(ctx, tree));
836
807
  const r = tree.withTreeLock(() => {
837
- const done = w.undo(tree, decisionChange(key, "declined"));
808
+ const done = w.undo(tree, decisionChange(key, "declined", { undone: true }));
838
809
  tree.commit(w.undone(key, done.restored, done.left));
839
810
  return done;
840
811
  });
@@ -1,4 +1,4 @@
1
- // history status · map · region · add · page · local · retract · done — and the person's own redo · first · hide · show ·
1
+ // history status · map · adopt · region · add · page · local · retract · done — and the person's own redo · first · hide · show ·
2
2
  // skip · unskip · assign: what the
3
3
  // ancestors lived through (the experiment experiments.history, core/pastevents.ts). Behind its gate (hidden): runs
4
4
  // when named, shown nowhere until the Strom app shows the events. `strom history` alone stays what changed recently.
@@ -16,6 +16,7 @@ import { checkQuotes, cleanText, findPassages, mainQuote, pageParts, PageError,
16
16
  import { currentSession } from "../core/session.js";
17
17
  import { addLocalEvent, addRegionEvent, askFirst, assignPlace, checkKind, checkTexts, checkYears, deleteEvent, ensureRegion, factPlaceKey, hideEvent, historyAnswer, historyStatus, forGaps, forHistory, gapsOfTask, gapText, historyOrder, historyHeld, historyTurn, mapPlace, raiseHistoryTasks, markDone, donePeriod, noteTried, readCatalog, redoRegion, refuseBeforePage, REGION_LANGS, regionIdOk, regionOfTask, requireHistoryOn, requireRegionId, retractEvent, skipHistory, EVENT_KINDS, yearsToSearch, whoSees, readPlaces, inRegion, regionName, placeRecordOf, } from "../core/pastevents.js";
18
18
  import { addPlaceEvent, askPlace, refusePlaceAsk, ensurePlaceCatalog, markPlaceDone, factsByRecord, notePlaceTried, placeEstimate, placeKeyOf, placeLabel, placeOfTask, readPlaceCatalog, refusePlaceBeforePage, refusePlaceSame, requirePlace, setArea, yearsAt, } from "../core/placehistory.js";
19
+ import { adoptPlaces, regionArg } from "../core/placeadopt.js";
19
20
  // strom history list
20
21
  import { moreLine, paginate } from "../cli/format.js";
21
22
  import { displayName } from "../core/people.js";
@@ -239,6 +240,31 @@ register({
239
240
  const m = mapPlace(tree, key, { regions: links, also: listOpt(opts.also) });
240
241
  return { text: lines(...tree.written.map((o) => o.summary), missing.length && tree.dryRun ? `would make the region ${missing[0]}` : undefined), data: { place: key, map: m } };
241
242
  },
243
+ }, {
244
+ path: ["history", "adopt"],
245
+ summary: "Take the places of the facts another research on this computer maps surely the same; list those it maps where nothing tells",
246
+ group: "history",
247
+ tree: true,
248
+ writes: true,
249
+ hidden: true,
250
+ description: "For each place of the facts not mapped yet, the maps of the other researches on this computer are read (their place\n" +
251
+ "map and place records alone). Taken: the same name, the records agree (coordinates within 2 km, the same parish, the same\n" +
252
+ "district or county), every research that has it maps it the same, every region's catalog here. Suggested: a place of the\n" +
253
+ "name mapped elsewhere where nothing tells it is the same place, or the researches differ — strom history map decides.\n" +
254
+ "strom does it by itself before it raises the task of the places; --dry-run says what it would take.",
255
+ examples: ["strom history adopt --dry-run", "strom history adopt --json"],
256
+ run(ctx) {
257
+ const tree = agentWork(ctx, "strom history adopt");
258
+ requireHistoryOn(tree, ctx.settings);
259
+ const plan = adoptPlaces(tree, ctx.settings.shared()?.value, ctx.settings);
260
+ const regions = (rs) => rs.map(regionArg).join(", ");
261
+ const by = { coords: "the same coordinates", parish: "the same parish", district: "the same district" };
262
+ const take = tree.dryRun ? "would take" : "taken";
263
+ return {
264
+ text: lines(`${take} ${plan.taken.length} · suggested ${plan.suggested.length} · left ${plan.left.length}`, ...plan.taken.slice(0, ctx.limit).map((t) => ` ${take}: "${t.place}" → ${regions(t.regions)} (${by[t.by]})`), ...plan.suggested.slice(0, ctx.limit).map((p) => ` suggested: "${p.place}" → ${p.options.map((o) => regions(o.regions)).join(" | ")}${p.options.length > 1 ? " (the researches differ)" : " (nothing tells it is the same place)"} — strom history map decides`), plan.left.length ? ` left to map: ${plan.left.slice(0, ctx.limit).join(" · ")}${plan.left.length > ctx.limit ? " …" : ""}` : undefined),
265
+ data: plan,
266
+ };
267
+ },
242
268
  }, {
243
269
  path: ["history", "add"],
244
270
  summary: "An event of a region's history, from a page strom reads itself: the quoted words with the year must be on it",
@@ -22,6 +22,7 @@ import { systemNotice } from "../core/dialog.js";
22
22
  import { configDir, noLinks } from "../core/paths.js";
23
23
  import { startLive } from "../core/live.js";
24
24
  import { stateOf } from "../core/state.js";
25
+ import { fixCheck } from "./fixchecks.js";
25
26
  /** The researches here with this id — a copy of a research folder has its id too; the current one first. */
26
27
  function researchesWithId(ctx, id) {
27
28
  const current = ctx.settings.config.currentTree;
@@ -120,7 +121,8 @@ function refusedHere(ctx, root, link) {
120
121
  link.action === "research" ||
121
122
  link.action === "history" ||
122
123
  (link.action === "conflict" && link.do === "agent") ||
123
- (link.action === "task" && link.do === "chat");
124
+ (link.action === "task" && link.do === "chat") ||
125
+ (link.action === "fixes" && link.id !== undefined && fixCheck(link.id)?.remedy !== "rewrite");
124
126
  if (!forAgent)
125
127
  return undefined;
126
128
  const tree = Tree.open(root, ctx.env);
@@ -272,6 +274,11 @@ async function inTerminal(ctx, link) {
272
274
  const { placeSearch } = await import("../cli/menu-links.js");
273
275
  return end(await placeSearch(ctx, run, treeLang, root, link.place));
274
276
  }
277
+ case "fixes": {
278
+ // strom's fixes: shown here; set right or put back only on the person's word, asked by strom fixes itself
279
+ const { fixesDo } = await import("../cli/menu-links.js");
280
+ return end(await fixesDo(ctx, run, treeLang, root, link.id, link.do));
281
+ }
275
282
  }
276
283
  const named = "person" in link ? link.person : undefined;
277
284
  const person = named ? personOf(root, ctx, named) : undefined;
@@ -417,6 +424,8 @@ register({
417
424
  "strom-research://finish?tree=<id>&session=N0012 — the session at work asked to finish (strom session finish).\n" +
418
425
  "strom-research://archive?tree=<id>&host=www.example.org — the question about an archive's images (slowly, through the\n" +
419
426
  "browser, by hand), answered in the terminal as in the menu's What waits; the answer is never in the link.\n" +
427
+ "strom-research://fixes?tree=<id>[&id=street-places][&do=undo] — strom's fixes of the research (strom fixes), one of them\n" +
428
+ " shown, or what it set right to be put back: set right or put back only on the person's word in the terminal.\n" +
420
429
  "strom-research://update|sessions|setup?tree=<id> — strom update, the agent's sessions and their cost, strom setup.\n" +
421
430
  "strom-research://new?app=<the app's mark> — a tree of the app becomes a new research: named, made, the app hands the\n" +
422
431
  "tree to its bridge (?adopt=, GET/POST /adopt), taken in as leads, sent back to the app. Family trees here already:\n" +
@@ -13,8 +13,9 @@ import { UsageError } from "../core/errors.js";
13
13
  import { excerptSettings, planExcerpts } from "../core/excerpt.js";
14
14
  import { runGit, tracked } from "../core/git.js";
15
15
  import { Settings } from "../core/config.js";
16
- import { appKnowsArchive, appKnowsNoCouple, appShowsHypothesisLinks, appShowsReadings, appShowsOmittedImages, appDecidesConflicts, appOpensLinks, appReadsTitles, appShowsCoupleEvents, appShowsEdges, appShowsSourceReads, appShowsFactStatus, appShowsStoryDrafts, appTurnsExcerpts, appReadsSurnameGroups } from "../core/stromapp.js";
16
+ import { appKnowsArchive, appKnowsNoCouple, appShowsHypothesisLinks, appShowsReadings, appShowsOmittedImages, appDecidesConflicts, appOpensLinks, appReadsTitles, appShowsCoupleEvents, appShowsEdges, appShowsSourceReads, appShowsFactStatus, appShowsStoryDrafts, appTurnsExcerpts, appReadsSurnameGroups, appReadsLines } from "../core/stromapp.js";
17
17
  import { surnamesForExport } from "../core/surnames.js";
18
+ import { lineMarks } from "../core/lineages.js";
18
19
  import { EXCERPT_QUALITIES, EXCERPT_SCOPES } from "../core/model.js";
19
20
  import { ui } from "../cli/ui.js";
20
21
  import { isAgent } from "../core/which.js";
@@ -98,7 +99,9 @@ export function writeTreeGed(tree, opts) {
98
99
  const omitted = !!images && appShowsOmittedImages(new Settings(tree.env, {}), opts.stromVersion);
99
100
  // …and the groups of surname forms the user made one family and the suggestions rejected, for an app that reads them
100
101
  const surnameGroups = opts.for === "strom" && appReadsSurnameGroups(new Settings(tree.env, {}), opts.stromVersion) ? surnamesForExport(tree) : undefined;
101
- const result = exportGedcom(tree, { for: opts.for, ...(surnameGroups ? { surnameGroups } : {}), stromVersion: opts.stromVersion, ...(persons ? { persons } : {}), ...(images ? { excerpts: images.of } : {}), ...(clips ? { clips } : {}), ...(research ? { research } : {}), ...(edges ? { edges } : {}), ...(storyDrafts ? { storyDrafts } : {}), ...(coupleResi ? { coupleResi } : {}), ...(sourceReads ? { sourceReads } : {}), ...(factStatus ? { factStatus } : {}), ...(archive ? { archive } : {}), ...(turnsExcerpts ? { turnsExcerpts } : {}), ...(noCouple ? { noCouple } : {}), ...(titles ? { titles } : {}), ...(hypothesisLinks ? { hypothesisLinks } : {}), ...(conflictSides ? { conflictSides } : {}), ...(readings ? { readings } : {}), ...(omitted ? { omitted: images.omitted } : {}) });
102
+ // …and the bounds of a lineage the person set, for an app that keeps them
103
+ const lines = opts.for === "strom" && appReadsLines(new Settings(tree.env, {}), opts.stromVersion) ? lineMarks(tree) : undefined;
104
+ const result = exportGedcom(tree, { for: opts.for, ...(surnameGroups ? { surnameGroups } : {}), ...(lines ? { lines } : {}), stromVersion: opts.stromVersion, ...(persons ? { persons } : {}), ...(images ? { excerpts: images.of } : {}), ...(clips ? { clips } : {}), ...(research ? { research } : {}), ...(edges ? { edges } : {}), ...(storyDrafts ? { storyDrafts } : {}), ...(coupleResi ? { coupleResi } : {}), ...(sourceReads ? { sourceReads } : {}), ...(factStatus ? { factStatus } : {}), ...(archive ? { archive } : {}), ...(turnsExcerpts ? { turnsExcerpts } : {}), ...(noCouple ? { noCouple } : {}), ...(titles ? { titles } : {}), ...(hypothesisLinks ? { hypothesisLinks } : {}), ...(conflictSides ? { conflictSides } : {}), ...(readings ? { readings } : {}), ...(omitted ? { omitted: images.omitted } : {}) });
102
105
  const findings = validateGedcom(result.text, opts.for === "standard" ? { strict: true } : {});
103
106
  const file = opts.out ?? gedFile(tree, opts.for, opts.research);
104
107
  if (!hasGedErrors(findings) && !tree.dryRun) {
@@ -529,7 +529,7 @@ register({
529
529
  env: { ...withoutAgentMarks(env), STROM_NONINTERACTIVE: "1", STROM_READER: "1" },
530
530
  settingsFile,
531
531
  reader: true,
532
- readerFiles: { views: seen, report },
532
+ readerFiles: { views: seen, report, room: own },
533
533
  // without the user's own add-ons (skills, plugins, MCP servers) unless they said otherwise
534
534
  ...(ctx.settings.agentAddons(tree.config) ? {} : { clean: true }),
535
535
  timeoutMs: minutes * 60_000,
@@ -24,10 +24,14 @@ import { refuseInArchive } from "../core/state.js";
24
24
  * started with (strom run --agent, a conversation of another agent), else the tree's.
25
25
  */
26
26
  export function readerAgent(ctx, tree) {
27
- const said = ctx.settings.agent(tree.config);
27
+ return readerAgentOf(ctx.settings, ctx.env, tree);
28
+ }
29
+ /** The same without a command's context (the bridge): its settings and environment. */
30
+ export function readerAgentOf(settings, env, tree) {
31
+ const said = settings.agent(tree.config);
28
32
  if (said.source === "flag" || said.source === "env")
29
33
  return said.value;
30
- const s = currentSession(tree, ctx.env);
34
+ const s = currentSession(tree, env);
31
35
  return [s?.runner, s?.agent].find((a) => !!a && !!RUNNERS[a]) ?? said.value;
32
36
  }
33
37
  /**
@@ -151,7 +155,7 @@ export function readers(ctx, tree, shared, kind, first, opts, reportsAt, own = {
151
155
  env: { ...withoutAgentMarks(env), STROM_NONINTERACTIVE: "1", STROM_READER: "1" },
152
156
  settingsFile,
153
157
  reader: true,
154
- readerFiles: { views, report },
158
+ readerFiles: { views, report, room: own },
155
159
  // without the user's own add-ons (skills, plugins, MCP servers) unless they said otherwise
156
160
  ...(ctx.settings.agentAddons(tree.config) ? {} : { clean: true }),
157
161
  timeoutMs: limit.minutes * 60_000,
@@ -875,7 +875,9 @@ register({
875
875
  // Other agents may be at work in this tree (conversations): never their tasks.
876
876
  const others = othersAtWork(tree, tree.env, runnerId).tasks;
877
877
  // The tasks of history the experiment asks for (core/pastevents.ts), made before the queue is read.
878
- if (raiseHistoryTasks(tree, ctx.settings.shared()?.value, ctx.settings).length)
878
+ // (and the places another research on this computer maps so, taken: core/placeadopt.ts)
879
+ raiseHistoryTasks(tree, ctx.settings.shared()?.value, ctx.settings);
880
+ if (tree.uncommitted().length)
879
881
  commitNow(tree, "Tasks of the history of the places");
880
882
  // Working alone: now and then a story's turn (in a conversation the user leads); the tasks of history after the
881
883
  // research, and now and then one of them first — how often is experiments.historyPace (core/pastevents.ts
@@ -51,6 +51,7 @@ import { agentSettingsLine, chooseEffort } from "../cli/model-choice.js";
51
51
  import { calibrationKey, calibrationLabel, calibrationOffer, forgetCalibration, researchKey, sizesText, viewModel, viewSizesFor } from "../core/viewsizes.js";
52
52
  import { bookTuned, bookViewSizes, forgetTuning, keyTuningOf, readingOf, selfTune, treeTuning } from "../core/tune.js";
53
53
  import { loadAliases } from "../core/modelkey.js";
54
+ import { ownModel } from "../agents/models.js";
54
55
  import { EXIT, NeedsInputError, StromError, UsageError } from "../core/errors.js";
55
56
  import { worsenings } from "../core/tunereset.js";
56
57
  import { resetReading } from "../cli/tunereset.js";
@@ -439,6 +440,16 @@ function diagnoseInto(ctx, checks, t, add, progress) {
439
440
  const model = ctx.settings.models(chosen, tree).lead;
440
441
  if (model)
441
442
  add("model", "ok", model);
443
+ else {
444
+ // none chosen: the agent's own, when strom knows it is weak or refused — said with the command, never set here
445
+ // (the model is the person's choice); the code for a program (--json)
446
+ const own = ownModel(chosen, ctx.env, tree ? loadAliases(rootHere(ctx)) : undefined);
447
+ if (own && (own.refused || own.weak)) {
448
+ const why = own.refused ? "refused" : "weak";
449
+ add("model", "warn", t(`ui.doc.model.own.${why}`, { agent: PROFILES[chosen]?.name ?? chosen, model: own.model }), placeholders(lang, "strom config set model.lead <model>"));
450
+ checks.at(-1).code = `model.own.${why}`;
451
+ }
452
+ }
442
453
  // the size of the scan views: the defaults, a calibration of this agent and model, or one of another (offered again)
443
454
  const views = viewSizesFor(ctx.settings, chosen, tree, undefined, tree ? rootHere(ctx) : undefined);
444
455
  const offer = calibrationOffer(ctx.settings, chosen, tree, tree ? rootHere(ctx) : undefined);
@@ -732,8 +743,12 @@ register({
732
743
  ctx.settings.save();
733
744
  const inst = installation();
734
745
  // npm's strom is npm's to update: its tag of the channel
735
- if (to && inst.kind === "npm")
746
+ // (and kept: npm keeps no word of its tag, and its beta moves to each release too — the channel holds for a release)
747
+ if (to && inst.kind === "npm") {
748
+ ctx.settings.config.npmChannel = to;
749
+ ctx.settings.save();
736
750
  return { text: t("ui.update.npm.channel", { tag: to === "beta" ? "beta" : "latest" }), data: { current: VERSION, latest: newest, channel: to, npm: true } };
751
+ }
737
752
  // another channel: its newest version, an older one too (back from a beta); the installer's only
738
753
  const switching = !!to && inst.kind === "installed";
739
754
  // The installer's Node: the newest release of its line (security fixes) is taken along.
@@ -163,7 +163,7 @@ register({
163
163
  { name: "language", type: "string", value: "<code>", description: "language of the record, e.g. la, de, cs" },
164
164
  { name: "information", type: "string", value: "<kind>", description: "primary (eyewitness), secondary, unknown (default)" },
165
165
  { name: "form", type: "string", value: "<form>", description: "original (default), derivative (copy, index — the default for --kind index and in a record set of kind index only), authored (compiled work)" },
166
- { name: "url", type: "string", value: "<url>", description: "link to the image or catalog entry" },
166
+ { name: "url", type: "string", value: "<url>", description: "link to the record: the lasting address of its page in the archive's viewer (a permalink, not the image's own address), else the catalog entry — the Strom app links it" },
167
167
  { name: "media", type: "string", multiple: true, value: "<M…|B…:n>", description: "the registered image(s) the record is on (repeatable)" },
168
168
  {
169
169
  name: "clip",
@@ -94,6 +94,12 @@ function changeLine(tree, c, incoming, lang, readings) {
94
94
  const p = tree.get(key);
95
95
  return p ? `${(p.names[0] ? `${p.names[0].given} ${p.names[0].surname}` : key).trim()} [${key}]` : key;
96
96
  };
97
+ // a person's bound of a lineage the user set in the app (core/lineages.ts)
98
+ if (c.line) {
99
+ const key = c.line.mark === "FOUNDER" ? "ui.sync.lineage.founder" : c.line.mark === "NOCARRY" ? "ui.sync.lineage.nocarry" : "ui.sync.lineage.none";
100
+ const does = c.takenBack ? "ui.sync.do.taken" : c.action === "report" ? "ui.sync.do.surname.report" : "ui.sync.do.lineage";
101
+ return `${ui(lang, key, { n: c.n, name: name(c.person) })} → ${ui(lang, does)}`;
102
+ }
97
103
  const who = c.partners ? c.partners.map(name).join(" & ") || c.family || "?" : name(c.person);
98
104
  // a partner in their age: the given name
99
105
  const short = (key) => (key.startsWith("x:") ? name(key) : (tree.get(key)?.names[0]?.given ?? key));
package/dist/core/age.js CHANGED
@@ -71,8 +71,9 @@ export function normalizeAge(input) {
71
71
  const word = WORDS[raw.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase()];
72
72
  if (word)
73
73
  return word;
74
+ // "05y" as the research had it is the app's "5y": a number without its leading zeros (its units of nothing stay, "0y 2m")
74
75
  if (isGedcomAge(raw))
75
- return raw;
76
+ return raw.replace(/\d+/g, (n) => String(Number(n)));
76
77
  let rest = plainFractions(raw.replace(/,(?!\d)/g, " ")).trim();
77
78
  let sign = "";
78
79
  if (/^[<>]/.test(rest)) {
@@ -432,6 +432,19 @@ export function changeLines(tree, ops, subject, lang, was, tasks) {
432
432
  say(kind === "undo" ? phrase(lang, "log.surname.undo") : kind in { group: 1, ungroup: 1, reject: 1, unreject: 1 } ? phrase(lang, k, { forms: short(forms, 120) }) : changed(o));
433
433
  continue;
434
434
  }
435
+ // the bound of a lineage the person set in the Strom app (quality/lineages.json): the person by name, never the summary
436
+ if (o.op === "lineage.set" || o.op === "lineage.undo") {
437
+ const m = /^(\S+) (begins a lineage|carries no lineage|lineage as computed)/u.exec(o.summary);
438
+ const person = who(o.targets[0] ?? m?.[1]);
439
+ say(o.op === "lineage.undo"
440
+ ? phrase(lang, "log.lineage.undo", { who: person })
441
+ : m?.[2] === "begins a lineage"
442
+ ? phrase(lang, "log.lineage.founder", { who: person })
443
+ : m?.[2] === "carries no lineage"
444
+ ? phrase(lang, "log.lineage.nocarry", { who: person })
445
+ : phrase(lang, "log.lineage.none", { who: person }));
446
+ continue;
447
+ }
435
448
  // the names of participants set apart from their notes by strom's fix, or put back (quality/participant-names.json)
436
449
  if (o.op === "participant.fix" || o.op === "participant.unfix") {
437
450
  const n = /: (\d+) in /u.exec(o.summary)?.[1] ?? String(o.targets.length);
@@ -11,6 +11,7 @@ import { clipText, inputPath, sharperPart } from "./media.js";
11
11
  import { kinship } from "./kin.js";
12
12
  import { convertedDir, readableFile } from "./readable.js";
13
13
  import { Settings } from "./config.js";
14
+ import { excerptPage } from "./scanlink.js";
14
15
  import { crop, resize, toGrey, upright } from "../image/image.js";
15
16
  import { decodeImage, encodeImage, exifOrientation, imageSize } from "../image/index.js";
16
17
  /** From the sharpest down: the quality asked for is where it starts; over the limit, it goes further down. */
@@ -450,7 +451,7 @@ export function fullExcerpt(tree, shared, s, mark) {
450
451
  const region = sharper?.crop ?? wanted;
451
452
  const file = path.join(shared, src.file);
452
453
  if (!fs.existsSync(file)) {
453
- const url = m.url ?? src.url;
454
+ const url = excerptPage(m.url ?? src.url, s);
454
455
  return url ? { url } : { missing: "scan" };
455
456
  }
456
457
  const key = crypto.createHash("sha256").update(JSON.stringify({ sha: src.sha, region, full: 1 })).digest("hex").slice(0, 16);