strom-research 1.37.0-beta.7 → 1.37.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.cs.md CHANGED
@@ -7,7 +7,7 @@ Změny každé verze ve zkratce. Úplné poznámky a instalační řádky jsou n
7
7
 
8
8
  ## 1.37.0
9
9
 
10
- *Připravuje se: bety do 1.37.0-beta.7. Oddíl bude úplný s vydáním.*
10
+ *Připravuje se: bety do 1.37.0-beta.8. Oddíl bude úplný s vydáním.*
11
11
 
12
12
  - **Záznam archivu už nedrží portál ze seznamu stromu:** kniha s adresou na portálu, který seznam stromu zná (Porta
13
13
  fontium, Acta Publica…), už nedělá portál tak přísný jako archiv, pod kterým je zapsaná – portál se řídí svými
@@ -79,6 +79,11 @@ Změny každé verze ve zkratce. Úplné poznámky a instalační řádky jsou n
79
79
  sort` třídí hned, když o to člověk požádá, a řekne, že se neptalo; nikdy samo od sebe a běh, který nikdo nesleduje,
80
80
  se ptá dál. `no` nastaví jen člověk ve vlastním terminálu nebo v aplikaci Strom na tomto
81
81
  počítači (řekne to jedna řádka v logu mostu), nikdy agent; zpět na dotaz může kdokoli.
82
+ **Materiál z aplikace zařazený do stromu:** soubor z dávky poslané aplikací Strom (i jiný materiál poslaný z ní), který
83
+ výzkum zařadí jako záznam, dokument nebo fotku osob, se nově dostane do stromu aplikace k nim – dva partneři jednoho
84
+ svazku k jejich svazku – takže ho aplikace ukáže u osoby, ne jen v okně Materiály. Žijící nejsou výjimka: co bylo
85
+ o nich posláno, se zařadí a zapíše jako u kohokoli jiného (ochrana žijících patří k exportu). Soubor, který ve stromu
86
+ místo má nebo jehož místo bylo v aplikaci odebráno, zůstane, jak je; osoba odebraná ze souboru u něj místo nedostane.
82
87
  - **Výzkum pro kopii rodokmenu:** odkaz aplikace Strom, který zakládá nový výzkum, může navrhnout jeho název (kopie
83
88
  stromu: „… (kopie)“); terminál ho nabídne k ponechání nebo přepsání a most aplikaci řekne složku, kde nové výzkumy
84
89
  vznikají. Strom předaný s čísly jiného výzkumu (kopie stromu, který výzkum měl, ze starší aplikace) dostane pro své
package/CHANGELOG.de.md CHANGED
@@ -7,7 +7,7 @@ Die Änderungen jeder Version in Kürze. Die vollständigen Hinweise und die Ins
7
7
 
8
8
  ## 1.37.0
9
9
 
10
- *In Vorbereitung: die Betas bis 1.37.0-beta.7. Der Abschnitt ist mit dem Release vollständig.*
10
+ *In Vorbereitung: die Betas bis 1.37.0-beta.8. Der Abschnitt ist mit dem Release vollständig.*
11
11
 
12
12
  - **Ein Archiveintrag der Forschung hält kein Portal der Liste von strom mehr:** ein Buch mit einer Adresse auf einem
13
13
  Portal, das die Liste von strom kennt (Porta fontium, Acta Publica…), macht das Portal nicht mehr so streng wie das
@@ -95,6 +95,13 @@ Die Änderungen jeder Version in Kürze. Die vollständigen Hinweise und die Ins
95
95
  gefragt wurde; nie von selbst, und ein Lauf, den niemand beobachtet, fragt weiterhin. `no` setzt nur die Person im
96
96
  eigenen Terminal oder in der Strom-App auf diesem Computer (eine Zeile im Log der Brücke sagt es), nie ein Agent;
97
97
  zurück zur Rückfrage kann jeder.
98
+ **Material aus der App in den Stammbaum einsortiert:** eine Datei aus einem Stapel, den die Strom-App geschickt hat
99
+ (oder anderes Material von ihr), die die Forschung als Eintrag, Dokument oder Foto von Personen einsortiert, kommt jetzt
100
+ bei ihnen in den Stammbaum der App — bei zwei Partnern eines Paares zu ihrem Paar —, sodass die App sie bei der Person
101
+ zeigt, nicht nur im Fenster Materialien. Lebende sind keine Ausnahme: was von ihnen geschickt wurde, wird wie bei allen
102
+ anderen einsortiert und erfasst (der Schutz Lebender gehört zum Export). Eine Datei mit einem Platz im Stammbaum oder
103
+ eine, deren Platz in der App entfernt wurde, bleibt, wie sie ist; eine von einer Datei entfernte Person bekommt dort
104
+ keinen Platz.
98
105
  - **Eine Forschung für die Kopie eines Stammbaums:** der Link der Strom-App, der eine neue Forschung beginnt, kann ihren
99
106
  Namen vorschlagen (Kopie eines Baums: „… (Kopie)“); das Terminal bietet ihn zum Behalten oder Überschreiben an, und
100
107
  die Brücke nennt der App den Ordner, in dem neue Forschungen entstehen. Ein Baum, der mit den Nummern einer anderen
package/CHANGELOG.md CHANGED
@@ -7,7 +7,7 @@ The changes of each version in short. The full notes and the install lines are o
7
7
 
8
8
  ## 1.37.0
9
9
 
10
- *In preparation: the betas up to 1.37.0-beta.7. The section is complete with the release.*
10
+ *In preparation: the betas up to 1.37.0-beta.8. The section is complete with the release.*
11
11
 
12
12
  - **A research's archive no longer holds a portal of strom's list:** a book whose address is on a portal strom's list
13
13
  knows (Porta fontium, Acta Publica…) no longer makes the portal as strict as the archive the book is recorded under —
@@ -82,6 +82,12 @@ The changes of each version in short. The full notes and the install lines are o
82
82
  `strom material sort` sorts at once when the person asks for it, saying it was not asked; never by itself, and a run
83
83
  nobody watches still asks. Only the person sets `no`, in their own terminal or in the Strom app on this computer (one
84
84
  line in the bridge's log says so), never an agent; asking again is anyone's.
85
+ **Material from the app sorted into the tree:** a file of a batch the Strom app sent (or other material sent from it)
86
+ that the research sorts as a record, a document or a photo of people now goes into the app's tree at them — two
87
+ partners of one couple at their couple — so the app shows it at the person, not only in the Materials window. The
88
+ living are no exception: what was sent of them is sorted and recorded as of anyone else (keeping the living private
89
+ belongs to the export). A file with a place in the tree, or one whose place was removed in the app, keeps what it has;
90
+ a person taken off a file gets no place at it.
85
91
  - **A research for a copy of a family tree:** the Strom app's link that starts a new research may suggest its name (a
86
92
  copy of a tree: "… (copy)"), offered in the terminal to keep or write over; the bridge tells the app the folder new
87
93
  researches are made in. A tree handed over with the numbers of another research (a copy of a tree that had one, from
package/CHANGELOG.pl.md CHANGED
@@ -7,7 +7,7 @@ Zmiany każdej wersji w skrócie. Pełne informacje o wydaniach i polecenia inst
7
7
 
8
8
  ## 1.37.0
9
9
 
10
- *W przygotowaniu: bety do 1.37.0-beta.7. Sekcja będzie kompletna z wydaniem.*
10
+ *W przygotowaniu: bety do 1.37.0-beta.8. Sekcja będzie kompletna z wydaniem.*
11
11
 
12
12
  - **Wpis archiwum w badaniu nie utrzymuje już portalu z listy stroma:** księga z adresem na portalu, który zna lista
13
13
  stroma (Porta fontium, Acta Publica…), nie czyni już portalu tak surowym jak archiwum, pod którym jest zapisana –
@@ -87,6 +87,12 @@ Zmiany każdej wersji w skrócie. Pełne informacje o wydaniach i polecenia inst
87
87
  `no`: `strom material sort` sortuje od razu, gdy osoba o to poprosi, i mówi, że nie pytano; nigdy samoczynnie,
88
88
  a przebieg, którego nikt nie obserwuje, nadal pyta. `no` ustawia tylko osoba we własnym terminalu lub w aplikacji
89
89
  Strom na tym komputerze (mówi o tym jedna linia w logu mostu), nigdy agent; powrót do pytania może każdy.
90
+ **Materiał z aplikacji przypisany w drzewie:** plik z paczki wysłanej przez aplikację Strom (lub inny materiał z niej
91
+ wysłany), który badanie przyporządkuje jako zapis, dokument lub zdjęcie osób, trafia teraz do drzewa aplikacji przy
92
+ nich – dwoje partnerów jednej pary przy ich parze – więc aplikacja pokazuje go przy osobie, nie tylko w oknie
93
+ Materiały. Osoby żyjące nie są wyjątkiem: to, co o nich wysłano, jest przyporządkowane i zapisane jak u każdego innego
94
+ (ochrona osób żyjących należy do eksportu). Plik, który ma już miejsce w drzewie lub którego miejsce usunięto
95
+ w aplikacji, zostaje bez zmian; osoba odebrana z pliku nie dostaje przy nim miejsca.
90
96
  - **Badanie dla kopii drzewa:** link aplikacji Strom, który zakłada nowe badanie, może zaproponować jego nazwę (kopia
91
97
  drzewa: „… (kopia)”); terminal proponuje ją do zachowania lub nadpisania, a most podaje aplikacji folder, w którym
92
98
  powstają nowe badania. Drzewo przekazane z numerami innego badania (kopia drzewa, które miało badanie, ze starszej
@@ -2567,6 +2567,13 @@
2567
2567
  "ui.live.unasked.sort": "Dotaz před tříděním materiálu tohoto výzkumu vypnut v aplikaci Strom na tomto počítači (znovu zapnout: strom config set sort.confirm ask --for-tree).",
2568
2568
  "ui.live.unasked.run": "Dotaz před spuštěním agenta z aplikace Strom vypnut v aplikaci Strom na tomto počítači, pro všechny výzkumy zde (znovu zapnout: strom config unset run.confirm).",
2569
2569
  "ui.link.noconfirm": "▶ Spouští se bez potvrzení (výzkum {name}): {what}. Dotaz před spuštěním agenta se zapíná v Nastavení → 1 → „Spouštění agenta z aplikace Strom“, nebo strom config unset run.confirm.",
2570
+ "ui.link.device.yes": "▶ Spuštěno ze zařízení {device} (výzkum {name}): {what}.",
2571
+ "ui.link.device.bad": "Odkaz pro tento výzkum nejde přečíst.",
2572
+ "ui.link.device.computer": "Jen na počítači.",
2573
+ "ui.link.device.locked": "Výzkum zapsal novější strom: otevře se až po aktualizaci na počítači.",
2574
+ "ui.link.device.noterminal": "Na počítači nejde otevřít terminál. Spustit na počítači.",
2575
+ "ui.link.device.recent": "Terminál pro totéž se na počítači otevřel před chvílí.",
2576
+ "ui.link.device.expired": "Potvrzení už neplatí: zeptat se znovu.",
2570
2577
  "ui.link.cost": "Agent pracuje na předplatné nebo kredit AI.",
2571
2578
  "ui.link.tasks": "Výzkum zapíše úkoly pro agenta – teď se nic nehledá a nic se neplatí.",
2572
2579
  "ui.link.what.chat": "rozhovor s agentem ({agent}) o výzkumu.",
@@ -2567,6 +2567,13 @@
2567
2567
  "ui.live.unasked.sort": "Die Rückfrage vor dem Sortieren des Materials dieser Forschung wurde in der Strom-App auf diesem Computer ausgeschaltet (wieder einschalten: strom config set sort.confirm ask --for-tree).",
2568
2568
  "ui.live.unasked.run": "Die Rückfrage vor dem Start des Agenten aus der Strom-App wurde in der Strom-App auf diesem Computer ausgeschaltet, für alle Forschungen hier (wieder einschalten: strom config unset run.confirm).",
2569
2569
  "ui.link.noconfirm": "▶ Startet ohne Rückfrage (Forschung {name}): {what}. Die Rückfrage vor dem Start des Agenten wird in den Einstellungen → 1 → „Agent aus der Strom-App starten“ eingeschaltet, oder strom config unset run.confirm.",
2570
+ "ui.link.device.yes": "▶ Gestartet vom Gerät {device} (Forschung {name}): {what}.",
2571
+ "ui.link.device.bad": "Der Link lässt sich für diese Forschung nicht lesen.",
2572
+ "ui.link.device.computer": "Nur am Computer.",
2573
+ "ui.link.device.locked": "Die Forschung wurde von einem neueren strom geschrieben: erst nach einem Update am Computer zu öffnen.",
2574
+ "ui.link.device.noterminal": "Am Computer lässt sich kein Terminal öffnen. Am Computer starten.",
2575
+ "ui.link.device.recent": "Ein Terminal dafür wurde am Computer gerade geöffnet.",
2576
+ "ui.link.device.expired": "Die Bestätigung gilt nicht mehr: erneut fragen.",
2570
2577
  "ui.link.cost": "Der Agent arbeitet auf das eigene Abonnement oder KI-Guthaben.",
2571
2578
  "ui.link.tasks": "Die Forschung schreibt Aufgaben für den Agenten – jetzt wird nichts gesucht und nichts bezahlt.",
2572
2579
  "ui.link.what.chat": "ein Gespräch mit dem Agenten ({agent}) über die Forschung.",
@@ -2567,6 +2567,13 @@
2567
2567
  "ui.live.unasked.sort": "Pytanie przed sortowaniem materiałów tego badania wyłączono w aplikacji Strom na tym komputerze (ponowne włączenie: strom config set sort.confirm ask --for-tree).",
2568
2568
  "ui.live.unasked.run": "Pytanie przed uruchomieniem agenta z aplikacji Strom wyłączono w aplikacji Strom na tym komputerze, dla wszystkich badań tutaj (ponowne włączenie: strom config unset run.confirm).",
2569
2569
  "ui.link.noconfirm": "▶ Uruchamianie bez potwierdzenia (badanie {name}): {what}. Pytanie przed uruchomieniem agenta włącza się w Ustawieniach → 1 → „Uruchamianie agenta z aplikacji Strom”, albo strom config unset run.confirm.",
2570
+ "ui.link.device.yes": "▶ Uruchomiono z urządzenia {device} (badanie {name}): {what}.",
2571
+ "ui.link.device.bad": "Tego linku dla tego badania nie można odczytać.",
2572
+ "ui.link.device.computer": "Tylko na komputerze.",
2573
+ "ui.link.device.locked": "Badanie zapisał nowszy strom: otworzy się dopiero po aktualizacji na komputerze.",
2574
+ "ui.link.device.noterminal": "Na komputerze nie można otworzyć terminala. Uruchomienie na komputerze.",
2575
+ "ui.link.device.recent": "Terminal do tego samego otworzył się na komputerze przed chwilą.",
2576
+ "ui.link.device.expired": "Potwierdzenie już nie obowiązuje: zapytać ponownie.",
2570
2577
  "ui.link.cost": "Agent pracuje w ramach subskrypcji lub kredytu AI swojego konta.",
2571
2578
  "ui.link.tasks": "Badanie zapisze zadania dla agenta – teraz niczego się nie szuka i za nic się nie płaci.",
2572
2579
  "ui.link.what.chat": "rozmowa z agentem ({agent}) o badaniu.",
@@ -46,7 +46,7 @@ outside the tree's history: what you do not record of them stays private.
46
46
  belongs to the people of the research.
47
47
  2. **Not of the family** (a tax form, a holiday photo of strangers, the same
48
48
  picture again in another size): `--as unrelated --reason "…"` and nothing
49
- of it is written anywhere. Someone living: sort it, record nothing of them.
49
+ of it is written anywhere. Someone living: sort and record as anyone.
50
50
  3. **Scans of a book** (many numbered images of one register): not read file
51
51
  by file — `strom recordset add "<the book>" …`, then `strom media add
