strom-research 1.38.0 → 1.39.0-beta.1
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 +14 -0
- package/CHANGELOG.de.md +16 -0
- package/CHANGELOG.md +15 -0
- package/CHANGELOG.pl.md +15 -0
- package/assets/lang/cs.json +8 -0
- package/assets/lang/de.json +8 -0
- package/assets/lang/pl.json +8 -0
- package/assets/method/core.md +2 -1
- package/dist/brief/brief.js +27 -12
- package/dist/cli/ui.js +5 -0
- package/dist/commands/connectors.js +25 -4
- package/dist/commands/media.js +8 -5
- package/dist/commands/setup.js +15 -2
- package/dist/commands/tasks.js +56 -6
- package/dist/core/browserhelp.js +2 -2
- package/dist/core/browserwait.js +70 -0
- package/dist/core/chromehook.js +10 -0
- package/dist/core/config.js +19 -0
- package/dist/core/metrics.js +9 -0
- package/dist/core/net.js +56 -10
- package/dist/core/phrases.js +3 -0
- package/dist/core/report.js +1 -1
- package/dist/core/retry.js +6 -0
- package/dist/core/terms.js +45 -1
- package/dist/core/tree.js +1 -1
- package/dist/core/web.js +36 -7
- package/package.json +4 -1
package/CHANGELOG.cs.md
CHANGED
|
@@ -5,6 +5,20 @@
|
|
|
5
5
|
Změny každé verze ve zkratce. Úplné poznámky a instalační řádky jsou na
|
|
6
6
|
[GitHub Releases](https://github.com/ACiDekCZ/strom-research/releases) (anglicky).
|
|
7
7
|
|
|
8
|
+
## 1.39.0
|
|
9
|
+
|
|
10
|
+
*Připravuje se: bety do 1.39.0-beta.1. Oddíl bude úplný s vydáním.*
|
|
11
|
+
|
|
12
|
+
- **Snímky přes prohlížeč agenta tempem člověka:** u archivu, kde je povolena cesta „přes prohlížeč“ (třeba Acta
|
|
13
|
+
Publica Moravského zemského archivu), ukládá rozsah snímků, který úkol potřebuje, agent sám, jeden po druhém přes
|
|
14
|
+
`strom media save`, nikdy celou knihu – už nezůstává na ručním uložení. Tempo hlídá strom pro každý archiv napříč
|
|
15
|
+
sezeními i výzkumy: aspoň 5 s mezi snímky s malým náhodným přídavkem, nejvýš 20 za sebou a pak pauza 3 minuty,
|
|
16
|
+
nejvýš 120 za hodinu; nikdy rychleji ani víc, než dovolují podmínky archivu. Po hodinovém stropu agent dělá jinou
|
|
17
|
+
práci nebo úkol vrátí na později. Výchozí hodnoty jsou nastavením tohoto počítače (`browser.pace`, „5 120 20 180“),
|
|
18
|
+
vlastní pro jeden archiv přes `strom allow host <host> --pace/--per-hour/--burst`; obojí mění jen člověk. Žádný
|
|
19
|
+
prohlížeč připojený: úkol čeká na prohlížeč agenta a vrátí se sám, jakmile ten otevře stránku; připojených víc a žádný
|
|
20
|
+
na tomto počítači: jednou se zeptá, který, a odpověď se pro tento počítač zapamatuje (`browser.name`).
|
|
21
|
+
|
|
8
22
|
## 1.38.0
|
|
9
23
|
|
|
10
24
|
*29. 11. 2026 · patří k aplikaci Strom 3.33.0.*
|
package/CHANGELOG.de.md
CHANGED
|
@@ -5,6 +5,22 @@
|
|
|
5
5
|
Die Änderungen jeder Version in Kürze. Die vollständigen Hinweise und die Installationszeilen stehen bei
|
|
6
6
|
[GitHub Releases](https://github.com/ACiDekCZ/strom-research/releases) (auf Englisch).
|
|
7
7
|
|
|
8
|
+
## 1.39.0
|
|
9
|
+
|
|
10
|
+
*In Vorbereitung: die Betas bis 1.39.0-beta.1. Der Abschnitt ist mit dem Release vollständig.*
|
|
11
|
+
|
|
12
|
+
- **Bilder über den Browser des Agenten im Tempo eines Menschen:** Bei einem Archiv, für das der Weg „über den Browser“
|
|
13
|
+
erlaubt ist (etwa Acta Publica des Mährischen Landesarchivs), speichert der Agent den Bereich der Bilder, den eine
|
|
14
|
+
Aufgabe braucht, selbst, eines nach dem anderen mit `strom media save`, nie das ganze Buch – nicht mehr von Hand.
|
|
15
|
+
strom hält das Tempo für jedes Archiv über Sitzungen und Forschungen hinweg ein: mindestens 5 s zwischen Bildern mit
|
|
16
|
+
einem kleinen zufälligen Zuschlag, höchstens 20 hintereinander und dann 3 Minuten Pause, höchstens 120 pro Stunde; nie
|
|
17
|
+
schneller oder mehr, als die Bedingungen des Archivs erlauben. Nach der Stundengrenze erledigt der Agent andere Arbeit
|
|
18
|
+
oder gibt die Aufgabe für später zurück. Die Vorgaben sind eine Einstellung dieses Computers (`browser.pace`,
|
|
19
|
+
„5 120 20 180“), eigene für ein Archiv über `strom allow host <host> --pace/--per-hour/--burst`; beides ändert nur
|
|
20
|
+
ein Mensch. Kein Browser verbunden: Die Aufgabe wartet auf den Browser des Agenten und kommt von selbst zurück, sobald
|
|
21
|
+
er eine Seite öffnet; mehrere verbunden und keiner auf diesem Computer: einmal die Frage, welcher, und die Antwort
|
|
22
|
+
bleibt für diesen Computer gespeichert (`browser.name`).
|
|
23
|
+
|
|
8
24
|
## 1.38.0
|
|
9
25
|
|
|
10
26
|
*29.11.2026 · gehört zur Strom-App 3.33.0.*
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,21 @@ English · [Čeština](CHANGELOG.cs.md) · [Deutsch](CHANGELOG.de.md) · [Polski
|
|
|
5
5
|
The changes of each version in short. The full notes and the install lines are on
|
|
6
6
|
[GitHub Releases](https://github.com/ACiDekCZ/strom-research/releases).
|
|
7
7
|
|
|
8
|
+
## 1.39.0
|
|
9
|
+
|
|
10
|
+
*In preparation: the betas up to 1.39.0-beta.1. The section is complete with the release.*
|
|
11
|
+
|
|
12
|
+
- **Images through the agent's browser at a person's pace:** at an archive the person allowed "through the browser"
|
|
13
|
+
(the Moravian Land Archive's Acta Publica, for one) the agent saves the range of images a task needs itself, one after
|
|
14
|
+
another with `strom media save`, never the whole book — no longer left to the person's hand. strom keeps the pace for
|
|
15
|
+
each archive across sessions and researches: at least 5 s between images with a small random part on top, at most 20
|
|
16
|
+
in a row and then a pause of 3 minutes, at most 120 an hour; never faster or more than the archive's own terms allow.
|
|
17
|
+
Past the hour's cap the agent does other work or returns the task for later. The defaults are a setting of this
|
|
18
|
+
computer (`browser.pace`, "5 120 20 180"), one archive's own by `strom allow host <host> --pace/--per-hour/--burst`,
|
|
19
|
+
both the person's alone. No browser connected: the task waits for the agent's browser and comes back by itself once it
|
|
20
|
+
opens a page; several connected, none of them on this computer: the person is asked once which, and the answer is
|
|
21
|
+
kept for this computer (`browser.name`).
|
|
22
|
+
|
|
8
23
|
## 1.38.0
|
|
9
24
|
|
|
10
25
|
*2026-11-29 · goes with the Strom app 3.33.0.*
|
package/CHANGELOG.pl.md
CHANGED
|
@@ -5,6 +5,21 @@
|
|
|
5
5
|
Zmiany każdej wersji w skrócie. Pełne informacje o wydaniach i polecenia instalacji są na
|
|
6
6
|
[GitHub Releases](https://github.com/ACiDekCZ/strom-research/releases) (po angielsku).
|
|
7
7
|
|
|
8
|
+
## 1.39.0
|
|
9
|
+
|
|
10
|
+
*W przygotowaniu: bety do 1.39.0-beta.1. Sekcja będzie kompletna z wydaniem.*
|
|
11
|
+
|
|
12
|
+
- **Skany przez przeglądarkę agenta w tempie człowieka:** w archiwum, w którym dozwolona jest droga „przez przeglądarkę“
|
|
13
|
+
(na przykład Acta Publica Morawskiego Archiwum Krajowego), zakres skanów potrzebny zadaniu agent zapisuje sam, jeden
|
|
14
|
+
po drugim przez `strom media save`, nigdy całej księgi – już nie zostaje to do ręcznego zapisania. Tempa strom pilnuje
|
|
15
|
+
dla każdego archiwum we wszystkich sesjach i badaniach: co najmniej 5 s między skanami z małym losowym dodatkiem,
|
|
16
|
+
najwyżej 20 pod rząd, potem 3 minuty przerwy, najwyżej 120 na godzinę; nigdy szybciej ani więcej, niż pozwalają
|
|
17
|
+
warunki archiwum. Po limicie godzinowym agent zajmuje się inną pracą albo odkłada zadanie na później. Wartości
|
|
18
|
+
domyślne są ustawieniem tego komputera (`browser.pace`, „5 120 20 180“), własne dla jednego archiwum przez
|
|
19
|
+
`strom allow host <host> --pace/--per-hour/--burst`; jedno i drugie zmienia tylko człowiek. Żadna przeglądarka nie
|
|
20
|
+
jest podłączona: zadanie czeka na przeglądarkę agenta i wraca samo, gdy ta otworzy stronę; podłączonych jest kilka,
|
|
21
|
+
a żadna na tym komputerze: jedno pytanie, która, a odpowiedź zostaje zapamiętana dla tego komputera (`browser.name`).
|
|
22
|
+
|
|
8
23
|
## 1.38.0
|
|
9
24
|
|
|
10
25
|
*29.11.2026 · współpracuje z aplikacją Strom 3.33.0.*
|
package/assets/lang/cs.json
CHANGED
|
@@ -1390,6 +1390,8 @@
|
|
|
1390
1390
|
"ui.web.ask.have": "Už {n, plural, one {# požadavek} few {# požadavky} other {# požadavků}} na {host} v tomto sezení. Více stránek nebo položek tohoto serveru je šetrnější stahovat přes jeho konektor {connector}, který tu už je a dodrží tempo serveru, robots.txt a jeho podmínky. Přesto povolit další?",
|
|
1391
1391
|
"ui.pace.cap": "nejvýš {n} za hodinu",
|
|
1392
1392
|
"ui.pace.nocap": "bez hodinového stropu",
|
|
1393
|
+
"ui.pace.burst": "nejvýš {n} za sebou, pak pauza {seconds} s",
|
|
1394
|
+
"ui.pace.noburst": "bez omezení počtu snímků za sebou",
|
|
1393
1395
|
"ui.o.results.offered": "{file} – pro aplikaci Strom, tady nenainstalovanou; uživatel o ní už ví – zmiň ji znovu, jen když chce vidět výsledky (strom app install, pak strom app)",
|
|
1394
1396
|
"ui.o.ask": "otázky",
|
|
1395
1397
|
"ui.o.ask.tell": "řekni uživateli jednou, jednou větou, že se tu může ptát na kohokoli ve stromu – strom to řekne jen jednou",
|
|
@@ -3397,6 +3399,9 @@
|
|
|
3397
3399
|
"retry.held": "prohlížeč zadržel stahování z {host} – v profilu, ve kterém agent pracuje, povolit stahování více souborů (ikona vpravo v adresním řádku), pak vrátit agentovi",
|
|
3398
3400
|
"retry.stopped": "ukládání přes prohlížeč agenta se zastavilo – sezení agenta skončilo uprostřed",
|
|
3399
3401
|
"retry.ready": "prohlížeč agenta k {archive} teď dosáhne – snímky uloží sám",
|
|
3402
|
+
"browser.none": "prohlížeč agenta – teď žádný připojený; úkol se vrátí sám, jakmile prohlížeč v tomto výzkumu otevře stránku",
|
|
3403
|
+
"browser.which": "Který prohlížeč má agent používat: {names}? (žádný z nich není na tomto počítači; odpověď se pro tento počítač zapamatuje)",
|
|
3404
|
+
"retry.browser": "prohlížeč agenta – po připojení se pokračuje",
|
|
3400
3405
|
"retry.noext": "rozšíření Claude in Chrome není připojené v žádném prohlížeči – snímky agent uloží jen s ním",
|
|
3401
3406
|
"retry.agent": "prohlížeč agenta {agent} strom nehlídá – snímky agent uloží jen přes Claude Code s rozšířením Claude in Chrome",
|
|
3402
3407
|
"retry.screen": "prohlížeč agenta k {archive} teď dosáhne – jen čtení z obrazovky, snímky se neuloží",
|
|
@@ -4180,6 +4185,9 @@
|
|
|
4180
4185
|
"ui.error.story.no-source.hint": "pozadí místa a doby se nejdřív zapíše jako pramen: strom source add … --kind book|newspaper|web",
|
|
4181
4186
|
"ui.consent.read.app": "Povolit aplikaci Strom až {hour} čtení dokumentů za hodinu a {day} za den? Každé čtení spustí agenta výzkumu a počítá se do ceny měsíce.",
|
|
4182
4187
|
"ui.consent.archive.pace": "Tempo stahování snímků z archivů, jejichž podmínky automatizaci omezují, po svolení „pomalu“: nejméně {seconds} s mezi dvěma snímky, nejvýš {n, plural, one {# požadavek} few {# požadavky} other {# požadavků}} na archiv za hodinu včetně katalogu. Nastavit?",
|
|
4188
|
+
"ui.consent.browser.pace": "Tempo, jakým prohlížeč agenta ukládá snímky z archivů jen přes prohlížeč člověka, po svolení „přes prohlížeč“: nejméně {seconds} s mezi dvěma snímky (náhodně o něco víc), nejvýš {n, plural, one {# snímek} few {# snímky} other {# snímků}} z jednoho archivu za hodinu na tomto počítači, {run}. Nastavit?",
|
|
4189
|
+
"ui.consent.browser.name": "Prohlížeč agenta, když je připojeno víc prohlížečů a žádný není na tomto počítači: „{name}“. Nastavit?",
|
|
4190
|
+
"ui.consent.browser.name.unset": "Prohlížeč, který agent používá, když je připojeno víc prohlížečů: zapomenout – agent se zeptá znovu. Nastavit?",
|
|
4183
4191
|
"ui.consent.claude.dir": "Složka Claude Code pro výzkum (její přihlášení, tedy které předplatné práci platí): {dir}",
|
|
4184
4192
|
"ui.archive.terms.known": "Podmínky: „{quote}“ ({terms})",
|
|
4185
4193
|
"ui.archive.terms.connector": "Podmínky podle stahovače: {quote} ({terms})",
|
package/assets/lang/de.json
CHANGED
|
@@ -1390,6 +1390,8 @@
|
|
|
1390
1390
|
"ui.web.ask.have": "Bereits {n, plural, one {# Anfrage} other {# Anfragen}} an {host} in dieser Sitzung. Mehr Seiten oder Einträge dieses Servers gehen schonender über seinen Connector {connector}, der schon da ist und Tempo, robots.txt und Bedingungen des Servers einhält. Trotzdem noch eine zulassen?",
|
|
1391
1391
|
"ui.pace.cap": "höchstens {n} pro Stunde",
|
|
1392
1392
|
"ui.pace.nocap": "ohne Stundenobergrenze",
|
|
1393
|
+
"ui.pace.burst": "höchstens {n} hintereinander, dann eine Pause von {seconds} s",
|
|
1394
|
+
"ui.pace.noburst": "ohne Grenze für Bilder hintereinander",
|
|
1393
1395
|
"ui.o.results.offered": "{file} – für die Strom-App, hier nicht installiert; der Nutzer kennt sie schon – erwähne sie erst wieder, wenn er die Ergebnisse sehen will (strom app install, dann strom app)",
|
|
1394
1396
|
"ui.o.ask": "Fragen",
|
|
1395
1397
|
"ui.o.ask.tell": "sag dem Nutzer einmal, in einem Satz, dass er dich hier nach jedem im Stammbaum fragen kann – strom sagt das nur einmal",
|
|
@@ -3397,6 +3399,9 @@
|
|
|
3397
3399
|
"retry.held": "der Browser hat das Herunterladen von {host} zurückgehalten – im Profil, in dem der Agent arbeitet, das Herunterladen mehrerer Dateien erlauben (das Symbol rechts in der Adressleiste), dann an den Agenten zurückgeben",
|
|
3398
3400
|
"retry.stopped": "das Speichern über den Browser des Agenten ist angehalten – die Sitzung des Agenten endete mittendrin",
|
|
3399
3401
|
"retry.ready": "der Browser des Agenten erreicht {archive} jetzt – er speichert die Aufnahmen selbst",
|
|
3402
|
+
"browser.none": "der Browser des Agenten – gerade keiner verbunden; die Aufgabe kommt von selbst zurück, sobald er in dieser Forschung eine Seite öffnet",
|
|
3403
|
+
"browser.which": "Welchen Browser soll der Agent verwenden: {names}? (keiner davon ist auf diesem Computer; die Antwort bleibt für diesen Computer gespeichert)",
|
|
3404
|
+
"retry.browser": "der Browser des Agenten – nach dem Verbinden geht es weiter",
|
|
3400
3405
|
"retry.noext": "die Erweiterung Claude in Chrome ist in keinem Browser verbunden – die Aufnahmen speichert der Agent nur mit ihr",
|
|
3401
3406
|
"retry.agent": "den Browser von {agent} überwacht strom nicht – die Aufnahmen speichert der Agent nur über Claude Code mit der Erweiterung Claude in Chrome",
|
|
3402
3407
|
"retry.screen": "der Browser des Agenten erreicht {archive} jetzt – nur vom Bildschirm gelesen, keine Aufnahme wird gespeichert",
|
|
@@ -4180,6 +4185,9 @@
|
|
|
4180
4185
|
"ui.error.story.no-source.hint": "der Hintergrund von Ort und Zeit wird zuerst als Quelle erfasst: strom source add … --kind book|newspaper|web",
|
|
4181
4186
|
"ui.consent.read.app": "Der Strom-App bis zu {hour, plural, one {# Lesung} other {# Lesungen}} von Dokumenten pro Stunde und {day} pro Tag erlauben? Jede Lesung startet den Agenten der Forschung und zählt zu den Kosten des Monats.",
|
|
4182
4187
|
"ui.consent.archive.pace": "Tempo für Bilder aus Archiven, deren Bedingungen die Automatisierung einschränken, nach der Erlaubnis „langsam“: mindestens {seconds} s zwischen zwei Bildern, höchstens {n, plural, one {# Anfrage} other {# Anfragen}} an das Archiv pro Stunde, den Katalog mitgezählt. So einstellen?",
|
|
4188
|
+
"ui.consent.browser.pace": "Tempo, in dem der Browser des Agenten Bilder aus Archiven speichert, die nur der Browser eines Menschen betreten darf, nach der Erlaubnis „über den Browser“: mindestens {seconds} s zwischen zwei Bildern (zufällig etwas mehr), höchstens {n, plural, one {# Bild} other {# Bilder}} aus einem Archiv pro Stunde auf diesem Computer, {run}. So einstellen?",
|
|
4189
|
+
"ui.consent.browser.name": "Der Browser des Agenten, wenn mehrere verbunden sind und keiner auf diesem Computer ist: „{name}“. So einstellen?",
|
|
4190
|
+
"ui.consent.browser.name.unset": "Der Browser, den der Agent verwendet, wenn mehrere verbunden sind: vergessen – der Agent fragt erneut. So einstellen?",
|
|
4183
4191
|
"ui.consent.claude.dir": "Ordner von Claude Code für die Forschung (seine Anmeldung, also welches Abonnement die Arbeit bezahlt): {dir}",
|
|
4184
4192
|
"ui.archive.terms.known": "Bedingungen: „{quote}“ ({terms})",
|
|
4185
4193
|
"ui.archive.terms.connector": "Bedingungen laut Downloader: {quote} ({terms})",
|
package/assets/lang/pl.json
CHANGED
|
@@ -1390,6 +1390,8 @@
|
|
|
1390
1390
|
"ui.web.ask.have": "Już {n, plural, one {# zapytanie} few {# zapytania} many {# zapytań} other {# zapytań}} do {host} w tej sesji. Kolejne strony lub pozycje tego serwera łagodniej jest pobierać przez jego konektor {connector}, który już tu jest i zachowa tempo serwera, robots.txt i jego warunki. Mimo to zezwolić na kolejne?",
|
|
1391
1391
|
"ui.pace.cap": "najwyżej {n} na godzinę",
|
|
1392
1392
|
"ui.pace.nocap": "bez limitu godzinowego",
|
|
1393
|
+
"ui.pace.burst": "najwyżej {n} pod rząd, potem przerwa {seconds} s",
|
|
1394
|
+
"ui.pace.noburst": "bez limitu skanów pod rząd",
|
|
1393
1395
|
"ui.o.results.offered": "{file} – dla aplikacji Strom, tu niezainstalowanej; użytkownik już o niej wie – wspomnieć o niej ponownie tylko wtedy, gdy zechce zobaczyć wyniki (strom app install, potem strom app)",
|
|
1394
1396
|
"ui.o.ask": "pytania",
|
|
1395
1397
|
"ui.o.ask.tell": "powiedz użytkownikowi raz, jednym zdaniem, że może tu pytać o kogokolwiek w drzewie – strom mówi to tylko raz",
|
|
@@ -3397,6 +3399,9 @@
|
|
|
3397
3399
|
"retry.held": "przeglądarka wstrzymała pobieranie z {host} – w profilu, w którym pracuje agent, zezwolić na pobieranie wielu plików (ikona po prawej stronie paska adresu), potem zwrócić agentowi",
|
|
3398
3400
|
"retry.stopped": "zapisywanie przez przeglądarkę agenta się zatrzymało – sesja agenta skończyła się w połowie",
|
|
3399
3401
|
"retry.ready": "przeglądarka agenta sięga teraz do {archive} – skany zapisze sama",
|
|
3402
|
+
"browser.none": "przeglądarka agenta – teraz żadna nie jest połączona; zadanie wróci samo, gdy przeglądarka otworzy stronę w tym badaniu",
|
|
3403
|
+
"browser.which": "Której przeglądarki ma używać agent: {names}? (żadna z nich nie jest na tym komputerze; odpowiedź zostanie zapamiętana dla tego komputera)",
|
|
3404
|
+
"retry.browser": "przeglądarka agenta – po połączeniu praca idzie dalej",
|
|
3400
3405
|
"retry.noext": "rozszerzenie Claude in Chrome nie jest połączone w żadnej przeglądarce – skany agent zapisze tylko z nim",
|
|
3401
3406
|
"retry.agent": "przeglądarki agenta {agent} strom nie pilnuje – skany agent zapisze tylko przez Claude Code z rozszerzeniem Claude in Chrome",
|
|
3402
3407
|
"retry.screen": "przeglądarka agenta sięga teraz do {archive} – tylko odczyt z ekranu, skany nie zostaną zapisane",
|
|
@@ -4180,6 +4185,9 @@
|
|
|
4180
4185
|
"ui.error.story.no-source.hint": "tło miejsca i czasu zapisuje się najpierw jako źródło: strom source add … --kind book|newspaper|web",
|
|
4181
4186
|
"ui.consent.read.app": "Zezwolić, by aplikacja Strom zlecała do {hour, plural, one {# odczytu} few {# odczytów} many {# odczytów} other {# odczytów}} dokumentów na godzinę i {day} na dobę? Każdy odczyt uruchamia agenta badania i wlicza się do kosztów miesiąca.",
|
|
4182
4187
|
"ui.consent.archive.pace": "Tempo pobierania skanów z archiwów, których warunki ograniczają automatyczny dostęp, po zgodzie „powoli”: co najmniej {seconds} s między dwoma skanami, najwyżej {n, plural, one {# zapytanie} few {# zapytania} many {# zapytań} other {# zapytań}} do archiwum na godzinę, łącznie z katalogiem. Ustawić tak?",
|
|
4188
|
+
"ui.consent.browser.pace": "Tempo, w jakim przeglądarka agenta zapisuje skany z archiwów dostępnych tylko przez przeglądarkę człowieka, po zgodzie „przez przeglądarkę”: co najmniej {seconds} s między dwoma skanami (losowo nieco więcej), najwyżej {n, plural, one {# skan} few {# skany} many {# skanów} other {# skanów}} z jednego archiwum na godzinę na tym komputerze, {run}. Ustawić tak?",
|
|
4189
|
+
"ui.consent.browser.name": "Przeglądarka agenta, gdy połączonych jest kilka, a żadna nie jest na tym komputerze: „{name}”. Ustawić tak?",
|
|
4190
|
+
"ui.consent.browser.name.unset": "Przeglądarka, której agent używa, gdy połączonych jest kilka: zapomnieć – agent zapyta ponownie. Ustawić tak?",
|
|
4183
4191
|
"ui.consent.claude.dir": "Folder Claude Code dla badania (jego logowanie, czyli która subskrypcja opłaca pracę): {dir}",
|
|
4184
4192
|
"ui.archive.terms.known": "Warunki: „{quote}” ({terms})",
|
|
4185
4193
|
"ui.archive.terms.connector": "Warunki według programu pobierającego: {quote} ({terms})",
|
package/assets/method/core.md
CHANGED
|
@@ -116,7 +116,8 @@ conclusion so the next researcher can follow it.
|
|
|
116
116
|
half the name falls in; never batches from one end), only the images of the
|
|
117
117
|
name's letter fetched; a page number from the index turned into an image
|
|
118
118
|
number by one or two images, never a batch of ten; an entry: its image ±1
|
|
119
|
-
(it may run over a page).
|
|
119
|
+
(it may run over a page). Through your browser: the range the task needs is
|
|
120
|
+
yours, at strom's pace — never the person's hand. An archive that allows automation: batches as
|
|
120
121
|
usual (about ±5 around the target, an index in batches) — fewer turns.
|
|
121
122
|
`strom read` may follow a fetch at work: sooner, never more images.
|
|
122
123
|
Images you will read later in the session: `--background` fetches them
|
package/dist/brief/brief.js
CHANGED
|
@@ -30,7 +30,7 @@ import { taskRecordsets } from "../core/frontier.js";
|
|
|
30
30
|
import { reviewItems } from "../core/review.js";
|
|
31
31
|
import { byHandOnly, listConnectors, missingConsents, readyConnectors, routeOf } from "../core/connector.js";
|
|
32
32
|
import { clock, clockUp, hostAllowed, hostState, leftAloneFor, REFUSED_FOREVER } from "../core/net.js";
|
|
33
|
-
import { archiveLevel } from "../core/terms.js";
|
|
33
|
+
import { archiveLevel, browserPace } from "../core/terms.js";
|
|
34
34
|
import { onHost, permissionQuestions, setHosts } from "../core/archivewait.js";
|
|
35
35
|
import { runs, runsArg, shellArg } from "../cli/format.js";
|
|
36
36
|
import { readingsLine, readingsOf } from "../core/readsync.js";
|
|
@@ -53,7 +53,7 @@ import { placesIdentifySections } from "./places.js";
|
|
|
53
53
|
import { verifySection } from "./verify.js";
|
|
54
54
|
import { auditSections } from "./audit.js";
|
|
55
55
|
export { DEFAULT_BUDGET } from "../core/config.js";
|
|
56
|
-
import { DEFAULT_BUDGET, Settings } from "../core/config.js";
|
|
56
|
+
import { DEFAULT_BUDGET, loadUserConfig, Settings } from "../core/config.js";
|
|
57
57
|
import { censusHoldings, forCensus } from "../core/census.js";
|
|
58
58
|
import { bookTuned, hostTuned, readingOf, treeTuning, tuningOn } from "../core/tune.js";
|
|
59
59
|
import { researchKey, viewModel, viewSizes } from "../core/viewsizes.js";
|
|
@@ -701,7 +701,7 @@ function byHandAsk(b, whole) {
|
|
|
701
701
|
/** What a finder of a record set means for its images. */
|
|
702
702
|
function finderText(f, b) {
|
|
703
703
|
if (f.why === "browser")
|
|
704
|
-
return `only a person's browser goes to this archive: its connector ${f.connector} is refused there by strom fetch, finding its books (--find) too — ${f.save ? `
|
|
704
|
+
return `only a person's browser goes to this archive: its connector ${f.connector} is refused there by strom fetch, finding its books (--find) too — ${f.save ? `the images the task needs through your browser, a range of them too, image after image: ${f.save} (then strom media add --inbox --waiting); the person saves them by hand only when your browser cannot reach it` : "the person saves the images by hand"}`;
|
|
705
705
|
if (f.why === "consent")
|
|
706
706
|
return `its connector ${f.connector} fetches them once the user allows it — one strom fetch ${f.connector} <book> --images <from-to> --recordset ${b.id} asks them; once the question waits, never again until they decide`;
|
|
707
707
|
const what = f.why === "manual" ? `the archive's terms allow no automation: its connector ${f.connector} finds books and gives their links` : `its connector ${f.connector} only finds books and fetches no images`;
|
|
@@ -967,9 +967,12 @@ function archiveLine(tree, b, repo, shared, installed, qs = []) {
|
|
|
967
967
|
: "no decision of the person's yet: a fetch of its images asks them once, and the question then waits — never fetch there again until they decide")(qs.find((x) => onHost(a.host, x.host))));
|
|
968
968
|
else if (a.permission === "manual")
|
|
969
969
|
parts.push("the person: images by hand only");
|
|
970
|
-
// a restricted archive's images
|
|
971
|
-
|
|
972
|
-
|
|
970
|
+
// a restricted archive's images allowed slowly: sparing (the method's "Fetch only what you read"); through the agent's
|
|
971
|
+
// browser: the images the task needs, a range of them too, at a person's pace strom keeps (Milan, 29 November 2026)
|
|
972
|
+
if ((a.level === "restricted" || a.level === "unknown") && a.permission === "slow" && !a.browserOnly)
|
|
973
|
+
parts.push("fetch sparingly: an index by halving, a page to its image by 1–2 images, an entry ±1");
|
|
974
|
+
else if ((a.level === "restricted" || a.level === "unknown") && a.permission === "browser")
|
|
975
|
+
parts.push(browserImagesLine(tree.env));
|
|
973
976
|
if (a.refused)
|
|
974
977
|
parts.push(`${a.refused.host} refused strom's client — left alone ${a.refused.until && a.refused.until < REFUSED_FOREVER ? `until ${clock(a.refused.until)}` : "until the person lifts it"}; not through your web tools or a browser either`);
|
|
975
978
|
else if (net) {
|
|
@@ -986,6 +989,16 @@ function archiveLine(tree, b, repo, shared, installed, qs = []) {
|
|
|
986
989
|
}
|
|
987
990
|
return parts.length ? ` archive ${a.host}: ${parts.join(" · ")}` : "";
|
|
988
991
|
}
|
|
992
|
+
/**
|
|
993
|
+
* An archive whose images the agent's browser saves (the person's permission "through the browser"): the images the
|
|
994
|
+
* task needs, a range of them too, image after image at a person's pace strom keeps (core/terms.ts browserPace, the
|
|
995
|
+
* archive's own slower) — past the archive's hour other work or the queue for later, never the person's hand; never a
|
|
996
|
+
* whole book. Finding the page stays sparing (an index by halving).
|
|
997
|
+
*/
|
|
998
|
+
export function browserImagesLine(env) {
|
|
999
|
+
const p = browserPace(env);
|
|
1000
|
+
return `images through your browser: the ones the task needs, a range of them too (an entry over pages, a year of a register), image after image — strom paces each page at a person's pace (${p.minIntervalMs / 1000} s apart or more${p.burst && p.burstPauseMs ? `, at most ${p.burst} in a row, then ${Math.round(p.burstPauseMs / 1000)} s of pause` : ""}, at most ${p.perHour} images an hour from this archive on this computer — its own, where the person set one, as strom keeps it); a pause or past its hour: other work, else strom session close --continue and on later — never strom task wait for the person (by hand only when your browser cannot reach it); never the whole book, nothing ahead; to find the page: an index by halving, an entry ±1`;
|
|
1001
|
+
}
|
|
989
1002
|
/**
|
|
990
1003
|
* The files that came for what the task waited for (Task.files: strom intake --answers, the Strom app's file to the
|
|
991
1004
|
* task) — that they came, never the person's words: read each as the task's next step.
|
|
@@ -1037,7 +1050,9 @@ const BROWSER_SITES = 12;
|
|
|
1037
1050
|
* person (several connected) — only another computer's: none, somebody may be working there —, and what is outside
|
|
1038
1051
|
* its sites or forbids automation goes to the user as a task that waits — never a question left in the summary.
|
|
1039
1052
|
*/
|
|
1040
|
-
export function browserRules(sites, alone, task) {
|
|
1053
|
+
export function browserRules(sites, alone, task, chosen) {
|
|
1054
|
+
// the person's choice of a browser for this computer (browser.name: their answer in What waits, or strom config)
|
|
1055
|
+
const pick = chosen ? `"${chosen}" (the person's choice for this computer), else ` : "";
|
|
1041
1056
|
const bare = [...new Set(sites.map((h) => h.replace(/^\*\./, "").toLowerCase()))];
|
|
1042
1057
|
const named = bare.length > BROWSER_SITES ? `${bare.slice(0, BROWSER_SITES).join(", ")} and ${bare.length - BROWSER_SITES} more` : bare.join(", ");
|
|
1043
1058
|
return [
|
|
@@ -1050,12 +1065,12 @@ export function browserRules(sites, alone, task) {
|
|
|
1050
1065
|
`- A site that forbids automation, refused strom, or restricts it without the person's permission "through the browser" (strom net web --check <url> --browser says it): no connector, no browser — another way to the same records (another archive or fonds of the jurisdiction, the parish, an index, secondary sources), the search recorded (strom search add … --result inconclusive --note "<host>: …"); only if the source stays necessary: strom task wait ${task ?? "T…"} --check <url> --on "<what the person checks there>"${alone ? ", then close the session" : ""}.`,
|
|
1051
1066
|
...(alone
|
|
1052
1067
|
? [
|
|
1053
|
-
|
|
1054
|
-
`- Neither: those browsers are another computer's, somebody may be working there —
|
|
1068
|
+
`- Nobody answers in a run: no AskUserQuestion, no switch_browser. Several browsers connected, none selected: list_connected_browsers, then select_browser — ${pick}onThisComputer, else isLocal.`,
|
|
1069
|
+
`- Neither: those browsers are another computer's, somebody may be working there — never one of your own choice: strom task wait ${task ?? "T…"} --browser "<name>|<name>" (as listed; the person chooses once, kept for this computer), then close the session. No browser connected: strom task wait ${task ?? "T…"} --browser none (back by itself once one is), then close the session — never images by hand for it.`,
|
|
1055
1070
|
`- Another site that allows automation: an archive the task needs without a connector — build one (strom connector new); anything else — strom task wait ${task ?? "T…"} --on "<the question>", then close the session.`,
|
|
1056
1071
|
]
|
|
1057
1072
|
: [
|
|
1058
|
-
|
|
1073
|
+
`- Several browsers connected, none selected: list_connected_browsers, ${chosen ? `select_browser "${chosen}" (the person's choice for this computer) if listed, else ` : ""}ask the user which — onThisComputer, else isLocal, else the first suggested —, then select_browser.`,
|
|
1059
1074
|
"- Another site: ask the user first.",
|
|
1060
1075
|
]),
|
|
1061
1076
|
].join("\n");
|
|
@@ -1452,7 +1467,7 @@ export function buildBrief(tree, opts) {
|
|
|
1452
1467
|
const saveFor = (b) => {
|
|
1453
1468
|
const repo = b.repository ? tree.get(b.repository) : undefined;
|
|
1454
1469
|
const a = bookBrowserArchive(tree, [b.url, repo?.url].find((x) => !!x && URL.canParse(x)), opts.shared);
|
|
1455
|
-
return a?.permitted && browserState(tree.env, tuneAgent, tree.root).state === "ready" ? `strom media save ${task?.id ?? "T…"} --image <n> --at <the archive's page of that image
|
|
1470
|
+
return a?.permitted && browserState(tree.env, tuneAgent, tree.root).state === "ready" ? `strom media save ${task?.id ?? "T…"} --image <n> --at <the archive's page of that image> (several: --image 70-79 --at "<the page with {n} where the number goes>")` : undefined;
|
|
1456
1471
|
};
|
|
1457
1472
|
const finders = new Map(sets.map((b) => [b.id, routes.get(b.id) ? undefined : bookFinder(tree, b, installed, opts.shared, saveFor(b))]));
|
|
1458
1473
|
// a weak scan of such an archive: the image saved once more through that browser (strom media save --again)
|
|
@@ -1649,7 +1664,7 @@ export function buildBrief(tree, opts) {
|
|
|
1649
1664
|
sections.push({ name: "commands", first: true, pointer: "strom help <command>", text: sheet });
|
|
1650
1665
|
// 8c. the browser, for a session that has it (its sites): how to use it, and gently
|
|
1651
1666
|
if (opts.browser)
|
|
1652
|
-
sections.push({ name: "browser", first: true, pointer: "strom guide", text: browserRules(opts.browser, !!opts.session?.runner, task?.id) });
|
|
1667
|
+
sections.push({ name: "browser", first: true, pointer: "strom guide", text: browserRules(opts.browser, !!opts.session?.runner, task?.id, loadUserConfig(tree.env).browserName) });
|
|
1653
1668
|
// 9. how to finish
|
|
1654
1669
|
sections.push({
|
|
1655
1670
|
name: "closing",
|
package/dist/cli/ui.js
CHANGED
|
@@ -40,6 +40,8 @@ export const UI = {
|
|
|
40
40
|
"ui.web.ask.have": "{n, plural, one {# request} other {# requests}} to {host} in this session already. More pages or items of this server go more gently through its connector {connector}, which is here and keeps the server's pace, robots.txt and terms. Allow one more anyway?",
|
|
41
41
|
"ui.pace.cap": "at most {n} an hour",
|
|
42
42
|
"ui.pace.nocap": "no hourly cap",
|
|
43
|
+
"ui.pace.burst": "at most {n} in a row, then a pause of {seconds} s",
|
|
44
|
+
"ui.pace.noburst": "no limit of images in a row",
|
|
43
45
|
"ui.consent.host": "Allow automatic downloading from {host}?",
|
|
44
46
|
"ui.consent.host.revoke": "Stop automatic downloading from {host}?",
|
|
45
47
|
"ui.consent.connector.hosts": "It will reach only {hosts} — slowly, through strom's limiter.",
|
|
@@ -3822,6 +3824,9 @@ export const UI = {
|
|
|
3822
3824
|
"ui.error.story.no-source.hint": "the background of place and time is recorded first: strom source add \u2026 --kind book|newspaper|web",
|
|
3823
3825
|
"ui.consent.read.app": "Let the Strom app ask up to {hour, plural, one {# reading} other {# readings}} of documents an hour and {day} a day? Each reading starts the research's agent and is counted in what the month costs.",
|
|
3824
3826
|
"ui.consent.archive.pace": "The pace for the images of archives whose terms restrict automated access, once allowed slowly: at least {seconds} s between two images, at most {n, plural, one {# request} other {# requests}} to the archive an hour, its catalogue counted too. Set it so?",
|
|
3827
|
+
"ui.consent.browser.pace": "The pace for the images the agent's browser saves at archives only a person's browser goes to, once allowed through the browser: at least {seconds} s between two images (a little more at random), at most {n, plural, one {# image} other {# images}} from one archive an hour on this computer, {run}. Set it so?",
|
|
3828
|
+
"ui.consent.browser.name": "The agent's browser, when several are connected and none is on this computer: \"{name}\". Set it so?",
|
|
3829
|
+
"ui.consent.browser.name.unset": "The browser the agent uses when several are connected: forgotten — the agent asks again. Set it so?",
|
|
3825
3830
|
"ui.consent.claude.dir": "The folder of Claude Code for the research (its login, i.e. which subscription pays the work): {dir}",
|
|
3826
3831
|
"ui.archive.terms.known": "Terms: “{quote}” ({terms})",
|
|
3827
3832
|
"ui.archive.terms.connector": "Terms as its downloader reads them: {quote} ({terms})",
|
|
@@ -1480,15 +1480,16 @@ register({
|
|
|
1480
1480
|
{ name: "unblock", type: "boolean", description: "lift a refusal (401/403), or a limit the host said is used up, early — only after the archive said it is fine" },
|
|
1481
1481
|
{ name: "pace", type: "string", value: "<seconds|auto>", description: `your own pause between two requests to the host (at least ${MIN_INTERVAL_MS / 1000} s); auto: the service's again` },
|
|
1482
1482
|
{ name: "per-hour", type: "string", value: "<n|none|auto>", description: "your own hourly cap for the host; none: no cap; auto: the service's again (strom sets none by itself)" },
|
|
1483
|
+
{ name: "burst", type: "string", value: "\"<n> <seconds>\"|none|auto", description: "the images the agent's browser saves there (an archive only a person's browser goes to): at most n in a row, then a pause of so many seconds; none: no such limit; auto: browser.pace's again (default 20 in a row, then 180 s)" },
|
|
1483
1484
|
],
|
|
1484
|
-
examples: ["strom allow host archive.example.org", "strom allow host archive.example.org --pace 1 --per-hour none", "strom allow host archive.example.org --pace auto --per-hour auto", "strom allow host archive.example.org --revoke"],
|
|
1485
|
+
examples: ["strom allow host archive.example.org", "strom allow host archive.example.org --pace 1 --per-hour none", 'strom allow host archive.example.org --pace 8 --per-hour 60 --burst "10 300"', "strom allow host archive.example.org --pace auto --per-hour auto", "strom allow host archive.example.org --revoke"],
|
|
1485
1486
|
run: async (ctx, { args, opts }) => {
|
|
1486
1487
|
const host = args[0].toLowerCase().replace(/^https?:\/\//, "").replace(/\/.*$/, "");
|
|
1487
1488
|
const lang = ctx.uiLang();
|
|
1488
1489
|
// The user's own pace for the host: theirs to set — asked in a window when an agent runs it.
|
|
1489
|
-
if (opts.pace !== undefined || opts["per-hour"] !== undefined) {
|
|
1490
|
+
if (opts.pace !== undefined || opts["per-hour"] !== undefined || opts.burst !== undefined) {
|
|
1490
1491
|
const was = hostState(netDir(ctx), host).own;
|
|
1491
|
-
const own = { ...(was?.minIntervalMs !== undefined ? { minIntervalMs: was.minIntervalMs } : {}), ...(was?.perHour !== undefined ? { perHour: was.perHour } : {}) };
|
|
1492
|
+
const own = { ...(was?.minIntervalMs !== undefined ? { minIntervalMs: was.minIntervalMs } : {}), ...(was?.perHour !== undefined ? { perHour: was.perHour } : {}), ...(was?.burst !== undefined ? { burst: was.burst } : {}), ...(was?.burstPauseMs !== undefined ? { burstPauseMs: was.burstPauseMs } : {}) };
|
|
1492
1493
|
if (opts.pace !== undefined) {
|
|
1493
1494
|
const v = String(opts.pace).trim();
|
|
1494
1495
|
if (v === "auto")
|
|
@@ -1509,9 +1510,29 @@ register({
|
|
|
1509
1510
|
else
|
|
1510
1511
|
throw new UsageError(`--per-hour must be a number, none or auto — not "${v}"`);
|
|
1511
1512
|
}
|
|
1513
|
+
if (opts.burst !== undefined) {
|
|
1514
|
+
const v = String(opts.burst).trim();
|
|
1515
|
+
const m = /^(\d+)\s+(\d+(?:\.\d+)?)$/u.exec(v);
|
|
1516
|
+
if (v === "auto") {
|
|
1517
|
+
delete own.burst;
|
|
1518
|
+
delete own.burstPauseMs;
|
|
1519
|
+
}
|
|
1520
|
+
else if (v === "none") {
|
|
1521
|
+
own.burst = 0;
|
|
1522
|
+
delete own.burstPauseMs;
|
|
1523
|
+
}
|
|
1524
|
+
else if (m && Number(m[1]) > 0 && Number(m[2]) >= 1) {
|
|
1525
|
+
own.burst = Number(m[1]);
|
|
1526
|
+
own.burstPauseMs = Math.round(Number(m[2]) * 1000);
|
|
1527
|
+
}
|
|
1528
|
+
else
|
|
1529
|
+
throw new UsageError(`--burst must be "<images in a row> <pause seconds>" (the pause at least 1 s), none or auto — not "${v}"`, { hint: `strom allow host ${host} --burst "20 180"` });
|
|
1530
|
+
}
|
|
1512
1531
|
const c = listConnectors(ctx.settings.shared()?.value).find((x) => x.manifest.hosts.some((h) => hostAllowed(host, [h])));
|
|
1513
1532
|
const next = hostPace({ recent: [], own: { ...own, at: "" } }, c?.manifest.policy.pace);
|
|
1514
|
-
|
|
1533
|
+
// so many in a row: said only where it is set for the host (the agent's browser keeps to it)
|
|
1534
|
+
const run = own.burst !== undefined ? `, ${own.burst && own.burstPauseMs ? ui(lang, "ui.pace.burst", { n: own.burst, seconds: secondsIn(lang, own.burstPauseMs) }) : ui(lang, "ui.pace.noburst")}` : "";
|
|
1535
|
+
const yes = await ctx.requireHumanYes(`Set the pace of ${host}: ${paceText(next)}${own.burst ? `, at most ${own.burst} in a row through the agent's browser, then ${own.burstPauseMs / 1000} s` : own.burst === 0 ? ", no limit in a row" : ""}?`, `strom allow host ${host}${opts.pace !== undefined ? ` --pace ${opts.pace}` : ""}${opts["per-hour"] !== undefined ? ` --per-hour ${opts["per-hour"]}` : ""}${opts.burst !== undefined ? ` --burst "${opts.burst}"` : ""}`, `pace:${host}`, ui(lang, "ui.consent.host.pace", { host, seconds: secondsIn(lang, next.minIntervalMs), cap: (Number.isFinite(next.perHour) ? ui(lang, "ui.pace.cap", { n: next.perHour }) : ui(lang, "ui.pace.nocap")) + run }));
|
|
1515
1536
|
if (!yes)
|
|
1516
1537
|
return { text: ui(lang, "ui.host.pace.kept", { host }), data: { host, changed: false }, exitCode: 1 };
|
|
1517
1538
|
const s = setOwnPace(netDir(ctx), host, own);
|
package/dist/commands/media.js
CHANGED
|
@@ -38,8 +38,8 @@ import { readableFile } from "../core/readable.js";
|
|
|
38
38
|
import { countUnknownAfterSave, liveBook } from "../core/books.js";
|
|
39
39
|
import { HELD_AFTER_MS, PLAN_TTL_MS, STOPS_FILE, TAKEN_KEEP_MS, findDownload, loadPlans, loadSaves, loadStops, noteSave, noteStop, parseRangeResult, rangeScript, saveScript, savePagesScript, SAVE_PAGES_MAX, storeSaves, storeStops, waitFileBase } from "../core/browser.js";
|
|
40
40
|
import { bookOn, browserGate, hostBlocked, netDirOf, otherWay } from "../core/webgate.js";
|
|
41
|
-
import { allows, browserRangeOf } from "../core/terms.js";
|
|
42
|
-
import { browserStopped, clockUp,
|
|
41
|
+
import { allows, browserPace, browserRangeOf } from "../core/terms.js";
|
|
42
|
+
import { browserStopped, clockUp, reserveSlots } from "../core/net.js";
|
|
43
43
|
import { phrase } from "../core/phrases.js";
|
|
44
44
|
import { browserKept, withoutBrowserReason } from "../core/browserhelp.js";
|
|
45
45
|
import { goesAhead } from "../core/queue.js";
|
|
@@ -1320,14 +1320,17 @@ function saveRange(ctx, tree, t, opts) {
|
|
|
1320
1320
|
});
|
|
1321
1321
|
if (!needed.length)
|
|
1322
1322
|
throw new UsageError(`nothing to save of ${b.id}: ${already.length ? `images ${runs(already)} registered already` : ""}${already.length && notWaited.length ? ", " : ""}${notWaited.length ? `${t.id} waits for none of images ${runs(notWaited)}` : ""}`, { hint: `strom task show ${t.id}` });
|
|
1323
|
-
// at times the limiter reserves: never faster than a person's pace
|
|
1323
|
+
// at times the limiter reserves: never faster than a person's pace through the browser (browser.pace: 5 s and a
|
|
1324
|
+
// random part on top, 120 an hour) nor the host's own
|
|
1324
1325
|
const shared = sharedDir(ctx);
|
|
1325
1326
|
const netDir = netDirOf(shared, tree);
|
|
1326
1327
|
const take = needed.slice(0, max);
|
|
1327
|
-
const
|
|
1328
|
+
const pace = browserPace(ctx.env);
|
|
1329
|
+
const times = tree.dryRun ? take.map((_, i) => Date.now() + (i + 1) * pace.minIntervalMs) : reserveSlots(netDir, g.host, { minIntervalMs: pace.minIntervalMs, perHour: pace.perHour, source: "a person's pace (strom media save --images)" }, take.length, { human: pace, leadMs: pace.minIntervalMs });
|
|
1328
1330
|
const items = times.map((at, i) => ({ n: take[i], file: waitFileBase(tree.config.id, t.id, take[i]), at }));
|
|
1329
1331
|
const rest = needed.slice(items.length);
|
|
1330
|
-
|
|
1332
|
+
// the shortest pause between two of them (each its own: the script keeps to their times)
|
|
1333
|
+
const gap = times.length > 1 ? Math.min(...times.slice(1).map((x, i) => x - times[i])) : pace.minIntervalMs;
|
|
1331
1334
|
// the task waits for them all — the rest over the cap too, which the same command gives once these came (with those it
|
|
1332
1335
|
// waited for already): the files the browser saves bring it back
|
|
1333
1336
|
const want = [...new Set([...waited, ...needed])].sort((x, y) => x - y);
|
package/dist/commands/setup.js
CHANGED
|
@@ -46,8 +46,8 @@ import { backupBefore, backupSaid, lastBackupLine } from "../cli/backups.js";
|
|
|
46
46
|
import { BACKUP_SAID_DAYS, lastBackup } from "../core/backup.js";
|
|
47
47
|
import { planMove, planUseExisting, researchHome, sameFolder, useExistingHome } from "../core/relocate.js";
|
|
48
48
|
import { knownTreesIn } from "../core/tree.js";
|
|
49
|
-
import { parseArchivePace } from "../core/terms.js";
|
|
50
|
-
import { HUMAN_PACE } from "../core/net.js";
|
|
49
|
+
import { parseArchivePace, parseBrowserPace } from "../core/terms.js";
|
|
50
|
+
import { BROWSER_PACE, HUMAN_PACE } from "../core/net.js";
|
|
51
51
|
import { appOpensLinks, appUrlSetting, researchUrl, stromAppUrl, stromAppState } from "../core/stromapp.js";
|
|
52
52
|
import { isInstalled } from "../agents/global.js";
|
|
53
53
|
import { offerLinks, shortcutName } from "../cli/wizard.js";
|
|
@@ -1272,6 +1272,7 @@ const FALLBACKS = {
|
|
|
1272
1272
|
mode: () => "research",
|
|
1273
1273
|
updates: () => "check",
|
|
1274
1274
|
"archive.pace": () => "auto",
|
|
1275
|
+
"browser.pace": () => "auto",
|
|
1275
1276
|
"read.app": () => "auto",
|
|
1276
1277
|
"live.idleMinutes": () => DEFAULT_LIVE_IDLE_MINUTES,
|
|
1277
1278
|
"task.hold": (s) => s.holdMinutes("task.hold"),
|
|
@@ -1965,6 +1966,18 @@ async function setUserSetting(ctx, key, value) {
|
|
|
1965
1966
|
const pace = p ?? HUMAN_PACE;
|
|
1966
1967
|
ctx.requireHuman(`Set the pace for the images of archives that restrict automation: at least ${pace.minIntervalMs / 1000} s apart, at most ${pace.perHour} an hour?`, value === undefined ? "strom config unset archive.pace" : `strom config set archive.pace "${value}"`, "archive.pace", ui(ctx.uiLang(), "ui.consent.archive.pace", { seconds: secondsIn(ctx.uiLang(), pace.minIntervalMs), n: pace.perHour }));
|
|
1967
1968
|
}
|
|
1969
|
+
// A person's pace for the images the agent's browser saves: theirs alone, faster or slower — never the agent's.
|
|
1970
|
+
if (key === "browser.pace" && value !== (s.config.browserPace ?? undefined)) {
|
|
1971
|
+
const p = typeof value === "string" && value !== "auto" ? parseBrowserPace(value) : undefined;
|
|
1972
|
+
const pace = p ?? BROWSER_PACE;
|
|
1973
|
+
const lang = ctx.uiLang();
|
|
1974
|
+
const run = pace.burst && pace.burstPauseMs ? ui(lang, "ui.pace.burst", { n: pace.burst, seconds: secondsIn(lang, pace.burstPauseMs) }) : ui(lang, "ui.pace.noburst");
|
|
1975
|
+
ctx.requireHuman(`Set the pace for the images the agent's browser saves: at least ${pace.minIntervalMs / 1000} s apart, at most ${pace.perHour} an hour from one archive, ${pace.burst ? `at most ${pace.burst} in a row, then ${pace.burstPauseMs / 1000} s` : "no limit in a row"}?`, value === undefined ? "strom config unset browser.pace" : `strom config set browser.pace "${value}"`, "browser.pace", ui(lang, "ui.consent.browser.pace", { seconds: secondsIn(lang, pace.minIntervalMs), n: pace.perHour, run }));
|
|
1976
|
+
}
|
|
1977
|
+
// Which browser the agent drives where several are connected: another computer's may be somebody's at work — the person's alone.
|
|
1978
|
+
if (key === "browser.name" && value !== (s.config.browserName ?? undefined)) {
|
|
1979
|
+
ctx.requireHuman(value === undefined ? "Forget the browser the agent uses (it asks again)?" : `Let the agent use the browser "${value}" when several are connected?`, value === undefined ? "strom config unset browser.name" : `strom config set browser.name "${value}"`, "browser.name", ui(ctx.uiLang(), value === undefined ? "ui.consent.browser.name.unset" : "ui.consent.browser.name", { name: String(value ?? "") }));
|
|
1980
|
+
}
|
|
1968
1981
|
// Which Claude Code folder — whose login, which subscription pays — is the person's alone, never an agent's.
|
|
1969
1982
|
if (key === "agent.claudeConfigDir" && value !== (s.config.claudeConfigDir ?? undefined)) {
|
|
1970
1983
|
const dir = typeof value === "string" && value ? value : "~/.claude";
|
package/dist/commands/tasks.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// is a wish; strom refuses it.
|
|
6
6
|
import { detectAgent } from "../core/which.js";
|
|
7
7
|
import { agentBrowserAdvice, bookBrowserArchive } from "../core/browserhelp.js";
|
|
8
|
-
import { Settings } from "../core/config.js";
|
|
8
|
+
import { loadUserConfig, saveUserConfig, Settings } from "../core/config.js";
|
|
9
9
|
import { finishRegionOf, forHistory, refuseInHistorySession } from "../core/pastevents.js";
|
|
10
10
|
import { opsLogs } from "../core/opslog.js";
|
|
11
11
|
import fs from "node:fs";
|
|
@@ -20,6 +20,7 @@ import { directionOf, ofResearch, scopes } from "../core/directions.js";
|
|
|
20
20
|
import { branchModeOf, lineOf, notTaken, placer, readOffline } from "../core/offline.js";
|
|
21
21
|
import { resolvePerson } from "../core/people.js";
|
|
22
22
|
import { foldText } from "../core/text.js";
|
|
23
|
+
import { browserNames, browserWaitSaid, chosenBrowser, waitsForBrowser } from "../core/browserwait.js";
|
|
23
24
|
import { now, typeOfId } from "../core/tree.js";
|
|
24
25
|
import { quietMinutes } from "../core/inboxsettle.js";
|
|
25
26
|
import { laterWords } from "../core/inboxwords.js";
|
|
@@ -458,6 +459,9 @@ function stateChange(tree, ref, state, fields, reason, verb, notes = []) {
|
|
|
458
459
|
// the archive's decision it waited for goes with any change but the one that says it
|
|
459
460
|
if (!fields.awaitsPermission)
|
|
460
461
|
delete next.awaitsPermission;
|
|
462
|
+
// the agent's browser it waited for goes with any change but the one that says it
|
|
463
|
+
if (!fields.awaitsBrowser)
|
|
464
|
+
delete next.awaitsBrowser;
|
|
461
465
|
if (state !== "waiting") {
|
|
462
466
|
delete next.waitingOn;
|
|
463
467
|
delete next.awaits;
|
|
@@ -1318,6 +1322,15 @@ register({
|
|
|
1318
1322
|
});
|
|
1319
1323
|
if (answer && [...answer].length > ANSWER_MAX)
|
|
1320
1324
|
throw new UsageError(`the answer is ${[...answer].length} characters (at most ${ANSWER_MAX})`, { code: "task.answer-long", params: { max: String(ANSWER_MAX) } });
|
|
1325
|
+
// the person's choice of the agent's browser: one of those the task asked about, kept for this computer
|
|
1326
|
+
const asked = seen.state === "waiting" ? seen.awaitsBrowser?.names : undefined;
|
|
1327
|
+
const browser = answer && asked?.length ? chosenBrowser(asked, answer) : undefined;
|
|
1328
|
+
if (answer && asked?.length && !browser)
|
|
1329
|
+
throw new UsageError(`the answer names none of the browsers ${id} asks about (${browserNames(asked)}) — nothing written`, {
|
|
1330
|
+
hint: `strom task wake ${id} --answer "${asked[0]}"`,
|
|
1331
|
+
code: "task.browser-name",
|
|
1332
|
+
params: { task: id, names: browserNames(asked) },
|
|
1333
|
+
});
|
|
1321
1334
|
// the person's answer is theirs alone: their terminal, else a window that shows it to them (none: exit 4) — or
|
|
1322
1335
|
// the Strom app's, whose bridge runs this as the person's (never with an agent's marks)
|
|
1323
1336
|
let via;
|
|
@@ -1360,9 +1373,17 @@ register({
|
|
|
1360
1373
|
// images" for a task that does not know which): ahead in the queue as their images bring one, once
|
|
1361
1374
|
const w = before.state === "waiting" && (fromApp || !isAgent(ctx.env)) ? inboxWaitOf(tree, before) : undefined;
|
|
1362
1375
|
const ahead = !!w && handedImages(tree, before, w.recordset).length > 0 && goesAhead(tree)(before);
|
|
1363
|
-
|
|
1376
|
+
const back = stateChange(tree, id, "open", { ...(said ? { answers: [...(before.answers ?? []), said] } : {}), ...(ahead ? { queueAt: { do: "next", at: now() } } : {}) }, why?.trim(), "wake");
|
|
1377
|
+
if (browser && before.awaitsBrowser?.names?.length) {
|
|
1378
|
+
// kept for this computer: the briefs name it for select_browser — and the other tasks that waited for it come back
|
|
1379
|
+
saveUserConfig(ctx.env, { ...loadUserConfig(ctx.env), browserName: browser });
|
|
1380
|
+
for (const o of tree.list("task"))
|
|
1381
|
+
if (o.id !== id && waitsForBrowser(o, true))
|
|
1382
|
+
stateChange(tree, o.id, "open", {}, `the person chose the browser ${browser}`, "wake");
|
|
1383
|
+
}
|
|
1384
|
+
return back;
|
|
1364
1385
|
});
|
|
1365
|
-
return { text: written(tree), data: { task: t } };
|
|
1386
|
+
return { text: lines(written(tree), browser ? `the agent's browser on this computer: ${browser} (browser.name) — select_browser it when several are connected` : undefined), data: { task: t, ...(browser ? { browser } : {}) } };
|
|
1366
1387
|
},
|
|
1367
1388
|
}, {
|
|
1368
1389
|
path: ["task", "wait"],
|
|
@@ -1391,6 +1412,11 @@ register({
|
|
|
1391
1412
|
"archive), family (a question to the family), web (a site the user looks at), other; --to whom (as the user names\n" +
|
|
1392
1413
|
"them), --request the request's text saved in the tree's notes/ first, --url the site. The menu groups what waits by\n" +
|
|
1393
1414
|
"them. Once the user says the request went out: strom task sent <task> (the task still waits for the reply).\n" +
|
|
1415
|
+
"--browser: the agent's browser (Claude in Chrome) for an archive only a person's browser goes to — none connected\n" +
|
|
1416
|
+
"(none: the task comes back by itself once the agent's browser opens a page in this research, or the person returns\n" +
|
|
1417
|
+
"it from What waits), or several connected and none of this computer (their names as list_connected_browsers gives\n" +
|
|
1418
|
+
"them, \"A|B\": the person answers which in What waits or the Strom app, kept for this computer as browser.name — the\n" +
|
|
1419
|
+
"briefs then name it for select_browser — and every task here that waited for it comes back). Never picked by you.\n" +
|
|
1394
1420
|
"Set waiting again, it waits for that alone: what was said of an earlier wait, and that it was sent, go.",
|
|
1395
1421
|
args: [{ name: "task", description: "task ID", required: true }],
|
|
1396
1422
|
options: [
|
|
@@ -1398,6 +1424,7 @@ register({
|
|
|
1398
1424
|
{ name: "on", type: "string", value: "<for the user: impersonal, research language>", description: "what it waits for, for the user: which book, its link, which images" },
|
|
1399
1425
|
{ name: "images", type: "string", value: "<B…:n-m>", multiple: true, description: "the images of one book the user saves by hand, numbered as the portal's viewer counts them (B0001:40-69, B0001:9,12); again, more of the same book — another book's images: a task of its own (one book per task)" },
|
|
1400
1426
|
{ name: "check", type: "string", value: "<URL>", description: "a site for the user to check (one strom may not read): only after another way was tried and the blocked way recorded (strom search add)" },
|
|
1427
|
+
{ name: "browser", type: "string", value: "none|\"<name>|<name>\"", description: "the agent's browser: none connected (back by itself once it opens a page here), or the browsers connected, none of this computer, by their names — the person chooses one (kept for this computer); strom writes --on itself" },
|
|
1401
1428
|
// --images and --check say the kind themselves: --kind is for a wait of neither
|
|
1402
1429
|
...WAIT_OPTIONS.map((o) => (o.name === "kind" ? { ...o, description: `${o.description} — not with --images or --check: they say the kind themselves` } : o)),
|
|
1403
1430
|
],
|
|
@@ -1406,12 +1433,27 @@ register({
|
|
|
1406
1433
|
'strom task wait T0002 --on "reply of the registry office of Lhota to the request of 21 Sep" --kind letter --to "the registry office of Lhota" --request notes/request-lhota.md',
|
|
1407
1434
|
'strom task wait T0002 --images B0001:40-45 --on "images 40-45 of the baptisms of Týnec 1784-1820 (https://archive.example.org/book/5359)"',
|
|
1408
1435
|
'strom task wait T0002 --check https://archive.example.org/book/5359 --on "whether the baptisms of 1784-1820 are there, with their images"',
|
|
1436
|
+
"strom task wait T0002 --browser none",
|
|
1437
|
+
'strom task wait T0002 --browser "Chrome (office)|Chrome (laptop)"',
|
|
1409
1438
|
],
|
|
1410
1439
|
run(ctx, { args, opts }) {
|
|
1411
1440
|
const tree = ctx.tree();
|
|
1412
|
-
|
|
1441
|
+
// the agent's browser: none connected, or the names of those connected — strom says what it waits for itself
|
|
1442
|
+
let awaitsBrowser;
|
|
1443
|
+
if (opts.browser !== undefined) {
|
|
1444
|
+
if (opts.images !== undefined || opts.check !== undefined)
|
|
1445
|
+
throw new UsageError("--browser waits for the agent's browser alone — not with --images or --check", { hint: `strom task wait ${args[0]} --browser none` });
|
|
1446
|
+
const v = String(opts.browser).normalize("NFC").trim();
|
|
1447
|
+
const names = foldText(v) === "none" ? [] : [...new Set(v.split("|").map((x) => x.trim()).filter(Boolean))];
|
|
1448
|
+
if (foldText(v) !== "none" && names.length < 2)
|
|
1449
|
+
throw new UsageError(`--browser: none (no browser connected), or the names of the browsers connected, "<name>|<name>" — not "${v}"`, { hint: `one browser connected: select_browser and go on; none: strom task wait ${args[0]} --browser none` });
|
|
1450
|
+
if (names.some((n) => [...n].length > 200))
|
|
1451
|
+
throw new UsageError("--browser: a name of at most 200 characters");
|
|
1452
|
+
awaitsBrowser = { ...(names.length ? { names } : {}), since: now() };
|
|
1453
|
+
}
|
|
1454
|
+
if (!opts.on && !awaitsBrowser)
|
|
1413
1455
|
throw new UsageError("--on is required", { hint: 'e.g. --on "reply of the archive to the request of 21 Sep"' });
|
|
1414
|
-
const on = impersonal(tree, "--on", String(opts.on));
|
|
1456
|
+
const on = awaitsBrowser ? browserWaitSaid(tree.lang, awaitsBrowser.names) : impersonal(tree, "--on", String(opts.on));
|
|
1415
1457
|
let awaits;
|
|
1416
1458
|
let awaitsCheck;
|
|
1417
1459
|
let b;
|
|
@@ -1466,10 +1508,18 @@ register({
|
|
|
1466
1508
|
delete would.awaits;
|
|
1467
1509
|
delete would.awaitsCheck;
|
|
1468
1510
|
delete would.awaitsPermission;
|
|
1511
|
+
delete would.awaitsBrowser;
|
|
1469
1512
|
delete would.wait;
|
|
1470
1513
|
refuseWait(tree, { ...would, ...(wait ? { wait } : {}), ...(awaits ? { awaits } : {}), ...(awaitsCheck ? { awaitsCheck } : {}), ...decision });
|
|
1471
1514
|
}
|
|
1472
|
-
const t = stateChange(tree, args[0], "waiting", { waitingOn: on, ...(wait ? { wait } : {}), ...(awaits ? { awaits } : {}), ...(awaitsCheck ? { awaitsCheck } : {}), ...decision, ...where }, undefined, "wait");
|
|
1515
|
+
const t = stateChange(tree, args[0], "waiting", { waitingOn: on, ...(awaitsBrowser ? { awaitsBrowser, wait: { ...wait, kind: "other" } } : wait ? { wait } : {}), ...(awaits ? { awaits } : {}), ...(awaitsCheck ? { awaitsCheck } : {}), ...decision, ...where }, undefined, "wait");
|
|
1516
|
+
if (awaitsBrowser)
|
|
1517
|
+
return {
|
|
1518
|
+
text: lines(written(tree), `waits ${on}`, awaitsBrowser.names
|
|
1519
|
+
? `the person answers which browser (strom's menu, What waits; the Strom app): kept for this computer, the task back with every other that waited for it — meanwhile other work, else close the session`
|
|
1520
|
+
: `comes back by itself once your browser opens a page in this research (or the person returns it from What waits) — meanwhile other work, else close the session; nothing of the person's is needed`),
|
|
1521
|
+
data: { task: t },
|
|
1522
|
+
};
|
|
1473
1523
|
// images the agent's browser was to save for it (strom media save) and never did: the agent's own wait replaces them —
|
|
1474
1524
|
// the person's now, said in the agent's words, never hidden as the agent's work going on (R4)
|
|
1475
1525
|
if (awaits && !tree.dryRun) {
|
package/dist/core/browserhelp.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import { allows, archiveLevel } from "./terms.js";
|
|
10
10
|
import { knownDisallow } from "./knownterms.js";
|
|
11
|
-
import { claudeInChrome, CLAUDE_IN_CHROME_URL } from "./browser.js";
|
|
11
|
+
import { claudeInChrome, CLAUDE_IN_CHROME_URL, SAVE_PAGES_MAX } from "./browser.js";
|
|
12
12
|
import { codexHookState } from "./codexhook.js";
|
|
13
13
|
import { whereToTalk } from "./apps.js";
|
|
14
14
|
import { Settings } from "./config.js";
|
|
@@ -133,7 +133,7 @@ export function agentBrowserAdvice(env, agent, a, task = "T…", book = "B…",
|
|
|
133
133
|
if (!a.permitted)
|
|
134
134
|
return `your browser goes there only with the person's permission "through the browser" (strom allow archive ${a.host} --way browser — the person's, never yours); until then the person saves the images by hand${wait}.`;
|
|
135
135
|
const yours = agent === "claude" ? "Claude in Chrome" : `its address written out in your code, tab.goto("<the page>") — strom's hook sees only an address it can read`;
|
|
136
|
-
return `through your browser (${yours}),
|
|
136
|
+
return `through your browser (${yours}), the images the task needs — a range of them too — image after image at a person's pace strom keeps (its hook paces each page; past the archive's hour: other work, else strom session close --continue and on later — never the person's hand for it): strom media save ${task} --image <n> --at <the archive's page of that image> gives the script that saves it in your tab, then ${SAVED_TAKEN}; several: --image 40-49 (or 40,41,45) with one --at with {n} (or one each), at most ${SAVE_PAGES_MAX} a call, the next call after it, one script for them all, each page opened in turn${agent === "claude" ? ` — more than ${IMAGE_SAVER_FROM}: this tree's subagent ${IMAGE_SAVER} saves them` : ""}; never the whole book. By hand only when your browser cannot reach it (none connected, the archive stopped it)${wait}.`;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* What takes an image the agent's browser saved, and that it says what came: the agent never reads the downloads folder
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Tasks that wait for the agent's browser (strom task wait --browser; Task.awaitsBrowser): none connected — back by
|
|
2
|
+
// themselves once the agent's browser opens a page in the research (the browser's hook after a navigate went through),
|
|
3
|
+
// or the person returns them from What waits; several connected, none of this computer — the person's choice of one,
|
|
4
|
+
// their answer (strom task wake --answer, What waits, the Strom app) kept for this computer as browser.name, and every
|
|
5
|
+
// task of the research that waited for the choice back with it. The agent never picks one of them itself.
|
|
6
|
+
//
|
|
7
|
+
// Any script, any accent: the names compared through foldText.
|
|
8
|
+
import { now, newerTree, Tree } from "./tree.js";
|
|
9
|
+
import { isArchive } from "./mode.js";
|
|
10
|
+
import { foldText } from "./text.js";
|
|
11
|
+
import { phrase } from "./phrases.js";
|
|
12
|
+
/** A task that waits for the agent's browser to be connected (no names), or for the person's choice of one (names). */
|
|
13
|
+
export const waitsForBrowser = (t, choice) => t.state === "waiting" && !!t.awaitsBrowser && (choice === undefined || !!t.awaitsBrowser.names?.length === choice);
|
|
14
|
+
/** The names of the browsers as a person reads them in the question: "A / B". */
|
|
15
|
+
export const browserNames = (names) => names.join(" / ");
|
|
16
|
+
/** What a task waiting for the agent's browser says, in the research language (impersonal). */
|
|
17
|
+
export function browserWaitSaid(lang, names) {
|
|
18
|
+
return names?.length ? phrase(lang, "browser.which", { names: browserNames(names) }) : phrase(lang, "browser.none");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The browser the person's answer names, of those the task asked about: the same name (folded), else the one name the
|
|
22
|
+
* answer holds whole or that holds it (a part of it written) — undefined when none or more than one.
|
|
23
|
+
*/
|
|
24
|
+
export function chosenBrowser(names, answer) {
|
|
25
|
+
const a = foldText(answer).trim();
|
|
26
|
+
if (!a)
|
|
27
|
+
return undefined;
|
|
28
|
+
const same = names.filter((n) => foldText(n).trim() === a);
|
|
29
|
+
if (same.length === 1)
|
|
30
|
+
return same[0];
|
|
31
|
+
const within = names.filter((n) => {
|
|
32
|
+
const f = foldText(n).trim();
|
|
33
|
+
return !!f && (a.includes(f) || f.includes(a));
|
|
34
|
+
});
|
|
35
|
+
return within.length === 1 ? within[0] : undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The agent's browser opened a page in this research: the tasks that waited for one to be connected come back to the
|
|
39
|
+
* queue, under the tree's lock, committed. Nothing in an archive, a tree a newer strom wrote, one strom cannot open now.
|
|
40
|
+
*/
|
|
41
|
+
export function wakeBrowserWaits(root, env, actor) {
|
|
42
|
+
try {
|
|
43
|
+
if (newerTree(root, env))
|
|
44
|
+
return [];
|
|
45
|
+
const tree = Tree.open(root, env);
|
|
46
|
+
if (isArchive(tree) || tree.dryRun)
|
|
47
|
+
return [];
|
|
48
|
+
// as the page's session (or "agent"): never the person's
|
|
49
|
+
if (actor)
|
|
50
|
+
tree.actor = actor;
|
|
51
|
+
if (!tree.list("task").some((t) => waitsForBrowser(t, false)))
|
|
52
|
+
return [];
|
|
53
|
+
return tree.withTreeLock(() => {
|
|
54
|
+
const ids = tree.list("task").filter((t) => waitsForBrowser(t, false)).map((t) => t.id);
|
|
55
|
+
if (!ids.length)
|
|
56
|
+
return [];
|
|
57
|
+
for (const id of ids) {
|
|
58
|
+
const t = tree.get(id);
|
|
59
|
+
const { waitingOn: _w, awaitsBrowser: _b, wait: _k, ...rest } = t;
|
|
60
|
+
tree.put({ ...rest, state: "open", updated: now() }, { op: "task.wake", targets: [id], summary: `${id} wake: the agent's browser is connected` });
|
|
61
|
+
}
|
|
62
|
+
tree.commit(`Tasks back in the queue: the agent's browser is connected (${ids.join(", ")})`);
|
|
63
|
+
return ids;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// a tree busy or broken now: they come back with the next page, or the person returns them
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
}
|
package/dist/core/chromehook.js
CHANGED
|
@@ -49,6 +49,7 @@ import { findTreeUpwards, Tree } from "./tree.js";
|
|
|
49
49
|
import { answerWebEvent } from "./web.js";
|
|
50
50
|
import { archiveHeldText, takeSiteFor } from "./archiveholds.js";
|
|
51
51
|
import { browserGate } from "./webgate.js";
|
|
52
|
+
import { wakeBrowserWaits } from "./browserwait.js";
|
|
52
53
|
const str = (v) => (typeof v === "string" && v.trim() ? v.trim() : undefined);
|
|
53
54
|
/** The agent's hook event on stdin: a call of Claude in Chrome's navigate or a page tool, else undefined. */
|
|
54
55
|
export function chromeEvent(text) {
|
|
@@ -352,6 +353,15 @@ export async function answerChromeEvent(ev, o) {
|
|
|
352
353
|
...(ev.error ? { error: ev.error } : {}),
|
|
353
354
|
};
|
|
354
355
|
const answer = await answerWebEvent(web, { env: o.env, cwd: o.cwd, ...(o.now ? { now: o.now } : {}), ...(o.sleep ? { sleep: o.sleep } : {}) });
|
|
356
|
+
// a page the agent's browser opened (Claude in Chrome): its tasks that waited for the browser to be connected come back
|
|
357
|
+
if (ev.phase === "post" && !ev.app && !ev.codex) {
|
|
358
|
+
try {
|
|
359
|
+
wakeBrowserWaits(root, o.env, currentSession(Tree.open(root, o.env), o.env)?.id ?? "agent");
|
|
360
|
+
}
|
|
361
|
+
catch {
|
|
362
|
+
// nothing woken now: the next page, or the person's return
|
|
363
|
+
}
|
|
364
|
+
}
|
|
355
365
|
// the tab's host from now: a navigate let go (or asked — the person's yes takes it there); back/forward keep it
|
|
356
366
|
if (!ev.phase && answer.decision !== "deny" && !/^(back|forward)$/i.test(given)) {
|
|
357
367
|
try {
|
package/dist/core/config.js
CHANGED
|
@@ -124,6 +124,12 @@ export const SETTINGS = [
|
|
|
124
124
|
// Read from the config file only, changed by the user alone: how fast strom may take images of an archive whose
|
|
125
125
|
// terms restrict automation, once the user allowed it slowly (core/terms.ts).
|
|
126
126
|
{ key: "archive.pace", env: "", tree: false, kind: "pace", description: "a person's pace for the images of an archive whose terms restrict automated access, once you allowed it slowly: seconds between two images, then requests to the archive an hour, its catalogue counted too (default \"10 120\"; auto: the default) — the service's own pace stays the slowest; one archive's own: strom allow host <host> --pace/--per-hour — only you set it" },
|
|
127
|
+
// Read from the config file only, changed by the user alone: how fast the agent's browser saves the images of an
|
|
128
|
+
// archive only a person's browser goes to, once the user allowed it "through the browser" (core/terms.ts browserPace).
|
|
129
|
+
{ key: "browser.pace", env: "", tree: false, kind: "pace", description: "a person's pace for the images the agent's browser saves at an archive only a person's browser goes to, once you allowed it \"through the browser\": seconds between two images (a small random part on top of each), then images from the archive an hour, every session and research on this computer counted together, then images in a row and the pause after them in seconds (default \"5 120 20 180\": at most 20 in a row, then 3 minutes; in a row 0: no such limit; auto: the default) — one archive's own: strom allow host <host> --pace/--per-hour/--burst — — never faster than the archive's own pace, never more an hour than its own cap; past the hour the agent works on other things and goes on later — only you set it" },
|
|
130
|
+
// Read from the config file only, changed by the user alone (their answer in What waits sets it too): which browser
|
|
131
|
+
// the agent drives when several are connected and none is this computer's — another's may be somebody's at work.
|
|
132
|
+
{ key: "browser.name", env: "", tree: false, kind: "text", description: "the browser the agent uses through Claude in Chrome when several are connected and none is on this computer, as its list of connected browsers names it (default: none — the agent asks, or a task waits for the answer in What waits, which sets it) — only you set it" },
|
|
127
133
|
{ key: "read.app", env: "", tree: false, kind: "limits", description: "readings of documents the Strom app may ask (its \"Read a document\"; each reader costs as one of strom read): at most so many an hour, then so many a day (default \"20 60\"; auto: the default) — one at a time, three more queued; never in an archive — only you raise it" },
|
|
128
134
|
{ key: "queue.strategy", env: "STROM_QUEUE_STRATEGY", tree: true, kind: "choice", choices: STRATEGIES, description: "order of the task queue: balanced (default — nearest ancestors first, spread over the lines, nothing taken forever), depth (stay on one line), priority (strict priority)" },
|
|
129
135
|
{ key: "queue.offLine", env: "STROM_QUEUE_OFFLINE", tree: true, kind: "choice", choices: OFF_LINE_CHOICES, description: "work off the lines of a research with several (a task of no line about people none of its lines reaches — a side branch — that helps no line: no hypothesis or conflict of a line, not joining people to the tree, no --helps): occasional (default — now and then one, the nearest to a line first: one in queue.offLineShare; at once when the lines have nothing to do), last (taken only once the lines have nothing to do), normal (by priority, as the lines' work), never (not taken; a session at work goes on). A branch's own choice wins: strom offline set" },
|
|
@@ -252,6 +258,8 @@ const FIELDS = {
|
|
|
252
258
|
"run.gate": "runGate",
|
|
253
259
|
"run.confirm": "runConfirm",
|
|
254
260
|
"archive.pace": "archivePace",
|
|
261
|
+
"browser.pace": "browserPace",
|
|
262
|
+
"browser.name": "browserName",
|
|
255
263
|
"read.app": "readApp",
|
|
256
264
|
"tune.transcripts": "tuneTranscripts",
|
|
257
265
|
"tune.auto": "tuneAuto",
|
|
@@ -353,6 +361,13 @@ export function checkValue(def, raw, resolvePath, env = {}) {
|
|
|
353
361
|
// seconds between two images, then requests to the archive an hour (its catalogue counted too): "10 120" — or auto, the default
|
|
354
362
|
if (v.toLowerCase() === "auto")
|
|
355
363
|
return "auto";
|
|
364
|
+
// the agent's browser: so many in a row and the pause after them may follow ("5 120 20 180"; in a row 0: none)
|
|
365
|
+
if (def.key === "browser.pace") {
|
|
366
|
+
const b = /^(\d+(?:\.\d+)?)\s+(\d+)(?:\s+(\d+)\s+(\d+(?:\.\d+)?))?$/u.exec(v);
|
|
367
|
+
if (!b || Number(b[1]) < 0.25 || !(Number(b[2]) >= 1) || (b[3] !== undefined && Number(b[3]) > 0 && Number(b[4]) < 1))
|
|
368
|
+
throw new UsageError(`invalid ${def.key} "${raw}"`, { hint: 'seconds between two images (at least 0.25), images from one archive an hour, then — if given — images in a row and the pause after them in seconds (at least 1): "5 120 20 180" (in a row 0: no such limit) — or auto' });
|
|
369
|
+
return [b[1], b[2], b[3], b[4]].filter((x) => x !== undefined).map(Number).join(" ");
|
|
370
|
+
}
|
|
356
371
|
const m = /^(\d+(?:\.\d+)?)\s+(\d+)$/u.exec(v);
|
|
357
372
|
if (!m || Number(m[1]) < 0.25 || !(Number(m[2]) >= 1))
|
|
358
373
|
throw new UsageError(`invalid ${def.key} "${raw}"`, { hint: 'seconds between two images (at least 0.25), then requests to the archive an hour, its catalogue counted too: "10 120" — or auto' });
|
|
@@ -372,6 +387,10 @@ export function checkValue(def, raw, resolvePath, env = {}) {
|
|
|
372
387
|
if (!/^[a-z0-9][a-z0-9-]*(\s+\S+)*$/.test(v))
|
|
373
388
|
throw new UsageError(`invalid ${def.key} "${raw}"`, { hint: 'a plugin\'s name (lowercase letters, digits and dashes), then what it is given, e.g. "claude-usage 10"' });
|
|
374
389
|
return v.split(/\s+/).join(" ");
|
|
390
|
+
case "text":
|
|
391
|
+
if (!v || [...v].length > 200)
|
|
392
|
+
throw new UsageError(`invalid ${def.key} "${raw}"`, { hint: "a name, at most 200 characters" });
|
|
393
|
+
return v.normalize("NFC");
|
|
375
394
|
case "person":
|
|
376
395
|
if (!/^[Pp]\d{4,}$/.test(v))
|
|
377
396
|
throw new UsageError(`invalid ${def.key} "${raw}"`, { hint: "a person's ID, e.g. P0009 (strom find <name>)" });
|
package/dist/core/metrics.js
CHANGED
|
@@ -236,6 +236,12 @@ export const WEB_SOFT = 12;
|
|
|
236
236
|
* raised by the person alone): refused in a run, the person asked once in a conversation (core/web.ts).
|
|
237
237
|
*/
|
|
238
238
|
export const WEB_PER_HOST = 30;
|
|
239
|
+
/**
|
|
240
|
+
* The why of a navigate of the agent's browser to an image's page strom gave it to save (strom media save, not saved
|
|
241
|
+
* yet): counted in the archive's hour at a person's pace (core/terms.ts browserPace), never against web.perHost or the
|
|
242
|
+
* soft threshold of the session — the range a task needs goes image after image (Milan, 29 November 2026).
|
|
243
|
+
*/
|
|
244
|
+
export const WEB_IMAGE = "image";
|
|
239
245
|
/** Whether a line of fetch.jsonl is an agent's own web request or search (not a run of strom's connectors). */
|
|
240
246
|
export function isAgentWeb(f) {
|
|
241
247
|
return f.via === "web" || f.via === "search";
|
|
@@ -546,6 +552,9 @@ export function webRequestsOf(root, who) {
|
|
|
546
552
|
for (const r of countedWeb(mine)) {
|
|
547
553
|
if (r.via === "search")
|
|
548
554
|
search++;
|
|
555
|
+
// an image's page strom gave the agent's browser to save (strom media save): the archive's hour alone counts it
|
|
556
|
+
else if (r.why === WEB_IMAGE)
|
|
557
|
+
continue;
|
|
549
558
|
else if (r.host) {
|
|
550
559
|
hosts.set(r.host, (hosts.get(r.host) ?? 0) + 1);
|
|
551
560
|
const site = r.domain ?? webDomain(r.host);
|
package/dist/core/net.js
CHANGED
|
@@ -34,6 +34,18 @@ export const DEFAULT_PACE = { minIntervalMs: 2000, perHour: Infinity };
|
|
|
34
34
|
* (the window and the menu say it), never made faster by strom. The person's own pace for the host comes first.
|
|
35
35
|
*/
|
|
36
36
|
export const HUMAN_PACE = { minIntervalMs: 10_000, perHour: 120 };
|
|
37
|
+
/**
|
|
38
|
+
* A person's pace for the images the agent's browser saves at an archive only a person's browser goes to, with the
|
|
39
|
+
* person's permission "through the browser" (Milan, 29 November 2026): the range a task needs, image after image, at
|
|
40
|
+
* least 5 s apart with a small random part on top (BROWSER_JITTER of the pause), at most 20 in a row and then a pause of
|
|
41
|
+
* 3 minutes, at most 120 an hour to the archive —
|
|
42
|
+
* counted on this computer across every session and research (the limiter's shared folder). The person's own default:
|
|
43
|
+
* browser.pace (core/terms.ts browserPace); the archive's and its connector's own pace stay the slowest, its hourly cap
|
|
44
|
+
* the smallest (hostPace).
|
|
45
|
+
*/
|
|
46
|
+
export const BROWSER_PACE = { minIntervalMs: 5_000, perHour: 120, burst: 20, burstPauseMs: 180_000 };
|
|
47
|
+
/** The random part on top of each pause of the agent's browser, as a share of the pause (0.4: 5 s → 5–7 s). */
|
|
48
|
+
export const BROWSER_JITTER = 0.4;
|
|
37
49
|
/** The shortest pause there is — a service's, or the user's for a host. */
|
|
38
50
|
export const MIN_INTERVAL_MS = 250;
|
|
39
51
|
/** How long a host that refused us (401/403) is left alone. */
|
|
@@ -331,7 +343,12 @@ function basePace(s, asked, human) {
|
|
|
331
343
|
return p;
|
|
332
344
|
// the person's own only where it is slower than what holds without it
|
|
333
345
|
const without = paceWithOwn({ ...s, own: undefined }, asked, human);
|
|
334
|
-
|
|
346
|
+
const slower = { ...p, minIntervalMs: Math.max(p.minIntervalMs, without.minIntervalMs), perHour: Math.min(p.perHour, without.perHour) };
|
|
347
|
+
if (without.burst) {
|
|
348
|
+
slower.burst = Math.min(p.burst || Infinity, without.burst);
|
|
349
|
+
slower.burstPauseMs = Math.max(p.burstPauseMs ?? 0, without.burstPauseMs ?? 0);
|
|
350
|
+
}
|
|
351
|
+
return slower;
|
|
335
352
|
}
|
|
336
353
|
function paceWithOwn(s, asked, human) {
|
|
337
354
|
const service = asked?.minIntervalMs !== undefined && (asked.minIntervalMs >= DEFAULT_PACE.minIntervalMs || asked.source?.trim()) ? asked.minIntervalMs : DEFAULT_PACE.minIntervalMs;
|
|
@@ -340,7 +357,10 @@ function paceWithOwn(s, asked, human) {
|
|
|
340
357
|
const minIntervalMs = Math.max(MIN_INTERVAL_MS, s.own?.minIntervalMs ?? human.minIntervalMs, service);
|
|
341
358
|
const own = s.own?.perHour !== undefined ? s.own.perHour || Infinity : human.perHour;
|
|
342
359
|
const perHour = Math.min(own, asked?.perHour && asked.perHour > 0 ? asked.perHour : Infinity);
|
|
343
|
-
|
|
360
|
+
// so many in a row, then a pause: the person's own for the host (0: none) in place of their default
|
|
361
|
+
const burst = s.own?.burst !== undefined ? s.own.burst : human.burst;
|
|
362
|
+
const burstPauseMs = s.own?.burstPauseMs ?? human.burstPauseMs;
|
|
363
|
+
return { minIntervalMs, perHour, ...(human.jitterMs ? { jitterMs: human.jitterMs } : {}), ...(burst && burstPauseMs ? { burst, burstPauseMs } : {}) };
|
|
344
364
|
}
|
|
345
365
|
const minIntervalMs = Math.max(MIN_INTERVAL_MS, s.own?.minIntervalMs ?? service);
|
|
346
366
|
// the user's own cap (0: none), else the service's, else none
|
|
@@ -352,8 +372,28 @@ export function paceText(pace) {
|
|
|
352
372
|
return `at least ${pace.minIntervalMs / 1000} s apart${Number.isFinite(pace.perHour) ? `, at most ${pace.perHour} an hour` : ", no hourly cap"}`;
|
|
353
373
|
}
|
|
354
374
|
/** The pause before the next request to a host: its pace, longer while it answers slowly or asked us to slow down. */
|
|
355
|
-
function gapOf(s, pace) {
|
|
356
|
-
return Math.max(pace.minIntervalMs, s.latencyMs ?? 0) * (s.slowdown ?? 1);
|
|
375
|
+
function gapOf(s, pace, random = Math.random) {
|
|
376
|
+
return Math.max(pace.minIntervalMs, s.latencyMs ?? 0) * (s.slowdown ?? 1) + (pace.jitterMs ? Math.round(random() * pace.jitterMs) : 0);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* When the next request may go after a run of them (Pace.burst): the run at the end of `times` (each less than
|
|
380
|
+
* burstPauseMs after the one before) as long as the burst, the pause after its last — else 0.
|
|
381
|
+
*/
|
|
382
|
+
export function burstFree(times, pace) {
|
|
383
|
+
if (!pace.burst || !pace.burstPauseMs || times.length < pace.burst)
|
|
384
|
+
return 0;
|
|
385
|
+
const t = [...times].sort((a, b) => a - b);
|
|
386
|
+
let run = 1;
|
|
387
|
+
for (let i = t.length - 1; i > 0 && run < pace.burst; i--) {
|
|
388
|
+
if (t[i] - t[i - 1] >= pace.burstPauseMs)
|
|
389
|
+
break;
|
|
390
|
+
run++;
|
|
391
|
+
}
|
|
392
|
+
return run >= pace.burst ? t.at(-1) + pace.burstPauseMs : 0;
|
|
393
|
+
}
|
|
394
|
+
/** The next request's time by the pace: the pause after the last one, a run's pause after a whole run. */
|
|
395
|
+
function nextAt(s, pace, times = s.recent, last = s.last ?? 0) {
|
|
396
|
+
return Math.max(last + gapOf(s, pace), burstFree(times, pace));
|
|
357
397
|
}
|
|
358
398
|
/** When a host's own limit is used up by its RateLimit headers (RateLimit: remaining=0, reset=…, or X-RateLimit-*). */
|
|
359
399
|
export function limitUsedUp(headers, now) {
|
|
@@ -374,7 +414,7 @@ export function setOwnPace(dir, host, own) {
|
|
|
374
414
|
const release = acquireLock(`${file}.lock`, { owner: "strom net", waitMs: 60_000, staleMs: 10 * 60_000 });
|
|
375
415
|
try {
|
|
376
416
|
const s = hostState(dir, host);
|
|
377
|
-
if (own && (own.minIntervalMs !== undefined || own.perHour !== undefined))
|
|
417
|
+
if (own && (own.minIntervalMs !== undefined || own.perHour !== undefined || own.burst !== undefined || own.burstPauseMs !== undefined))
|
|
378
418
|
s.own = { ...own, at: new Date().toISOString() };
|
|
379
419
|
else
|
|
380
420
|
delete s.own;
|
|
@@ -1032,7 +1072,7 @@ export async function politeRequest(url, opts, redirects = 0) {
|
|
|
1032
1072
|
paused(opts, { host, ms: s.waitUntil - now(), why: "limit" });
|
|
1033
1073
|
await sleep(s.waitUntil - now());
|
|
1034
1074
|
}
|
|
1035
|
-
const gap = (s
|
|
1075
|
+
const gap = nextAt(s, pace) - now();
|
|
1036
1076
|
// a pause longer than the caller waits (a site's long Crawl-delay): said when to come back, never sooner
|
|
1037
1077
|
if (gap > MAX_WAIT_MS && now() + gap > waitBy)
|
|
1038
1078
|
throw new NetError("cap", host, `${host}'s pace (${paceText(pace)}${robotsDelayMs(s.robots) >= pace.minIntervalMs ? ", its robots.txt's Crawl-delay" : ""}) — the next request at ${clockUp(now() + gap)}`, `go on with other work; run it again at ${clockUp(now() + gap)} — not sooner`, undefined, now() + gap);
|
|
@@ -1230,12 +1270,18 @@ export function reserveSlots(stateDir, host, asked, count, opts = {}) {
|
|
|
1230
1270
|
const free = Math.min(count, pace.perHour - s.recent.length);
|
|
1231
1271
|
if (free <= 0)
|
|
1232
1272
|
throw capError(host, "cap", capFree(s.recent, pace.perHour), pace.perHour);
|
|
1233
|
-
const
|
|
1234
|
-
const first = Math.max(t + (opts.leadMs ?? 0), (s.last ?? 0) + gap, s.waitUntil ?? 0);
|
|
1273
|
+
const first = Math.max(t + (opts.leadMs ?? 0), nextAt(s, pace), s.waitUntil ?? 0);
|
|
1235
1274
|
// never further ahead than SLOTS_AHEAD_MS: fewer than asked, the rest next time
|
|
1236
1275
|
if (first > t + SLOTS_AHEAD_MS)
|
|
1237
1276
|
throw new NetError("cap", host, `${host}: strom has planned its requests for the next hour already; try again at ${clockUp(first - SLOTS_AHEAD_MS)}`, `go on with other work; run it again at ${clockUp(first - SLOTS_AHEAD_MS)}`, undefined, first - SLOTS_AHEAD_MS);
|
|
1238
|
-
|
|
1277
|
+
// each pause its own (a person's pace through the browser: a random part on top of each), never past SLOTS_AHEAD_MS
|
|
1278
|
+
const times = [first];
|
|
1279
|
+
while (times.length < free) {
|
|
1280
|
+
const next = nextAt(s, pace, [...s.recent, ...times], times.at(-1));
|
|
1281
|
+
if (next > t + SLOTS_AHEAD_MS)
|
|
1282
|
+
break;
|
|
1283
|
+
times.push(next);
|
|
1284
|
+
}
|
|
1239
1285
|
s.last = times.at(-1);
|
|
1240
1286
|
s.recent.push(...times);
|
|
1241
1287
|
writeJson(file, s);
|
|
@@ -1375,7 +1421,7 @@ export async function agentRequest(stateDir, host, asked, o) {
|
|
|
1375
1421
|
: undefined;
|
|
1376
1422
|
// the request's slot: the host's last one (strom's own, another agent's, one reserved and not yet gone) + its pause
|
|
1377
1423
|
const siteGap = site && wait ? o.site.gapMs() : 0;
|
|
1378
|
-
const slot = wait ? Math.max(t, (s
|
|
1424
|
+
const slot = wait ? Math.max(t, nextAt(s, pace), siteGap > 0 ? (site.last ?? 0) + siteGap : 0) : t;
|
|
1379
1425
|
const late = wait && slot - begun > o.maxWaitMs;
|
|
1380
1426
|
const decided = o.inside({ refused, waitMs: Math.round(slot - t), late });
|
|
1381
1427
|
value = decided.value;
|
package/dist/core/phrases.js
CHANGED
|
@@ -331,6 +331,9 @@ export const PHRASES = {
|
|
|
331
331
|
"retry.held": "the browser held back the downloads from {host} — downloading several files to be allowed in the profile the agent works in (the icon at the right end of the address bar), then back to the agent",
|
|
332
332
|
"retry.stopped": "saving through the agent's browser stopped — the agent's session ended mid-way",
|
|
333
333
|
"retry.ready": "the agent's browser reaches {archive} now — it saves the images itself",
|
|
334
|
+
"browser.none": "the agent's browser — none connected now; the task comes back by itself once it opens a page in this research",
|
|
335
|
+
"browser.which": "Which browser is the agent to use: {names}? (none of them is on this computer; the answer is kept for this computer)",
|
|
336
|
+
"retry.browser": "the agent's browser — it goes on once connected",
|
|
334
337
|
"retry.noext": "the Claude in Chrome extension is connected in no browser — the images saved by the agent only with it",
|
|
335
338
|
"retry.agent": "strom does not keep the browser of {agent} — the images saved by the agent only through Claude Code with the Claude in Chrome extension",
|
|
336
339
|
"retry.screen": "the agent's browser reaches {archive} now — only read from the screen, no image is saved",
|
package/dist/core/report.js
CHANGED
|
@@ -622,7 +622,7 @@ export function launchedFrom(env, tty) {
|
|
|
622
622
|
}
|
|
623
623
|
/** The settings that say nothing of a person (a whitelist: anything else of the settings never goes). */
|
|
624
624
|
const CONFIG_PLAIN = [
|
|
625
|
-
"lang", "mode", "stromVersion", "lastVersion", "lastChannel", "npmChannel", "stories", "runGate", "runConfirm", "archivePace", "readApp", "briefBudget", "runMinutes", "runParallel",
|
|
625
|
+
"lang", "mode", "stromVersion", "lastVersion", "lastChannel", "npmChannel", "stories", "runGate", "runConfirm", "archivePace", "browserPace", "readApp", "briefBudget", "runMinutes", "runParallel",
|
|
626
626
|
"taskHold", "archiveHold", "archiveWait",
|
|
627
627
|
"webPerHost", "readParallel", "queueStrategy", "queueOffLine", "queueOffLineShare", "queueSuggestLines", "queueSuggestTasks", "queueSuggestPersons", "queueSameBook", "booksMinTasks", "syncImportAsk",
|
|
628
628
|
"connectorsConsent", "browserDownloads", "experimentsHistory", "experimentsHistoryPace", "experimentsHistoryPlaces", "experimentsPlaceHistory",
|
package/dist/core/retry.js
CHANGED
|
@@ -137,6 +137,12 @@ export function retryOf(tree, t, c = {}, at) {
|
|
|
137
137
|
const images = missingImages(tree, c, t);
|
|
138
138
|
view = { why: s, ...(a?.host ?? host ? { host: (a?.host ?? host) } : {}), ...(images !== undefined ? { images } : {}), says: stateSays(s, a?.title ?? a?.host ?? host ?? "") };
|
|
139
139
|
}
|
|
140
|
+
if (!view && t.awaitsBrowser) {
|
|
141
|
+
// the agent's browser was not connected: the person returns it once it is (a choice of one waits for their answer)
|
|
142
|
+
if (t.awaitsBrowser.names?.length)
|
|
143
|
+
return undefined;
|
|
144
|
+
view = { why: browser().state, says: phrase(lang, "retry.browser") };
|
|
145
|
+
}
|
|
140
146
|
if (!view)
|
|
141
147
|
return undefined;
|
|
142
148
|
const again = t.retried ? { at: t.retried.at } : undefined;
|
package/dist/core/terms.js
CHANGED
|
@@ -39,7 +39,7 @@ import { readJsonIfExists, writeJson } from "./json.js";
|
|
|
39
39
|
import { acquireLock } from "./lock.js";
|
|
40
40
|
import { bare, loopbackGuard, openByTerms, RANGE_MAX, readPack, shippedTerms, strictestEntry, within } from "./knownterms.js";
|
|
41
41
|
import { webDomain } from "./metrics.js";
|
|
42
|
-
import { HUMAN_PACE, MIN_INTERVAL_MS, readHostState, REFUSED_FOREVER, robotsAll, robotsNamesAi } from "./net.js";
|
|
42
|
+
import { BROWSER_JITTER, BROWSER_PACE, HUMAN_PACE, MIN_INTERVAL_MS, readHostState, REFUSED_FOREVER, robotsAll, robotsNamesAi } from "./net.js";
|
|
43
43
|
import { loadUserConfig, Settings } from "./config.js";
|
|
44
44
|
import { installation } from "./self.js";
|
|
45
45
|
import { settingsTrust } from "./trust.js";
|
|
@@ -969,6 +969,50 @@ export function humanPace(env, inst = installation()) {
|
|
|
969
969
|
return { minIntervalMs: Math.max(own.minIntervalMs, HUMAN_PACE.minIntervalMs), perHour: Math.min(own.perHour, HUMAN_PACE.perHour) };
|
|
970
970
|
return own;
|
|
971
971
|
}
|
|
972
|
+
/**
|
|
973
|
+
* A person's pace for the images the agent's browser saves (an archive only a person's browser goes to, the person's
|
|
974
|
+
* permission "through the browser"): the person's own default for this computer (browser.pace), else BROWSER_PACE —
|
|
975
|
+
* with its random part on top of each pause (BROWSER_JITTER) and its pause after a run (Pace.burst). The archive's own pace and hourly cap (its connector's,
|
|
976
|
+
* strom's list) stay the slowest and the smallest: the limiter takes the slower (core/net.ts hostPace). Settings not
|
|
977
|
+
* verified as the person's: theirs only where it is slower. STROM_TEST_HUMAN_PACE_MS as for humanPace (the tests).
|
|
978
|
+
*/
|
|
979
|
+
export function browserPace(env, inst = installation()) {
|
|
980
|
+
const jitter = (p) => ({ ...p, jitterMs: Math.round(p.minIntervalMs * BROWSER_JITTER) });
|
|
981
|
+
const test = Number(env.STROM_TEST_HUMAN_PACE_MS);
|
|
982
|
+
if (inst.kind === "source" && env.STROM_TEST_HUMAN_PACE_MS && Number.isFinite(test) && test >= 0)
|
|
983
|
+
return { minIntervalMs: test, perHour: BROWSER_PACE.perHour };
|
|
984
|
+
const set = loadUserConfig(env).browserPace;
|
|
985
|
+
const own = set && set !== "auto" ? parseBrowserPace(set) : undefined;
|
|
986
|
+
if (!own)
|
|
987
|
+
return jitter(BROWSER_PACE);
|
|
988
|
+
if (!settingsTrust(env, { inst }).verified)
|
|
989
|
+
return jitter({
|
|
990
|
+
minIntervalMs: Math.max(own.minIntervalMs, BROWSER_PACE.minIntervalMs),
|
|
991
|
+
perHour: Math.min(own.perHour, BROWSER_PACE.perHour),
|
|
992
|
+
burst: Math.min(own.burst || Infinity, BROWSER_PACE.burst),
|
|
993
|
+
burstPauseMs: Math.max(own.burstPauseMs ?? 0, BROWSER_PACE.burstPauseMs),
|
|
994
|
+
});
|
|
995
|
+
return jitter(own);
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* browser.pace as the person writes it: "<seconds> <per hour>" (in a row and the pause BROWSER_PACE's), or
|
|
999
|
+
* "<seconds> <per hour> <in a row> <pause seconds>" — in a row 0: no such limit.
|
|
1000
|
+
*/
|
|
1001
|
+
export function parseBrowserPace(v) {
|
|
1002
|
+
const m = /^\s*(\d+(?:\.\d+)?)\s+(\d+)(?:\s+(\d+)\s+(\d+(?:\.\d+)?))?\s*$/u.exec(v);
|
|
1003
|
+
if (!m)
|
|
1004
|
+
return undefined;
|
|
1005
|
+
const base = parseArchivePace(`${m[1]} ${m[2]}`);
|
|
1006
|
+
if (!base)
|
|
1007
|
+
return undefined;
|
|
1008
|
+
if (m[3] === undefined)
|
|
1009
|
+
return { ...base, burst: BROWSER_PACE.burst, burstPauseMs: BROWSER_PACE.burstPauseMs };
|
|
1010
|
+
const burst = Number(m[3]);
|
|
1011
|
+
const pause = Math.round(Number(m[4]) * 1000);
|
|
1012
|
+
if (!burst)
|
|
1013
|
+
return base;
|
|
1014
|
+
return pause >= 1000 ? { ...base, burst, burstPauseMs: pause } : undefined;
|
|
1015
|
+
}
|
|
972
1016
|
/**
|
|
973
1017
|
* The service's pace a connector gives, as strom keeps to it on a host at a person's pace: never faster than it gave
|
|
974
1018
|
* when the person decided (seen) — slower at once.
|
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.
|
|
35
|
+
export const VERSION = "1.39.0-beta.1";
|
|
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/dist/core/web.js
CHANGED
|
@@ -43,7 +43,7 @@ import path from "node:path";
|
|
|
43
43
|
import { agentRequest, clock, clockUp, hostAllowed } from "./net.js";
|
|
44
44
|
import { LockedError } from "./errors.js";
|
|
45
45
|
import { noteSitePage, siteFreeAt, sitePagesHere } from "./machine.js";
|
|
46
|
-
import { metricsDir, PUBLIC_SECOND_LEVEL, recordWebRequest, webDomain, webHost, webHourOf, webRequestsOf, metricsOn, WEB_PER_HOST, WEB_SAID_NO, WEB_SOFT } from "./metrics.js";
|
|
46
|
+
import { metricsDir, PUBLIC_SECOND_LEVEL, recordWebRequest, webDomain, webHost, webHourOf, webRequestsOf, metricsOn, samePage, WEB_IMAGE, WEB_PER_HOST, WEB_SAID_NO, WEB_SOFT } from "./metrics.js";
|
|
47
47
|
import { listConnectors, suggestName } from "./connector.js";
|
|
48
48
|
import { deadlineOf, finishAsked } from "./clock.js";
|
|
49
49
|
import { currentSession } from "./session.js";
|
|
@@ -53,9 +53,9 @@ import { calibrationKey, viewModel } from "./viewsizes.js";
|
|
|
53
53
|
import { ui } from "../cli/ui.js";
|
|
54
54
|
import { isAgent } from "./which.js";
|
|
55
55
|
import { browserGate, otherWay, webGate } from "./webgate.js";
|
|
56
|
-
import { humanPace } from "./terms.js";
|
|
56
|
+
import { browserPace, humanPace } from "./terms.js";
|
|
57
57
|
import { archiveHeldText, takeSiteFor } from "./archiveholds.js";
|
|
58
|
-
import { APP_BROWSER_HOOK_MATCHER, APP_BROWSER_NAVIGATE_MATCHER, CHROME_HOOK_MATCHER, CHROME_NAVIGATE } from "./browser.js";
|
|
58
|
+
import { APP_BROWSER_HOOK_MATCHER, APP_BROWSER_NAVIGATE_MATCHER, CHROME_HOOK_MATCHER, CHROME_NAVIGATE, loadSaves } from "./browser.js";
|
|
59
59
|
import { searchText } from "./knownterms.js";
|
|
60
60
|
import { forHistory } from "./pastevents.js";
|
|
61
61
|
/**
|
|
@@ -293,7 +293,7 @@ export function wayText(host, way) {
|
|
|
293
293
|
: `Its archive allows its images by hand only — no connector to build for its images: strom task wait ${way.of ?? "T…"} --images B…:<numbers> --on "<the book, its link, which images — impersonal, in the research language>"; its catalogue one page at a time within the limit. ${GO_ON}`;
|
|
294
294
|
// only a person's browser goes there, and the browser does: one page at a time, its images strom's or by hand
|
|
295
295
|
if (way.closed === "browser" && way.browser)
|
|
296
|
-
return `Only a person's browser goes to this archive: its pages one at a time at a person's pace, never a series of them; its images through
|
|
296
|
+
return `Only a person's browser goes to this archive: its pages one at a time at a person's pace, never a series of them for reading; its images through your browser (the person's permission "through the browser"): strom media save, the ones the task needs, a range too, image after image at the pace strom keeps (past its hour: other work, else strom session close --continue — never strom task wait for the person); its connector's by the browser route as strom fetch says. By hand only when your browser cannot reach it: strom task wait ${way.of ?? "T…"} --images B…:<numbers> --on "<the book, its link, which images — impersonal, in the research language>". ${GO_ON}`;
|
|
297
297
|
if (way.closed)
|
|
298
298
|
return `This site lets strom read no more of it (${way.closed === "refused" ? "it refused strom's client" : way.closed === "forbidden" ? "its terms forbid automated access" : "only a person's browser goes there"}): no connector, no browser. ${otherWay(host, way.url, way.of)}`;
|
|
299
299
|
// a session of history: a page of it read by strom itself, once — the same read strom history add checks the quote on
|
|
@@ -365,6 +365,23 @@ function paceText(host, waitMs, way, slow) {
|
|
|
365
365
|
const pace = slow ? `past ${slow.soft} pages of ${siteText(host, slow.site)} ${slow.where ?? IN_SESSION}, one request per ${WEB_SOFT_GAP_MS / 1000} s to it` : "a person's pace";
|
|
366
366
|
return `strom: one request at a time to ${host}, ${pace} — ${why}. Fetch its pages one after another, never many at once (this one again in a moment); more pages of this server: ${wayText(host, way)} ${NEVER}`;
|
|
367
367
|
}
|
|
368
|
+
/**
|
|
369
|
+
* The agent's browser at an archive a person's pace holds, whose next free moment is too far (its hour of images used,
|
|
370
|
+
* or it asked to slow down): the time, and the way on — other work, or the queue for later; never the person's hand
|
|
371
|
+
* (nothing of theirs is needed: the same images go through the browser then).
|
|
372
|
+
*/
|
|
373
|
+
export function browserLateText(host, at, now) {
|
|
374
|
+
return `strom: ${host} — your browser goes there at a person's pace (strom media save; browser.pace: so many seconds apart, so many in a row and then a pause, at most so many an hour from one archive on this computer, every session counted): its next page not before ${clockUp(at, now)}. Never sooner, never another way: work on what needs nothing from it, else back to the queue for later (strom session close --continue --next "<the images still to save, from which>") and on after ${clockUp(at, now)}. Never strom task wait for the person: nothing of theirs is needed, your browser saves the rest then.`;
|
|
375
|
+
}
|
|
376
|
+
/** A page strom gave the agent's browser to save an image from (strom media save), its image not taken yet. */
|
|
377
|
+
function plannedSave(root, url) {
|
|
378
|
+
try {
|
|
379
|
+
return loadSaves(root).some((r) => r.taken === undefined && samePage(r.url, url));
|
|
380
|
+
}
|
|
381
|
+
catch {
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
368
385
|
/** The advice once a session past the soft threshold of a site: slower from now, refused past the hard one — and the way on. */
|
|
369
386
|
function softText(host, site, soft, perHost, where = IN_SESSION) {
|
|
370
387
|
return `strom: ${soft} pages of ${siteText(host, site)} through the web fetch tool ${where} — from now one request per ${WEB_SOFT_GAP_MS / 1000} s to it, and past ${perHost} the web fetch tool is refused (web.perHost). For the rest of its pages:`;
|
|
@@ -477,6 +494,9 @@ async function answerWeb(ev, o) {
|
|
|
477
494
|
return { decision: "deny", reason: archiveHeldText(host, taken, root), record };
|
|
478
495
|
}
|
|
479
496
|
}
|
|
497
|
+
// an image's page strom gave the agent's browser to save (strom media save), at an archive a person's pace holds: the
|
|
498
|
+
// archive's hour counts it, the session's thresholds never — the range the task needs goes image after image
|
|
499
|
+
const image = !ev.phase && ev.browser && gate?.human && ev.url ? plannedSave(root, ev.url) : false;
|
|
480
500
|
const lvl = gate?.level;
|
|
481
501
|
const closed = lvl ? (lvl.refused ? "refused" : lvl.level === "forbidden" ? "forbidden" : lvl.browserOnly ? "browser" : lvl.level === "manual" ? "manual" : undefined) : undefined;
|
|
482
502
|
const way = () => connectorWay({ host, netHost: ev.netHost ?? host, shared, tree, session, env: o.env, ...(o.now ? { now: o.now() } : {}), ...(closed ? { closed } : {}), ...(ev.browser ? { browser: true } : {}) });
|
|
@@ -531,10 +551,18 @@ async function answerWeb(ev, o) {
|
|
|
531
551
|
const mine = had.domains.get(site) ?? 0;
|
|
532
552
|
const before = count(had);
|
|
533
553
|
// the host stopped (it refused, its limit, its cap): refused, whatever the person said
|
|
554
|
+
// its hour of images through the browser used: the time it takes them again, and the way on (never the person's hand)
|
|
555
|
+
if (refused?.why === "cap" && ev.browser && gate?.human)
|
|
556
|
+
return { take: false, value: { decision: "deny", reason: browserLateText(host, refused.until, o.now?.() ?? Date.now()), record: { ...base, decision: "deny", why: refused.why, n: mine } } };
|
|
534
557
|
if (refused)
|
|
535
558
|
return { take: false, value: { decision: "deny", reason: refusedText(host, refused), record: { ...base, decision: "deny", why: refused.why, n: mine } } };
|
|
559
|
+
// a person's pace through the browser (its hour used, a slower pace asked): refused, in a conversation too — never let go late
|
|
560
|
+
if (late && ev.browser && gate?.human)
|
|
561
|
+
return { take: false, value: { decision: "deny", reason: browserLateText(host, (o.now?.() ?? Date.now()) + (waitMs ?? 0), o.now?.() ?? Date.now()), record: { ...base, decision: "deny", why: "pace", n: mine } } };
|
|
536
562
|
if (late)
|
|
537
563
|
return beyond("pace", had, waitMs);
|
|
564
|
+
if (image)
|
|
565
|
+
return { take: true, value: { record: { ...base, decision: "allow", why: WEB_IMAGE, n: mine } } };
|
|
538
566
|
if (before >= perHost)
|
|
539
567
|
return beyond("many", had);
|
|
540
568
|
// past the soft threshold: let through at the site's slower pace — the first of them in the session carries the advice (once)
|
|
@@ -552,7 +580,7 @@ async function answerWeb(ev, o) {
|
|
|
552
580
|
a.record.paceMs = waitedMs;
|
|
553
581
|
recordWebRequest(tree, o.env, a.record);
|
|
554
582
|
// a page that goes out counts for every session of this computer too (under the site's lock where it was had)
|
|
555
|
-
if (a.record.decision === "allow")
|
|
583
|
+
if (a.record.decision === "allow" && a.record.why !== WEB_IMAGE)
|
|
556
584
|
noteSitePage(stateDir, site, session?.id ?? ev.agentSession ?? "agent", o.now?.() ?? Date.now());
|
|
557
585
|
};
|
|
558
586
|
// after the call ran: one the person was asked about (the hook's last line of it: ask) went out — counted now, no pause
|
|
@@ -607,13 +635,14 @@ async function answerWeb(ev, o) {
|
|
|
607
635
|
wait: !ev.phase,
|
|
608
636
|
lockWaitMs: WEB_LOCK_WAIT_MS,
|
|
609
637
|
// through a person's browser to an archive that asks it (browserGate): a person's pace, the slower of it and the host's
|
|
610
|
-
|
|
638
|
+
// (the agent's browser: the pace for the images it saves, browser.pace — a random part on top of each pause)
|
|
639
|
+
...(gate?.human ? { human: ev.browser ? browserPace(o.env) : humanPace(o.env) } : {}),
|
|
611
640
|
// the site's requests kept together: past the soft threshold one per WEB_SOFT_GAP_MS to all its hosts
|
|
612
641
|
site: {
|
|
613
642
|
key: site,
|
|
614
643
|
gapMs: () => {
|
|
615
644
|
locked = webRequestsOf(root, who);
|
|
616
|
-
return count(locked) >= soft ? WEB_SOFT_GAP_MS : 0;
|
|
645
|
+
return !image && count(locked) >= soft ? WEB_SOFT_GAP_MS : 0;
|
|
617
646
|
},
|
|
618
647
|
},
|
|
619
648
|
// the host's state broken: made again from this tree's journal of it
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strom-research",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.39.0-beta.1",
|
|
4
4
|
"stromDoc": "520d6a045ca420be57b8c5191f822bf60f56c381",
|
|
5
5
|
"description": "Genealogical research toolkit for AI coding agents",
|
|
6
6
|
"type": "module",
|
|
@@ -61,5 +61,8 @@
|
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/node": "^22.20.4",
|
|
63
63
|
"typescript": "^7.0.2"
|
|
64
|
+
},
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"tag": "beta"
|
|
64
67
|
}
|
|
65
68
|
}
|