strom-research 1.35.0 → 1.36.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 (59) hide show
  1. package/CHANGELOG.cs.md +45 -0
  2. package/CHANGELOG.de.md +53 -0
  3. package/CHANGELOG.md +48 -0
  4. package/CHANGELOG.pl.md +47 -0
  5. package/assets/lang/cs.json +47 -5
  6. package/assets/lang/de.json +47 -5
  7. package/assets/lang/pl.json +46 -4
  8. package/assets/plugins/gates/claude-usage/gate.ts +94 -16
  9. package/dist/cli/help.js +2 -2
  10. package/dist/cli/menu-links.js +58 -11
  11. package/dist/cli/menu-settings.js +19 -0
  12. package/dist/cli/menu-waiting.js +50 -1
  13. package/dist/cli/ui.js +41 -5
  14. package/dist/commands/analysis.js +20 -1
  15. package/dist/commands/guide.js +4 -1
  16. package/dist/commands/index.js +1 -0
  17. package/dist/commands/intake.js +32 -9
  18. package/dist/commands/links.js +10 -6
  19. package/dist/commands/media.js +166 -32
  20. package/dist/commands/setup.js +6 -0
  21. package/dist/commands/sourceretract.js +139 -0
  22. package/dist/commands/sources.js +42 -13
  23. package/dist/commands/sync.js +5 -3
  24. package/dist/commands/tasks.js +37 -9
  25. package/dist/commands/verify.js +7 -4
  26. package/dist/core/actions.js +11 -9
  27. package/dist/core/busy.js +9 -0
  28. package/dist/core/changelog.js +17 -0
  29. package/dist/core/config.js +7 -0
  30. package/dist/core/evidence.js +16 -0
  31. package/dist/core/import.js +9 -3
  32. package/dist/core/inboxwait.js +133 -15
  33. package/dist/core/inboxwatch.js +5 -4
  34. package/dist/core/links.js +13 -2
  35. package/dist/core/live.js +368 -33
  36. package/dist/core/material.js +12 -5
  37. package/dist/core/materialdelete.js +97 -23
  38. package/dist/core/media.js +4 -0
  39. package/dist/core/origin.js +16 -6
  40. package/dist/core/phrases.js +6 -0
  41. package/dist/core/queue.js +12 -4
  42. package/dist/core/report.js +1 -1
  43. package/dist/core/samescan.js +359 -0
  44. package/dist/core/sort.js +1 -1
  45. package/dist/core/sourcefields.js +16 -0
  46. package/dist/core/sourceretract.js +531 -0
  47. package/dist/core/sync.js +152 -7
  48. package/dist/core/taskaudit.js +104 -6
  49. package/dist/core/taskkind.js +58 -0
  50. package/dist/core/tree.js +1 -1
  51. package/dist/core/verify.js +12 -6
  52. package/dist/core/verifyfacts.js +7 -0
  53. package/dist/core/waiting.js +22 -3
  54. package/dist/core/waitkept.js +2 -0
  55. package/dist/gedcom/export.js +32 -9
  56. package/dist/gedcom/validate.js +8 -3
  57. package/dist/image/index.js +6 -3
  58. package/dist/image/jpeg-decode.js +80 -21
  59. package/package.json +4 -1
@@ -56,7 +56,7 @@ const NO_REPLY_DAYS = 30;
56
56
  /** The sections, in the order of the app's chips. */
57
57
  const SECTIONS = ["decide", "images", "letter", "family", "web", "other"];
58
58
  /** The kinds a word is said for (anything else: "other"). */
59
- const KINDS = ["images", "letter", "family", "web", "check", "permission", "takeover", "milder", "story", "send", "tune", "conflict", "hypothesis", "place", "branch", "proven", "transcript", "other"];
59
+ const KINDS = ["images", "letter", "family", "web", "check", "permission", "takeover", "milder", "story", "send", "tune", "aside", "conflict", "hypothesis", "place", "branch", "proven", "transcript", "other"];
60
60
  /** Everything that waits for the person here, in the order of What waits: the app's items and the terminal's own. */