52
52
  --from-input I… --recordset B…` (the numbers come from their names); then
@@ -20,6 +20,7 @@ import { foldText } from "../core/text.js";
20
20
  import { currentSession } from "../core/session.js";
21
21
  import { isAgent } from "../core/which.js";
22
22
  import { viaDevice, viaTaken } from "../core/devicevia.js";
23
+ import { DevicePreview, fromDevice, markAsking } from "../core/deviceagent.js";
23
24
  import { updateChannel } from "../core/update.js";
24
25
  import { stateOf, treeAgentHere } from "../core/state.js";
25
26
  import { canShowDialog, systemDialog, WAIT_SECONDS } from "../core/dialog.js";
@@ -55,6 +56,13 @@ export class Context {
55
56
  readOnly = false;
56
57
  /** The language texts are said in, whatever the settings say (strom error's report: English). */
57
58
  langShown;
59
+ /**
60
+ * A link's way gone through for a device without doing anything (spec 094 K3.15, core/deviceagent.ts): the first
61
+ * question it comes to says what the terminal would do (DevicePreview) — never asked, never waited for.
62
+ */
63
+ devicePreview = false;
64
+ /** The device whose yes this terminal took instead of its question before the agent starts (spec 094 K3.15). */
65
+ deviceYes;
58
66
  constructor(opts) {
59
67
  this.env = opts.env;
60
68
  this.cwd = opts.cwd;
@@ -105,6 +113,22 @@ export class Context {
105
113
  return (this.io.tty || this.io.answers !== undefined) && !this.yes && !this.json && this.env.STROM_NONINTERACTIVE !== "1";
106
114
  }
107
115
  async ask(question, suggested) {
116
+ if (this.devicePreview)
117
+ throw new DevicePreview({ kind: "computer", why: "question" });
118
+ // a terminal a device opened (spec 094 K3.15): its question marked as waiting at the computer while it waits
119
+ const marked = fromDevice(this.env) && this.interactive && !isAgent(this.env) ? markAsking(this.askingRoot(), "question", this.env) : undefined;
120
+ try {
121
+ return await this.asked(question, suggested);
122
+ }
123
+ finally {
124
+ marked?.();
125
+ }
126
+ }
127
+ /** The research a question or a window waits in: the one opened, else the one this runs in. */
128
+ askingRoot() {
129
+ return this.opened?.root ?? findTreeUpwards(this.cwd);
130
+ }
131
+ async asked(question, suggested) {
108
132
  const prompt = suggested ? `${question} [${suggested}] ` : `${question} `;
109
133
  let answer;
110
134
  if (this.io.answers) {
@@ -139,6 +163,8 @@ export class Context {
139
163
  }
140
164
  /** A question whose answer is not shown as it is typed (a password): kept as typed, spaces too. */
141
165
  async askSecret(question) {
166
+ if (this.devicePreview)
167
+ throw new DevicePreview({ kind: "computer", why: "question" });
142
168
  if (this.io.answers) {
143
169
  this.io.stdout(`${question} \n`);
144
170
  return this.io.answers.shift() ?? "";
@@ -243,6 +269,9 @@ export class Context {
243
269
  * What opens the computer outward, costs or runs another's code asks their yes in the terminal too: requireHumanYes.
244
270
  */
245
271
  requireHuman(question, set, key, says, opts = {}) {
272
+ // a consent stays the person's at the computer: a device's preview of a link ends here (spec 094 K3.15)
273
+ if (this.devicePreview)
274
+ throw new DevicePreview({ kind: "computer", why: "question" });
246
275
  const agent = isAgent(this.env);
247
276
  if (this.interactive && !agent)
248
277
  return "terminal";
@@ -252,7 +281,15 @@ export class Context {
252
281
  const text = { title: ui(lang, "ui.dialog.title"), question: says ?? question, yes: ui(lang, "ui.dialog.yes"), no: ui(lang, "ui.dialog.no") };
253
282
  // said first where it runs: a window can be behind others, and the command waits for it without a word
254
283
  this.io.stderr(`${ui(lang, "ui.dialog.waiting", { minutes: String(WAIT_SECONDS / 60), question: text.question })}\n`);
255
- const answer = this.io.dialog ? this.io.dialog(text) : systemDialog(text, this.env);
284
+ // waiting at the computer while the window is up (a device's glance says so, spec 094 K3.15)
285
+ const marked = markAsking(this.askingRoot(), "consent", this.env);
286
+ let answer;
287
+ try {
288
+ answer = this.io.dialog ? this.io.dialog(text) : systemDialog(text, this.env);
289
+ }
290
+ finally {
291
+ marked();
292
+ }
256
293
  if (answer === true)
257
294
  return "window";
258
295
  // said no: an agent reads the English and what not to do; a person (the app, a script) their language — nothing
@@ -330,6 +367,8 @@ export class Context {
330
367
  * a test ran out of answers.
331
368
  */
332
369
  async choose(question, choices, suggested, opts = {}) {
370
+ if (this.devicePreview)
371
+ throw new DevicePreview({ kind: "computer", why: "question" });
333
372
  const options = opts.back ? [...choices, { key: "0", label: opts.back }] : choices;
334
373
  const keys = options.map((o, i) => o.key ?? String(i + 1));
335
374
  const lang = this.uiLang();
@@ -16,6 +16,7 @@ import { DEFAULT_RUN_MINUTES, DEFAULT_RUN_PARALLEL, readStored } from "../core/c
16
16
  import { lineRunFilter, runRefusal } from "../core/linerun.js";
17
17
  import { runsAtWork } from "../core/workers.js";
18
18
  import { choosePace } from "../commands/setup.js";
19
+ import { DevicePreview } from "../core/deviceagent.js";
19
20
  import { costPartial, monthSpend, sessionCost } from "../core/session.js";
20
21
  import { adoptAskedSince, adoptFailedSince, adoptedAt, adoptionNeverCame, awaitAdoption, nothingSince, removedByItsDecision, SYNC_INBOX, keptLines, clientLabel, undoSync, withoutImages } from "../core/sync.js";
21
22
  import { moveToTrash } from "../core/trash.js";
@@ -70,8 +71,13 @@ import { BATCH_MAX, identifyEstimate, PLACES_IDENTIFY_ORIGIN } from "../core/pla
70
71
  import { placeView, queueView } from "../core/placesview.js";
71
72
  import { kindsAdded, kindsOf, kindsSetting } from "../core/eventkinds.js";
72
73
  import { alignEmpty, kindNames, planAlign } from "../core/historyalign.js";
74
+ /** A note under a question as its lines (what a device's dialog shows). */
75
+ const noteLines = (note) => (note ?? "").split("\n").filter((l) => l.trim());
73
76
  /** What the Strom app asks, said before anything is done; true when the person goes on. */
74
77
  export async function asks(ctx, lang, root, what, note, suggested = true) {
78
+ // a device's preview of the link (spec 094 K3.15): this is the question the device asks instead
79
+ if (ctx.devicePreview)
80
+ throw new DevicePreview({ kind: "ask", what, note: noteLines(note) });
75
81
  const name = Tree.open(root, ctx.env).config.name;
76
82
  ctx.io.stdout(lines(translator(lang)("ui.link.asks", { what, name }), note, "") + "\n");
77
83
  return ctx.confirm(translator(lang)("ui.link.go"), suggested);
@@ -83,18 +89,32 @@ export async function asks(ctx, lang, root, what, note, suggested = true) {
83
89
  * own command (only the person in their terminal), and all the rest (consents, deletions, the gate of strom run).
84
90
  */
85
91
  export async function asksToStart(ctx, lang, root, what, note, suggested = true, priced = false) {
92
+ // a device's preview (spec 094 K3.15): a price in money stays the terminal's, run.confirm no starts at once, else the
93
+ // device asks this question itself
94
+ if (ctx.devicePreview)
95
+ throw new DevicePreview(priced ? { kind: "computer", why: "price" } : startsUnasked(ctx) ? { kind: "started" } : { kind: "ask", what, note: noteLines(note) });
86
96
  if (!startsUnasked(ctx, priced))
87
97
  return asks(ctx, lang, root, what, note, suggested);
88
98
  const name = Tree.open(root, ctx.env).config.name;
89
- ctx.io.stdout(translator(lang)("ui.link.noconfirm", { what: what.trim().replace(/[.:]$/u, ""), name }) + "\n");
99
+ const said = what.trim().replace(/[.:]$/u, "");
100
+ ctx.io.stdout((ctx.deviceYes ? deviceYesLine(ctx.deviceYes, lang, said, name) : translator(lang)("ui.link.noconfirm", { what: said, name })) + "\n");
90
101
  return true;
91
102
  }
103
+ /** The line a terminal says for the device's yes it took instead of its question (spec 094 K3.15). */
104
+ function deviceYesLine(device, lang, what, name) {
105
+ return translator(lang)("ui.link.device.yes", { device: device.name ?? device.id, what, name });
106
+ }
92
107
  /**
93
- * Whether asksToStart starts without its question (run.confirm no, a person in their terminal, no price in money): what
94
- * the link starts right after it is then not asked yes or no again — the line said it starts.
108
+ * Whether asksToStart starts without its question (run.confirm no, a person in their terminal, no price in money — or
109
+ * the yes of a device that opened this terminal, spec 094 K3.15): what the link starts right after it is then not
110
+ * asked yes or no again — the line said it starts.
95
111
  */
96
112
  export function startsUnasked(ctx, priced = false) {
97
- return !priced && ctx.settings.runConfirm() === "no" && ctx.interactive && !isAgent(ctx.env);
113
+ if (priced)
114
+ return false;
115
+ if (ctx.deviceYes)
116
+ return true;
117
+ return ctx.settings.runConfirm() === "no" && ctx.interactive && !isAgent(ctx.env);
98
118
  }
99
119
  const out = (ctx, line) => ctx.io.stdout(line + "\n");
100
120
  /** The app that loads the research's version itself right after a hand-over (the research's numbers for its people). */
@@ -462,13 +482,22 @@ export async function placeSearch(ctx, run, lang, root, id) {
462
482
  // its session is strom run's: the agent's CLI not here said before the estimate and the question
463
483
  if (!(await agentCliHere(ctx, run, lang, tree)))
464
484
  return false;
465
- if (!(await asks(ctx, lang, root, t("ui.link.what.history.place", { place }), placeCost(t, lang, tree), false)))
485
+ // a price in money stays the terminal's question; the yes of a device that opened it (no price): queued and started
486
+ // now, both questions answered (spec 094 K3.15)
487
+ const priced = !!placeEstimate(tree).usd;
488
+ if (ctx.devicePreview && priced)
489
+ throw new DevicePreview({ kind: "computer", why: "price" });
490
+ const yes = !!ctx.deviceYes && !priced;
491
+ const what = t("ui.link.what.history.place", { place });
492
+ if (yes)
493
+ out(ctx, deviceYesLine(ctx.deviceYes, lang, what.trim().replace(/[.:]$/u, ""), tree.config.name));
494
+ else if (!(await asks(ctx, lang, root, what, placeCost(t, lang, tree), false)))
466
495
  return false;
467
496
  if ((await run(["history", "place", p.id], true)) !== 0)
468
497
  return false;
469
498
  const task = placeTask(Tree.open(root, ctx.env), p.id);
470
499
  out(ctx, t("ui.link.history.place.done", { place }));
471
- if (!task || !(await ctx.confirm(t("ui.link.history.place.now"), false)))
500
+ if (!task || (!yes && !(await ctx.confirm(t("ui.link.history.place.now"), false))))
472
501
  return true;
473
502
  return (await run(["run", "--task", task.id])) === 0;
474
503
  }
@@ -13,7 +13,7 @@ export function outOfAnswers(ctx) {
13
13
  }
14
14
  /** "Press Enter to go back to the menu." — unless there is nobody to press it. */
15
15
  export async function pause(ctx, lang, enter = "ui.enter") {
16
- if (!outOfAnswers(ctx))
16
+ if (!outOfAnswers(ctx) && !ctx.devicePreview)
17
17
  await ctx.ask(ui(lang, enter));
18
18
  }
19
19
  /**
package/dist/cli/ui.js CHANGED
@@ -2505,6 +2505,13 @@ export const UI = {
2505
2505
  "ui.live.unasked.sort": "The question before the material of this research is sorted was turned off in the Strom app on this computer (on again: strom config set sort.confirm ask --for-tree).",
2506
2506
  "ui.live.unasked.run": "The question before the agent starts from the Strom app was turned off in the Strom app on this computer, for every research here (on again: strom config unset run.confirm).",
2507
2507
  "ui.link.noconfirm": "▶ Started without the question (research {name}): {what}. The question before the agent starts is turned on in Settings → 1 → “Starting the agent from the Strom app”, or strom config unset run.confirm.",
2508
+ "ui.link.device.yes": "▶ Started from the device {device} (research {name}): {what}.",
2509
+ "ui.link.device.bad": "The link cannot be read for this research.",
2510
+ "ui.link.device.computer": "Only on the computer.",
2511
+ "ui.link.device.locked": "The research was written by a newer strom: it opens only after an update on the computer.",
2512
+ "ui.link.device.noterminal": "A terminal cannot be opened on the computer. To be started on the computer.",
2513
+ "ui.link.device.recent": "A terminal for the same was opened on the computer a moment ago.",
2514
+ "ui.link.device.expired": "The confirmation is no longer valid: asked again.",
2508
2515
  "ui.link.cost": "The agent works on the subscription or AI credit of its account.",
2509
2516
  "ui.link.tasks": "The research writes tasks for the agent — nothing is searched and nothing is paid now.",
2510
2517
  "ui.link.what.chat": "a conversation with the agent ({agent}) about the research.",
@@ -13,10 +13,11 @@ import { counted, lines, secondsIn, shellArg, table } from "../cli/format.js";
13
13
  import { EXIT, StromError, UsageError } from "../core/errors.js";
14
14
  import { isAgent } from "../core/which.js";
15
15
  import { canShowDialog, systemChoice, WAIT_SECONDS } from "../core/dialog.js";
16
+ import { markAsking } from "../core/deviceagent.js";
16
17
  import { bareHost, listConnectors, routeOf, routesOf } from "../core/connector.js";
17
18
  import { hostAllowed, hostPace, hostState, netTrust, paceText, robotsNow, ROBOTS_MS } from "../core/net.js";
18
19
  import { settingsTrust } from "../core/trust.js";
19
- import { Tree } from "../core/tree.js";
20
+ import { Tree, findTreeUpwards } from "../core/tree.js";
20
21
  import { syncAgentFiles } from "../agents/files.js";
21
22
  import { currentSession } from "../core/session.js";
22
23
  import { noteSessionWait, wakeForArchive } from "../core/archivewait.js";
@@ -400,7 +401,15 @@ async function askPerson(ctx, c, missing, way) {
400
401
  keys: ui(lang, "ui.archive.btn.keys", { allow: allowLabel, manual: ui(lang, "ui.archive.btn.manual"), later: ui(lang, "ui.archive.btn.later") }),
401
402
  };
402
403
  ctx.io.stderr(`${ui(lang, "ui.dialog.waiting", { minutes: String(WAIT_SECONDS / 60), question: ui(lang, "ui.archive.name", { title: a.title ?? a.host, host: a.host }) })}\n`);
403
- const answer = ctx.io.choice ? ctx.io.choice(text) : systemChoice(text, ctx.env);
404
+ // waiting at the computer while the window is up (a device's glance says so, spec 094 K3.15)
405
+ const marked = markAsking(ctx.openedRoot() ?? findTreeUpwards(ctx.cwd), "consent", ctx.env);
406
+ let answer;
407
+ try {
408
+ answer = ctx.io.choice ? ctx.io.choice(text) : systemChoice(text, ctx.env);
409
+ }
410
+ finally {
411
+ marked();
412
+ }
404
413
  if (answer === main || answer === "manual") {
405
414
  grantWay(ctx.env, hosts, answer, { by: "window", connector: c });
406
415
  routeFollows(ctx, c, answer);
@@ -21,7 +21,7 @@ import { pendingIds } from "../core/originfix.js";
21
21
  import { displayName, gedcomName, likelyDuplicates } from "../core/people.js";
22
22
  import { decodeText, safeFolderName } from "../core/text.js";
23
23
  import { decodeGedcom, decodingNote } from "../gedcom/encoding.js";
24
- import { amendInput, checkOriginalMeta } from "../core/originals.js";
24
+ import { amendInput, checkOriginalMeta, sentByApp } from "../core/originals.js";
25
25
  import { batchStatus, closeBatch, listBatches, readBatch } from "../core/batches.js";
26
26
  import { HIDE_REASONS, MATERIAL_KINDS, SORT_KINDS } from "../core/model.js";
27
27
  import { assignMaterial, declinedOf, editMaterial, hideMaterial, MATERIAL_MOST_EDIT, MATERIAL_TITLE_MAX, materialPersons, unhideMaterial } from "../core/material.js";
@@ -858,7 +858,9 @@ register({
858
858
  writes: true,
859
859
  description: "Sorting a batch: each file's kind and the person it is of. source: a record (give --source S… once it is recorded);\n" +
860
860
  "document, photo: the family's own; unrelated: nothing of the family (--reason; it is skipped, nothing of it is written).\n" +
861
- "What a file says is recorded as from any material; sorting only says what it is.",
861
+ "What a file says is recorded as from any material; sorting only says what it is.\n" +
862
+ "A file the Strom app sent with no place in its tree, sorted of people, goes there at them (two partners: at their\n" +
863
+ "couple; --json placed); a place taken off stays off.",
862
864
  args: [{ name: "inputs", description: "input IDs (I0001 …)", variadic: true }],
863
865
  options: [
864
866
  { name: "as", type: "string", value: "<kind>", description: `${SORT_KINDS.join(", ")}` },
@@ -891,10 +893,42 @@ register({
891
893
  const at = new Date().toISOString();
892
894
  // a person the person took off a file is never put back on it by sorting (Input.declined)
893
895
  const ofFile = (i) => persons.filter((p) => !declinedOf(tree, i).has(p));
896
+ let order;
897
+ /** The next place of a person's or a couple's files in the app's tree (after the last one they have). */
898
+ const nextOrder = (ref) => {
899
+ if (!order) {
900
+ order = new Map();
901
+ for (const x of tree.list("input"))
902
+ for (const l of x.retracted ? [] : (x.links ?? []))
903
+ if (!l.retracted && l.type !== "event" && l.type !== "source")
904
+ order.set(l.ref, Math.max(order.get(l.ref) ?? -1, l.order));
905
+ }
906
+ const n = (order.get(ref) ?? -1) + 1;
907
+ order.set(ref, n);
908
+ return n;
909
+ };
910
+ /**
911
+ * A file the Strom app sent (a batch, material of a person) with no place in the app's tree yet, sorted as the
912
+ * family's (a record, a document, a photo) of people: put in the tree at them, as the app's Attach to would — a
913
+ * couple's at their family, else at each of them; the living as anyone. A file with any place, one taken off too,
914
+ * is left as it is: what the person removed in the app stays removed.
915
+ */
916
+ const placesOf = (i) => {
917
+ const of = ofFile(i);
918
+ if (as === "unrelated" || !of.length || i.retracted || i.hidden || i.links?.length || !(i.batch || sentByApp(i)))
919
+ return [];
920
+ const couple = of.length === 2 ? tree.list("family").find((f) => !f.retracted && !f.mergedInto && of.every((p) => f.partners.includes(p))) : undefined;
921
+ return couple ? [{ type: "family", ref: couple.id, order: nextOrder(couple.id), at }] : of.map((p) => ({ type: "person", ref: p, order: nextOrder(p), at }));
922
+ };
923
+ const placed = [];
894
924
  tree.withTreeLock(() => {
895
- for (const id of ids)
925
+ for (const id of ids) {
926
+ const links = placesOf(tree.get(id));
927
+ if (links.length)
928
+ placed.push({ id, at: links.map((l) => l.ref) });
896
929
  update(tree, id, "input", (i) => ({
897
930
  ...i,
931
+ ...(links.length ? { links } : {}),
898
932
  ...(ofFile(i).length ? { persons: [...new Set([...(i.persons ?? []), ...ofFile(i)])] } : {}),
899
933
  ...(source ? { source } : {}),
900
934
  ...(title ? { title } : {}),
@@ -902,12 +936,13 @@ register({
902
936
  // nothing of the family: hidden, the state it had kept (strom input unskip gives it back)
903
937
  ...(as === "unrelated" && i.state !== "skipped" ? { state: "skipped", hidden: { at, by: tree.actor, reason: "unrelated", was: i.state === "processed" ? "processed" : "new" } } : {}),
904
938
  sorted: { as: as, ...(ofFile(i).length ? { persons: ofFile(i) } : {}), ...(source ? { source } : {}), ...(reason ? { reason } : {}), at, by: tree.actor },
905
- }), { op: "input.sort", summary: `${id} ${as}${ofFile(tree.get(id)).length ? ` of ${ofFile(tree.get(id)).join(", ")}` : ""}${source ? ` → ${source}` : ""}`, ...(reason ? { reason } : {}), targets: persons });
939
+ }), { op: "input.sort", summary: `${id} ${as}${ofFile(tree.get(id)).length ? ` of ${ofFile(tree.get(id)).join(", ")}` : ""}${source ? ` → ${source}` : ""}${links.length ? `, in the app's tree at ${links.map((l) => l.ref).join(", ")}` : ""}`, ...(reason ? { reason } : {}), targets: persons });
940
+ }
906
941
  });
907
942
  const kept = ids.flatMap((id) => persons.filter((p) => declinedOf(tree, tree.get(id)).has(p)).map((person) => ({ id, person })));
908
943
  return {
909
944
  text: lines(...tree.written.map((o) => o.summary), ...kept.map((k) => `${k.person} not put on ${k.id}: the person took them off it (strom input assign ${k.id} --add ${k.person} is the person's)`)),
910
- data: { inputs: ids, as, ...(kept.length ? { declined: kept } : {}) },
945
+ data: { inputs: ids, as, ...(placed.length ? { placed } : {}), ...(kept.length ? { declined: kept } : {}) },
911
946
  };
912
947
  },
913
948
  });