@astrofoundry/pi-astro 0.40.75 → 0.40.77

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.
@@ -225,9 +225,9 @@ export function dayText(iso: string, timeZone: string): string {
225
225
  /** How often this key paged in the last 7 days, before this check. */
226
226
  export function repeatText(occurrences: SecurityState["occurrences"], key: string, now: number, count: number, timeZone: string): string {
227
227
  const earlier = occurrences.filter((o) => o.key === key && Date.parse(o.at) >= now - 7 * DAY).map((o) => o.at).sort();
228
- const here = count > 1 ? ` · × ${count} in this check` : "";
229
- if (earlier.length === 0) return `first time this week${here}`;
230
- return `seen ${earlier.length + 1} times this week, last ${clockText(earlier[earlier.length - 1], timeZone)}${here}`;
228
+ const here = count > 1 ? ` · × ${count} this check` : "";
229
+ if (earlier.length === 0) return `first this week${here}`;
230
+ return `${earlier.length + 1} times this week, last ${clockText(earlier[earlier.length - 1], timeZone)}${here}`;
231
231
  }
232
232
 
233
233
  function mentionLine(owners: readonly string[]): string {
@@ -244,7 +244,7 @@ export function alertText(alert: PostedAlert, owners: readonly string[], timeZon
244
244
  if (e.path) lines.push(`-# file ${escapeDiscord(e.event ?? "changed")}${alert.origin ? ` · origin ${alert.origin.verdict}: ${escapeDiscord(alert.origin.reason)}` : ""}`);
245
245
  else if (e.log) lines.push(`-# ${escapeDiscord(firstLine(e.log).slice(0, 200))}`);
246
246
  lines.push(mentionLine(owners));
247
- if (alert.ack) lines.push(`-# ✅ Acknowledged by <@${alert.ack.by}>; repeats stay quiet until ${dayText(alert.ack.until, timeZone)}`);
247
+ if (alert.ack) lines.push(`-# ✅ Acknowledged by <@${alert.ack.by}>; repeats muted until ${dayText(alert.ack.until, timeZone)}`);
248
248
  return lines.join("\n");
249
249
  }
250
250
 
@@ -334,24 +334,24 @@ export function healthChange(previous: string[] | null, issues: readonly HealthI
334
334
  const codes = issues.map((i) => i.code).sort();
335
335
  if (previous === null && codes.length === 0) return null;
336
336
  if (previous !== null && previous.length === codes.length && previous.every((c, i) => c === codes[i])) return null;
337
- if (codes.length === 0) return { text: "✅ **Security health recovered:** every check is clear again.", mention: false };
337
+ if (codes.length === 0) return { text: "✅ **Security health recovered:** all checks clear.", mention: false };
338
338
  const list = issues.map((i) => `- ${escapeDiscord(i.message)}`).join("\n");
339
339
  const added = previous === null || codes.some((c) => !previous.includes(c));
340
340
  return { text: `⚠️ **Security health${previous === null ? "" : " changed"}:**\n${list}`, mention: added };
341
341
  }
342
342
 
343
343
  export function checksFailingText(what: string, minutes: number, reason: string): string {
344
- return `⚠️ **Security checks failing:** the bridge could not read ${what} for ${minutes} minutes (${escapeDiscord(reason.slice(0, 200))}). Until it can, urgent alerts are not checked; the specialist log on Cortex has details.`;
344
+ return `⚠️ **Security checks failing:** ${what} unreadable for ${minutes} min (${escapeDiscord(reason.slice(0, 200))}). Urgent alerts unchecked meanwhile; details in the specialist log on Cortex.`;
345
345
  }
346
346
 
347
347
  export function checksRecoveredText(what: string): string {
348
- return `✅ **Security checks** read ${what} again; anything from the gap is checked now.`;
348
+ return `✅ **Security checks** read ${what} again; the gap is checked now.`;
349
349
  }
350
350
 
351
351
  export function healthLine(a: Attention | null): string {
352
- if (!a) return "Health · the check failed";
352
+ if (!a) return "Health · check failed";
353
353
  if (a.issues.length > 0) return `Health · ${a.issues.length} issue${a.issues.length === 1 ? "" : "s"} · ${a.issues.map((i) => escapeDiscord(i.message.replace(/\.$/, ""))).join(" · ")}`;
354
- const pull = a.oldestPullSeconds === null ? "no bouncer pull recorded" : `bouncer pulled ${a.oldestPullSeconds} s ago`;
354
+ const pull = a.oldestPullSeconds === null ? "no bouncer pull" : `bouncer pulled ${a.oldestPullSeconds} s ago`;
355
355
  return `Health · ${a.agentsActive ?? "?"}/${a.agentsTotal ?? "?"} Wazuh agents active · ${pull}`;
356
356
  }
357
357
 
@@ -374,27 +374,27 @@ function sources(s: AlertSummary): string {
374
374
  }
375
375
 
376
376
  export function crowdsecDailyLine(s: AlertSummary | null): string {
377
- if (!s) return "CrowdSec · the check failed";
377
+ if (!s) return "CrowdSec · check failed";
378
378
  if (s.count === 0) return "CrowdSec · no bans";
379
379
  const scenarios = s.scenarios.length === 1 ? `all ${scenarioLabel(s.scenarios[0].scenario)}` : s.scenarios.slice(0, 3).map((x) => `${scenarioLabel(x.scenario)} ${x.count}`).join(", ");
380
380
  const lengths = new Map<string, number>();
381
381
  for (const e of s.escalated) lengths.set(e.ban, (lengths.get(e.ban) ?? 0) + 1);
382
382
  const order = (len: string) => s.bans.find((b) => b.length === len)?.hours ?? 0;
383
383
  const escalated = [...lengths.entries()].sort((x, y) => order(y[0]) - order(x[0])).map(([len, n]) => `${n} × ${len}`);
384
- const repeat = s.escalated.length === 0 ? "" : ` · ${s.escalated.length} repeat offender${s.escalated.length === 1 ? "" : "s"} now banned longer: ${escalated.join(", ")}`;
384
+ const repeat = s.escalated.length === 0 ? "" : ` · ${s.escalated.length} repeat offender${s.escalated.length === 1 ? "" : "s"} banned longer: ${escalated.join(", ")}`;
385
385
  return `CrowdSec · ${s.count} ban${s.count === 1 ? "" : "s"}, ${escapeDiscord(scenarios)}${repeat}${sources(s)}`;
386
386
  }
387
387
 
388
388
  /** `−8 %` against the previous week, or why there is no comparison. */
389
389
  export function weekChange(count: number, previous: number | null): string {
390
- if (previous === null) return "no earlier week on record";
390
+ if (previous === null) return "no earlier week";
391
391
  if (previous === 0) return count === 0 ? "none last week either" : "none last week";
392
392
  const pct = Math.round(((count - previous) / previous) * 100);
393
393
  return `${pct > 0 ? "+" : pct < 0 ? "−" : "±"}${Math.abs(pct)} % vs last week`;
394
394
  }
395
395
 
396
396
  export function crowdsecWeeklyLine(s: AlertSummary | null, previous: number | null): string {
397
- if (!s) return "CrowdSec · the check failed";
397
+ if (!s) return "CrowdSec · check failed";
398
398
  if (s.count === 0) return `CrowdSec · no bans (${weekChange(0, previous)})`;
399
399
  const longest = s.bans[s.bans.length - 1];
400
400
  const scenarios = s.scenarios.map((x) => `${scenarioLabel(x.scenario)} ${Math.round((x.count / s.count) * 100)} %`).join(", ");
@@ -418,12 +418,12 @@ export interface WazuhDigest {
418
418
 
419
419
  function originCount(n: number, of: number): string {
420
420
  if (n === of) return of === 1 ? "matched GitOps" : of === 2 ? "both matched GitOps" : "all matched GitOps";
421
- return n === 0 ? `${of === 1 ? "" : "none "}unexplained` : `${n} matched GitOps, ${of - n} unexplained`;
421
+ return n === 0 ? (of === 1 ? "unexplained" : "all unexplained") : `${n} matched GitOps, ${of - n} unexplained`;
422
422
  }
423
423
 
424
424
  /** The Wazuh line of a report: alerts at level 10 or higher, grouped by issue and agent, urgent ones first. */
425
425
  export function wazuhDigest(events: readonly WazuhEvent[] | null, origins: SecurityState["origins"], acked: (e: WazuhEvent) => boolean, maxGroups = 4): WazuhDigest {
426
- if (!events) return { line: "Wazuh · the check failed", failed: true, count: 0, urgent: 0, unacknowledged: [], open: [], unexplained: [] };
426
+ if (!events) return { line: "Wazuh · check failed", failed: true, count: 0, urgent: 0, unacknowledged: [], open: [], unexplained: [] };
427
427
  if (events.length === 0) return { line: "Wazuh · no alerts at level 10+", failed: false, count: 0, urgent: 0, unacknowledged: [], open: [], unexplained: [] };
428
428
  const groups = new Map<string, { label: string; agent: string; events: WazuhEvent[]; urgent: number; known: number }>();
429
429
  let urgent = 0;
@@ -526,7 +526,7 @@ function severityText(e: { severity: string; score: number | null }): string {
526
526
  }
527
527
 
528
528
  export function vulnLine(found: readonly VulnEvent[] | null, maxShown = 3): string {
529
- if (!found) return "Host packages · the check failed";
529
+ if (!found) return "Host packages · check failed";
530
530
  if (found.length === 0) return "Host packages · no new CVEs";
531
531
  const byCve = new Map<string, { e: VulnEvent; hosts: string[]; fix: boolean }>();
532
532
  for (const e of found) {
@@ -544,13 +544,13 @@ export function vulnLine(found: readonly VulnEvent[] | null, maxShown = 3): stri
544
544
  });
545
545
  const more = groups.length > maxShown ? ` · +${groups.length - maxShown} more CVEs` : "";
546
546
  const fixes = groups.filter((g) => g.fix).length;
547
- const fixText = fixes === 0 ? "no fixed version yet" : fixes === groups.length ? "fixed versions exist" : `fixed version exists for ${fixes}`;
547
+ const fixText = fixes === 0 ? "no fix yet" : fixes === groups.length ? "all fixable" : `${fixes} fixable`;
548
548
  const hosts = new Set(found.map((e) => e.agent)).size;
549
549
  return `Host packages · ${groups.length} new CVE${groups.length === 1 ? "" : "s"} on ${hosts} host${hosts === 1 ? "" : "s"}, ${fixText} · ${shown.join(" · ")}${more}`;
550
550
  }
551
551
 
552
552
  export function patchLine(closed: readonly VulnEvent[] | null, label = "Patches", maxShown = 3): string {
553
- if (!closed) return `${label} · the check failed`;
553
+ if (!closed) return `${label} · check failed`;
554
554
  if (closed.length === 0) return `${label} · none`;
555
555
  const byPackage = new Map<string, { agent: string; pkg: string; version: string; cves: VulnEvent[] }>();
556
556
  for (const e of closed) {
@@ -686,7 +686,7 @@ export function shortImageName(image: string): string {
686
686
 
687
687
  function buildText(build: ImageBuild | undefined): string {
688
688
  const built = build?.created ? `built ${new Intl.DateTimeFormat("en-GB", { timeZone: "UTC", day: "numeric", month: "short" }).format(new Date(build.created * 1000))}` : "build date unknown";
689
- return build?.newer ? `${built}, a newer build waits in the registry` : built;
689
+ return build?.newer ? `${built}, newer build in registry` : built;
690
690
  }
691
691
 
692
692
  /**
@@ -696,9 +696,9 @@ function buildText(build: ImageBuild | undefined): string {
696
696
  * A `maxWaiting` of 0 leaves the publisher group out: nobody here can act on it.
697
697
  */
698
698
  export function imageVulnLine(facts: ImageVulnFacts | null, offers: ReadonlyMap<string, ImageOffer>, arcaneChannelId?: string, maxWaiting = 5): string {
699
- if (!facts) return "Arcane images · the check failed";
699
+ if (!facts) return "Arcane images · check failed";
700
700
  if (facts.scanned === 0) return `Arcane images · no Trivy scan yet (${facts.total} images)`;
701
- if (facts.critical.length === 0) return `Arcane images · no critical CVE with a fix (${facts.scanned} of ${facts.total} images scanned)`;
701
+ if (facts.critical.length === 0) return `Arcane images · no fixable critical CVE (${facts.scanned} of ${facts.total} images scanned)`;
702
702
  const counts = new Map<string, number>();
703
703
  for (const v of facts.critical) counts.set(v.image, (counts.get(v.image) ?? 0) + 1);
704
704
  const images = [...counts.entries()].sort((x, y) => y[1] - x[1] || x[0].localeCompare(y[0]));
@@ -715,12 +715,12 @@ export function imageVulnLine(facts: ImageVulnFacts | null, offers: ReadonlyMap<
715
715
  else waiting.push(name);
716
716
  }
717
717
  const n = facts.critical.length;
718
- const parts = [`Arcane images · ${n} critical CVE${n === 1 ? "" : "s"} whose package has a fix, in ${images.length} image${images.length === 1 ? "" : "s"}`];
718
+ const parts = [`Arcane images · ${n} fixable critical CVE${n === 1 ? "" : "s"} in ${images.length} image${images.length === 1 ? "" : "s"}`];
719
719
  if (own.length > 0) parts.push(`ours to rebuild: ${own.join(", ")}`);
720
720
  if (offered.length > 0) parts.push(`update offered${arcaneChannelId ? ` in <#${arcaneChannelId}>` : " in the Arcane Daily Report"}: ${offered.join(", ")}`);
721
721
  if (held.length > 0) parts.push(`held: ${held.join(", ")}`);
722
722
  const rest = waiting.length - Math.min(waiting.length, maxWaiting);
723
- if (waiting.length > 0 && maxWaiting > 0) parts.push(`waiting on the publisher: ${[...waiting.slice(0, maxWaiting), ...(rest > 0 ? [`+${rest} more`] : [])].join(", ")}`);
723
+ if (waiting.length > 0 && maxWaiting > 0) parts.push(`waiting on publisher: ${[...waiting.slice(0, maxWaiting), ...(rest > 0 ? [`+${rest} more`] : [])].join(", ")}`);
724
724
  return parts.join(" · ");
725
725
  }
726
726
 
@@ -750,14 +750,14 @@ export function rebuildItems(facts: ImageVulnFacts | null): string[] {
750
750
  }
751
751
  const byCount = <T>(m: Map<string, T>, count: (t: T) => number) => [...m.entries()].sort((x, y) => count(y[1]) - count(x[1]) || x[0].localeCompare(y[0]));
752
752
  const items: string[] = [];
753
- if (os.size > 0) items.push(`rebuild ${byCount(os, (n) => n).map(([image, n]) => `${escapeDiscord(shortImageName(image))} (${n})`).join(", ")}: their base image packages have critical CVEs with a fixed version`);
753
+ if (os.size > 0) items.push(`rebuild ${byCount(os, (n) => n).map(([image, n]) => `${escapeDiscord(shortImageName(image))} (${n})`).join(", ")}: fixable critical CVEs in base image packages`);
754
754
  if (lang.size > 0) {
755
755
  const images = byCount(lang, (e) => e.n).map(([image, e]) => {
756
756
  const pkgs = [...e.pkgs].sort();
757
757
  const shown = pkgs.slice(0, MAX_PACKAGES).map(escapeDiscord).join(", ");
758
758
  return `${escapeDiscord(shortImageName(image))} (${e.n}: ${shown}${pkgs.length > MAX_PACKAGES ? ` +${pkgs.length - MAX_PACKAGES}` : ""})`;
759
759
  });
760
- items.push(`update dependencies of ${images.join(", ")} in their repositories: their language packages have critical CVEs with a fixed version`);
760
+ items.push(`update dependencies of ${images.join(", ")} in their repositories: fixable critical CVEs in language packages`);
761
761
  }
762
762
  return items;
763
763
  }
@@ -843,7 +843,7 @@ export function dailyNeeds(d: DailyData): string[] {
843
843
  if (d.wazuh.unexplained.length > 0) items.push(`${d.wazuh.unexplained.length} unexplained deployment change${d.wazuh.unexplained.length === 1 ? "" : "s"}; Investigate on the alert`);
844
844
  items.push(...unacknowledgedItems(d.wazuh, d.alerts, d.timeZone, d.guildId));
845
845
  const failed = failures(d);
846
- if (failed > 0) items.push(`${failed} check${failed === 1 ? "" : "s"} of this report failed; the bridge log on Cortex has the reason`);
846
+ if (failed > 0) items.push(`${failed} check${failed === 1 ? "" : "s"} failed; reason in the bridge log on Cortex`);
847
847
  return items;
848
848
  }
849
849
 
@@ -952,7 +952,7 @@ export function resticStatus(text: string): BackupFacts["restic"] {
952
952
  const STALE_BACKUP_S = 48 * 3600;
953
953
 
954
954
  export function backupLine(b: BackupFacts | null, now: number, timeZone: string): string {
955
- if (!b) return "Backups · the check failed";
955
+ if (!b) return "Backups · check failed";
956
956
  const stale = b.guests.filter((g) => now / 1000 - g.last > STALE_BACKUP_S);
957
957
  const newest = Math.max(...b.guests.map((g) => g.last));
958
958
  const proxmox =
@@ -966,7 +966,7 @@ export function backupLine(b: BackupFacts | null, now: number, timeZone: string)
966
966
  }
967
967
 
968
968
  export function patchingLine(p: PatchingFacts | null, closed: readonly VulnEvent[] | null, timeZone: string): string {
969
- if (!p) return "Patching · the check failed";
969
+ if (!p) return "Patching · check failed";
970
970
  const installs = p.installs.reduce((n, i) => n + i.count, 0);
971
971
  const cves = closed === null ? "" : ` · ${new Set(closed.map((c) => `${c.agent}|${c.cve}`)).size} CVEs closed`;
972
972
  const restarts = p.restarts.length === 0 ? "none" : p.restarts.map((r) => `${escapeDiscord(r.agent)} ${dayText(r.last, timeZone)}`).join(", ");
@@ -985,7 +985,7 @@ export function crlFromEvents(events: readonly WazuhEvent[], now: number): { day
985
985
 
986
986
  function crlText(crl: WeeklyData["crl"], timeZone: string): string {
987
987
  if (crl === "unknown") return "RADIUS CRL: unknown";
988
- if (crl === null) return "RADIUS CRL: no renewal warning (it warns 30 days ahead)";
988
+ if (crl === null) return "RADIUS CRL: no renewal warning (warns 30 days ahead)";
989
989
  return `RADIUS CRL: renew within ${crl.days} days (warned ${dayText(crl.warned, timeZone)})`;
990
990
  }
991
991
 
@@ -999,9 +999,9 @@ function unacknowledgedItems(wazuh: WazuhDigest, alerts: readonly PostedAlertRef
999
999
  const when = events.length > 1 ? ` × ${events.length}, last ${clockText(last.timestamp, timeZone)}` : `, ${clockText(last.timestamp, timeZone)}`;
1000
1000
  const posted = alerts.filter((a) => a.key === key).at(-1);
1001
1001
  const fact = `${what} on ${escapeDiscord(last.agent)}${when}`;
1002
- if (!posted) return `urgent alert never posted, so it has no Acknowledge button: ${fact}; check that it was expected`;
1002
+ if (!posted) return `urgent alert never posted (no Acknowledge button): ${fact}; check it was expected`;
1003
1003
  const where = guildId && posted.messageId ? `on [the alert](https://discord.com/channels/${guildId}/${posted.channelId}/${posted.messageId})` : `in <#${posted.channelId}>`;
1004
- return `urgent alert not acknowledged: ${fact}; Acknowledge it ${where}`;
1004
+ return `unacknowledged urgent alert: ${fact}; Acknowledge ${where}`;
1005
1005
  });
1006
1006
  }
1007
1007
 
@@ -1013,25 +1013,25 @@ export function needsYou(d: WeeklyData): string[] {
1013
1013
  for (const i of d.attention?.issues ?? []) items.push(escapeDiscord(i.message.replace(/\.$/, "")));
1014
1014
  if (d.wazuh.unexplained.length > 0) items.push(`${d.wazuh.unexplained.length} unexplained deployment change${d.wazuh.unexplained.length === 1 ? "" : "s"} this week; Investigate on the alert`);
1015
1015
  items.push(...unacknowledgedItems(d.wazuh, d.alerts, d.timeZone, d.guildId));
1016
- if (d.patching && d.patching.rebootPending.length > 0) items.push(`reboot ${d.patching.rebootPending.map(escapeDiscord).join(", ")} to load installed updates`);
1016
+ if (d.patching && d.patching.rebootPending.length > 0) items.push(`reboot ${d.patching.rebootPending.map(escapeDiscord).join(", ")} for installed updates`);
1017
1017
  const stuck = d.openWithFix.filter((v) => d.now - Date.parse(v.since) > 3 * DAY);
1018
1018
  const agents = (list: readonly ReportedVuln[]) => [...new Set(list.map((v) => v.agent))].map(escapeDiscord).join(", ");
1019
1019
  // Wazuh reports a Mac's own CVEs under the package `macOS`; only a macOS update closes them, never unattended-upgrades.
1020
1020
  const mac = stuck.filter((v) => v.package === MACOS_PACKAGE);
1021
1021
  const linux = stuck.filter((v) => v.package !== MACOS_PACKAGE);
1022
- if (linux.length > 0) items.push(`${linux.length} CVE${linux.length === 1 ? "" : "s"} with a fixed version still open after 3 days (${agents(linux)}); unattended-upgrades may be stuck`);
1023
- if (mac.length > 0) items.push(`${mac.length} macOS CVE${mac.length === 1 ? "" : "s"} open after 3 days on ${agents(mac)}: install the waiting macOS update`);
1022
+ if (linux.length > 0) items.push(`${linux.length} fixable CVE${linux.length === 1 ? "" : "s"} open over 3 days (${agents(linux)}); unattended-upgrades may be stuck`);
1023
+ if (mac.length > 0) items.push(`${mac.length} macOS CVE${mac.length === 1 ? "" : "s"} open over 3 days on ${agents(mac)}: install the waiting macOS update`);
1024
1024
  const offered = offeredImages(d.images, d.offers);
1025
- if (offered.length > 0) items.push(`update ${offered.map(escapeDiscord).join(", ")} in the Arcane Daily Report: the newer image replaces one with a critical CVE`);
1025
+ if (offered.length > 0) items.push(`update ${offered.map(escapeDiscord).join(", ")} in the Arcane Daily Report: replaces an image with a critical CVE`);
1026
1026
  items.push(...rebuildItems(d.images));
1027
- if (d.crl !== null && d.crl !== "unknown") items.push(`renew the RADIUS CRL (wifi-device.sh renew-crl), ${d.crl.days} days left`);
1027
+ if (d.crl !== null && d.crl !== "unknown") items.push(`renew the RADIUS CRL (\`wifi-device.sh renew-crl\`), ${d.crl.days} days left`);
1028
1028
  if (d.backups) {
1029
1029
  const stale = d.backups.guests.filter((g) => d.now / 1000 - g.last > STALE_BACKUP_S);
1030
1030
  if (stale.length > 0) items.push(`no Proxmox backup within 48 h for ${stale.map((g) => escapeDiscord(g.name)).join(", ")}`);
1031
- if (d.backups.restic && d.backups.restic.result !== "success") items.push(`the restic check ended with ${escapeDiscord(d.backups.restic.result)}`);
1031
+ if (d.backups.restic && d.backups.restic.result !== "success") items.push(`restic check ended with ${escapeDiscord(d.backups.restic.result)}`);
1032
1032
  }
1033
1033
  const failed = [d.crowdsec === null, d.wazuh.failed, d.found === null, d.patching === null, d.attention === null, d.backups === null, d.images === null].filter(Boolean).length;
1034
- if (failed > 0) items.push(`${failed} check${failed === 1 ? "" : "s"} of this report failed; the bridge log on Cortex has the reason`);
1034
+ if (failed > 0) items.push(`${failed} check${failed === 1 ? "" : "s"} failed; reason in the bridge log on Cortex`);
1035
1035
  return items;
1036
1036
  }
1037
1037
 
@@ -1054,7 +1054,7 @@ export function weeklyCard(d: WeeklyData, owners: readonly string[]): ReportCard
1054
1054
  const sections = [
1055
1055
  section("🚫", crowdsecWeeklyLine(d.crowdsec, d.previousBans)),
1056
1056
  section("👁️", d.wazuh.line),
1057
- section("📦", `Host packages · ${found} · ${closed} · ${fixable} open with a fixed version${tracking}`),
1057
+ section("📦", `Host packages · ${found} · ${closed} · ${fixable} open with a fix${tracking}`),
1058
1058
  section("🩹", patchingLine(d.patching, d.closed, d.timeZone)),
1059
1059
  section("🐳", imageVulnLine(d.images, d.offers, d.arcaneChannelId)),
1060
1060
  section("🩺", `${healthLine(d.attention)} · ${crlText(d.crl, d.timeZone)}`),
@@ -26,7 +26,7 @@ describe("supervision", () => {
26
26
  it("tags the owners and hands the foreman a read-only task with the evidence to collect", () => {
27
27
  const applied = { stack: "media", finishedAt: Date.parse("2026-10-24T03:05:00Z"), detail: "updated: sonarr 4.0.21", commit: "abc1234" };
28
28
  expect(autoFailureText(applied, ["sonarr unhealthy"], "Rolled back to the previous Compose file.", ["178096425509453824"])).toBe(
29
- "⚠️ **Automatic update failed its check** · media · updated: sonarr 4.0.21\nChecked again after the update: sonarr unhealthy.\nRolled back to the previous Compose file.\nThe foreman investigates in the thread and changes nothing.\n<@178096425509453824>",
29
+ "⚠️ **Automatic update failed its check** · media · updated: sonarr 4.0.21\nRecheck found: sonarr unhealthy.\nRolled back to the previous Compose file.\nThe foreman investigates read-only in the thread.\n<@178096425509453824>",
30
30
  );
31
31
  const task = foremanTask(applied, ["sonarr unhealthy"], "rolled back", Date.parse("2026-10-24T03:10:00Z"));
32
32
  expect(task).toContain("host container-logs <name> 2026-10-24T02:35:00.000Z 2026-10-24T03:10:00.000Z");
@@ -41,9 +41,9 @@ export function stackProblems(snapshot: readonly WatchedContainer[], stack: stri
41
41
  export function autoFailureText(applied: Applied, problems: readonly string[], rollback: string, owners: readonly string[]): string {
42
42
  return [
43
43
  `⚠️ **Automatic update failed its check** · ${escapeDiscord(applied.stack)} · ${escapeDiscord(applied.detail)}`,
44
- `Checked again after the update: ${problems.map(escapeDiscord).join(", ")}.`,
44
+ `Recheck found: ${problems.map(escapeDiscord).join(", ")}.`,
45
45
  rollback,
46
- "The foreman investigates in the thread and changes nothing.",
46
+ "The foreman investigates read-only in the thread.",
47
47
  owners.map((id) => `<@${id}>`).join(" "),
48
48
  ].join("\n");
49
49
  }
@@ -129,7 +129,7 @@ describe("casks whose installer needs a password", () => {
129
129
  const chrome = lines.find((l) => l.key === "cask:google-chrome");
130
130
  expect(temurin?.manual).toContain("brew upgrade --cask temurin@17");
131
131
  expect(chrome?.manual).toBeUndefined();
132
- expect(lineText(temurin as ToolLine)).toContain("asks for your password");
132
+ expect(lineText(temurin as ToolLine)).toContain("needs your password");
133
133
  expect(brewHasOutdated(outdated)).toBe(false);
134
134
  });
135
135
  });
@@ -292,13 +292,13 @@ describe("report layout", () => {
292
292
  const report = sampleReport([], false);
293
293
  const pages = layoutMessages(report);
294
294
  expect(pages).toEqual([{ keys: [], head: true, all: false }]);
295
- expect(messageComponents(report, pages[0])).toEqual([{ type: 10, content: "**Cortex Tools Report:** everything is up to date (checked 06:00 CEST)." }]);
295
+ expect(messageComponents(report, pages[0])).toEqual([{ type: 10, content: "**Cortex Tools Report:** all up to date (checked 06:00 CEST)." }]);
296
296
  });
297
297
 
298
298
  it("shows the review, a major change, and each button state", () => {
299
299
  const [pi] = buildLines(COLLECTED);
300
300
  pi.review = { verdict: "breaking", reason: "Removes the `--tools` flag in favor of `--allow`" };
301
- expect(lineText(pi)).toBe("**Pi** 0.87.1 → 1.3.0 · major version\n-# 🔴 breaking: Removes the \\`--tools\\` flag in favor of \\`--allow\\`");
301
+ expect(lineText(pi)).toBe("**Pi** 0.87.1 → 1.3.0 · major\n-# 🔴 breaking: Removes the \\`--tools\\` flag in favor of \\`--allow\\`");
302
302
  const report = sampleReport([pi]);
303
303
  const page = layoutMessages(report)[0];
304
304
  const button = () => messageComponents(report, page)[1].accessory;
@@ -322,7 +322,7 @@ describe("report layout", () => {
322
322
  const components = messageComponents(report, page);
323
323
  expect(components[2].accessory).toMatchObject({ label: "Automatic", disabled: true });
324
324
  expect(components[0].content).toContain("\n-# 1 update applies automatically; Pi waits for its button.");
325
- expect(components[0].content).toContain("\n<@178096425509453824> 1 update needs you: Pi (major version)");
325
+ expect(components[0].content).toContain("\n<@178096425509453824> 1 update needs you: Pi (major)");
326
326
  pi.plan = "button";
327
327
  expect(messageComponents(report, page)[0].content).not.toContain("<@");
328
328
  jq.state = "running";
@@ -382,13 +382,13 @@ describe("release-notes review", () => {
382
382
 
383
383
  it("says why there is nothing to review", async () => {
384
384
  const gcloud = buildLines(COLLECTED).find((l) => l.key === "spc:gcloud") as ToolLine;
385
- expect(await notesFor(gcloud, fetch)).toEqual({ notes: null, reason: "no release notes to review here; see https://cloud.google.com/sdk/docs/release-notes" });
385
+ expect(await notesFor(gcloud, fetch)).toEqual({ notes: null, reason: "no release notes here; see https://cloud.google.com/sdk/docs/release-notes" });
386
386
  const trendarr: ToolLine = { key: "spc:trendarr", label: "trendarr", installed: "0.6.0", latest: "0.7.0", major: false, action: { kind: "installer", component: "trendarr" }, state: "offered" };
387
387
  const notFound = vi.fn(async () => new Response("{}", { status: 404 })) as unknown as typeof fetch;
388
388
  expect(await notesFor(trendarr, notFound)).toMatchObject({ notes: null, reason: expect.stringMatching(/release notes unavailable: GitHub answered 404/) });
389
389
  const empty = vi.fn(async () => new Response("[]")) as unknown as typeof fetch;
390
390
  const herdr = buildLines(COLLECTED).find((l) => l.key === "brew:herdr") as ToolLine;
391
- expect(await notesFor(herdr, empty)).toEqual({ notes: null, reason: "GitHub lists no release between the two versions" });
391
+ expect(await notesFor(herdr, empty)).toEqual({ notes: null, reason: "no GitHub release between the versions" });
392
392
  expect(await notesFor(buildLines(COLLECTED).find((l) => l.key === "brew:gh") as ToolLine, empty)).toEqual({ notes: null, reason: "not reviewed" });
393
393
  });
394
394
 
@@ -252,7 +252,7 @@ export function buildLines(c: Collected): ToolLine[] {
252
252
  for (const k of casks.sort((a, b) => a.name.localeCompare(b.name))) {
253
253
  if (k.pinned) continue;
254
254
  const l = line(`cask:${k.name}`, k.name, k.installed, k.latest, { kind: "cask", token: k.name });
255
- if (packages.has(k.name)) l.manual = `its installer asks for your password; on Cortex: brew upgrade --cask ${k.name}`;
255
+ if (packages.has(k.name)) l.manual = `installer needs your password; on Cortex: brew upgrade --cask ${k.name}`;
256
256
  lines.push(l);
257
257
  }
258
258
  return lines;
@@ -394,7 +394,7 @@ export async function collectTools(options: CollectOptions): Promise<Collected>
394
394
  try {
395
395
  const res = await options.fetchImpl("https://nodejs.org/dist/index.json", { signal: AbortSignal.timeout(30_000) });
396
396
  nodeLts = res.ok ? latestLts(await res.json()) : null;
397
- if (!nodeLts) warnings.push(`nodejs.org index answered ${res.status} without an LTS release`);
397
+ if (!nodeLts) warnings.push(`nodejs.org index answered ${res.status}, no LTS release`);
398
398
  } catch (err) {
399
399
  warnings.push(`nodejs.org index failed: ${err instanceof Error ? err.message : String(err)}`);
400
400
  }
@@ -414,13 +414,13 @@ export async function collectTools(options: CollectOptions): Promise<Collected>
414
414
  // Only for tools the installer manages; the first install of each is a manual step.
415
415
  const python = installedComponent(installer, "python");
416
416
  const pythonLatest = python ? pythonBuild(await fetchJson("https://api.github.com/repos/astral-sh/python-build-standalone/releases/latest", "python-build-standalone"), python.split(".").slice(0, 2).join(".")) : null;
417
- const gcloudLatest = installedComponent(installer, "gcloud") ? gcloudRelease(await fetchJson("https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json", "the gcloud release snapshot")) : null;
417
+ const gcloudLatest = installedComponent(installer, "gcloud") ? gcloudRelease(await fetchJson("https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json", "gcloud release snapshot")) : null;
418
418
  const bwLatest = installedComponent(installer, "bw") ? bwRelease(await fetchJson("https://api.github.com/repos/bitwarden/clients/releases?per_page=30", "bitwarden/clients releases")) : null;
419
419
  const jqLatest = installedComponent(installer, "jq") ? jqRelease(await fetchJson("https://api.github.com/repos/jqlang/jq/releases/latest", "jqlang/jq releases")) : null;
420
420
  let arcaneServer: string | null = null;
421
421
  try {
422
422
  arcaneServer = await options.arcaneServer();
423
- if (!arcaneServer) warnings.push("the Arcane server reported no version");
423
+ if (!arcaneServer) warnings.push("Arcane server reported no version");
424
424
  } catch (err) {
425
425
  warnings.push(`Arcane server version failed: ${firstLine(err instanceof Error ? err.message : String(err))}`);
426
426
  }
@@ -505,7 +505,7 @@ export type NotesResult = { notes: ReleaseNote[]; omitted: string[] } | { notes:
505
505
  export async function notesFor(line: ToolLine, fetchImpl: typeof fetch): Promise<NotesResult> {
506
506
  const source = REVIEW_SOURCES[line.key];
507
507
  if (!source) return { notes: null, reason: "not reviewed" };
508
- if (!source.repo) return { notes: null, reason: `no release notes to review here; see ${source.notesUrl ?? "the vendor's site"}` };
508
+ if (!source.repo) return { notes: null, reason: `no release notes here; see ${source.notesUrl ?? "the vendor's site"}` };
509
509
  let releases: GithubRelease[];
510
510
  try {
511
511
  releases = withoutPrefix(await fetchReleases(source.repo, fetchImpl), source.tagPrefix);
@@ -513,7 +513,7 @@ export async function notesFor(line: ToolLine, fetchImpl: typeof fetch): Promise
513
513
  return { notes: null, reason: `release notes unavailable: ${err instanceof Error ? err.message : String(err)}` };
514
514
  }
515
515
  const between = releasesBetween(releases, line.installed, line.latest);
516
- if (between.length === 0) return { notes: null, reason: "GitHub lists no release between the two versions" };
516
+ if (between.length === 0) return { notes: null, reason: "no GitHub release between the versions" };
517
517
  return capTotal(between);
518
518
  }
519
519
 
@@ -673,7 +673,7 @@ function stateButton(state: LineState, customId: string, offeredLabel: string):
673
673
  const VERDICT_MARK: Record<Verdict, string> = { none: "🟢 nothing relevant", check: "🟡 check", breaking: "🔴 breaking" };
674
674
 
675
675
  export function lineText(l: ToolLine): string {
676
- const head = `**${escapeDiscord(l.label)}** ${escapeDiscord(l.installed)} → ${escapeDiscord(l.latest)}${l.major ? " · major version" : ""}`;
676
+ const head = `**${escapeDiscord(l.label)}** ${escapeDiscord(l.installed)} → ${escapeDiscord(l.latest)}${l.major ? " · major" : ""}`;
677
677
  const notes = l.review ? `\n-# ${l.review.verdict ? `${VERDICT_MARK[l.review.verdict]}: ` : "notes: "}${escapeDiscord(l.review.reason)}` : "";
678
678
  const detail = l.detail ? `\n-# ${escapeDiscord(l.detail)}` : "";
679
679
  const manual = l.manual ? `\n-# ${escapeDiscord(l.manual)}` : "";
@@ -688,13 +688,13 @@ function lineSection(l: ToolLine): MessageComponent {
688
688
  ? l.plan === "auto" && l.state === "offered"
689
689
  ? { type: 2, style: SECONDARY, label: "Automatic", custom_id: id, disabled: true }
690
690
  : stateButton(l.state, id, "Update")
691
- : { type: 2, style: SECONDARY, label: "Update by hand", custom_id: `tools:none:${l.key}`.slice(0, CUSTOM_ID_MAX), disabled: true };
691
+ : { type: 2, style: SECONDARY, label: "By hand", custom_id: `tools:none:${l.key}`.slice(0, CUSTOM_ID_MAX), disabled: true };
692
692
  return { type: 9, components: [{ type: 10, content: lineText(l) }], accessory };
693
693
  }
694
694
 
695
695
  function allSection(report: ToolsReport): MessageComponent {
696
696
  const detail = report.brewAllDetail ? `\n-# ${escapeDiscord(report.brewAllDetail)}` : "";
697
- return { type: 9, components: [{ type: 10, content: `**Homebrew**: upgrade every outdated formula, dependencies included${detail}` }], accessory: stateButton(report.brewAll, allId(report.date), "Upgrade everything") };
697
+ return { type: 9, components: [{ type: 10, content: `**Homebrew**: upgrade all outdated formulae, dependencies included${detail}` }], accessory: stateButton(report.brewAll, allId(report.date), "Upgrade everything") };
698
698
  }
699
699
 
700
700
  function clock(iso: string, timeZone: string): string {
@@ -705,7 +705,7 @@ function headText(report: ToolsReport): MessageComponent {
705
705
  const when = `checked ${clock(report.checkedAt, report.timeZone)}`;
706
706
  const head =
707
707
  report.lines.length === 0 && !report.brewOutdated
708
- ? `**${TOOLS_PREFIX}** everything is up to date (${when}).`
708
+ ? `**${TOOLS_PREFIX}** all up to date (${when}).`
709
709
  : `**${TOOLS_PREFIX}** ${report.lines.length} update${report.lines.length === 1 ? "" : "s"} (${when}).`;
710
710
  const warnings = report.warnings.length > 0 ? `\n-# ⚠️ ${escapeDiscord(report.warnings.join(" · ")).slice(0, 800)}` : "";
711
711
  const automatic = report.lines.filter((l) => l.plan === "auto").length;
@@ -713,7 +713,7 @@ function headText(report: ToolsReport): MessageComponent {
713
713
  const attention = report.lines.filter((l) => l.plan === "update");
714
714
  const needs =
715
715
  attention.length > 0 && report.mention && report.mention.length > 0
716
- ? `\n${report.mention.map((id) => `<@${id}>`).join(" ")} ${attention.length} update${attention.length === 1 ? " needs" : "s need"} you: ${attention.map((l) => `${escapeDiscord(l.label)}${l.major ? " (major version)" : " (release notes)"}`).join(", ")}`
716
+ ? `\n${report.mention.map((id) => `<@${id}>`).join(" ")} ${attention.length} update${attention.length === 1 ? " needs" : "s need"} you: ${attention.map((l) => `${escapeDiscord(l.label)}${l.major ? " (major)" : " (release notes)"}`).join(", ")}`
717
717
  : "";
718
718
  return { type: 10, content: `${head}${warnings}${plan}${needs}` };
719
719
  }
@@ -779,5 +779,5 @@ export function writePostedReport(report: ToolsReport): void {
779
779
  }
780
780
 
781
781
  export function failureText(): string {
782
- return `${TOOLS_PREFIX} the version check failed today, so there is no update list. The bridge log on Cortex has the reason.`;
782
+ return `${TOOLS_PREFIX} version check failed, no update list today. Reason in the bridge log on Cortex.`;
783
783
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrofoundry/pi-astro",
3
- "version": "0.40.75",
3
+ "version": "0.40.77",
4
4
  "description": "Personal pi customizations (extensions, subagents, skills, prompts, themes) for the pi coding agent.",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -63,7 +63,7 @@ Fixed operations on each node's host through one forced-command SSH key (`spc-dn
63
63
  |---|---|
64
64
  | `status` | `dns` service state, start time, restart count, uptime, memory, root disk |
65
65
  | `journal <since>` | the `dns` service journal since, e.g. `2 hours ago` |
66
- | `updates` | upgradable OS packages |
66
+ | `updates` | upgradable OS packages, then `new:` and `remove:` lines: what `apt-get full-upgrade` would add or remove. Such lines mean packages are kept back; the nightly run never installs them, and no specialist can: say so and give the host and the command |
67
67
  | `restart` | restart Technitium and print its state |
68
68
  | `upgrade` | run the official installer (`download.technitium.com/dns/install.sh`), which upgrades Technitium and its ASP.NET runtime in place; up to 10 minutes |
69
69
 
@@ -43,7 +43,7 @@ Power actions and snapshot changes return `{ upid, exitstatus }`; `OK` means don
43
43
  | `updates` | upgradable host packages |
44
44
  | `host-upgrade` | apt full-upgrade of the host (risky, needs approval); a new Proxmox VE major is held and printed as `held:`; ends with `reboot-needed:`. The morning run does this on its own each day |
45
45
  | `host-reboot --confirm` | reboot the host in one minute (risky): every guest on it restarts. Only on the owner's explicit request; the morning run offers a Reboot button instead |
46
- | `guest-exec <vmid> <status|journal|df|updates>` | fixed read inside a guest: failed units and uptime, warning journal of 24 h, disk usage, upgradable packages |
46
+ | `guest-exec <vmid> <status|journal|df|updates>` | fixed read inside a guest: failed units and uptime, warning journal of 24 h, disk usage, upgradable packages (`updates` adds `new:` and `remove:` lines when packages are kept back: what `apt-get full-upgrade` would add or remove; the nightly run never installs them, and no specialist can: say so and give the guest and the command) |
47
47
  | `nightly [days]` | start, end, duration (UTC) and result of each nightly job of the last 1..14 days (default 7): vzdump tasks from the API, then from the journals of the host and every running guest the host timers, `apt-daily-upgrade`, the backup and dump timers, and Docker restarts. Answer questions about nightly run times with it |
48
48
 
49
49
  ## Guest change procedure
@@ -26,7 +26,8 @@ case "$name" in
26
26
  journal)
27
27
  printf '%s' "$rest" | grep -Eq '^[A-Za-z0-9 :+-]{1,40}$' || { echo "bad since" >&2; exit 2; }
28
28
  run journalctl -u dns --since "$rest" --no-pager -n 200 ;;
29
- updates) run sh -c 'apt list --upgradable 2>/dev/null' ;;
29
+ # updates: the dry run of a full upgrade names the new packages and removals that keep packages back; the nightly run never installs those.
30
+ updates) run sh -c 'apt list --upgradable 2>/dev/null; apt-get -s -o Debug::NoLocking=1 full-upgrade 2>/dev/null | sed -n -e "s/^Inst \([^ ]*\) (.*/new: \1/p" -e "s/^Remv \([^ ]*\) .*/remove: \1/p"' ;;
30
31
  restart) run sh -c 'systemctl restart dns && sleep 3 && systemctl is-active dns' ;;
31
32
  # The installer's exit code decides the result; its last 20 lines are shown either way.
32
33
  upgrade) run sh -c 'f=$(mktemp) && curl -fsSL https://download.technitium.com/dns/install.sh -o "$f" || exit 1; rc=0; bash "$f" >"$f.log" 2>&1 || rc=$?; tail -20 "$f.log"; rm -f "$f" "$f.log"; [ "$rc" -eq 0 ] || { echo "installer exited $rc" >&2; exit "$rc"; }; sleep 5; systemctl is-active dns' ;;
@@ -25,12 +25,13 @@ reboot_needed() {
25
25
  fi
26
26
  }
27
27
 
28
+ # updates: the dry run of a full upgrade names the new packages and removals that keep packages back; the nightly run never installs those.
28
29
  guest_cmd() {
29
30
  case "$1" in
30
31
  status) echo 'systemctl --failed --no-pager; uptime' ;;
31
32
  journal) echo 'journalctl -p warning --since "24 hours ago" --no-pager -n 100' ;;
32
33
  df) echo 'df -h -x tmpfs -x devtmpfs' ;;
33
- updates) echo 'apt list --upgradable 2>/dev/null' ;;
34
+ updates) echo 'apt list --upgradable 2>/dev/null; apt-get -s -o Debug::NoLocking=1 full-upgrade 2>/dev/null | sed -n -e "s/^Inst \([^ ]*\) (.*/new: \1/p" -e "s/^Remv \([^ ]*\) .*/remove: \1/p"' ;;
34
35
  *) return 1 ;;
35
36
  esac
36
37
  }
@@ -25,12 +25,13 @@ reboot_needed() {
25
25
  fi
26
26
  }
27
27
 
28
+ # updates: the dry run of a full upgrade names the new packages and removals that keep packages back; the nightly run never installs those.
28
29
  guest_cmd() {
29
30
  case "$1" in
30
31
  status) echo 'systemctl --failed --no-pager; uptime' ;;
31
32
  journal) echo 'journalctl -p warning --since "24 hours ago" --no-pager -n 100' ;;
32
33
  df) echo 'df -h -x tmpfs -x devtmpfs' ;;
33
- updates) echo 'apt list --upgradable 2>/dev/null' ;;
34
+ updates) echo 'apt list --upgradable 2>/dev/null; apt-get -s -o Debug::NoLocking=1 full-upgrade 2>/dev/null | sed -n -e "s/^Inst \([^ ]*\) (.*/new: \1/p" -e "s/^Remv \([^ ]*\) .*/remove: \1/p"' ;;
34
35
  *) return 1 ;;
35
36
  esac
36
37
  }