61
61
  export function waitingHere(ctx, tree) {
62
62
  return waitingFor(tree, {
@@ -72,6 +72,8 @@ export function waitingHere(ctx, tree) {
72
72
  hypothesesOpen: ctx.settings.hypothesesDecide(tree.config) === "person",
73
73
  // the questions about the reading of scans: an archive asks none
74
74
  ...(isArchive(tree) ? {} : { tune: ctx.settings }),
75
+ // the files of the inbox set aside: which one is the image
76
+ aside: true,
75
77
  });
76
78
  }
77
79
  /**
@@ -557,6 +559,8 @@ async function decide(ctx, run, lang, root, w) {
557
559
  return void (await decideSent(ctx, run, lang, root, w.send));
558
560
  if (w.tune)
559
561
  return decideTune(ctx, run, lang, w.tune);
562
+ if (w.aside)
563
+ return decideAside(ctx, run, lang, root, w.aside);
560
564
  if (w.task?.proposal)
561
565
  return void (await decideTranscript(ctx, run, lang, root, w.task.id));
562
566
  const tree = Tree.open(root, ctx.env);
@@ -1133,3 +1137,48 @@ async function decideTune(ctx, run, lang, q) {
1133
1137
  if (q.kind === "views.smaller" && choice === "calibrate")
1134
1138
  await run(["media", "calibrate"]);
1135
1139
  }
1140
+ /**
1141
+ * A file of a book's folder of the inbox set aside (B0408, B0374): the two shown to compare, then which one is the
1142
+ * image — the one registered kept (the file into the system's trash), the file taken as the image of its number (the one
1143
+ * there withdrawn, kept), or as another image of the book (its number typed). The same file as another image: which of
1144
+ * the two numbers is right is the research's to sort out; the file may go.
1145
+ */
1146
+ async function decideAside(ctx, run, lang, root, a) {
1147
+ const t = translator(lang);
1148
+ const out = (s) => ctx.io.stdout(`${s}\n`);
1149
+ const tree = Tree.open(root, ctx.env);
1150
+ const shared = ctx.settings.shared()?.value;
1151
+ const m = tree.get(a.media);
1152
+ const image = a.image ?? "?";
1153
+ out(["", ` ${t(a.kind === "same" ? "ui.waiting.aside.same" : "ui.waiting.aside.other", { file: a.name, book: a.recordset, image, media: a.media })}`, ` ${a.path}`].join("\n"));
1154
+ const compare = () => {
1155
+ openForUser(a.path, ctx.env);
1156
+ if (m && shared)
1157
+ openForUser(path.join(shared, m.file), ctx.env);
1158
+ };
1159
+ const choices = [{ label: t("ui.aside.compare"), act: compare }];
1160
+ if (a.kind === "other") {
1161
+ choices.push({ label: t("ui.aside.keep", { image }), act: () => run(["media", "aside", a.file, "--discard"]) });
1162
+ if (a.image !== undefined)
1163
+ choices.push({ label: t("ui.aside.take", { image }), act: () => run(["media", "aside", a.file, "--take"]) });
1164
+ choices.push({
1165
+ label: t("ui.aside.number"),
1166
+ act: async () => {
1167
+ const n = (await ctx.ask(t("ui.aside.number.ask"))).trim();
1168
+ if (!/^\p{Nd}+$/u.test(n))
1169
+ return;
1170
+ return run(["media", "aside", a.file, `--image=${Number(n)}`]);
1171
+ },
1172
+ });
1173
+ }
1174
+ else
1175
+ choices.push({ label: t("ui.aside.discard"), act: () => run(["media", "aside", a.file, "--discard"]) });
1176
+ for (;;) {
1177
+ const i = await ctx.choose("", choices, choices.length, { back: t("ui.browse.back") });
1178
+ if (i === undefined)
1179
+ return;
1180
+ await choices[i].act();
1181
+ if (i > 0 || !fs.existsSync(a.path))
1182
+ return;
1183
+ }
1184
+ }
package/dist/cli/ui.js CHANGED
@@ -178,7 +178,11 @@ export const UI = {
178
178
  "ui.consent.sort": "Sort {n, plural, one {# file} other {# files}} of the material by readers of the research: a title, date, kind and places in the tree proposed for each, nothing written. Paid readings (about {readings, plural, one {# reading} other {# readings}} of the agent). Start?",
179
179
  "ui.consent.sort.no": "Nothing sorted.",
180
180
  "ui.consent.delete": "Delete {n, plural, one {# file} other {# files}} of the material for good: the record of each and its places in the family tree go; a source made of one keeps its text and citations. It cannot be undone in the Strom app – a file stays only in earlier backups of the research. Delete for good?",
181
+ "ui.consent.delete.sources": "First the sources made of them are deleted: {list} – their citations go from the facts (the values stay); they can be restored, without the file (strom source restore).",
181
182
  "ui.consent.delete.no": "Nothing deleted.",
183
+ "ui.consent.retract": "Withdraw {list} from the research: {cites, plural, one {# citation goes} other {# citations go}} from the facts (the values stay; facts less sure: {lowered}), {stories, plural, one {# story no longer lists it} other {# stories no longer list it}}. It can be restored later (strom source restore). Withdraw?",
184
+ "ui.source.retract.would": "Would withdraw {name} [{id}]: {cites, plural, one {# citation} other {# citations}}, {stories, plural, one {# story} other {# stories}}; left with no source: {bare}; less sure: {lowered}; tasks: {tasks}; conflicts to review: {conflicts}. Nothing written.",
185
+ "ui.source.restore.skipped": "{n, plural, one {# citation not put back} other {# citations not put back}} (the fact is gone, or cites it already)",
182
186
  "ui.views.estimate": "{n, plural, one {# image} other {# images}} of {books, plural, one {# book} other {# books}}, {readers} readings at {sizes} px, about {cost} — started by a person: strom media calibrate",
183
187
  "ui.views.offer": "the reading of scans was tuned for {before}, not yet for {now}: strom media calibrate (started by a person; paid model work)",
184
188
  "ui.views.progress": "▶ {what} · {size} px · images: {n}",
@@ -233,6 +237,15 @@ export const UI = {
233
237
  "ui.tune.q.c.keep": "Keep it",
234
238
  "ui.o.tune": "{n, plural, one {# question about reading them waits} other {# questions about reading them wait}} for a person's decision: strom media calibrate --questions",
235
239
  "ui.waiting.tune": "A question about the reading of scans: {text}",
240
+ "ui.waiting.aside.same": "{file}: saved as image {image} of {book}, the same scan as {media} under another number — one of the two numbers is wrong",
241
+ "ui.waiting.aside.other": "{file}: another scan than image {image} of {book} ({media}) — which one is image {image}?",
242
+ "ui.wait.kind.aside": "a saved image",
243
+ "ui.aside.compare": "Open both to compare",
244
+ "ui.aside.keep": "Image {image} stays as it is (the file into the trash)",
245
+ "ui.aside.take": "The new file is image {image} (the one there withdrawn, kept)",
246
+ "ui.aside.number": "The new file is another image of the book: its number",
247
+ "ui.aside.number.ask": "Image number:",
248
+ "ui.aside.discard": "The file into the trash (which number is right is sorted out in the research)",
236
249
  "ui.tune.title": "Reading of scans · {agent} · {days, plural, one {# day} other {# days}} since {since} — from this research's own records, free",
237
250
  "ui.tune.none": "Reading of scans · {agent}: nothing measured yet — the figures come from the sessions of strom run and the readers of strom read.",
238
251
  "ui.tune.noscans": "Reading of scans · {agent}: no scans read here yet (sessions {sessions}).",
@@ -1228,6 +1241,7 @@ export const UI = {
1228
1241
  "ui.help.cmd.offline.set": "How one branch off the lines is taken: its own way, added to a line, or as the whole tree says",
1229
1242
  "ui.help.cmd.offline.answer": "Answer what is proposed for a branch that grew: add it to a line, leave it, or not research it",
1230
1243
  "ui.help.cmd.conflict.leave": "Leave a conflict of an edit made in the Strom app to the agent to decide",
1244
+ "ui.help.cmd.conflict.keep": "Keep a decision as it is though a source it stood on was deleted: its mark of review taken off",
1231
1245
  "ui.help.cmd.event.main": "Choose the record shown first with a fact (its main citation), or cancel the choice",
1232
1246
  "ui.help.cmd.event.revert": "Put a fact back as the imported family tree gave it",
1233
1247
  "ui.help.cmd.person.revert": "Put a name or sex back as the imported family tree gave it",
@@ -1251,6 +1265,8 @@ export const UI = {
1251
1265
  "ui.help.cmd.place.answer": "Answer the research's question about a place",
1252
1266
  "ui.help.cmd.place.undo": "Undo a step on places: an answer, a name taken off",
1253
1267
  "ui.help.cmd.source.split": "Split where the older sources' entries stand into folio and image: a preview, then one step that can be undone",
1268
+ "ui.help.cmd.source.retract": "Delete a source in the research: its citations kept in it, what it takes said first, to be put back later",
1269
+ "ui.help.cmd.source.restore": "Put back a deleted source with its citations (strom source list --retracted lists the deleted ones)",
1254
1270
  "ui.help.cmd.hypothesis.decide": "Decide an uncertain connection (a hypothesis) by one of its variants, with a reason",
1255
1271
  "ui.help.cmd.connector.add": "Install a downloader for an archive from a folder or a git address",
1256
1272
  "ui.help.cmd.connector.remove": "Remove a downloader for an archive, its consent with it",
@@ -1856,6 +1872,10 @@ export const UI = {
1856
1872
  "ui.sync.do.uncite.kept": "not written: what a fact no longer cites only the user decides",
1857
1873
  "ui.sync.do.cite.olderApp": "nothing changes: this Strom app does not say a citation was removed — the research keeps it",
1858
1874
  "ui.sync.do.cite.sourceRemoved": "nothing changes: the research keeps the source and what cites it",
1875
+ "ui.sync.source.retract": "{n}. deleted in the Strom app: {sources}",
1876
+ "ui.sync.do.source.retract": "deleted in the research too, its citations kept in it (strom source restore puts it back)",
1877
+ "ui.sync.do.source.retract-skipped": "nothing deleted: the research keeps the source",
1878
+ "ui.sync.do.source.retracted": "not written: the source was deleted",
1859
1879
  "ui.sync.do.cite.notCarried": "nothing changes: the research keeps the citation",
1860
1880
  "ui.sync.do.fact.noMatch": "not written: the fact it was chosen at is not the research's as it is",
1861
1881
  "ui.sync.do.event.retracted": "not written: the research has taken this fact back since (nothing of it comes back to the app)",
@@ -2137,6 +2157,13 @@ export const UI = {
2137
2157
  "ui.phone.page.lines.off": "Nobody researches this tree now: the lines stay as they are.",
2138
2158
  "ui.settings.phone": "Phone connection (photos from a phone into the research on the local network): {state}",
2139
2159
  "ui.settings.hypotheses": "Who decides the hypotheses: {state}",
2160
+ "ui.settings.runconfirm": "Starting the agent from the Strom app: {state}",
2161
+ "ui.runconfirm.ask": "asked first",
2162
+ "ui.runconfirm.no": "without the question",
2163
+ "ui.runconfirm.pick": "Starting the agent from the Strom app (a conversation, a task, the work on the queue, the identification of places) — on the subscription or AI credit:",
2164
+ "ui.runconfirm.choice.ask": "Ask before it starts (default)",
2165
+ "ui.runconfirm.choice.no": "Start without the question",
2166
+ "ui.runconfirm.about": "Without the question, what the Strom app asks for starts at once and one line in the terminal says so. Still asked: a question with a price in money, consents of archives, deletions, a request sent, and the condition of working alone. For every research on this computer.",
2140
2167
  "ui.settings.phone.on": "on, paired phones: {n}",
2141
2168
  "ui.settings.phone.error": "on, unreachable",
2142
2169
  "ui.phone.menu.off": "Turn the phone connection off (the paired phones stay paired)",
@@ -2332,6 +2359,7 @@ export const UI = {
2332
2359
  "ui.run.loop": "Let it work on while there is work and the condition “{name}” allows it",
2333
2360
  "ui.consent.gate.set": "Let the condition “{name}” decide when the agent working alone goes on?",
2334
2361
  "ui.consent.gate.unset": "Remove the condition “{name}” — the agent working alone no longer asks it?",
2362
+ "ui.consent.run.confirm": "Start the agent from the Strom app's links without the question first? It works on the subscription or AI credit of its account; what says a price in money, consents and the condition of working alone still ask.",
2335
2363
  "ui.consent.gate.skip": "Let the agent work on its own without the condition “{name}”?",
2336
2364
  "ui.run.browser.always": "· the browser (Claude in Chrome) in every session, as set (agent.browser always) — without asking for {hosts}; Chrome with the Claude extension must be running",
2337
2365
  "ui.consent.browser": "Give the agent browser tools (Claude in Chrome) in every research session? It works in the Chrome of this computer — with its sign-ins — for the sites of the research's archives without asking; in a conversation it asks about any other site.",
@@ -2380,6 +2408,7 @@ export const UI = {
2380
2408
  "ui.link.noterminal.new": "strom could not open a terminal window. Start {strom}, then try again from the Strom app.",
2381
2409
  "ui.link.asks": "The Strom app asks for: {what}\nResearch: {name}",
2382
2410
  "ui.link.go": "Go on?",
2411
+ "ui.link.noconfirm": "▶ Started without the question (research {name}): {what}. The question before the agent starts is turned on in Settings → 1 → “Starting the agent from the Strom app”, or strom config unset run.confirm.",
2383
2412
  "ui.link.cost": "The agent works on the subscription or AI credit of its account.",
2384
2413
  "ui.link.tasks": "The research writes tasks for the agent — nothing is searched and nothing is paid now.",
2385
2414
  "ui.link.what.chat": "a conversation with the agent ({agent}) about the research.",
@@ -2643,6 +2672,7 @@ export const UI = {
2643
2672
  "ui.input.delete.kept.sameAs": "{id}: the file stays on the disk – the same file is {same}",
2644
2673
  "ui.input.delete.kept.otherResearch": "{id}: the file stays on the disk – another research on this computer has the same file",
2645
2674
  "ui.input.delete.source": "{source} without its file {id} – its text and citations stay",
2675
+ "ui.input.delete.retracted": "{source} deleted with its file – strom source restore puts it back, without the file",
2646
2676
  "ui.input.delete.images": "{source} without {n, plural, one {# image} other {# images}} of a file deleted",
2647
2677
  "ui.input.delete.task.without": "task {task} – without {files} (deleted)",
2648
2678
  "ui.input.delete.task.dropped": "task {task} dropped – its files are deleted ({files})",
@@ -2973,7 +3003,7 @@ export const UI = {
2973
3003
  "ui.sent.discarded.app": "The Strom app shows the send as thrown away; the edits stay in it and can be sent again.",
2974
3004
  "ui.trees.pack": "pack \"{name}\" to send to someone (a ZIP file)",
2975
3005
  "ui.trees.unpack": "a family tree from someone else (a ZIP file)",
2976
- "ui.pack.which": "Which images go along?",
3006
+ "ui.pack.which": "Which archive scans go along? (the family's photos and originals always go, all of them)",
2977
3007
  "ui.pack.opt.records": "the ones its records stand on — {size} (the pages searched through the archive gives again)",
2978
3008
  "ui.pack.opt.all": "all of them — {size}",
2979
3009
  "ui.pack.done": "Packed \"{name}\": {file} ({size})",
@@ -2982,10 +3012,10 @@ export const UI = {
2982
3012
  "ui.pack.images.all": " archive scans: all {n} ({size})",
2983
3013
  "ui.pack.family": " the family's photos and originals: {n} ({size}) — all of them, nobody can fetch them again",
2984
3014
  "ui.pack.batches": " {n, plural, one {# batch} other {# batches}} from the Strom app (name, people, note)",
2985
- "ui.pack.left": " left out: {n, plural, one {# image} other {# images}} ({size}) — pages searched through; strom fetches them from the archive again when they are needed",
3015
+ "ui.pack.left": " left out: {n, plural, one {# archive scan} other {# archive scans}} ({size}) — pages searched through; strom fetches them from the archive again when they are needed",
2986
3016
  "ui.pack.connectors": " connectors: {list}",
2987
- "ui.pack.noconnector": "⚠ some images left out came through a connector that is not on this computer — nobody could fetch them again: strom pack --all-images",
2988
- "ui.pack.missing": "⚠ {n, plural, one {# image the family tree names is} other {# images the family tree names are}} not on this computer — not in the package",
3017
+ "ui.pack.noconnector": "⚠ some scans left out came through a connector that is not on this computer — nobody could fetch them again: strom pack --all-images",
3018
+ "ui.pack.missing": "⚠ {n, plural, one {# archive scan the family tree names is} other {# archive scans the family tree names are}} not on this computer — not in the package",
2989
3019
  "ui.pack.send": "Send the file. The one who gets it unpacks it and double-clicks Windows.cmd or macOS.command inside: strom is installed where it is missing and the research opens (with strom already: strom unpack \"<the file>\").",
2990
3020
  "ui.pack.readme.file": "HOW-TO-CONTINUE.txt",
2991
3021
  "ui.pack.readme": "The research \"{name}\" - how to go on with it\n=============================================\n\n1. Unpack the whole ZIP file: on Windows right click it - Extract All; on a Mac double click it.\n\n2. In the unpacked folder start, by a double click:\n Windows: Windows.cmd\n macOS: macOS.command (the first time: right click - Open; when macOS refuses:\n System Settings - Privacy & Security - Open Anyway)\n Linux: in a terminal: bash Linux.sh\n It installs Strom Research where it is not yet (the official installer), puts the\n research in place - the family tree among the others, the images into the shared folder,\n all of it checked - takes it over on this computer and opens strom.\n\n3. Go on: in strom's menu, the conversation with the agent.\n\nWithout the launchers: install strom by hand\n Windows (PowerShell): {win}\n macOS, Linux (Terminal): {unix}\nthen: strom unpack \"<this ZIP file>\" (type strom unpack and a space, drag the file into\nthe terminal, press Enter) - or in strom's menu: another family tree - a family tree from someone else.\n\nThe images the records stand on and the family's own photos and originals are in the package. The other pages of the books\n(searched through, nothing found on them) are not, for size - strom fetches them from\nthe archive again when they are needed.\n",
@@ -3015,7 +3045,7 @@ export const UI = {
3015
3045
  "ui.remove.person": "only the person at the computer takes a family tree off it",
3016
3046
  "ui.remove.busy": "somebody is at work on \"{name}\" right now — it can go once the work is over",
3017
3047
  "ui.remove.what": "\"{name}\" ({root}) · people: {persons}",
3018
- "ui.remove.backup": "Pack it first as a backup, with all its images ({size})? It comes back any time with strom unpack.",
3048
+ "ui.remove.backup": "Pack it first as a backup, with all its archive scans, family photos and originals ({size})? It comes back any time with strom unpack.",
3019
3049
  "ui.remove.backup.done": " backup: {file}",
3020
3050
  "ui.remove.images": "Into the trash too the archive scans no other family tree uses ({n}, {size})?",
3021
3051
  "ui.remove.family": "Into the trash too the family's photos and originals no other family tree uses ({n}, {size})? Nobody can fetch them again.",
@@ -3573,6 +3603,11 @@ export const UI = {
3573
3603
  "ui.link.work.gate.once": "Condition: {gate} — asked once, before the first session; when it would not start, the question comes here.",
3574
3604
  "ui.link.work.gate.none": "Condition: none (setting run.gate).",
3575
3605
  "ui.link.work.empty": "Nothing waits in the queue. Nothing was started.",
3606
+ "ui.link.what.work.picked": "the agent working alone on {n, plural, one {# task} other {# tasks}} named by the Strom app",
3607
+ "ui.link.work.picked.head": "These tasks, in this order:",
3608
+ "ui.link.work.picked": "One session for each task ({n, plural, one {# session} other {# sessions}}), then it ends; what is not finished goes back to the queue.",
3609
+ "ui.link.work.picked.gone": "{n, plural, one {# task} other {# tasks}} of the link no longer {n, plural, one {waits} other {wait}} (done, taken back or held by another): left out.",
3610
+ "ui.link.work.picked.none": "None of the tasks of the link waits any more. Nothing was started.",
3576
3611
  "ui.link.work.busy": "Work already goes on in this research (runs: {runs}, sessions: {sessions}). Nothing more was started.",
3577
3612
  "ui.link.work.nogate": "Automatic work runs only under a condition (setting run.gate): before each session it says whether to go on, wait or stop. Without one, nothing starts by itself.",
3578
3613
  "ui.link.work.instead": "Instead:",
@@ -3804,6 +3839,7 @@ export const UI = {
3804
3839
  "ui.verify.bulk.queued": "{people, plural, one {# person} other {# people}}, {facts, plural, one {# fact} other {# facts}} to verify against the originals — after the lines' work, now and then one first",
3805
3840
  "ui.verify.bulk.would": "To verify against the originals: {people, plural, one {# person} other {# people}}, {facts, plural, one {# fact} other {# facts}} (nothing written yet)",
3806
3841
  "ui.verify.bulk.search": "of them {n, plural, one {# fact} other {# facts}} of an imported family tree with no original read: the record looked for first (dearer)",
3842
+ "ui.verify.bulk.first": "{people, plural, one {# person} other {# people}}, {facts, plural, one {# fact} other {# facts}} to verify against the originals — a try, first in the queue: the next session takes it",
3807
3843
  "ui.verify.bulk.left": "{n, plural, one {# more person} other {# more people}} of the scope left for later",
3808
3844
  "ui.verify.confirmed": "{fact} confirmed against the scan.",
3809
3845
  "ui.verify.unconfirmed": "{fact}: the confirmation against the scan taken back.",
@@ -26,6 +26,7 @@ import { yearsOption, yearsOverlap } from "../core/years.js";
26
26
  import { searchedAs } from "../core/evidence.js";
27
27
  import { refuseNegativeOverUnclear } from "./readings.js";
28
28
  import { hypothesisPeople } from "../core/directions.js";
29
+ import { keepConflict } from "../core/sourceretract.js";
29
30
  import { BIG_BRANCH, branchJoined } from "../core/kin.js";
30
31
  function written(tree) {
31
32
  return lines(...tree.written.map((o) => opLine(tree, o)));
@@ -710,7 +711,8 @@ register({
710
711
  const earlier = again ? [makeNote(tree, truncate(`earlier decided${again.decidedBy ? ` by the ${again.decidedBy}` : ""}${again.taken ? ` (the ${again.taken === "user" ? "user's" : "research's"} value)` : ""}: ${again.resolution ?? ""} — ${again.reasoning ?? ""}`, 480))] : [];
711
712
  const newer = again && sources.length ? [makeNote(tree, truncate(`decided again on ${sources.join(", ")}: ${reason}`, 480))] : [];
712
713
  return update(tree, id, "conflict", (c) => {
713
- const { taken: _t, decidedIn: _i, ...rest } = c;
714
+ // decided (again): a mark of review of a source deleted goes (spec 117 K1.7)
715
+ const { taken: _t, decidedIn: _i, review: _r, ...rest } = c;
714
716
  return { ...rest, state: "resolved", resolution, reasoning: String(opts.reasoning), decidedBy: by, ...(inApp ? { decidedIn: "app" } : {}), decidedAt: new Date().toISOString(), ...(side ? { taken: side } : {}), notes: [...c.notes, ...earlier, ...newer] };
715
717
  }, {
716
718
  op: "conflict.resolve",
@@ -749,6 +751,23 @@ register({
749
751
  const x = update(tree, id, "conflict", (c) => ({ ...c, leftToAgent: new Date().toISOString() }), { op: "conflict.leave", summary: `${id} left to the agent by the user` });
750
752
  return { text: written(tree), data: { conflict: x } };
751
753
  },
754
+ }, {
755
+ path: ["conflict", "keep"],
756
+ summary: "A decision stands though a source it stood on was deleted: its mark of review taken off (the person's own)",
757
+ group: "analysis",
758
+ tree: true,
759
+ writes: true,
760
+ person: "Whether a decision stands without the source the person deleted is the person's judgment: the Strom app or their terminal, never an agent",
761
+ description: "A conflict that stood on a source the person deleted (strom source retract) is marked for review, its state kept.\n" +
762
+ "Deciding it (again) takes the mark off; for a decided one this says the decision stands as it is. Refused for an\n" +
763
+ "open conflict or one with no mark (conflict.notMarked). An agent may tell the person of the mark, never take it off.",
764
+ args: [{ name: "conflicts", description: "conflict IDs (X0001 …)", required: true, variadic: true }],
765
+ examples: ["strom conflict keep X0001"],
766
+ run(ctx, { args }) {
767
+ const tree = ctx.tree();
768
+ const kept = args.map((a) => keepConflict(tree, a).id);
769
+ return { text: written(tree), data: kept.length === 1 ? { conflict: kept[0], conflicts: kept } : { conflicts: kept } };
770
+ },
752
771
  }, {
753
772
  path: ["conflict", "list"],
754
773
  summary: "Conflicts between sources",
@@ -61,7 +61,10 @@ HARD RULES
61
61
  3. Nothing is deleted. Wrong facts are retracted with --reason, so is a wrong
62
62
  name or note (strom name retract, strom note retract|edit) — yours to do.
63
63
  Deleting a file of the family's material for good (strom input delete) is
64
- the user's alone: never run it, nor offer to run it for them.
64
+ the user's alone: never run it, nor offer to run it for them. Deleting a
65
+ source (strom source retract) and putting it back (strom source restore)
66
+ are the user's alone too: never run them; you may propose deleting one to
67
+ the user with what strom source retract <S…> --dry-run counts.
65
68
  4. A namesake is not your person: check year, place, house and parents —
66
69
  different parents mean two people, not a clerk's error.
67
70
  5. Negative results are results: record every search, also when nothing
@@ -17,6 +17,7 @@ import "./quality.js";
17
17
  import "./batch.js";
18
18
  import "./sources.js";
19
19
  import "./sourcesplit.js";
20
+ import "./sourceretract.js";
20
21
  import "./source-reading.js";
21
22
  import "./placeid.js";
22
23
  import "./media.js";
@@ -24,7 +24,10 @@ import { amendInput, checkOriginalMeta } from "../core/originals.js";
24
24
  import { batchStatus, closeBatch, listBatches, readBatch } from "../core/batches.js";
25
25
  import { HIDE_REASONS, MATERIAL_KINDS, SORT_KINDS } from "../core/model.js";
26
26
  import { assignMaterial, editMaterial, hideMaterial, MATERIAL_MOST_EDIT, MATERIAL_TITLE_MAX, materialPersons, unhideMaterial } from "../core/material.js";
27
- import { checkDeleteConfirm, DELETE_MOST_FILES, deleteImpacts, deleteMaterial } from "../core/materialdelete.js";
27
+ import { checkDeleteConfirm, checkRetractWith, DELETE_MOST_FILES, deleteImpacts, deleteMaterial, deleteSourceImpacts, refuseLiveSources } from "../core/materialdelete.js";
28
+ import { RETRACT_MOST } from "../core/sourceretract.js";
29
+ import { wouldLine } from "./sourceretract.js";
30
+ import { autoCommit } from "../cli/commit.js";
28
31
  import { normalizeDate } from "../core/gdate.js";
29
32
  import { actsAsArchive } from "../core/state.js";
30
33
  import { appHasTree } from "../core/live.js";
@@ -576,29 +579,44 @@ register({
576
579
  "research does not have, and nothing is written. --dry-run says all of it, file by file (--json: impacts). Without\n" +
577
580
  "it the person says yes in their own terminal (Enter says no), else in a window of the system; nobody to ask: exit\n" +
578
581
  "4. An agent never runs it, nor offers to run it for the person. It cannot be undone in the Strom app: a file stays\n" +
579
- "only in a backup (strom backup) or a pack made before. Many files: --files-from <file> (one ID a line; - = stdin).",
582
+ "only in a backup (strom backup) or a pack made before. Many files: --files-from <file> (one ID a line; - = stdin).\n" +
583
+ "A family tree's file (an imported GEDCOM, the app's JSON) is deleted the same way — unless a source of the research\n" +
584
+ "was made of it and stands (exit with material.source-live): then only together with that source, --retract-sources\n" +
585
+ "S… (deleted first, as strom source retract does; one yes for both; the source can be restored, without the file).\n" +
586
+ "Everything is checked first and written in one commit; the bytes go only after it.",
580
587
  args: [{ name: "inputs", description: "input IDs (I0001 …)", variadic: true, unless: ["files-from"] }],
581
588
  options: [
582
589
  { name: "files-from", type: "string", value: "<file|->", description: "the input IDs from a file, one a line (- = stdin)" },
590
+ { name: "retract-sources", type: "string", value: "<S…,S…>", description: "the sources made of a family tree's file, deleted with it (the person's, as strom source retract)" },
583
591
  // the Strom app's yes: what its bridge signed of the list the person saw there (POST /material/delete)
584
592
  { name: "confirm", type: "string", value: "<token>", hidden: true, description: "the Strom app's confirmation, signed by its bridge" },
585
593
  ],
586
- examples: ["strom input delete I0003 --dry-run", "strom input delete I0003 I0005"],
594
+ examples: ["strom input delete I0003 --dry-run", "strom input delete I0003 I0005", "strom input delete I0004 --retract-sources S0004 --dry-run"],
587
595
  async run(ctx, { args, opts }) {
588
596
  const tree = ctx.tree();
589
597
  const shared = ctx.settings.shared()?.value;
590
598
  const impacts = deleteImpacts(tree, shared, idsGiven(ctx, args, opts));
591
599
  const files = impacts.map((i) => i.id);
592
600
  const lang = tree.lang;
601
+ // the sources made of a family tree's file, deleted with it (spec 117 K2.2): checked whole first
602
+ const given = typeof opts["retract-sources"] === "string" ? opts["retract-sources"].split(/[\s,]+/u).filter(Boolean) : [];
603
+ if (given.length > RETRACT_MOST)
604
+ throw new UsageError(`at most ${RETRACT_MOST} sources at once`, { code: "material.body", params: { most: String(RETRACT_MOST) }, hint: "strom help input delete" });
605
+ checkRetractWith(impacts, given);
606
+ const sourceImpacts = deleteSourceImpacts(tree, given);
607
+ const sources = sourceImpacts.map((s) => s.id);
608
+ const both = sources.length ? { sources, impacts: sourceImpacts } : undefined;
593
609
  if (ctx.dryRun)
594
- return { text: lines(...impacts.map((i) => deleteWould(lang, i))), data: { files, impacts } };
610
+ return { text: lines(...sourceImpacts.map((s) => wouldLine(lang, s)), ...impacts.map((i) => deleteWould(lang, i))), data: { files, impacts, ...(both ? { retractSources: sources, sourceImpacts } : {}) } };
611
+ // a family tree's file with a source standing: never without it
612
+ refuseLiveSources(impacts, sources);
595
613
  if (typeof opts.confirm === "string") {
596
614
  // the Strom app's: its bridge signed the list the person saw and said yes to there — only that list, only a while.
597
615
  // An agent's marks outweigh STROM_FOR_APP (the bridge runs this without them): an agent never deletes, not even
598
616
  // with a confirmation it got hold of
599
617
  if (isAgent(ctx.env))
600
618
  throw new UsageError("an agent never deletes files of the material for good, not even with the Strom app's confirmation: nothing deleted", { code: "material.agent", hint: "the person deletes them in the Strom app, or says yes to strom input delete in their own terminal" });
601
- const said = ctx.env.STROM_FOR_APP === "1" ? checkDeleteConfirm(tree.key, files, impacts, opts.confirm) : "invalid";
619
+ const said = ctx.env.STROM_FOR_APP === "1" ? checkDeleteConfirm(tree.key, files, impacts, opts.confirm, Date.now(), both) : "invalid";
602
620
  if (said === "changed")
603
621
  throw new UsageError("the files would take other things with them than the person saw: nothing deleted", { code: "material.delete-changed", params: { files: files.join(",").slice(0, 200) }, hint: "the person looks at the list again in the Strom app" });
604
622
  if (said !== "ok")
@@ -606,14 +624,19 @@ register({
606
624
  }
607
625
  else {
608
626
  const set = `strom input delete ${files.length > 10 ? `${files.slice(0, 10).join(" ")} …` : files.join(" ")}`;
609
- const says = ui(ctx.uiLang(), "ui.consent.delete", { n: String(files.length) });
610
- const how = await ctx.requireHumanYes(`Delete ${files.length} file(s) of the material for good (${files.slice(0, 10).join(", ")}${files.length > 10 ? " …" : ""})? Only the user decides this; an agent never deletes nor offers to.`, set, "material.delete", says);
627
+ const says = [...(sources.length ? [ui(ctx.uiLang(), "ui.consent.delete.sources", { list: sources.join(", ") })] : []), ui(ctx.uiLang(), "ui.consent.delete", { n: String(files.length) })].join(" ");
628
+ const how = await ctx.requireHumanYes(`Delete ${files.length} file(s) of the material for good (${files.slice(0, 10).join(", ")}${files.length > 10 ? " …" : ""})${sources.length ? `, and first the sources made of them (${sources.join(", ")})` : ""}? Only the user decides this; an agent never deletes nor offers to.`, `${set}${sources.length ? ` --retract-sources ${sources.join(",")}` : ""}`, "material.delete", says);
611
629
  if (!how)
612
- return { text: ui(ctx.uiLang(), "ui.consent.delete.no"), data: { files, deleted: [], impacts } };
630
+ return { text: ui(ctx.uiLang(), "ui.consent.delete.no"), data: { files, deleted: [], impacts, ...(both ? { sourceImpacts } : {}) } };
613
631
  }
614
632
  const before = filesOfTasks(tree);
615
- const got = deleteMaterial(tree, shared, files, fileBy(tree, ctx.env));
633
+ const { removeBytes, ...got } = deleteMaterial(tree, shared, files, fileBy(tree, ctx.env), { retractSources: sources, via: ctx.env.STROM_FOR_APP === "1" ? "bridge" : "terminal" });
634
+ // written first, in one commit; only then do the bytes go (spec 117 R7) — a commit that fails keeps them
635
+ if (!autoCommit(ctx, { path: ["input", "delete"] }))
636
+ removeBytes();
616
637
  const out = [];
638
+ for (const id of got.retracted ?? [])
639
+ out.push(ui(lang, "ui.input.delete.retracted", { source: id }));
617
640
  for (const i of got.impacts) {
618
641
  out.push(ui(lang, "ui.input.deleted", { id: i.id, name: i.name }));
619
642
  if (i.keptWhy === "sameAs")
@@ -247,8 +247,8 @@ async function inTerminal(ctx, link) {
247
247
  const say = aboutConflict(root, ctx, link.id);
248
248
  if (!say)
249
249
  return said("ui.link.conflict.none", { id: link.id });
250
- const { asks } = await import("../cli/menu-links.js");
251
- if (!(await asks(ctx, treeLang, root, ui(treeLang, "ui.link.what.conflict.agent", { agent, title: tree.get(link.id).title }), ui(treeLang, "ui.link.cost"))))
250
+ const { asksToStart } = await import("../cli/menu-links.js");
251
+ if (!(await asksToStart(ctx, treeLang, root, ui(treeLang, "ui.link.what.conflict.agent", { agent, title: tree.get(link.id).title }), ui(treeLang, "ui.link.cost"))))
252
252
  return end(false);
253
253
  // the user's own edit: the agent may decide it only once the user left it so — written first, by the person
254
254
  if (isEditConflict(tree.get(link.id)) && (await run(["conflict", "leave", link.id], true)) !== 0)
@@ -318,7 +318,7 @@ async function inTerminal(ctx, link) {
318
318
  case "work": {
319
319
  // the agent working on the queue alone: what starts shown here, started in this terminal only on the person's yes
320
320
  const { workRun } = await import("../cli/menu-links.js");
321
- return end(await workRun(ctx, run, treeLang, root, link.do, link.n === undefined ? undefined : Number(link.n)));
321
+ return end(await workRun(ctx, run, treeLang, root, link.do, link.n === undefined ? undefined : Number(link.n), link.task?.split(",")));
322
322
  }
323
323
  case "fixes": {
324
324
  // strom's fixes: shown here; set right or put back only on the person's word, asked by strom fixes itself
@@ -345,7 +345,7 @@ async function inTerminal(ctx, link) {
345
345
  const person = named ? personOf(root, ctx, named) : undefined;
346
346
  if (named && !person)
347
347
  return said("ui.link.noperson", { person: named });
348
- const { asks } = await import("../cli/menu-links.js");
348
+ const { asks, asksToStart } = await import("../cli/menu-links.js");
349
349
  switch (link.action) {
350
350
  case "chat": {
351
351
  // one direction: its tasks only (the research's own name and ID in the first message)
@@ -358,7 +358,7 @@ async function inTerminal(ctx, link) {
358
358
  : person
359
359
  ? ui(treeLang, "ui.link.what.chat.person", { agent, person: who(person) })
360
360
  : ui(treeLang, "ui.link.what.chat", { agent });
361
- if (!(await asks(ctx, treeLang, root, what, ui(treeLang, "ui.link.cost"))))
361
+ if (!(await asksToStart(ctx, treeLang, root, what, ui(treeLang, "ui.link.cost"))))
362
362
  return { text: "", data: { done: false, action: link.action, tree: root } };
363
363
  const first = direction ? aboutDirection(treeLang, direction) : person ? aboutPerson(treeLang, person) : undefined;
364
364
  return { text: "", data: { done: (await run(["chat", ...(first ? [`--say=${first}`] : [])])) === 0, action: link.action, tree: root } };
@@ -636,6 +636,8 @@ register({
636
636
  " default 5; strom run --tasks n) or for as long as there is work (strom run --loop, only under a gate — none set: n\n" +
637
637
  " tasks or the gate offered instead); the first tasks, the session's time and the gate shown, started in the terminal\n" +
638
638
  " only on the person's yes (no by default; the bridge never starts it). Refused where nobody researches.\n" +
639
+ " &do=tasks&task=T0003,T0007 (not with n): these tasks alone, one session each in this order (strom run --task) —\n" +
640
+ " those no longer open or held by another left out, none left: nothing started.\n" +
639
641
  "strom-research://fixes?tree=<id>[&id=street-places][&do=undo] — strom's fixes of the research (strom fixes), one of them\n" +
640
642
  " 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" +
641
643
  "strom-research://back?tree=<id>[&change=<hash>] — the research back in time (strom history back): the change named by\n" +
@@ -645,7 +647,9 @@ register({
645
647
  "strom-research://new?app=<the app's mark> — a tree of the app becomes a new research: named, made, the app hands the\n" +
646
648
  "tree to its bridge (?adopt=, GET/POST /adopt), taken in as leads, sent back to the app. Family trees here already:\n" +
647
649
  "opening one of them in the app (strom app) is offered first; with no terminal the result lists them (trees).\n" +
648
- "What writes tasks or starts the agent is said and asked in the terminal first. Any page can open such a link:\n" +
650
+ "What writes tasks or starts the agent is said and asked in the terminal first; with run.confirm no (the person's,\n" +
651
+ "this computer's) what only starts the agent on the subscription or AI credit starts at once, one line says so — a\n" +
652
+ "price in money, a consent, a deletion, a request sent, the gate and an agent's own command still ask. Any page can open such a link:\n" +
649
653
  "each part is checked (only IDs and fixed values, never text), an unknown research, person, task or excerpt is\n" +
650
654
  "only said. No link: the menu.\n" +
651
655
  "&handoff=<uuid> (any link of a research): the app's id of it — written when the link was taken (the terminal it\n" +