@join-pantheon/cli 0.37.3 → 0.38.0
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/dist/admin-founder.js +5 -2
- package/dist/admin-pages.js +29 -2
- package/dist/cli.js +285 -38
- package/dist/crash-loop.js +207 -0
- package/dist/doctor.js +38 -1
- package/dist/finish-line.js +14 -7
- package/dist/folder-ask.js +104 -0
- package/dist/founder-stats.js +24 -1
- package/dist/home-guard.js +21 -0
- package/dist/home-safety.js +2 -0
- package/dist/install-stats.js +314 -0
- package/dist/machine.js +2 -0
- package/dist/mcp.js +37 -1
- package/dist/notice.js +106 -0
- package/dist/notifier.js +206 -16
- package/dist/onboard-copy.js +3 -0
- package/dist/pickup.js +11 -3
- package/dist/quickstart.js +41 -21
- package/dist/relay.js +56 -6
- package/dist/service.js +5 -0
- package/dist/setup-changes.js +5 -0
- package/dist/setup-guide.js +25 -4
- package/dist/status-engine.js +1 -1
- package/dist/tray.js +9 -2
- package/dist/version-health.js +288 -0
- package/dist/win-host.js +2 -0
- package/dist/worker-policy.js +45 -3
- package/dist/worker.js +61 -24
- package/npm-shrinkwrap.json +13 -2
- package/package.json +2 -1
package/dist/notifier.js
CHANGED
|
@@ -9,18 +9,22 @@ import { dirname, join, resolve } from "node:path";
|
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
import { PantheonClient } from "./client.js";
|
|
11
11
|
import { CONFIG_DIR } from "./config.js";
|
|
12
|
-
import { awaitingDecision } from "./pickup.js";
|
|
12
|
+
import { awaitingDecision, pickupEstimate } from "./pickup.js";
|
|
13
13
|
import { loadProfile } from "./profile.js";
|
|
14
|
-
import { APP_TOOLS, CLAUDE_APP_CHOSEN, composeDecision,
|
|
14
|
+
import { APP_TOOLS, CLAUDE_APP_CHOSEN, composeDecision, composeJoined, composePassedOver, composeReplies, composeUnpicked, composeWaiting, composeWakeAsk, declineCodeOf, neverAlerts, passedOverNotice, TOOL_LABELS } from "./notice.js";
|
|
15
15
|
import { loadPolicy } from "./worker-policy.js";
|
|
16
16
|
import { withoutAgentMarkers } from "./setup-changes.js";
|
|
17
|
-
import { wakeAlerted } from "./continued.js";
|
|
17
|
+
import { liveReadAt, wakeAlerted } from "./continued.js";
|
|
18
|
+
import { teamPinId } from "./pins.js";
|
|
19
|
+
import { signedRead } from "./reads.js";
|
|
18
20
|
import { cliOnPath, detectAvailable } from "./agents.js";
|
|
19
21
|
import { CLAUDE_APP_TOOL, chosenOpenIn, claudeAppPresent, effectiveOpenIn } from "./open-in.js";
|
|
20
22
|
import { whichPantheon } from "./service.js";
|
|
21
23
|
import { powerNow } from "./power.js";
|
|
22
24
|
import { obligationSignature, StatusNudger } from "./status-nudge.js";
|
|
23
25
|
import { clientState, ConnectionReport } from "./conn-report.js";
|
|
26
|
+
import { noteServiceConnected } from "./crash-loop.js";
|
|
27
|
+
import { refusalOf } from "./refusal.js";
|
|
24
28
|
import { removalFor, removalHolds, removalRefusal, removalWords, removedLine, removedNotice, takeTold } from "./removed.js";
|
|
25
29
|
export const DEFAULT_REMINDER_MS = 4 * 60 * 60 * 1_000;
|
|
26
30
|
export const JOIN_BATCH_MS = 20_000;
|
|
@@ -49,6 +53,46 @@ export function waitingRequests(obligations, member, state, now, fromOf) {
|
|
|
49
53
|
&& !awaitingDecision(obligations, o)
|
|
50
54
|
&& (() => { const f = fromOf(o); return !!f && f !== member; })());
|
|
51
55
|
}
|
|
56
|
+
export const ASKED_FOLLOWUP_MS = 60 * 60_000;
|
|
57
|
+
export const ASKED_EVERY_MS = 10 * 60_000;
|
|
58
|
+
export const REPLY_BATCH_MS = 2_500;
|
|
59
|
+
let machineAskedAt = 0;
|
|
60
|
+
export function resetAskedClock() { machineAskedAt = 0; }
|
|
61
|
+
export function unpickedRequests(obligations, member, state, now, fromOf, o = {}) {
|
|
62
|
+
const byRef = new Map();
|
|
63
|
+
for (const x of obligations) {
|
|
64
|
+
if (x.owner === member || x.owner.startsWith("human:") || x.kind === "HUMAN" || x.kind === "CONTINUE" || x.kind === "DELIVER")
|
|
65
|
+
continue;
|
|
66
|
+
byRef.set(x.ref, [...(byRef.get(x.ref) ?? []), x]);
|
|
67
|
+
}
|
|
68
|
+
const out = [];
|
|
69
|
+
for (const [ref, owed] of byRef) {
|
|
70
|
+
if (state.notified_at[`act:asked:${ref}`] !== undefined)
|
|
71
|
+
continue;
|
|
72
|
+
if (owed.some((x) => x.claimed_by))
|
|
73
|
+
continue;
|
|
74
|
+
if (fromOf(owed[0]) !== member)
|
|
75
|
+
continue;
|
|
76
|
+
const at = Math.min(...owed.map((x) => x.created_at));
|
|
77
|
+
if (now - at < ASKED_FOLLOWUP_MS || now - at >= WAITING_MAX_AGE_MS)
|
|
78
|
+
continue;
|
|
79
|
+
if (owed.some((x) => awaitingDecision(obligations, x)))
|
|
80
|
+
continue;
|
|
81
|
+
const goal = owed[0].goal;
|
|
82
|
+
if (goal && o.closed?.(goal))
|
|
83
|
+
continue;
|
|
84
|
+
const to = o.sentTo?.(ref)?.filter((t) => t !== member);
|
|
85
|
+
if (to?.length && owed.length < to.length)
|
|
86
|
+
continue;
|
|
87
|
+
if (o.replied?.(ref, to?.length ? to : owed.map((x) => x.owner)))
|
|
88
|
+
continue;
|
|
89
|
+
out.push({ ref, owed });
|
|
90
|
+
}
|
|
91
|
+
return out;
|
|
92
|
+
}
|
|
93
|
+
export function repliedIn(acts, ref, askedOf) {
|
|
94
|
+
return acts.some((a) => a.ref === ref && askedOf.includes(a.from) && !(a.act === "NOTE" && a.role === "worker" && !a.meta?.declined));
|
|
95
|
+
}
|
|
52
96
|
export function humanObligations(obligations, member) {
|
|
53
97
|
return obligations.filter((o) => o.kind === "HUMAN" && o.owner === `human:${member}`);
|
|
54
98
|
}
|
|
@@ -276,6 +320,7 @@ export class HumanNotifier {
|
|
|
276
320
|
report.close();
|
|
277
321
|
throw e;
|
|
278
322
|
}
|
|
323
|
+
noteServiceConnected();
|
|
279
324
|
try {
|
|
280
325
|
await this.serve(client);
|
|
281
326
|
}
|
|
@@ -298,6 +343,23 @@ export class HumanNotifier {
|
|
|
298
343
|
const joined = new Set();
|
|
299
344
|
const settled = new Set();
|
|
300
345
|
let joinedSince = 0;
|
|
346
|
+
let replies = [];
|
|
347
|
+
let repliesSince = 0;
|
|
348
|
+
const batched = new Set();
|
|
349
|
+
const own = new Map();
|
|
350
|
+
const ownAct = async (id) => {
|
|
351
|
+
const seen = client.seenAct(id);
|
|
352
|
+
if (seen)
|
|
353
|
+
return seen;
|
|
354
|
+
if (own.has(id))
|
|
355
|
+
return own.get(id);
|
|
356
|
+
const r = await client.storedAct(id, 3_000).catch(() => null);
|
|
357
|
+
own.set(id, r);
|
|
358
|
+
if (own.size > 500)
|
|
359
|
+
own.delete(own.keys().next().value);
|
|
360
|
+
return r;
|
|
361
|
+
};
|
|
362
|
+
const byRun = (a) => a.sig?.role === "run" || a.role === "worker";
|
|
301
363
|
try {
|
|
302
364
|
let removedSaid = false;
|
|
303
365
|
while (!this.stopped) {
|
|
@@ -381,7 +443,11 @@ export class HumanNotifier {
|
|
|
381
443
|
const last = Math.max(state.notified_at["act:wait:last"] ?? 0, machineWaitingAt);
|
|
382
444
|
if (waiting.length && (last === 0 || now() - last >= WAITING_EVERY_MS)) {
|
|
383
445
|
const items = waiting.map((o) => ({ from: fromOf(o), what: client.seenAct(o.ref)?.summary ?? o.body }));
|
|
446
|
+
const before = machineWaitingAt;
|
|
447
|
+
machineWaitingAt = now();
|
|
384
448
|
const ok = await send(withLabel(composeWaiting(items, this.cfg.space, { tools, preferred: preferredTool(profile, tools), now: now() })));
|
|
449
|
+
if (!ok)
|
|
450
|
+
machineWaitingAt = before;
|
|
385
451
|
if (ok) {
|
|
386
452
|
for (const o of waiting)
|
|
387
453
|
state.notified_at[`act:wait:${o.ref}`] = now();
|
|
@@ -392,6 +458,70 @@ export class HumanNotifier {
|
|
|
392
458
|
}
|
|
393
459
|
}
|
|
394
460
|
}
|
|
461
|
+
if (prefs.decisions) {
|
|
462
|
+
const relayNow = now() + (client.relayNow() - Date.now());
|
|
463
|
+
const fromOf = (o) => client.seenAct(o.ref)?.from ?? own.get(o.ref)?.from ?? requestFrom(o.body);
|
|
464
|
+
let due = unpickedRequests(client.obligations, this.cfg.member, state, relayNow, fromOf, {
|
|
465
|
+
closed: (g) => client.goals.get(g)?.state === "CLOSED",
|
|
466
|
+
sentTo: (ref) => (client.seenAct(ref) ?? own.get(ref))?.to,
|
|
467
|
+
replied: (ref, askedOf) => repliedIn(client.seenSince(0), ref, askedOf),
|
|
468
|
+
});
|
|
469
|
+
const last = Math.max(state.notified_at["act:asked:last"] ?? 0, machineAskedAt);
|
|
470
|
+
if (due.length && (last === 0 || now() - last >= ASKED_EVERY_MS)) {
|
|
471
|
+
const before = machineAskedAt;
|
|
472
|
+
machineAskedAt = now();
|
|
473
|
+
const runs = [];
|
|
474
|
+
for (const d of due) {
|
|
475
|
+
const a = await ownAct(d.ref);
|
|
476
|
+
if (a && byRun(a))
|
|
477
|
+
runs.push(d.ref);
|
|
478
|
+
}
|
|
479
|
+
for (const ref of runs) {
|
|
480
|
+
state.notified_at[`act:asked:${ref}`] = now();
|
|
481
|
+
dirty = true;
|
|
482
|
+
}
|
|
483
|
+
due = due.filter((d) => !runs.includes(d.ref) && !((a) => a?.to?.length && d.owed.length < a.to.filter((t) => t !== this.cfg.member).length)(own.get(d.ref) ?? client.seenAct(d.ref)));
|
|
484
|
+
const replied = [];
|
|
485
|
+
for (const d of due) {
|
|
486
|
+
const mine = client.seenAct(d.ref) ?? own.get(d.ref);
|
|
487
|
+
const to = mine?.to?.filter((t) => t !== this.cfg.member);
|
|
488
|
+
const askedOf = to?.length ? to : d.owed.map((x) => x.owner);
|
|
489
|
+
try {
|
|
490
|
+
const goal = d.owed[0].goal;
|
|
491
|
+
const res = await signedRead(this.cfg, "/history", goal ? { goal } : { since: String(Math.max(0, (mine?.seq ?? 1) - 1)) }, { timeoutMs: 3_000 });
|
|
492
|
+
const acts = res.ok ? (await res.json()).acts ?? [] : [];
|
|
493
|
+
if (repliedIn(acts, d.ref, askedOf))
|
|
494
|
+
replied.push(d.ref);
|
|
495
|
+
}
|
|
496
|
+
catch { }
|
|
497
|
+
}
|
|
498
|
+
for (const ref of replied) {
|
|
499
|
+
state.notified_at[`act:asked:${ref}`] = now();
|
|
500
|
+
dirty = true;
|
|
501
|
+
}
|
|
502
|
+
due = due.filter((d) => !replied.includes(d.ref));
|
|
503
|
+
if (due.length) {
|
|
504
|
+
const mayWake = client.members.find((m) => m.member === this.cfg.member)?.may_wake;
|
|
505
|
+
const items = due.map((d) => {
|
|
506
|
+
const owners = [...new Set(d.owed.map((o) => o.owner))];
|
|
507
|
+
const peer = client.roster.find((m) => m.id === owners[0]) ?? { id: owners[0], sessions: [] };
|
|
508
|
+
const est = owners.length === 1 ? pickupEstimate(peer, { now: relayNow, about: { ref: d.ref, goal: d.owed[0].goal }, claimedBy: null, ...(mayWake !== undefined ? { mayWake } : {}) }) : null;
|
|
509
|
+
const why = est && est.kind !== "soon" ? est.says : undefined;
|
|
510
|
+
const mine = client.seenAct(d.ref) ?? own.get(d.ref);
|
|
511
|
+
return { owners, what: mine?.summary ?? mine?.body ?? d.owed[0].body, ...(why ? { why } : {}) };
|
|
512
|
+
});
|
|
513
|
+
const ok = await send(withLabel(composeUnpicked(items, this.cfg.space, { tools, preferred: preferredTool(profile, tools), now: now() })));
|
|
514
|
+
for (const d of due)
|
|
515
|
+
state.notified_at[`act:asked:${d.ref}`] = now();
|
|
516
|
+
state.notified_at["act:asked:last"] = now();
|
|
517
|
+
machineAskedAt = now();
|
|
518
|
+
dirty = true;
|
|
519
|
+
this.opts.log(ok ? `> follow-up alert: ${due.length} request${due.length === 1 ? "" : "s"} of yours nobody picked up` : `! could not show the follow-up alert for ${due.length} request${due.length === 1 ? "" : "s"}`);
|
|
520
|
+
}
|
|
521
|
+
else
|
|
522
|
+
machineAskedAt = before;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
395
525
|
if (dirty || !existsSync(stateFile))
|
|
396
526
|
writeState(stateFile, state);
|
|
397
527
|
const arrived = await client.next(pollMs);
|
|
@@ -455,21 +585,66 @@ export class HumanNotifier {
|
|
|
455
585
|
writeState(stateFile, state);
|
|
456
586
|
}
|
|
457
587
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
588
|
+
for (const r of arrived) {
|
|
589
|
+
if (!prefs.decisions && !prefs.deliveries)
|
|
590
|
+
break;
|
|
591
|
+
if (r.from === this.cfg.member || neverAlerts(r) || batched.has(r.id) || state.notified_at[`act:${r.id}`])
|
|
592
|
+
continue;
|
|
593
|
+
if (r.act !== "ANSWER" && r.act !== "DELIVERED" && !declineCodeOf(r))
|
|
594
|
+
continue;
|
|
595
|
+
if (client.relayNow() - r.ts > WAITING_MAX_AGE_MS)
|
|
596
|
+
continue;
|
|
597
|
+
const goal = r.goal ? client.goals.get(r.goal) : undefined;
|
|
598
|
+
const code = declineCodeOf(r);
|
|
599
|
+
const asked = r.ref && prefs.decisions ? await ownAct(r.ref) : null;
|
|
600
|
+
let item = null;
|
|
601
|
+
if (!prefs.decisions) { }
|
|
602
|
+
else if (asked && asked.from === this.cfg.member && !byRun(asked)) {
|
|
603
|
+
item = code ? (r.to?.includes(this.cfg.member) ? { kind: "declined", act: r, code, asked: asked.summary ?? asked.body } : null)
|
|
604
|
+
: { kind: r.act === "ANSWER" ? "answer" : "delivery", act: r };
|
|
605
|
+
}
|
|
606
|
+
else if (!r.ref && !code) {
|
|
607
|
+
if (r.act === "ANSWER" && r.to?.includes(this.cfg.member))
|
|
608
|
+
item = { kind: "answer", act: r };
|
|
609
|
+
else if (r.act === "DELIVERED" && goal?.opened_by === this.cfg.member && goal.sig?.role !== "run"
|
|
610
|
+
&& (r.to?.length ? r.to.includes(this.cfg.member) : goal.members.length === 2))
|
|
611
|
+
item = { kind: "delivery", act: r };
|
|
612
|
+
}
|
|
613
|
+
if (!item && prefs.deliveries && r.act === "DELIVERED") {
|
|
463
614
|
const forMe = r.to?.length ? r.to.includes(this.cfg.member) : (goal?.members.includes(this.cfg.member) ?? false);
|
|
464
|
-
if (
|
|
465
|
-
|
|
466
|
-
const ok = await send(withLabel(composeDelivery(r, goal, peerOf(r.from), { tools, preferred: preferredTool(profile, tools), now: now() })));
|
|
467
|
-
if (ok) {
|
|
468
|
-
state.notified_at[`act:${r.id}`] = now();
|
|
469
|
-
writeState(stateFile, state);
|
|
470
|
-
this.opts.log(`> delivery alert for ${r.id} from ${r.from}`);
|
|
471
|
-
}
|
|
615
|
+
if (forMe)
|
|
616
|
+
item = { kind: "delivery", act: r };
|
|
472
617
|
}
|
|
618
|
+
if (!item)
|
|
619
|
+
continue;
|
|
620
|
+
if (!replies.length)
|
|
621
|
+
repliesSince = now();
|
|
622
|
+
replies.push(item);
|
|
623
|
+
batched.add(r.id);
|
|
624
|
+
}
|
|
625
|
+
if (replies.length && now() - repliesSince >= (this.opts.replyBatchMs ?? REPLY_BATCH_MS)) {
|
|
626
|
+
const batch = replies;
|
|
627
|
+
replies = [];
|
|
628
|
+
const pin = [teamPinId(this.cfg)];
|
|
629
|
+
const shown = (x) => x.kind !== "declined" && (() => { try {
|
|
630
|
+
return liveReadAt(pin, x.act.id).length > 0;
|
|
631
|
+
}
|
|
632
|
+
catch {
|
|
633
|
+
return false;
|
|
634
|
+
} })();
|
|
635
|
+
const say = batch.filter((x) => !shown(x));
|
|
636
|
+
for (const x of batch) {
|
|
637
|
+
state.notified_at[`act:${x.act.id}`] = now();
|
|
638
|
+
batched.delete(x.act.id);
|
|
639
|
+
}
|
|
640
|
+
for (const x of batch)
|
|
641
|
+
if (x.kind === "declined" && x.act.ref)
|
|
642
|
+
state.notified_at[`act:asked:${x.act.ref}`] = now();
|
|
643
|
+
if (say.length) {
|
|
644
|
+
const ok = await send(withLabel(composeReplies(say, this.cfg.space, (g) => (g ? client.goals.get(g) : undefined), (m) => peerOf(m), { tools, preferred: preferredTool(profile, tools), now: now() })));
|
|
645
|
+
this.opts.log(ok ? `> reply alert: ${say.map((x) => `${x.kind} ${x.act.id} from ${x.act.from}`).join(", ")}` : `! could not show the reply alert for ${say.length}`);
|
|
646
|
+
}
|
|
647
|
+
writeState(stateFile, state);
|
|
473
648
|
}
|
|
474
649
|
}
|
|
475
650
|
}
|
|
@@ -478,9 +653,19 @@ export class HumanNotifier {
|
|
|
478
653
|
}
|
|
479
654
|
}
|
|
480
655
|
}
|
|
656
|
+
export function onlyNetworkFailures(errors) {
|
|
657
|
+
return errors.length > 0 && errors.every((e) => {
|
|
658
|
+
const r = refusalOf(e);
|
|
659
|
+
if (r && PASSING_OR_SAID.has(r.code))
|
|
660
|
+
return true;
|
|
661
|
+
return !r && !/^SPACE_MISMATCH\b/.test(e.trim());
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
const PASSING_OR_SAID = new Set(["SPACE_UNREADABLE", "BAD_NONCE", "STORAGE", "SHUTTING_DOWN", "SPACE_DELETED"]);
|
|
481
665
|
export async function runNotifiers(teams, o) {
|
|
482
666
|
const sleep = o.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
483
667
|
const failing = new Set();
|
|
668
|
+
const lastError = new Map();
|
|
484
669
|
let gaveUp = false;
|
|
485
670
|
let giveUp;
|
|
486
671
|
const allFailing = new Promise((r) => { giveUp = () => r(false); });
|
|
@@ -497,9 +682,14 @@ export async function runNotifiers(teams, o) {
|
|
|
497
682
|
removed = !!removalRefusal(e.message);
|
|
498
683
|
if (!removed) {
|
|
499
684
|
failing.add(i);
|
|
685
|
+
lastError.set(i, e.message);
|
|
500
686
|
o.log(`[${t.label}] ! not connecting: ${e.message.split("\n")[0]}`);
|
|
501
687
|
if (failing.size === teams.length) {
|
|
502
688
|
gaveUp = true;
|
|
689
|
+
try {
|
|
690
|
+
o.onGiveUp?.([...failing].map((n) => lastError.get(n) ?? ""));
|
|
691
|
+
}
|
|
692
|
+
catch { }
|
|
503
693
|
giveUp();
|
|
504
694
|
return;
|
|
505
695
|
}
|
package/dist/onboard-copy.js
CHANGED
|
@@ -48,6 +48,7 @@ function stepsFor(invite, o) {
|
|
|
48
48
|
const npm = ["npm install -g @join-pantheon/cli", `pantheon ${cmd.map(q).join(" ")}`];
|
|
49
49
|
return { person, npm, agent: agentRequest(invite, o) };
|
|
50
50
|
}
|
|
51
|
+
export const FOLDER_ASK = "If it ends by asking which folder I work in for the team, show me the folders it lists and ask me which one — a project, or a folder of documents. Run the line it gives for the one I pick, or for a folder I name. Never pick one for me.";
|
|
51
52
|
export function agentRequest(invite, o) {
|
|
52
53
|
const base = invite === null || quotableInvite(invite) === invite ? baseOf(o) : null;
|
|
53
54
|
const what = invite ? "join my teammate's Pantheon team" : "set up Pantheon and start a team";
|
|
@@ -63,6 +64,7 @@ export function agentRequest(invite, o) {
|
|
|
63
64
|
`On Windows: curl.exe -fsSL ${base}/install.ps1 -o pantheon-install.ps1, read it, then run: powershell -NoProfile -Command "Set-Item Env:PANTHEON_ARGS '${psVerb} ${flags}'; Get-Content -Raw pantheon-install.ps1 | iex"`,
|
|
64
65
|
`It emails me a 6-digit code and a link (it may land in spam), and prints two words in capitals. When you ask me for the code, show me those two words too: I can give you the code, or open the email's link and type the words there. Then, for the way I used, run the exact command it prints next (it names Pantheon by its full path, since this shell may not find \`pantheon\` yet), with the code in place of <the 6-digit code>.`,
|
|
65
66
|
...(invite ? [] : [`If it says I'm already in some teams, show me their names and ask which this computer should join, then run the line it gives for each one I pick. Don't ask me to name a new team unless I say I want one.`]),
|
|
67
|
+
FOLDER_ASK,
|
|
66
68
|
`The download, the sign-in and the setup need network access, and the setup starts Pantheon's background helpers, which a sandbox blocks. If your shell runs in a sandbox (Codex's does), ask me to approve running each of them outside it. In Codex, ask me to approve running them with network access. If the request is turned down without asking me, or this shell still can't go online, don't look for a way around it: tell me to choose "Ask for approval" in Codex's permissions menu (under the message box), then try again when I say so.`,
|
|
67
69
|
"What it changes, to tell me before running it:",
|
|
68
70
|
...INSTALL_CHANGES.slice(0, 3).map((c) => `- ${c}`),
|
|
@@ -72,6 +74,7 @@ export function agentRequest(invite, o) {
|
|
|
72
74
|
intro,
|
|
73
75
|
`It needs Node.js 22.13 or newer. Run: npm install -g @join-pantheon/cli — then: pantheon ${verb} --json`,
|
|
74
76
|
`If it exits with code 10, I need to sign in once: give me the line it prints to run in a terminal of my own, and run it again after.${invite ? " Don't open the invite link: it holds a one-time secret." : ""}`,
|
|
77
|
+
FOLDER_ASK,
|
|
75
78
|
].join("\n");
|
|
76
79
|
}
|
|
77
80
|
export function inviteBlock(invite, o) {
|
package/dist/pickup.js
CHANGED
|
@@ -8,6 +8,12 @@ export function inWords(ms) {
|
|
|
8
8
|
const h = Math.round(m / 60);
|
|
9
9
|
return `about ${h} hour${h === 1 ? "" : "s"}`;
|
|
10
10
|
}
|
|
11
|
+
export function machineOn(peer) {
|
|
12
|
+
return (peer.sessions ?? []).length > 0;
|
|
13
|
+
}
|
|
14
|
+
export function notSetUpWords(who) {
|
|
15
|
+
return `${who}'s computer is on, but nothing there is set up to take requests while ${who} is away`;
|
|
16
|
+
}
|
|
11
17
|
const UNAVAILABLE = {
|
|
12
18
|
no_agent: "Claude Code (or another agent CLI) isn't installed there",
|
|
13
19
|
kiro_only: "only Kiro is installed there, and Kiro answers in live sessions only",
|
|
@@ -38,9 +44,11 @@ export function pickupEstimate(peer, o = {}) {
|
|
|
38
44
|
return { kind: "no-wake", says: `${who}'s worker does not take your requests (the team does not let you wake it), so this waits for ${who}${live ? ", who has a live session open" : ""}` };
|
|
39
45
|
}
|
|
40
46
|
if (!workerOn) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
if (live)
|
|
48
|
+
return { kind: "not-set-up", says: `${who} has a session open, which sees this when their agent next looks; nothing on ${who}'s computer is set up to take requests while ${who} is away` };
|
|
49
|
+
if (machineOn(peer))
|
|
50
|
+
return { kind: "not-set-up", says: notSetUpWords(who) };
|
|
51
|
+
return { kind: "offline", says: `${who}'s worker is offline, so this waits until ${who} is back` };
|
|
44
52
|
}
|
|
45
53
|
const cb = o.claimedBy;
|
|
46
54
|
if (cb && cb.role === "worker" && !(peer.sessions ?? []).some((s) => s.id === cb.session)) {
|
package/dist/quickstart.js
CHANGED
|
@@ -8,22 +8,23 @@ import { lookup } from "node:dns/promises";
|
|
|
8
8
|
import { describeRelayFailure, interceptedText, RelayReplyError } from "./network.js";
|
|
9
9
|
import { PantheonClient } from "./client.js";
|
|
10
10
|
import { holdsRepo } from "./repo-find.js";
|
|
11
|
-
import { folderFacts, folderRefusal,
|
|
11
|
+
import { folderFacts, folderRefusal, isInside } from "./folder-guard.js";
|
|
12
12
|
import { load, loadAll, identity, save, toInvite, resolveFor, repoInfo, bindRepo, bindFolder, folderBinding, DEFAULT_RELAY } from "./config.js";
|
|
13
13
|
import { looksLikePlaceholder, teamSlug } from "./team-name.js";
|
|
14
|
-
import { commandsChosen, loadProfile, wakeChosen, wakeDefault } from "./profile.js";
|
|
14
|
+
import { commandsChosen, decisionAlertsOn, loadProfile, wakeChosen, wakeDefault } from "./profile.js";
|
|
15
|
+
import { turnedOff } from "./setup-changes.js";
|
|
15
16
|
import { newKeypair } from "./identity.js";
|
|
16
17
|
import { installForUser } from "./install.js";
|
|
17
18
|
import { writeIntent, installHooks } from "./notify.js";
|
|
18
19
|
import { detectAvailable, agentById, agentsNeedingUnsandboxed, folderReaderLine, recordedAgent } from "./agents.js";
|
|
19
|
-
import { installService, installedServiceArgs, keepServiceFlags, servicesUnavailable } from "./service.js";
|
|
20
|
+
import { borrowedHome, installService, installedServiceArgs, keepServiceFlags, serviceState, servicesUnavailable } from "./service.js";
|
|
20
21
|
import { clearTrayQuit } from "./win-host.js";
|
|
21
22
|
import { ensureNativeNotifier } from "./notifier.js";
|
|
22
23
|
import { ensureTrayBinary, writeTrayCommands } from "./tray.js";
|
|
23
24
|
import { desktopUnavailable, ephemeralWarning, hostEnv } from "./host-env.js";
|
|
24
|
-
import {
|
|
25
|
+
import { mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
25
26
|
import { localAddresses } from "./machine.js";
|
|
26
|
-
import {
|
|
27
|
+
import { grantSelfUpgradeAtSetup, loadPolicy, unsandboxedAllowed } from "./worker-policy.js";
|
|
27
28
|
import { Relay } from "./relay.js";
|
|
28
29
|
import { loginShellEnv, which } from "./which.js";
|
|
29
30
|
const sh = (cmd) => {
|
|
@@ -39,6 +40,24 @@ const notLoaded = (r) => r && typeof r === "object" && r.loaded === false
|
|
|
39
40
|
: null;
|
|
40
41
|
export function wireUp(opts, deps = {}) {
|
|
41
42
|
const installSvc = deps.installService ?? installService;
|
|
43
|
+
const running = (kind) => { try {
|
|
44
|
+
return (deps.running ?? ((k) => !borrowedHome() && serviceState(k).running))(kind);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return false;
|
|
48
|
+
} };
|
|
49
|
+
const offByPerson = (s) => { try {
|
|
50
|
+
return (deps.turnedOff ?? turnedOff)(s) && !running(s === "worker" ? "worker" : "notifier");
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return false;
|
|
54
|
+
} };
|
|
55
|
+
const alertsOff = () => { try {
|
|
56
|
+
return offByPerson("alerts") || !(deps.alertsOn ?? decisionAlertsOn)();
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return false;
|
|
60
|
+
} };
|
|
42
61
|
const workerFlags = (wanted, decided) => keepServiceFlags(deps.installService ? null : installedServiceArgs("worker"), wanted, decided);
|
|
43
62
|
const ensureNotifier = deps.ensureNotifier ?? ensureNativeNotifier;
|
|
44
63
|
const ensureTray = deps.ensureTray ?? ensureTrayBinary;
|
|
@@ -69,6 +88,9 @@ export function wireUp(opts, deps = {}) {
|
|
|
69
88
|
if (opts.notifications && !host.desktop) {
|
|
70
89
|
tools.push({ tool: "notifications", status: desktopUnavailable(host, "desktop alerts") });
|
|
71
90
|
}
|
|
91
|
+
else if (opts.notifications && alertsOff()) {
|
|
92
|
+
tools.push({ tool: "notifications", status: "off — you turned alerts off on this computer, and they stay so. To turn them on: pantheon setup --alerts decisions" });
|
|
93
|
+
}
|
|
72
94
|
else if (opts.notifications) {
|
|
73
95
|
try {
|
|
74
96
|
const mac = host.platform === "darwin";
|
|
@@ -124,6 +146,9 @@ export function wireUp(opts, deps = {}) {
|
|
|
124
146
|
if (how === "off") {
|
|
125
147
|
tools.push({ tool: "worker", status: "off (--no-worker) — this machine cannot answer the team while you are away" });
|
|
126
148
|
}
|
|
149
|
+
else if (how === "default" && opts.unattended && offByPerson("worker")) {
|
|
150
|
+
tools.push({ tool: "worker", status: "off — you turned it off on this computer, and it stays so: teammates' requests wait for you. To turn it on: pantheon service install worker" });
|
|
151
|
+
}
|
|
127
152
|
else if (opts.unattended && noServices) {
|
|
128
153
|
tools.push({ tool: "worker", status: noServices });
|
|
129
154
|
}
|
|
@@ -160,6 +185,9 @@ export function wireUp(opts, deps = {}) {
|
|
|
160
185
|
} })();
|
|
161
186
|
if (reader && !reader.ok)
|
|
162
187
|
warnings.push(`${reader.line} — until then, teammates' requests for this folder wait for your live session`);
|
|
188
|
+
const selfUpgrade = grantSelfUpgradeAtSetup();
|
|
189
|
+
if (selfUpgrade)
|
|
190
|
+
granted.push(selfUpgrade);
|
|
163
191
|
}
|
|
164
192
|
}
|
|
165
193
|
catch (e) {
|
|
@@ -197,12 +225,9 @@ export function wireUp(opts, deps = {}) {
|
|
|
197
225
|
} })();
|
|
198
226
|
if (away.length && unsandboxedAllowed(loadPolicy()))
|
|
199
227
|
granted.push(`${away.join(", ")} ${away.length === 1 ? "answers" : "answer"} those requests, so teammates get answers even when you're offline. To have them wait for you instead: pantheon setup --unsandboxed no`);
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
savePolicy(pol);
|
|
204
|
-
granted.push(`The worker keeps pantheon itself current with your team's relay (fast-forward pull + rebuild, reported on the ledger). Revoke: pantheon policy revoke self-upgrade`);
|
|
205
|
-
}
|
|
228
|
+
const selfUpgrade = grantSelfUpgradeAtSetup();
|
|
229
|
+
if (selfUpgrade)
|
|
230
|
+
granted.push(selfUpgrade);
|
|
206
231
|
}
|
|
207
232
|
catch (e) {
|
|
208
233
|
tools.push({ tool: "worker", status: `could not install: ${e.message}` });
|
|
@@ -513,12 +538,14 @@ export async function start(opts) {
|
|
|
513
538
|
if (repo && !client.repos.some((r) => r.fingerprint === repo.fingerprint)) {
|
|
514
539
|
await client.bindRepo(repo.fingerprint, repo.origin).catch((e) => warnings.push(`could not register this repo with the team: ${e.message}`));
|
|
515
540
|
}
|
|
516
|
-
|
|
541
|
+
const linkedAlready = reuse && Object.values(loadAll()?.bindings ?? {}).some((b) => b.space === c.spaceId);
|
|
542
|
+
if (!repo && c.spaceId && bindableFolder(process.cwd()) && !linkedAlready) {
|
|
517
543
|
bindFolder(process.cwd(), c.spaceId);
|
|
518
544
|
folderBound = process.cwd();
|
|
519
545
|
}
|
|
520
|
-
else if (!repo && c.spaceId)
|
|
521
|
-
|
|
546
|
+
else if (!repo && c.spaceId && linkedAlready && !folderBinding(loadAll(), process.cwd()) && bindableFolder(process.cwd())) {
|
|
547
|
+
opts.log(` folder this folder was not added — "${c.space}" already has its folders on this computer (to add this one too: pantheon use ${c.space} --here)`);
|
|
548
|
+
}
|
|
522
549
|
if (repo && c.spaceId) {
|
|
523
550
|
const { replaced } = bindRepo(repo, c.spaceId);
|
|
524
551
|
const was = replaced ?? (here.binding && here.binding.space !== c.spaceId ? here.binding : null);
|
|
@@ -613,8 +640,6 @@ export async function join(opts) {
|
|
|
613
640
|
bindFolder(process.cwd(), cfg.spaceId);
|
|
614
641
|
opts.log(` folder ${process.cwd()} → bound to "${cfg.space}" (agents opened here speak in it; no git needed)`);
|
|
615
642
|
}
|
|
616
|
-
else if (!repo && cfg.spaceId)
|
|
617
|
-
temporaryFolderNote(process.cwd(), opts.log, cfg.space);
|
|
618
643
|
if (repo && cfg.spaceId) {
|
|
619
644
|
const { replaced } = bindRepo(repo, cfg.spaceId);
|
|
620
645
|
if (replaced)
|
|
@@ -660,11 +685,6 @@ export function bindableFolder(dir) {
|
|
|
660
685
|
catch { }
|
|
661
686
|
return true;
|
|
662
687
|
}
|
|
663
|
-
function temporaryFolderNote(dir, log, team) {
|
|
664
|
-
const r = folderRefusalHere(dir);
|
|
665
|
-
if (isTemporaryRefusal(r))
|
|
666
|
-
log(` folder not bound — ${r.why.replace("<team>", team)}`);
|
|
667
|
-
}
|
|
668
688
|
function detectAgent(prior) {
|
|
669
689
|
return recordedAgent(prior, { fresh: true });
|
|
670
690
|
}
|
package/dist/relay.js
CHANGED
|
@@ -9,6 +9,7 @@ import { badRemote, Inbound, isCatchAllDomain, isContinuationFor, LIMITS, newId,
|
|
|
9
9
|
import { VERSION } from "./version.js";
|
|
10
10
|
import { compareVersions, INSTALLER_MIN_CLI, isVersion, installerScript, InstallerGate } from "./installer.js";
|
|
11
11
|
import { installerLine } from "./managed.js";
|
|
12
|
+
import { GeoIp, InstallStats, summarize } from "./install-stats.js";
|
|
12
13
|
import { joinMd, onboardJson, onboardMd } from "./onboard-copy.js";
|
|
13
14
|
import { Ledger, SpaceFull } from "./ledger.js";
|
|
14
15
|
import { fingerprint, newNonce, verifyChallenge, verifyActivity, verifyAccount, verifyRead, verifyStatus, canonicalKey, actPayload, goalPayload, verifyBytes, verifyDelegate, canonicalJson } from "./identity.js";
|
|
@@ -442,7 +443,7 @@ const LINK_CLOSED = "Different words were typed here, so this link is closed. Th
|
|
|
442
443
|
const LINK_GONE = "This link has expired (they last 10 minutes), a newer Pantheon email replaced it, or it was already used. Use the code in the newest Pantheon email, or ask your coding agent to send a new one.";
|
|
443
444
|
const STORAGE_HELD = "the relay received this but has not saved it yet — its disk is refusing writes. It is kept, and reaches the team when the disk recovers; do not send it again.";
|
|
444
445
|
export function backupExcludes(dir, keep) {
|
|
445
|
-
const always = ["--exclude=*.tmp"];
|
|
446
|
+
const always = ["--exclude=*.tmp", "--exclude=./geoip"];
|
|
446
447
|
if (!keep)
|
|
447
448
|
return always;
|
|
448
449
|
let names = [];
|
|
@@ -708,6 +709,9 @@ export class Relay {
|
|
|
708
709
|
recoveryWaitMs;
|
|
709
710
|
backupTimer;
|
|
710
711
|
installerGate;
|
|
712
|
+
installStats = null;
|
|
713
|
+
geo = null;
|
|
714
|
+
geoTimer = null;
|
|
711
715
|
upgradeHold;
|
|
712
716
|
get features() { return this.opts.features ?? RELAY_FEATURES; }
|
|
713
717
|
constructor(opts = {}) {
|
|
@@ -775,6 +779,14 @@ export class Relay {
|
|
|
775
779
|
}
|
|
776
780
|
this.upgradeHold = upgradeHoldFrom(opts.upgradeHoldAt ?? process.env.PANTHEON_HOLD_UPGRADES_AT, VERSION, this.log);
|
|
777
781
|
this.installerGate = opts.installerGate ?? new InstallerGate({ log: this.log, ...(this.upgradeHold ? { version: this.upgradeHold } : {}) });
|
|
782
|
+
try {
|
|
783
|
+
if ((process.env.PANTHEON_GEOIP ?? "").trim().toLowerCase() === "dbip")
|
|
784
|
+
this.geo = new GeoIp(join(this.dataDir, "geoip"), this.log);
|
|
785
|
+
this.installStats = new InstallStats(join(this.dataDir, "install-stats"), this.geo);
|
|
786
|
+
}
|
|
787
|
+
catch (e) {
|
|
788
|
+
this.log(`! installer downloads will not be counted here: ${e.message}`);
|
|
789
|
+
}
|
|
778
790
|
this.busyTtlMs = opts.activityBusyTtlMs ?? LIMITS.activityBusyTtlMs;
|
|
779
791
|
this.pruneMs = opts.activityPruneMs ?? LIMITS.activityPruneMs;
|
|
780
792
|
const readsEnv = (process.env.PANTHEON_READS ?? "").trim().toLowerCase();
|
|
@@ -804,6 +816,12 @@ export class Relay {
|
|
|
804
816
|
this.loopTimer = setInterval(() => this.rotateLoopWindow(), LOOP_WINDOW_MS);
|
|
805
817
|
this.loopTimer.unref?.();
|
|
806
818
|
this.startBackups();
|
|
819
|
+
if (this.geo) {
|
|
820
|
+
const geo = this.geo;
|
|
821
|
+
void geo.start().catch((e) => this.log(`geoip: ${e.message}`));
|
|
822
|
+
this.geoTimer = setInterval(() => { void geo.refresh().catch(() => { }); }, 86_400_000);
|
|
823
|
+
this.geoTimer.unref?.();
|
|
824
|
+
}
|
|
807
825
|
const addr = this.http.address();
|
|
808
826
|
const port = typeof addr === "object" && addr ? addr.port : want;
|
|
809
827
|
resolve({ port, host });
|
|
@@ -812,6 +830,10 @@ export class Relay {
|
|
|
812
830
|
}
|
|
813
831
|
async close() {
|
|
814
832
|
this.closing = true;
|
|
833
|
+
if (this.geoTimer) {
|
|
834
|
+
clearInterval(this.geoTimer);
|
|
835
|
+
this.geoTimer = null;
|
|
836
|
+
}
|
|
815
837
|
for (const ws of this.wss.clients)
|
|
816
838
|
ws.terminate();
|
|
817
839
|
await new Promise((r) => this.wss.close(() => r()));
|
|
@@ -956,7 +978,7 @@ export class Relay {
|
|
|
956
978
|
if (url.pathname === "/install.sh" || url.pathname === "/install.ps1") {
|
|
957
979
|
if (req.method !== "GET" && req.method !== "HEAD")
|
|
958
980
|
return this.json(res, 405, { error: "GET only" });
|
|
959
|
-
void this.serveInstaller(req, res, url.pathname.slice(1));
|
|
981
|
+
void this.serveInstaller(req, res, url.pathname.slice(1), ip);
|
|
960
982
|
return;
|
|
961
983
|
}
|
|
962
984
|
if (url.pathname === "/onboard.json" || url.pathname === "/skills/join.md" || url.pathname === "/skills/onboard.md") {
|
|
@@ -3585,6 +3607,7 @@ ${body}`;
|
|
|
3585
3607
|
name: e.member, agent: m?.agent ?? e.last_agent ?? "", founder: founder === e.member, admitted: e.admitted, mayWake: e.may_wake,
|
|
3586
3608
|
online: present.length > 0, windows, busy: work ? work.busy : null,
|
|
3587
3609
|
worker: w ? { state: w.state, ...(w.reason ? { reason: w.reason } : {}), at: w.at } : null,
|
|
3610
|
+
workerOn: present.some((s) => s.role === "worker"),
|
|
3588
3611
|
build, behind: !!build && stuckBehind(build, relayPkg, now - this.startedAt),
|
|
3589
3612
|
lastSeen: present.length ? now : (m?.last_seen || e.last_seen || null), unseen,
|
|
3590
3613
|
reportsSince: ts.sp ? ts.sp.createdAt : null,
|
|
@@ -3869,7 +3892,7 @@ ${body}`;
|
|
|
3869
3892
|
const safe = live ? safeName(live.name) : safeName(name);
|
|
3870
3893
|
const key = safe.toLowerCase();
|
|
3871
3894
|
const day = new Date(now).toISOString().slice(0, 10);
|
|
3872
|
-
const sig = `${day}|${live ? (() => { const all = live.ledger.all(); return `live:${all.length}:${all.length ? all[all.length - 1].seq : 0}`; })() : await this.teamFilesSig(safe)}`;
|
|
3895
|
+
const sig = `${day}|${live ? (() => { const all = live.ledger.all(); return `live:${all.length}:${all.length ? all[all.length - 1].seq : 0}:${live.store.firstClaims.size}`; })() : await this.teamFilesSig(safe)}`;
|
|
3873
3896
|
const hit = this.teamWeeksCache.get(key);
|
|
3874
3897
|
if (hit && hit.sig === sig)
|
|
3875
3898
|
return hit.v;
|
|
@@ -3921,7 +3944,7 @@ ${body}`;
|
|
|
3921
3944
|
}
|
|
3922
3945
|
const index = await flowIndexAsync(projected, 10_000);
|
|
3923
3946
|
const createdAt = ts.allow.all().reduce((min, e) => (min === null || e.first_seen < min ? e.first_seen : min), null);
|
|
3924
|
-
const v = await teamWeeksOfAsync({ name: ts.name, now, records: projected, usage: ts.usage, compactedThrough: ts.compactedThrough, createdAt, askers: [...askers], firstAskAt, lastActAt, index });
|
|
3947
|
+
const v = await teamWeeksOfAsync({ name: ts.name, now, records: projected, usage: ts.usage, compactedThrough: ts.compactedThrough, createdAt, askers: [...askers], firstAskAt, lastActAt, index, claims: ts.firstClaims.values() });
|
|
3925
3948
|
let bytes = 2_000 + v.askers.length * 40;
|
|
3926
3949
|
for (const w of v.people)
|
|
3927
3950
|
bytes += w.length * 40;
|
|
@@ -4234,6 +4257,7 @@ ${body}`;
|
|
|
4234
4257
|
backupAt, backupOkAt, snapshots,
|
|
4235
4258
|
},
|
|
4236
4259
|
founder, lastActive: Object.fromEntries(weeks.map((w) => [w.name, w.lastActiveAt])),
|
|
4260
|
+
installs: this.installSummary(now),
|
|
4237
4261
|
sort: url?.searchParams.get("sort") ?? null, dir: url?.searchParams.get("dir") ?? null,
|
|
4238
4262
|
accounts: {
|
|
4239
4263
|
total: accounts.length, paid: Object.entries(planCounts).filter(([n]) => n !== "free").reduce((s, [, v]) => s + v, 0),
|
|
@@ -4482,7 +4506,22 @@ pantheon start</code></pre>
|
|
|
4482
4506
|
<p>It asks for your email and sends you a 6-digit code (check spam if it does not arrive). Invited to a team? Use the line in your invite.</p>`}`);
|
|
4483
4507
|
}
|
|
4484
4508
|
startInstallerCheck() { this.installerGate.start(); }
|
|
4485
|
-
|
|
4509
|
+
installSummary(now) {
|
|
4510
|
+
const st = this.installStats;
|
|
4511
|
+
if (!st)
|
|
4512
|
+
return null;
|
|
4513
|
+
try {
|
|
4514
|
+
const since = now - 30 * 86_400_000;
|
|
4515
|
+
const signIns = (this.accounts?.auditLog({ event: "session_created", sinceMs: since, limit: 20_000 }) ?? [])
|
|
4516
|
+
.filter((r) => !!r.ip).map((r) => ({ at: r.ts, net: st.netOf(r.ip) }));
|
|
4517
|
+
return summarize(st.read(since), signIns, now, !!this.geo?.ready);
|
|
4518
|
+
}
|
|
4519
|
+
catch (e) {
|
|
4520
|
+
this.log(`! installer downloads could not be read: ${e.message}`);
|
|
4521
|
+
return null;
|
|
4522
|
+
}
|
|
4523
|
+
}
|
|
4524
|
+
async serveInstaller(req, res, name, ip = "") {
|
|
4486
4525
|
const plain = (code, body, extra = {}) => {
|
|
4487
4526
|
res.writeHead(code, {
|
|
4488
4527
|
"content-type": "text/plain; charset=utf-8",
|
|
@@ -4509,6 +4548,12 @@ pantheon start</code></pre>
|
|
|
4509
4548
|
return plain(200, name === "install.sh" ? `#!/bin/sh\nprintf '%s\\n' '${sentence}' >&2\nexit 1\n` : `Write-Host '${sentence}' -ForegroundColor Red\nthrow 'Pantheon was not installed.'\n`, { "x-pantheon-installer": "unavailable" });
|
|
4510
4549
|
}
|
|
4511
4550
|
plain(200, body, { "x-pantheon-installs": choice.version });
|
|
4551
|
+
if (this.installStats && ip) {
|
|
4552
|
+
try {
|
|
4553
|
+
void this.installStats.record(this.installStats.event({ ip, file: name, method: req.method ?? "GET", version: choice.version, headers: req.headers }));
|
|
4554
|
+
}
|
|
4555
|
+
catch { }
|
|
4556
|
+
}
|
|
4512
4557
|
}
|
|
4513
4558
|
catch (e) {
|
|
4514
4559
|
this.log(`! ${name} failed: ${e?.message ?? e}`);
|
|
@@ -5444,8 +5489,13 @@ pantheon start</code></pre>
|
|
|
5444
5489
|
return fail("BAD_ACT_ID", `act id ${m.id} was not made in the last day — check this machine's clock`, m.cid);
|
|
5445
5490
|
if (m.after_seq !== undefined) {
|
|
5446
5491
|
const mine = me.id;
|
|
5447
|
-
const
|
|
5492
|
+
const unseen = space.ledger.since(m.after_seq);
|
|
5493
|
+
const answered = new Set(unseen.filter((r) => r.from === mine && r.ref).map((r) => r.ref));
|
|
5494
|
+
if (m.ref)
|
|
5495
|
+
answered.add(m.ref);
|
|
5496
|
+
const missed = unseen
|
|
5448
5497
|
.filter((r) => r.from !== mine && r.act !== "JOIN" && r.act !== "LEAVE")
|
|
5498
|
+
.filter((r) => !answered.has(r.id))
|
|
5449
5499
|
.filter((r) => (m.goal ? r.goal === m.goal : !r.goal)
|
|
5450
5500
|
|| (r.to?.includes(mine) ?? false)
|
|
5451
5501
|
|| (m.to?.includes(r.from) ?? false)
|