strom-research 1.36.0-beta.8 → 1.36.0-beta.9

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.36.0
9
9
 
10
- *Připravuje se: bety do 1.36.0-beta.8. Oddíl bude úplný s vydáním.*
10
+ *Připravuje se: bety do 1.36.0-beta.9. Oddíl bude úplný s vydáním.*
11
11
 
12
12
  - **Zkouška hromadného ověření hned:** úkoly zkoušky hromadného ověření (`strom verify bulk --try`) stojí na začátku
13
13
  fronty – vezme je příští sezení – a aplikace Strom je dá zpracovat hned, každý úkol jedno sezení, odkazem, který úkoly
@@ -120,6 +120,13 @@ Změny každé verze ve zkratce. Úplné poznámky a instalační řádky jsou n
120
120
  Když prohledané snímky knihy nepokrývají roky kolem data známého jen z věku (narozen asi 1761 podle věku při úmrtí),
121
121
  agent se dozví, které roky chybí a kde kniha pokračuje, dřív než se na „nenalezeno“ spolehne – kolik let na každou
122
122
  stranu, určuje nastavení výzkumu `search.ageMargin` (výchozí 5).
123
+ Rozhovor o linii z aplikace Strom se u ukončené linie odmítne jednou větou – nic se neptá ani nespouští. Snímek jiné
124
+ knihy se už nestáhne do knihy omylem: `strom fetch` odmítne knihu, jejíž snímky přišly z jiné knihy konektoru, nebo
125
+ knihu z portálu jiného konektoru, a řekne, která kniha to je; odvolaný snímek knihu k ničemu neváže.
126
+ Odeslání z aplikace Strom už nesebere poznámku k souboru materiálu, který aplikace ve svém stromu nikdy neměla:
127
+ takové odeslání zastavilo každý další zápis výzkumu (přijetí třídění v aplikaci hlásilo jen „exit 1“); otevření
128
+ aplikace Strom nebo další zápis poznámku vrátí a zapíše, co čekalo. Zápis z aplikace, který kontrola výzkumu odmítne, nic nezanechá a aplikace se
129
+ dozví proč.
123
130
 
124
131
  ## 1.35.0
125
132
 
package/CHANGELOG.de.md CHANGED
@@ -7,7 +7,7 @@ Die Änderungen jeder Version in Kürze. Die vollständigen Hinweise und die Ins
7
7
 
8
8
  ## 1.36.0
9
9
 
10
- *In Vorbereitung: die Betas bis 1.36.0-beta.8. Der Abschnitt ist mit dem Release vollständig.*
10
+ *In Vorbereitung: die Betas bis 1.36.0-beta.9. Der Abschnitt ist mit dem Release vollständig.*
11
11
 
12
12
  - **Ein Versuch der Sammelprüfung sofort:** Die Aufgaben eines Versuchs der Sammelprüfung (`strom verify bulk --try`)
13
13
  stehen am Anfang der Warteschlange – die nächste Sitzung nimmt sie –, und die Strom-App lässt sie sofort bearbeiten,
@@ -142,6 +142,15 @@ Die Änderungen jeder Version in Kürze. Die vollständigen Hinweise und die Ins
142
142
  1761 nach dem Alter beim Tod), erfährt der Agent, welche Jahre fehlen und wo das Buch weitergeht, bevor man sich auf
143
143
  „nicht gefunden“ verlässt – wie viele Jahre zu jeder Seite, bestimmt die Einstellung der Forschung `search.ageMargin`
144
144
  (Standard 5).
145
+ Ein Gespräch über eine Linie aus der Strom-App wird bei einer beendeten Linie mit einem Satz abgelehnt – nichts wird
146
+ gefragt oder gestartet. Ein Bild eines anderen Buches wird nicht mehr versehentlich in ein Buch geholt: `strom
147
+ fetch` lehnt ein Buch ab, dessen Bilder aus einem anderen Buch des Konnektors kamen, oder ein Buch vom Portal eines
148
+ anderen Konnektors, und sagt, welches Buch es ist; ein zurückgenommenes Bild bindet das Buch an nichts.
149
+ Eine Sendung der Strom-App nimmt die Notiz einer Datei des Materials, die die App nie in ihrem Stammbaum hatte,
150
+ nicht mehr weg: eine solche Sendung hielt jedes weitere Schreiben der Forschung an (das Übernehmen der Sortierung in
151
+ der App meldete nur „exit 1“); das Öffnen der Strom-App oder das nächste Schreiben gibt die Notiz zurück und
152
+ schreibt, was wartete. Ein Schreiben
153
+ der Strom-App, das die Prüfung der Forschung ablehnt, hinterlässt nichts, und die App erfährt den Grund.
145
154
 
146
155
  ## 1.35.0
147
156
 
package/CHANGELOG.md CHANGED
@@ -7,7 +7,7 @@ The changes of each version in short. The full notes and the install lines are o
7
7
 
8
8
  ## 1.36.0
9
9
 
10
- *In preparation: the betas up to 1.36.0-beta.8. The section is complete with the release.*
10
+ *In preparation: the betas up to 1.36.0-beta.9. The section is complete with the release.*
11
11
 
12
12
  - **A try of the bulk verification at once:** the tasks of a try of the bulk verification (`strom verify bulk --try`)
13
13
  stand first in the queue — the next session takes them — and the Strom app can have them worked on at once, one
@@ -126,6 +126,14 @@ The changes of each version in short. The full notes and the install lines are o
126
126
  When the images searched in a book do not cover the years around a date known only from an age (born about 1761 by the
127
127
  age at death), the agent is told which years are missing and where the book goes on, before a “not found” is relied on
128
128
  — how many years either side is the research's setting `search.ageMargin` (default 5).
129
+ A conversation about a line asked from the Strom app is refused in one sentence when the line is ended — nothing is
130
+ asked or started. An image of another book is no longer fetched into a book by a slip: `strom fetch` refuses a book
131
+ whose images came from another book of the connector, or a book of another connector's portal, and says which book
132
+ it is; an image taken back binds the book to nothing.
133
+ A send of the Strom app no longer takes off the note of a file of the material that the app never had in its tree:
134
+ such a send stopped every later write of the research (accepting the sorting in the app said only “exit 1”); opening
135
+ the Strom app or the next write gives the note back and writes what waited. A write of the Strom app that the check of the research
136
+ refuses leaves nothing behind, and the app hears why.
129
137
 
130
138
  ## 1.35.0
131
139
 
package/CHANGELOG.pl.md CHANGED
@@ -7,7 +7,7 @@ Zmiany każdej wersji w skrócie. Pełne informacje o wydaniach i polecenia inst
7
7
 
8
8
  ## 1.36.0
9
9
 
10
- *W przygotowaniu: bety do 1.36.0-beta.8. Sekcja będzie kompletna z wydaniem.*
10
+ *W przygotowaniu: bety do 1.36.0-beta.9. Sekcja będzie kompletna z wydaniem.*
11
11
 
12
12
  - **Próba zbiorczej weryfikacji od razu:** zadania próby zbiorczej weryfikacji (`strom verify bulk --try`) stoją na
13
13
  początku kolejki – weźmie je następna sesja – a aplikacja Strom pozwala przerobić je od razu, każde zadanie w jednej
@@ -128,6 +128,14 @@ Zmiany każdej wersji w skrócie. Pełne informacje o wydaniach i polecenia inst
128
128
  Gdy przeszukane skany księgi nie obejmują lat wokół daty znanej tylko z wieku (urodzony około 1761 według wieku przy
129
129
  śmierci), agent dowiaduje się, których lat brakuje i gdzie księga ciągnie się dalej, zanim „nie znaleziono” zostanie
130
130
  przyjęte – ile lat w każdą stronę, określa ustawienie badania `search.ageMargin` (domyślnie 5).
131
+ Rozmowa o linii z aplikacji Strom jest przy zakończonej linii odrzucana jednym zdaniem – nic nie jest pytane ani
132
+ uruchamiane. Skan innej księgi nie trafia już przez pomyłkę do księgi: `strom fetch` odrzuca księgę, której skany
133
+ przyszły z innej księgi konektora, albo księgę z portalu innego konektora, i mówi, która to księga; wycofany skan
134
+ nie wiąże księgi z niczym.
135
+ Wysyłka z aplikacji Strom nie usuwa już notatki pliku materiału, którego aplikacja nigdy nie miała w swoim drzewie:
136
+ taka wysyłka zatrzymywała każdy kolejny zapis badania (przyjęcie sortowania w aplikacji mówiło tylko „exit 1”);
137
+ otwarcie aplikacji Strom lub kolejny zapis przywraca notatkę i zapisuje to, co czekało. Zapis aplikacji Strom odrzucony przez kontrolę badania
138
+ nie zostawia niczego, a aplikacja dowiaduje się dlaczego.
131
139
 
132
140
  ## 1.35.0
133
141
 
@@ -2529,6 +2529,7 @@
2529
2529
  "ui.link.what.direction.done": "ukončit linii „{name}“: její úkoly ({n}) odejdou z fronty. Nic se nemaže, jde ji znovu spustit.",
2530
2530
  "ui.link.what.direction.resume": "znovu spustit linii „{name}“: její úkoly ({n}) se vrátí do fronty a výzkum navrhne, co chybí.",
2531
2531
  "ui.link.direction.none": "Linie {id} v tomto výzkumu není. Nic se nestalo.",
2532
+ "ui.link.direction.done": "Linie „{name}“ ({id}) je ukončená: agent na ní nepracuje, dokud se v přehledu linií znovu nespustí. Nic se nespustilo.",
2532
2533
  "ui.link.direction.cannot": "Linie „{name}“ už je {state}. Nic se nestalo.",
2533
2534
  "ui.link.direction.why": "Proč? (pár slov, zůstane u linie; Enter: bez důvodu)",
2534
2535
  "ui.link.what.chat.research": "rozhovor s agentem ({agent}) o linii „{name}“, jen její úkoly.",
@@ -2529,6 +2529,7 @@
2529
2529
  "ui.link.what.direction.done": "die Linie „{name}“ beenden: ihre Aufgaben ({n}) verlassen die Warteschlange. Nichts wird gelöscht, sie kann wieder aufgenommen werden.",
2530
2530
  "ui.link.what.direction.resume": "die Linie „{name}“ wieder aufnehmen: ihre Aufgaben ({n}) kommen zurück in die Warteschlange, und die Forschung schlägt vor, was fehlt.",
2531
2531
  "ui.link.direction.none": "Linie {id} ist nicht in dieser Forschung. Es ist nichts geschehen.",
2532
+ "ui.link.direction.done": "Die Linie „{name}“ ({id}) ist beendet: kein Agent arbeitet an ihr, bis sie in der Übersicht der Linien wieder aufgenommen wird. Nichts wurde gestartet.",
2532
2533
  "ui.link.direction.cannot": "Die Linie „{name}“ ist schon {state}. Es ist nichts geschehen.",
2533
2534
  "ui.link.direction.why": "Warum? (ein paar Worte, bleiben bei der Linie; Enter: ohne Grund)",
2534
2535
  "ui.link.what.chat.research": "ein Gespräch mit dem Agenten ({agent}) über die Linie „{name}“, nur ihre Aufgaben.",
@@ -2529,6 +2529,7 @@
2529
2529
  "ui.link.what.direction.done": "zakończenie linii „{name}”: jej zadania ({n}) opuszczą kolejkę. Nic nie jest usuwane, można ją znów uruchomić.",
2530
2530
  "ui.link.what.direction.resume": "ponowne uruchomienie linii „{name}”: jej zadania ({n}) wrócą do kolejki, a badanie zaproponuje, czego brakuje.",
2531
2531
  "ui.link.direction.none": "Linii {id} nie ma w tym badaniu. Nic się nie stało.",
2532
+ "ui.link.direction.done": "Linia „{name}” ({id}) jest zakończona: żaden agent nad nią nie pracuje, dopóki nie zostanie znów uruchomiona w przeglądzie linii. Nic nie uruchomiono.",
2532
2533
  "ui.link.direction.cannot": "Linia „{name}” jest już {state}. Nic się nie stało.",
2533
2534
  "ui.link.direction.why": "Dlaczego? (kilka słów, zostaną przy linii; Enter: bez powodu)",
2534
2535
  "ui.link.what.chat.research": "rozmowa z agentem ({agent}) o linii „{name}”, tylko jej zadania.",
@@ -671,7 +671,8 @@ function bookRoute(tree, b, ready) {
671
671
  return undefined;
672
672
  const part = c.manifest.can.includes("part");
673
673
  const browser = routeOf(tree.env, c).via === "browser";
674
- const media = tree.list("media").filter((m) => m.fetched?.connector === c.name && m.recordset);
674
+ // images taken back (a slip into the wrong book) tell nothing of the book
675
+ const media = tree.list("media").filter((m) => m.fetched?.connector === c.name && m.recordset && !m.retracted);
675
676
  const own = media.find((m) => m.recordset === b.id)?.fetched?.book;
676
677
  if (own)
677
678
  return { connector: c.name, book: own, part, browser };
@@ -1,7 +1,7 @@
1
1
  // Automatic commit after a writing command. Git is invisible to the user:
2
2
  // every change is committed by strom, behind the check + guard gate.
3
3
  import { hasErrors } from "../core/check.js";
4
- import { guard } from "../core/guard.js";
4
+ import { giveNotesBack, guard } from "../core/guard.js";
5
5
  import { snapshot, verifyFast } from "../core/integrity.js";
6
6
  import { isArchive } from "../core/mode.js";
7
7
  import { counted } from "./format.js";
@@ -25,7 +25,12 @@ export function autoCommit(ctx, def) {
25
25
  const blocked = tree.withTreeLock(() => {
26
26
  // Incremental gate: records were validated when written; here only what
27
27
  // changed since the last commit is checked, so the cost stays flat.
28
- const snap = snapshot(tree);
28
+ let snap = snapshot(tree);
29
+ // a note of the material a send of the app took off with no reason (1.35.0): given back, logged — its commit
30
+ // and every one after it went through again, nothing of anybody's work lost (found: a research stuck for an hour)
31
+ const gave = giveNotesBack(tree, snap) > 0;
32
+ if (gave)
33
+ snap = snapshot(tree);
29
34
  const fast = verifyFast(tree, snap);
30
35
  const findings = [...fast.findings, ...guard(tree, snap)];
31
36
  if (hasErrors(findings)) {
@@ -39,11 +44,11 @@ export function autoCommit(ctx, def) {
39
44
  problems: errors.map((f) => ({ ...(f.id ? { id: f.id } : {}), ...(f.file ? { file: f.file } : {}), message: f.message })),
40
45
  };
41
46
  }
42
- const message = commitMessage(ops.map((o) => o.summary), `strom ${def.path.join(" ")}`);
47
+ const message = commitMessage((gave ? tree.uncommitted() : ops).map((o) => o.summary), `strom ${def.path.join(" ")}`);
43
48
  // Only the files this command wrote, plus the free-form folders the agent
44
49
  // may edit — `git add` then never has to scan the whole data/ tree.
45
50
  const written = new Set(["data/_counters.json"]);
46
- for (const op of ops)
51
+ for (const op of gave ? tree.uncommitted() : ops)
47
52
  for (const f of op.files)
48
53
  written.add(f.path);
49
54
  for (const f of tree.opsFilesTouched())
package/dist/cli/main.js CHANGED
@@ -12,18 +12,18 @@ import { Cancelled, diskFull, DISK_FULL, EXIT, folderOf, isDiskFull, notFound, S
12
12
  import { ownCommand } from "../core/paths.js";
13
13
  import { Context } from "./context.js";
14
14
  import { commands, match } from "./registry.js";
15
- import { asCommand, asCommandJson, shellArg } from "./format.js";
15
+ import { asCommand, asCommandJson, counted, shellArg } from "./format.js";
16
16
  import { groupHelpAs, helpAs } from "./help.js";
17
17
  import { autoCommit } from "./commit.js";
18
18
  import { takeOverOldSettings } from "../core/oldsettings.js";
19
- import { assertIntact } from "../core/integrity.js";
19
+ import { assertIntact, settleNotesBack } from "../core/integrity.js";
20
20
  import { head as gitHead, resetCache } from "../core/git.js";
21
21
  import { newerTree, Tree, VERSION } from "../core/tree.js";
22
22
  import { settleArchive } from "../core/mode.js";
23
23
  import { settleWaiting } from "../core/state.js";
24
24
  import { startTiming, stepEnd, stepStart, stopTiming, timed, timingOn } from "../core/timing.js";
25
25
  import { timingSaid } from "./timing.js";
26
- import { raiseHypothesisLinkTasks, settleHypothesisLinks } from "../core/hypolinks.js";
26
+ import { quiet as nobodyAtWork, raiseHypothesisLinkTasks, settleHypothesisLinks } from "../core/hypolinks.js";
27
27
  import { settleReaders } from "../core/readerfix.js";
28
28
  import { settleProven } from "../core/provenfix.js";
29
29
  import { settleHeldProposals, settleOrigins } from "../core/originfix.js";
@@ -460,6 +460,14 @@ async function mainOf(argv, io, env, cwd) {
460
460
  // written under it — its bridge renews itself once that work ends and settles the rest (spec 037)
461
461
  if (otherVersionsAtWork(k.root, VERSION).length > 0)
462
462
  continue;
463
+ // …and the notes of the material a send of the app took off with no reason (1.35.0) given back, what waited with
464
+ // them committed (first: nothing else is written unasked while the check of a write refuses it)
465
+ try {
466
+ settleNotesBack(Tree.open(k.root, env), nobodyAtWork);
467
+ }
468
+ catch {
469
+ // another computer's seal, a tree at work: its bridge's start or the next write gives them back
470
+ }
463
471
  try {
464
472
  settleArchive(Tree.open(k.root, env));
465
473
  settleWaiting(Tree.open(k.root, env));
@@ -590,8 +598,9 @@ async function mainOf(argv, io, env, cwd) {
590
598
  // (a command that locks only while it writes looks under the lock too: another strom may be in the middle of a write)
591
599
  if (writes && def.tree)
592
600
  def.lock === "sections" ? ctx.tree().withTreeLock(() => assertIntact(ctx.tree())) : assertIntact(ctx.tree());
593
- // a task another's session holds, or a session taken over from the one writing (spec 127): refused before the command
594
- if (writes && def.tree && !ctx.dryRun && env.STROM_FOR_APP !== "1")
601
+ // a task another's session holds, or a session taken over from the one writing (spec 127): refused before the command,
602
+ // a dry run too (fencing only reads) — it says what the real one would, never "done" where that is refused
603
+ if (writes && def.tree && env.STROM_FOR_APP !== "1")
595
604
  fence(ctx.tree(), env, def.path, parsed.positionals);
596
605
  let result;
597
606
  let blocked;
@@ -640,9 +649,21 @@ async function mainOf(argv, io, env, cwd) {
640
649
  result.data = { ...result.data, notices: [...notices] };
641
650
  }
642
651
  if (blocked) {
652
+ // a write of the Strom app's (the bridge): a transaction as any failure — nothing of it left in data/ for every
653
+ // write after it to stumble over (found: one send of the app left behind, the research stuck for all), the app
654
+ // told why; an agent's stays for it to look at (strom check)
655
+ const undone = writes && def.tree && !ctx.dryRun && env.STROM_FOR_APP === "1";
656
+ if (undone) {
657
+ const t = ctx.current();
658
+ if (t)
659
+ t.withTreeLock(() => t.rollback());
660
+ }
661
+ const first = blocked.problems[0];
662
+ const why = first ? `${first.id ?? first.file ?? ""} ${first.message}`.trim() : "";
663
+ const message = `${undone ? "nothing written" : "written but NOT committed"} — the check of the research found ${counted(blocked.problems.length, "problem")}${why ? `: ${why}` : ""}`;
643
664
  // The agent must notice: an uncommitted write is not part of the research yet.
644
- result.text = result.text ? `${result.text}\n${blocked.message}` : blocked.message;
645
- result.data = { ...(result.data ?? {}), status: "not-committed", problems: blocked.problems, hint: "strom check" };
665
+ result.text = undone ? message : result.text ? `${result.text}\n${blocked.message}` : blocked.message;
666
+ result.data = { ...(undone ? {} : (result.data ?? {})), status: undone ? "not-written" : "not-committed", code: "commit.blocked", message, problems: blocked.problems, hint: "strom check" };
646
667
  result.exitCode = EXIT.error;
647
668
  }
648
669
  return result;
package/dist/cli/ui.js CHANGED
@@ -2477,6 +2477,7 @@ export const UI = {
2477
2477
  "ui.link.what.direction.done": "end the line “{name}”: its tasks ({n}) leave the queue. Nothing is deleted, it can be taken up again.",
2478
2478
  "ui.link.what.direction.resume": "take the line “{name}” up again: its tasks ({n}) come back to the queue and the research proposes what is missing.",
2479
2479
  "ui.link.direction.none": "Line {id} is not in this research. Nothing was done.",
2480
+ "ui.link.direction.done": "The line “{name}” ({id}) is ended: no agent works on it until it is taken up again in the overview of lines. Nothing was started.",
2480
2481
  "ui.link.direction.cannot": "The line “{name}” is {state} already. Nothing was done.",
2481
2482
  "ui.link.direction.why": "Why? (a few words, kept with the line; Enter: no reason)",
2482
2483
  "ui.link.what.chat.research": "a conversation with the agent ({agent}) about the line “{name}”, only its tasks.",
@@ -47,7 +47,7 @@ import { now } from "../core/tree.js";
47
47
  import { FetchMeter, metricsDir, recordFetch, requestsPerImage, webDomain } from "../core/metrics.js";
48
48
  import { siteConnector } from "../core/web.js";
49
49
  import { allows, forgetConnector, grantWay, keyHost, latchedPace, liftRefusal, loadArchives, pendingQuestions, termsFor, termsOpen } from "../core/terms.js";
50
- import { waitsOnHost } from "../core/archivewait.js";
50
+ import { setHosts, waitsOnHost } from "../core/archivewait.js";
51
51
  import { waysOffered } from "../core/archiveasks.js";
52
52
  import { archivesOverview, browserOnlyRefusal, checkEnvironment, gateArchive, levelsOf, levelText, NeedsPermissionError, permissionText, robotsPermits, syncTrees, taskHere, verdictKeeper } from "./archives.js";
53
53
  import { currentSession, lifeOf, othersAtWork } from "../core/session.js";
@@ -1410,6 +1410,8 @@ register({
1410
1410
  const task = opts.task === undefined ? undefined : requireRecord(tree, String(opts.task), "task").id;
1411
1411
  if (task && (request.cmd === "find" || request.cmd === "list"))
1412
1412
  throw new UsageError("--task names whose images are fetched: with --images (and --recordset)");
1413
+ if (request.cmd === "fetch")
1414
+ rightBookFirst(ctx, c, request, recordset, again);
1413
1415
  if (request.cmd === "fetch")
1414
1416
  sameBookFirst(ctx, c, request, recordset, again);
1415
1417
  if (opts.background) {
@@ -2146,6 +2148,47 @@ function fromStore(ctx, c, request, recordset, h, via) {
2146
2148
  },
2147
2149
  };
2148
2150
  }
2151
+ /**
2152
+ * A fetch into a book that is not this book of the connector, before any request (found live: a slip of the agent's
2153
+ * fetched an image of one archive's book into a book of another archive, which was then "the same book" as the first):
2154
+ * a book whose images came from another book of this connector, or a book of another archive — its link, or its
2155
+ * archive's, on the portal of another connector and not on this one's, and no image of it from this book (a link
2156
+ * nobody's connector knows says nothing: a catalogue elsewhere, a copy on an aggregator's portal). Said which book it is,
2157
+ * and where the images go: the book of the research this book of the connector is, or a book of its own. Images taken
2158
+ * back (strom media retract) bind a book to nothing. --again with a reason fetches all the same (another film of it).
2159
+ */
2160
+ function rightBookFirst(ctx, c, request, recordset, again) {
2161
+ if (!recordset || again)
2162
+ return;
2163
+ const tree = ctx.tree();
2164
+ const target = tree.get(recordset);
2165
+ if (!target)
2166
+ return;
2167
+ const book = String(request.book);
2168
+ const from = new Map();
2169
+ for (const m of tree.list("media"))
2170
+ if (m.recordset === recordset && m.fetched && !m.retracted)
2171
+ from.set(`${m.fetched.connector} ${m.fetched.book}`, m.fetched);
2172
+ if (from.has(`${c.name} ${book}`))
2173
+ return;
2174
+ const otherBook = [...from.values()].find((x) => x.connector === c.name);
2175
+ const portal = new Set(c.manifest.hosts.map((h) => siteOf(h.replace(/^\*\./u, ""))));
2176
+ const hosts = setHosts(tree, target);
2177
+ const ours = hosts.some((h) => hostAllowed(h, c.manifest.hosts) || portal.has(siteOf(h)));
2178
+ const host = !otherBook && !ours ? hosts.find((h) => listConnectors(shared(ctx), ctx.env).some((x) => x.name !== c.name && hostAllowed(h, x.manifest.hosts))) : undefined;
2179
+ const elsewhere = host ? listConnectors(shared(ctx), ctx.env).find((x) => x.name !== c.name && hostAllowed(host, x.manifest.hosts)) : undefined;
2180
+ if (!otherBook && !elsewhere)
2181
+ return;
2182
+ const why = otherBook ? `its images came from book ${otherBook.book} of ${c.name}` : `it is a book of ${host}, connector ${elsewhere.name}'s portal, not of ${c.name}'s (${c.manifest.hosts.join(", ")})`;
2183
+ const imgs = imagesArg(request.images);
2184
+ const right = sameBooks(tree, { connector: c.name, book }, recordset)[0];
2185
+ const into = right
2186
+ ? `book ${book} of ${c.name} is ${sameBookText(right)}: strom fetch ${c.name} ${shellArg(book)} --images ${imgs} --recordset ${right.book.id}`
2187
+ : `book ${book} of ${c.name} is no book of the research yet: a book of its own — strom recordset add "<title>" --url <its link on ${c.name}'s portal>, then strom fetch ${c.name} ${shellArg(book)} --images ${imgs} --recordset <its B…>`;
2188
+ throw new UsageError(`${recordset} is not book ${book} of ${c.name}: ${why} — nothing fetched`, {
2189
+ hint: `${into} · ${otherBook ? `${recordset}'s own images: strom fetch ${c.name} ${shellArg(otherBook.book)} --images ${imgs} --recordset ${recordset}` : `${recordset}'s own images: strom fetch ${elsewhere.name} <book> --images ${imgs} --recordset ${recordset}`} · ${recordset} is this book all the same (another film of it): --again "<why>"`,
2190
+ });
2191
+ }
2149
2192
  /**
2150
2193
  * A book the research has under another ID is never fetched again (B0389 = B0169: every image asked of the archive
2151
2194
  * twice, found by its hash only after): before any request, the book of the same link, or whose images came from this
@@ -366,6 +366,9 @@ async function inTerminal(ctx, link) {
366
366
  const direction = link.research ? tree.get(link.research) : undefined;
367
367
  if (link.research && direction?.type !== "research")
368
368
  return said("ui.link.direction.none", { id: link.research });
369
+ // an ended line: no agent works on it (its tasks are out of the queue) — refused before anything is asked or started
370
+ if (direction?.type === "research" && direction.state === "done")
371
+ return said("ui.link.direction.done", { name: direction.name, id: direction.id });
369
372
  // the agent costs: said and asked first, then the conversation as strom chat starts it
370
373
  const what = direction
371
374
  ? ui(treeLang, "ui.link.what.chat.research", { agent, name: direction.name })
@@ -452,6 +455,8 @@ async function withoutTerminal(ctx, link, root) {
452
455
  const direction = tree.get(link.research);
453
456
  if (direction?.type !== "research")
454
457
  return say(ctx, "ui.link.direction.none", { id: link.research }, { tree: link.tree });
458
+ if (direction.state === "done")
459
+ return say(ctx, "ui.link.direction.done", { name: direction.name, id: direction.id }, { tree: link.tree });
455
460
  first = aboutDirection(tree.lang, direction);
456
461
  }
457
462
  else if (link.action === "chat" && link.person) {
@@ -37,6 +37,73 @@ function parse(text) {
37
37
  return undefined;
38
38
  }
39
39
  }
40
+ /**
41
+ * The notes of the family's material a send of the Strom app took off with no reason (1.35.0: a file the app was
42
+ * never given in its tree read as its note removed by the user — the write's commit refused, every write after it
43
+ * too): what the last commit had and the record lacks now, to be given back before the commit (cli/commit.ts). Only
44
+ * the app's own write of its files (input.media) since the last commit; one with a reason (the user's word since) none.
45
+ */
46
+ export function notesTakenOffByApp(tree, snap) {
47
+ if (!git.hasHead(tree.root))
48
+ return [];
49
+ const ids = new Set();
50
+ const changes = snap.changes.filter((c) => c.path.startsWith("data/"));
51
+ for (const c of changes) {
52
+ if (!c.path.startsWith("data/ops/"))
53
+ continue;
54
+ const abs = path.join(tree.root, c.path);
55
+ if (!fs.existsSync(abs))
56
+ continue;
57
+ const old = snap.head.get(c.path) ?? "";
58
+ const now = fs.readFileSync(abs, "utf8");
59
+ if (!now.startsWith(old))
60
+ continue;
61
+ for (const line of now.slice(old.length).split("\n")) {
62
+ if (!line.trim())
63
+ continue;
64
+ try {
65
+ const op = JSON.parse(line);
66
+ if (op.op === "input.media" && !op.reason)
67
+ for (const t of op.targets)
68
+ ids.add(t);
69
+ }
70
+ catch {
71
+ // reported by verify
72
+ }
73
+ }
74
+ }
75
+ const out = [];
76
+ for (const id of ids) {
77
+ const file = `data/inputs/${id}.json`;
78
+ const prev = parse(snap.head.get(file));
79
+ const abs = path.join(tree.root, file);
80
+ if (!prev || !Array.isArray(prev.notes) || !fs.existsSync(abs))
81
+ continue;
82
+ const cur = parse(fs.readFileSync(abs, "utf8"));
83
+ if (!cur)
84
+ continue;
85
+ const key = KEPT_ARRAYS.notes;
86
+ const left = new Set(Array.isArray(cur.notes) ? cur.notes.map(key) : []);
87
+ const lost = prev.notes.filter((n) => !left.has(key(n)));
88
+ if (lost.length)
89
+ out.push({ id, notes: lost });
90
+ }
91
+ return out;
92
+ }
93
+ /**
94
+ * The notes notesTakenOffByApp finds given back, one logged operation each (under the tree's lock): the commit after it
95
+ * goes through the check, nothing of anybody's work lost, the research writable again. How many records.
96
+ */
97
+ export function giveNotesBack(tree, snap) {
98
+ const lost = notesTakenOffByApp(tree, snap);
99
+ for (const l of lost) {
100
+ const cur = tree.get(l.id);
101
+ if (!cur)
102
+ continue;
103
+ tree.put({ ...cur, notes: [...(cur.notes ?? []), ...l.notes], updated: new Date().toISOString() }, { op: "input.note", targets: [l.id], summary: `${l.id} its note given back: a send of the Strom app had taken it off` });
104
+ }
105
+ return lost.length;
106
+ }
40
107
  export function guard(tree, snap = snapshot(tree)) {
41
108
  const out = [];
42
109
  if (!git.hasHead(tree.root))
@@ -21,6 +21,7 @@ import { fileSha, fingerprint, otherKeys, readCommitSeal, verifyCommitSeal, veri
21
21
  import { settingsHidden } from "./oldsettings.js";
22
22
  import { NeedsConsentError, StromError } from "./errors.js";
23
23
  import { counted } from "../cli/format.js";
24
+ import { giveNotesBack, guard, notesTakenOffByApp } from "./guard.js";
24
25
  /**
25
26
  * What strom alone writes in a tree, each change through a sealed operation: the records and their history (data/), the
26
27
  * tree's settings (strom.json), the history at the places of the tree (history/: core/pastevents.ts) and the person's
@@ -648,12 +649,36 @@ export function writableUnasked(tree) {
648
649
  // what an interrupted write left in git's index: out of it first, or no write (its commit would hold it)
649
650
  if (settleLeftovers(tree, snap) !== undefined)
650
651
  return false;
651
- return !verifyFast(tree, snap).findings.some((f) => f.level === "error");
652
+ // a commit unasked takes what lies in the folder: never what the check of a write refuses (found: a write of 1.35.0
653
+ // the check refused, its note lost by the commit of a fix of a newer strom at its first start — settleNotesBack first)
654
+ return !verifyFast(tree, snap).findings.some((f) => f.level === "error") && !guard(tree, snap).some((f) => f.level === "error");
652
655
  }
653
656
  catch {
654
657
  return false;
655
658
  }
656
659
  }
660
+ /**
661
+ * At the first start of a strom and at a bridge's start: the notes of the material a send of the Strom app took off with
662
+ * no reason (core/guard.ts notesTakenOffByApp) given back and what waited with them committed — a research such a send
663
+ * left refusing every write is whole again before anybody writes. Skipped as the fixes are (somebody at work, another
664
+ * computer's seal, something else wrong, a dry run). How many records.
665
+ */
666
+ export function settleNotesBack(tree, quiet) {
667
+ if (tree.dryRun || !tree.key || !quiet(tree))
668
+ return 0;
669
+ let n = 0;
670
+ tree.atomically(() => {
671
+ if (!notesTakenOffByApp(tree, snapshot(tree)).length)
672
+ return;
673
+ const lost = giveNotesBack(tree, snapshot(tree));
674
+ // something else wrong besides: given back no more (left as it was), said by strom check
675
+ if (!writableUnasked(tree))
676
+ return void tree.rollback();
677
+ tree.commit(`Notes of the material given back: a send of the Strom app had taken ${counted(lost, "note")} off`);
678
+ n = lost;
679
+ });
680
+ return n;
681
+ }
657
682
  /**
658
683
  * The newest commit any key of this computer sealed (strom of an app packaged for Windows and of a terminal each had
659
684
  * their own), and whether strom repair is the terminal's: started by such an app, a commit above it with strom's seal may
package/dist/core/live.js CHANGED
@@ -727,7 +727,7 @@ import { settleNameStatus } from "./namestatusfix.js";
727
727
  import { browserState, treeBrowserArchives } from "./browserhelp.js";
728
728
  import { opsLogsOf } from "./opslog.js";
729
729
  import { placeOfWork } from "./workplace.js";
730
- import { notDownloaded } from "./integrity.js";
730
+ import { notDownloaded, settleNotesBack } from "./integrity.js";
731
731
  import fs from "node:fs";
732
732
  import zlib from "node:zlib";
733
733
  import os from "node:os";
@@ -767,7 +767,7 @@ import { forStory } from "./stories.js";
767
767
  import { censusHeldCount, censusHidden } from "./census.js";
768
768
  import { kindCounts, kindMatches, parseKnownKinds, parseTaskKind, TASK_KINDS, taskKind } from "./taskkind.js";
769
769
  import { factMark, nameMark, transcriptMark } from "./readers.js";
770
- import { raiseHypothesisLinkTasks, settleHypothesisLinks } from "./hypolinks.js";
770
+ import { quiet, raiseHypothesisLinkTasks, settleHypothesisLinks } from "./hypolinks.js";
771
771
  import { settleReaders } from "./readerfix.js";
772
772
  import { settleProven } from "./provenfix.js";
773
773
  import { settleHeldProposals, settleOrigins } from "./originfix.js";
@@ -3123,6 +3123,16 @@ export function serveLive(root, env) {
3123
3123
  kids.add(child);
3124
3124
  child.once("exit", () => kids.delete(child));
3125
3125
  };
3126
+ // the notes of the material a send of the app took off with no reason (1.35.0): given back and what waited with them
3127
+ // committed, before anything else is written unasked — the research writable again before anybody writes
3128
+ try {
3129
+ const back = settleNotesBack(Tree.open(root, env), quiet);
3130
+ if (back)
3131
+ noteLive(root, `notes of the material given back: ${counted(back, "file")} a send of the Strom app had taken them off`);
3132
+ }
3133
+ catch (e) {
3134
+ noteLive(root, `the notes of the material not given back now: ${errorText(e)}`);
3135
+ }
3126
3136
  // an archive switched by an older strom: its tasks that wait put aside before the app asks (logged, with the reason)
3127
3137
  try {
3128
3138
  const held = settleArchive(Tree.open(root, env));
@@ -23,7 +23,8 @@ export function sameBooks(tree, of, except) {
23
23
  for (const b of tree.list("recordset")) {
24
24
  if (skip.has(b.id) || b.duplicates?.of.includes(except ?? ""))
25
25
  continue;
26
- const mine = media.filter((m) => m.recordset === b.id);
26
+ // images taken back (strom media retract: a slip into the wrong book) bind it to nothing
27
+ const mine = media.filter((m) => m.recordset === b.id && !m.retracted);
27
28
  const by = key && b.url && bookUrlKey(b.url) === key
28
29
  ? "url"
29
30
  : of.connector && of.book !== undefined && mine.some((m) => m.fetched?.connector === of.connector && m.fetched?.book === String(of.book))
@@ -48,9 +49,9 @@ export function sameBookText(s) {
48
49
  */
49
50
  export function bookRoute(tree, recordset, connector) {
50
51
  const media = tree.list("media");
51
- const mine = (m) => m.recordset === recordset && !!m.fetched && (!connector || m.fetched.connector === connector);
52
- // an image withdrawn (a placeholder the portal gave) came from the book all the same: the others first
53
- const got = media.find((m) => mine(m) && !m.retracted) ?? media.find(mine);
52
+ // images taken back bind it to nothing: fetched into the wrong book by a slip and retracted, the book is free again
53
+ // (a placeholder withdrawn leaves the image it was the same file as)
54
+ const got = media.find((m) => m.recordset === recordset && !!m.fetched && !m.retracted && (!connector || m.fetched.connector === connector));
54
55
  if (got?.fetched)
55
56
  return { connector: got.fetched.connector, book: got.fetched.book, by: "images" };
56
57
  const url = tree.get(recordset)?.url;
@@ -60,7 +61,7 @@ export function bookRoute(tree, recordset, connector) {
60
61
  // the books of the research with a link whose images came through a connector: their link and their book
61
62
  const known = new Map();
62
63
  for (const m of media) {
63
- if (!m.fetched || !m.recordset || m.recordset === recordset || (connector && m.fetched.connector !== connector))
64
+ if (!m.fetched || !m.recordset || m.retracted || m.recordset === recordset || (connector && m.fetched.connector !== connector))
64
65
  continue;
65
66
  const b = tree.get(m.recordset);
66
67
  if (b?.url)
package/dist/core/sync.js CHANGED
@@ -1585,10 +1585,13 @@ export function settleReceived(root, file, to, applied = []) {
1585
1585
  }
1586
1586
  /** A send the bridge could not write: so said (the app may send it again); `retry`: the research was busy, tried again later. */
1587
1587
  export function failReceived(root, intake, reason, retry, code) {
1588
- const r = receivedAll(root).find((x) => x.intake === intake && x.state === "pending");
1588
+ // pending; or said written by the sync whose commit the check of the research then refused and took back (its input
1589
+ // no longer in data/): never "written" for the app while nothing of it is in the research
1590
+ const gone = (x) => x.state === "written" && !!x.input && !fs.existsSync(path.join(root, "data", "inputs", `${x.input}.json`));
1591
+ const r = receivedAll(root).find((x) => x.intake === intake && (x.state === "pending" || gone(x)));
1589
1592
  if (!r)
1590
1593
  return undefined;
1591
- if (retry) {
1594
+ if (retry && r.state === "pending") {
1592
1595
  const next = { ...r, tries: (r.tries ?? 0) + 1 };
1593
1596
  writeReceived(root, next);
1594
1597
  return next;
@@ -4646,8 +4649,12 @@ function mediaBase(tree, incoming) {
4646
4649
  cache.set(id, got);
4647
4650
  return got;
4648
4651
  };
4649
- const records = new Set([...atHead.keys(), ...commits.flatMap((c) => c.records)]);
4650
- return { links, records, field: (id, k) => fieldsOf(id)?.[k] };
4652
+ // the records the app was given: those in its tree at the head (a place there), and those its own sends wrote since —
4653
+ // never a record of the material that had no place in the tree (found: the note of a file the app first got in that
4654
+ // very send taken as removed by its user, its commit refused, the research stuck for every write after it)
4655
+ const given = [...atHead].filter(([, r]) => !r.retracted && (r.links ?? []).some((l) => !l.retracted)).map(([id]) => id);
4656
+ const records = new Set([...given, ...commits.flatMap((c) => c.records)]);
4657
+ return { links, records, field: (id, k) => (records.has(id) ? fieldsOf(id)?.[k] : undefined) };
4651
4658
  }
4652
4659
  /** What of a record only follows the file (no change of the user's): the original come, a working copy, its orientation. */
4653
4660
  function mediaKept(rec, f) {
@@ -5120,7 +5127,10 @@ function applyMedia(tree, plan, incoming, changes, by) {
5120
5127
  const now = JSON.stringify(Object.fromEntries(MEDIA_KEPT.flatMap((k) => (r[k] !== undefined ? [[k, r[k]]] : []))));
5121
5128
  if (now === before)
5122
5129
  continue;
5123
- update(tree, id, "input", () => r, { op: "input.media", summary: `${id} its places in the Strom app's tree, as the app gave them` });
5130
+ // a note its user took off in the app: said why (the history keeps every note: one gone without a reason blocks the commit)
5131
+ const prior = tree.get(id)?.notes ?? [];
5132
+ const noteOff = prior.some((n) => !(r.notes ?? []).some((x) => x.text === n.text && x.at === n.at));
5133
+ update(tree, id, "input", () => r, { op: "input.media", summary: `${id} its places in the Strom app's tree, as the app gave them`, ...(noteOff ? { reason: "its note taken off in the Strom app" } : {}) });
5124
5134
  by.applied.push({ do: "input.media.edit", id, before });
5125
5135
  }
5126
5136
  }
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.36.0-beta.8";
35
+ export const VERSION = "1.36.0-beta.9";
36
36
  /** What a new research is settled with from the start: nothing an older strom counted otherwise to set right in it. */
37
37
  export const NEW_TREE_SETTLED = ["readers-1", "proven-originals-1", "origins-1", "verify-originals-1", "origins-tree-1", "name-status-1"];
38
38
  const GITIGNORE = `# Strom Research — local state and large files are not versioned
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strom-research",
3
- "version": "1.36.0-beta.8",
3
+ "version": "1.36.0-beta.9",
4
4
  "stromDoc": "eddd7e946752f146eeb8767c5d13ce3b8ab0e488",
5
5
  "description": "Genealogical research toolkit for AI coding agents",
6
6
  "type": "module",