@astrofoundry/pi-astro 0.40.64 → 0.40.66

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.
@@ -479,7 +479,7 @@ export class SecurityMonitor {
479
479
  const state = readSecurityState();
480
480
  const wazuh = wazuhDigest(events, state.origins, (e) => acked(state, e));
481
481
  if (this.deps.stopping()) return;
482
- const data = { until: clockText(new Date(now).toISOString(), s.timeZone).replace(/^\d+ \w+ /, ""), timeZone: s.timeZone, crowdsec, wazuh, found: vulns?.found ?? null, closed: vulns?.closed ?? null, attention, ...images, alerts: state.alerts };
482
+ const data = { until: clockText(new Date(now).toISOString(), s.timeZone).replace(/^\d+ \w+ /, ""), timeZone: s.timeZone, crowdsec, wazuh, found: vulns?.found ?? null, closed: vulns?.closed ?? null, attention, ...images, alerts: state.alerts, guildId: this.deps.config().guildId };
483
483
  writeReportState("security", { date, status: "sending" });
484
484
  const report = dailyCard(data, this.owners());
485
485
  const id = await this.postReport(s.channelId, report);
@@ -529,6 +529,7 @@ export class SecurityMonitor {
529
529
  backups: archives ? { guests: archives, restic: resticText === null ? null : resticStatus(resticText) } : null,
530
530
  ...images,
531
531
  alerts: state.alerts,
532
+ guildId: this.deps.config().guildId,
532
533
  last24h: {
533
534
  bans: lastDay?.count ?? null,
534
535
  wazuh: lastDayEvents?.length ?? null,
@@ -47,6 +47,7 @@ import {
47
47
  needsYou,
48
48
  noteNas,
49
49
  repeatText,
50
+ rebuildItems,
50
51
  resticStatus,
51
52
  section,
52
53
  type VulnEvent,
@@ -401,7 +402,8 @@ describe("Arcane image scans", () => {
401
402
 
402
403
  it("keeps critical findings that have a fix and are not ignored", () => {
403
404
  const facts = parseImageVulns({ totalImages: 57, scannedImages: 3 }, { data: [item(), item({ vulnerabilityId: "CVE-2", ignored: true }), item({ vulnerabilityId: "CVE-3", fixedVersion: "" }), { nonsense: true }] });
404
- expect(facts).toEqual({ scanned: 3, total: 57, critical: [{ id: "CVE-2026-1", pkg: "openssl", image: "ghcr.io/mealie-recipes/mealie:latest" }] });
405
+ expect(facts).toEqual({ scanned: 3, total: 57, critical: [{ id: "CVE-2026-1", pkg: "openssl", image: "ghcr.io/mealie-recipes/mealie:latest", os: false }] });
406
+ expect(parseImageVulns({ totalImages: 1, scannedImages: 1 }, { data: [item({ class: "os-pkgs" }), item({ vulnerabilityId: "CVE-4", class: "lang-pkgs" })] })?.critical.map((v) => v.os)).toEqual([true, false]);
405
407
  expect(parseImageVulns({ totalImages: 57 }, { data: [] })).toBeNull();
406
408
  expect(parseImageVulns({ totalImages: 1, scannedImages: 1 }, {})).toBeNull();
407
409
  });
@@ -420,11 +422,11 @@ describe("Arcane image scans", () => {
420
422
  scanned: 57,
421
423
  total: 57,
422
424
  critical: [
423
- { id: "CVE-1", pkg: "openssl", image: "ghcr.io/mealie-recipes/mealie:latest" },
424
- { id: "CVE-2", pkg: "zlib", image: "ghcr.io/mealie-recipes/mealie:latest" },
425
- { id: "CVE-3", pkg: "glibc", image: "ghcr.io/mealie-recipes/mealie:latest" },
426
- { id: "CVE-4", pkg: "libpq", image: "supabase/postgres:15.8.1.085" },
427
- { id: "CVE-5", pkg: "curl", image: "nginx:latest" },
425
+ { id: "CVE-1", pkg: "openssl", image: "ghcr.io/mealie-recipes/mealie:latest", os: true },
426
+ { id: "CVE-2", pkg: "zlib", image: "ghcr.io/mealie-recipes/mealie:latest", os: true },
427
+ { id: "CVE-3", pkg: "glibc", image: "ghcr.io/mealie-recipes/mealie:latest", os: true },
428
+ { id: "CVE-4", pkg: "libpq", image: "supabase/postgres:15.8.1.085", os: true },
429
+ { id: "CVE-5", pkg: "curl", image: "nginx:latest", os: true },
428
430
  ],
429
431
  };
430
432
  expect(imageVulnLine(facts, offers, "1549873938140499999")).toBe(
@@ -454,12 +456,12 @@ describe("Arcane image scans", () => {
454
456
  scanned: 20,
455
457
  total: 57,
456
458
  critical: [
457
- { id: "CVE-1", pkg: "glib", image: "ghcr.io/astronaute77/arcane-graphile-worker:latest" },
458
- { id: "CVE-2", pkg: "glib", image: "ghcr.io/astronaute77/arcane-graphile-worker:latest" },
459
- { id: "CVE-3", pkg: "zlib", image: "ghcr.io/monadeo/grimoire-server:v0.27.57@sha256:a86042bb83d85203283135f6f2762c85161a0d2458d9a5378e1a59174b946147" },
460
- { id: "CVE-4", pkg: "openssl", image: "ghcr.io/astrofoundry/bigcapital-redis:astrofoundry" },
461
- { id: "CVE-5", pkg: "pyjwt", image: "unclecode/crawl4ai:latest" },
462
- { id: "CVE-6", pkg: "openssl", image: "ghcr.io/hotio/lidarr:pr-plugins" },
459
+ { id: "CVE-1", pkg: "glib", image: "ghcr.io/astronaute77/arcane-graphile-worker:latest", os: true },
460
+ { id: "CVE-2", pkg: "glib", image: "ghcr.io/astronaute77/arcane-graphile-worker:latest", os: true },
461
+ { id: "CVE-3", pkg: "zlib", image: "ghcr.io/monadeo/grimoire-server:v0.27.57@sha256:a86042bb83d85203283135f6f2762c85161a0d2458d9a5378e1a59174b946147", os: true },
462
+ { id: "CVE-4", pkg: "openssl", image: "ghcr.io/astrofoundry/bigcapital-redis:astrofoundry", os: true },
463
+ { id: "CVE-5", pkg: "pyjwt", image: "unclecode/crawl4ai:latest", os: true },
464
+ { id: "CVE-6", pkg: "openssl", image: "ghcr.io/hotio/lidarr:pr-plugins", os: true },
463
465
  ],
464
466
  builds,
465
467
  };
@@ -531,16 +533,16 @@ describe("daily report", () => {
531
533
  expect(wazuh.open.map((e) => e.id)).toEqual(["o1"]);
532
534
  const builds = new Map([["ghcr.io/astrofoundry/app:1", { created: 1, newer: false }], ["ghcr.io/astrofoundry/web:1", { created: 1, newer: true }]]);
533
535
  const critical = [
534
- { id: "CVE-1", pkg: "a", image: "ghcr.io/astrofoundry/app:1" },
535
- { id: "CVE-2", pkg: "b", image: "ghcr.io/astrofoundry/app:1" },
536
- { id: "CVE-3", pkg: "c", image: "ghcr.io/astrofoundry/web:1" },
537
- { id: "CVE-4", pkg: "d", image: "docker.io/library/redis:7" },
536
+ { id: "CVE-1", pkg: "a", image: "ghcr.io/astrofoundry/app:1", os: true },
537
+ { id: "CVE-2", pkg: "b", image: "ghcr.io/astrofoundry/app:1", os: true },
538
+ { id: "CVE-3", pkg: "c", image: "ghcr.io/astrofoundry/web:1", os: true },
539
+ { id: "CVE-4", pkg: "d", image: "docker.io/library/redis:7", os: true },
538
540
  ];
539
541
  const data = { until: "06:00 CEST", timeZone: TZ, crowdsec: summary(), wazuh, found: [], closed: [], attention, images: { scanned: 57, total: 57, critical, builds }, offers: new Map(), alerts: [{ key: alertKey(oom), channelId: "c9" }] };
540
- expect(dailyNeeds(data)).toEqual([
541
- "urgent alert not acknowledged: System running out of memory. Availability of the system is in risk on space-x, 20 Oct 08:24 CEST; Acknowledge it in <#c9>",
542
- "rebuild app:1 (2): our images carry critical CVEs that have a fixed version",
543
- ]);
542
+ expect(dailyNeeds(data)).toEqual(["urgent alert not acknowledged: System running out of memory. Availability of the system is in risk on space-x, 20 Oct 08:24 CEST; Acknowledge it in <#c9>"]);
543
+ const linked = { ...data, guildId: "g1", alerts: [{ key: alertKey(oom), channelId: "c9", messageId: "m1" }, { key: alertKey(oom), channelId: "c9", messageId: "m2" }] };
544
+ expect(dailyNeeds(linked)).toEqual(["urgent alert not acknowledged: System running out of memory. Availability of the system is in risk on space-x, 20 Oct 08:24 CEST; Acknowledge it on [the alert](https://discord.com/channels/g1/c9/m2)"]);
545
+ expect(rebuildItems(data.images)).toEqual(["rebuild app:1 (2): their base image packages have critical CVEs with a fixed version"]);
544
546
  expect(dailyCard(data, [OWNER]).components[0].accent_color).toBe(0xe67e22);
545
547
  });
546
548
  });
@@ -603,11 +605,33 @@ describe("weekly report", () => {
603
605
  expect(shown.join("\n")).toContain("- RADIUS CRL: renew within 23 days (warned 19 Oct)");
604
606
  expect(out.components.at(-1)).toEqual({ type: 10, content: `<@${OWNER}>` });
605
607
  const offers = imageOffers([{ stack: "mealie", lines: [{ ref: "ghcr.io/mealie-recipes/mealie:latest" }], actionable: true, state: "offered" }]);
606
- const withImages = weeklyCard({ ...base, offers, images: { scanned: 57, total: 57, critical: [{ id: "CVE-9", pkg: "openssl", image: "ghcr.io/mealie-recipes/mealie:1" }] } }, [OWNER]);
608
+ const withImages = weeklyCard({ ...base, offers, images: { scanned: 57, total: 57, critical: [{ id: "CVE-9", pkg: "openssl", image: "ghcr.io/mealie-recipes/mealie:1", os: true }] } }, [OWNER]);
607
609
  expect(texts(withImages.components)[1]).toBe("### Needs you\n1. update mealie in the Arcane Daily Report: the newer image replaces one with a critical CVE");
608
610
  expect(needsYou({ ...base, images: null })).toEqual(["1 check of this report failed; the bridge log on Cortex has the reason"]);
609
611
  });
610
612
 
613
+ it("tells base-image rebuilds from dependency updates, and Mac CVEs from stuck unattended-upgrades", () => {
614
+ const own = (id: string, pkg: string, image: string, os: boolean) => ({ id, pkg, image, os });
615
+ const critical = [
616
+ own("CVE-1", "brotli-libs", "ghcr.io/astrofoundry/webapp:1", true),
617
+ own("CVE-2", "tar", "ghcr.io/astrofoundry/server:1", false),
618
+ own("CVE-3", "handlebars", "ghcr.io/astrofoundry/server:1", false),
619
+ own("CVE-4", "handlebars", "ghcr.io/astrofoundry/server:1", false),
620
+ own("CVE-5", "vitest", "ghcr.io/astrofoundry/server:1", false),
621
+ own("CVE-6", "form-data", "ghcr.io/astrofoundry/server:1", false),
622
+ own("CVE-7", "proxy-addr", "ghcr.io/astrofoundry/server:1", false),
623
+ own("CVE-8", "certifi", "ghcr.io/monadeo/grimoire-server:v1", false),
624
+ own("CVE-9", "zlib", "docker.io/library/redis:7", true),
625
+ ];
626
+ const mac: ReportedVuln = { agent: "CORTEX", cve: "CVE-10", package: "macOS", version: "26.7.2", severity: "High", score: 7, fix: true, since: "2026-10-10T00:00:00Z" };
627
+ expect(needsYou({ ...base, images: { scanned: 57, total: 57, critical }, openWithFix: [mac, { ...mac, agent: "NEXUS", cve: "CVE-11" }] })).toEqual([
628
+ "2 macOS CVEs open after 3 days on CORTEX, NEXUS: install the waiting macOS update",
629
+ "rebuild webapp:1 (1): their base image packages have critical CVEs with a fixed version",
630
+ "update dependencies of server:1 (6: form-data, handlebars, proxy-addr, tar +1), grimoire-server:v1 (1: certifi) in their repositories: their language packages have critical CVEs with a fixed version",
631
+ ]);
632
+ expect(rebuildItems(null)).toEqual([]);
633
+ });
634
+
611
635
  it("names each unacknowledged alert and says when it never reached Discord", () => {
612
636
  const setup = event({ id: "s1", rule: "100021", level: 10, timestamp: "2026-10-19T21:31:28.085+0000", path: "/etc/sudoers.d/spc-arcane", event: "added" });
613
637
  const test1 = event({ id: "t1", rule: "100021", level: 10, timestamp: "2026-10-21T21:47:18.458+0000", path: "/etc/sudoers.d/zz-alert-test", event: "added" });
@@ -636,6 +660,10 @@ describe("weekly report", () => {
636
660
  expect(backupGuests([{ vmid: 100, ctime: 20, notes: "arcane" }, { vmid: 101, ctime: 5, notes: "hermes" }, { vmid: 101, ctime: 9, notes: "hermes", protected: 1 }])).toEqual([{ vmid: "100", name: "arcane", last: 20 }]);
637
661
  expect(resticStatus("Result=success\nExecMainStartTimestamp=Sun 2026-10-18 04:00:24 CEST\n")).toEqual({ result: "success", at: "18 Oct 04:00" });
638
662
  expect(resticStatus("nothing")).toBeNull();
663
+ const timer = "NEXT LEFT LAST PASSED UNIT ACTIVATES\nSun 2026-11-15 02:25:00 CET 5 days Sun 2026-11-08 02:25:06 CET - restic-check.timer restic-check.service\n";
664
+ expect(resticStatus(`Result=success\nExecMainStartTimestamp=\nExecMainExitTimestamp=\n${timer}`)).toEqual({ result: "success", at: "8 Nov 02:25" });
665
+ expect(resticStatus("Result=success\nExecMainStartTimestamp=\n- - - - restic-check.timer restic-check.service\n")).toEqual({ result: "success", at: "never ran" });
666
+ expect(resticStatus("Result=success\nExecMainStartTimestamp=\nSun 2026-11-15 02:25:00 CET 5 days - - restic-check.timer restic-check.service\n")).toEqual({ result: "success", at: "never ran" });
639
667
  expect(backupLine(null, 0, TZ)).toBe("Backups · the check failed");
640
668
  const crl = event({ rule: "100011", level: 10, timestamp: "2026-10-12T04:00:00.000+0000", log: "radius-crl-alert: days_remaining=30 threshold=30" });
641
669
  expect(crlFromEvents([crl], Date.parse("2026-10-20T04:00:00Z"))).toEqual({ days: 22, warned: crl.timestamp });
@@ -579,6 +579,8 @@ export interface ImageVuln {
579
579
  id: string;
580
580
  pkg: string;
581
581
  image: string;
582
+ /** Trivy class `os-pkgs`: the base image's distribution package, which a rebuild on a fixed base picks up. */
583
+ os: boolean;
582
584
  }
583
585
 
584
586
  /** What `images list` says about one image tag: when it was built, and whether its registry has a newer build. */
@@ -616,7 +618,7 @@ export function parseImageVulns(summary: unknown, list: unknown): ImageVulnFacts
616
618
  for (const v of data as Record<string, unknown>[]) {
617
619
  if (typeof v.vulnerabilityId !== "string" || typeof v.imageName !== "string" || v.ignored === true) continue;
618
620
  if (typeof v.fixedVersion !== "string" || v.fixedVersion.length === 0) continue;
619
- critical.push({ id: v.vulnerabilityId, pkg: typeof v.pkgName === "string" ? v.pkgName : "?", image: v.imageName });
621
+ critical.push({ id: v.vulnerabilityId, pkg: typeof v.pkgName === "string" ? v.pkgName : "?", image: v.imageName, os: v.class === "os-pkgs" });
620
622
  }
621
623
  return { scanned: s.scannedImages, total: s.totalImages, critical };
622
624
  }
@@ -722,17 +724,42 @@ export function imageVulnLine(facts: ImageVulnFacts | null, offers: ReadonlyMap<
722
724
  return parts.join(" · ");
723
725
  }
724
726
 
725
- /** Our own images with critical CVEs that have a fix and no newer build in the registry: only our rebuild closes them. */
726
- export function rebuildItem(facts: ImageVulnFacts | null): string | null {
727
- if (!facts) return null;
728
- const counts = new Map<string, number>();
727
+ /** Most package names an image's dependency item shows. */
728
+ const MAX_PACKAGES = 4;
729
+
730
+ /**
731
+ * Our own images with critical CVEs that have a fix and no newer build in the
732
+ * registry, by what closes them: a rebuild picks up fixed base-image packages,
733
+ * while language packages (npm, Python, Go binaries) need a dependency update
734
+ * in the image's repository. Developer work, so only the weekly report lists it.
735
+ */
736
+ export function rebuildItems(facts: ImageVulnFacts | null): string[] {
737
+ if (!facts) return [];
738
+ const os = new Map<string, number>();
739
+ const lang = new Map<string, { n: number; pkgs: Set<string> }>();
729
740
  for (const v of facts.critical) {
730
741
  const build = facts.builds?.get(v.image) ?? facts.builds?.get(v.image.split("@")[0]);
731
- if (isOwnImage(v.image) && !build?.newer) counts.set(v.image, (counts.get(v.image) ?? 0) + 1);
742
+ if (!isOwnImage(v.image) || build?.newer) continue;
743
+ if (v.os) os.set(v.image, (os.get(v.image) ?? 0) + 1);
744
+ else {
745
+ const entry = lang.get(v.image) ?? { n: 0, pkgs: new Set<string>() };
746
+ entry.n++;
747
+ entry.pkgs.add(v.pkg);
748
+ lang.set(v.image, entry);
749
+ }
750
+ }
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
+ 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`);
754
+ if (lang.size > 0) {
755
+ const images = byCount(lang, (e) => e.n).map(([image, e]) => {
756
+ const pkgs = [...e.pkgs].sort();
757
+ const shown = pkgs.slice(0, MAX_PACKAGES).map(escapeDiscord).join(", ");
758
+ return `${escapeDiscord(shortImageName(image))} (${e.n}: ${shown}${pkgs.length > MAX_PACKAGES ? ` +${pkgs.length - MAX_PACKAGES}` : ""})`;
759
+ });
760
+ items.push(`update dependencies of ${images.join(", ")} in their repositories: their language packages have critical CVEs with a fixed version`);
732
761
  }
733
- if (counts.size === 0) return null;
734
- const images = [...counts.entries()].sort((x, y) => y[1] - x[1] || x[0].localeCompare(y[0])).map(([image, n]) => `${escapeDiscord(shortImageName(image))} (${n})`);
735
- return `rebuild ${images.join(", ")}: our images carry critical CVEs that have a fixed version`;
762
+ return items;
736
763
  }
737
764
 
738
765
  // ---------------------------------------------------------------- reports
@@ -768,6 +795,9 @@ function card(groups: readonly (readonly string[])[], attention: boolean, mentio
768
795
  return [{ type: 17, accent_color: attention ? ORANGE : GREEN, components }, ...(mention ? [{ type: 10, content: mention }] : [])];
769
796
  }
770
797
 
798
+ /** Where an alert was posted; its message carries the Acknowledge button. */
799
+ export type PostedAlertRef = Pick<PostedAlert, "key" | "channelId"> & { messageId?: string };
800
+
771
801
  export interface DailyData {
772
802
  /** Local time the report covers up to, already formatted (`06:00 CEST`). */
773
803
  until: string;
@@ -782,7 +812,9 @@ export interface DailyData {
782
812
  /** The Arcane Daily Report's channel, linked from offered updates. */
783
813
  arcaneChannelId?: string;
784
814
  /** Alerts posted to Discord, to tell an unacknowledged alert from one that was never posted. */
785
- alerts: readonly Pick<PostedAlert, "key" | "channelId">[];
815
+ alerts: readonly PostedAlertRef[];
816
+ /** The server, for links to the posted alert itself. */
817
+ guildId?: string;
786
818
  }
787
819
 
788
820
  function headline(urgent: number, unexplained: number, health: number, failed: number): string {
@@ -804,14 +836,12 @@ export function dailyNeedsOwner(d: DailyData): boolean {
804
836
  return (d.attention?.issues.length ?? 0) > 0 || failures(d) > 0;
805
837
  }
806
838
 
807
- /** What the owners must act on today: health issues, unexplained changes, open urgent alerts, our images to rebuild, failed checks. */
839
+ /** What the owners must act on today: health issues, unexplained changes, open urgent alerts, failed checks. Our images' CVEs are developer work for the weekly report. */
808
840
  export function dailyNeeds(d: DailyData): string[] {
809
841
  const items: string[] = [];
810
842
  for (const i of d.attention?.issues ?? []) items.push(escapeDiscord(i.message.replace(/\.$/, "")));
811
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`);
812
- items.push(...unacknowledgedItems(d.wazuh, d.alerts, d.timeZone));
813
- const rebuild = rebuildItem(d.images);
814
- if (rebuild) items.push(rebuild);
844
+ items.push(...unacknowledgedItems(d.wazuh, d.alerts, d.timeZone, d.guildId));
815
845
  const failed = failures(d);
816
846
  if (failed > 0) items.push(`${failed} check${failed === 1 ? "" : "s"} of this report failed; the bridge log on Cortex has the reason`);
817
847
  return items;
@@ -871,7 +901,9 @@ export interface WeeklyData {
871
901
  offers: ReadonlyMap<string, ImageOffer>;
872
902
  arcaneChannelId?: string;
873
903
  /** Alerts posted to Discord, to tell an unacknowledged alert from one that was never posted. */
874
- alerts: readonly Pick<PostedAlert, "key" | "channelId">[];
904
+ alerts: readonly PostedAlertRef[];
905
+ /** The server, for links to the posted alert itself. */
906
+ guildId?: string;
875
907
  last24h: { bans: number | null; wazuh: number | null; urgent: number; found: number | null; closed: number | null; health: number | null };
876
908
  }
877
909
 
@@ -893,10 +925,25 @@ export function backupGuests(value: unknown): BackupFacts["guests"] | null {
893
925
  .sort((x, y) => x.vmid.localeCompare(y.vmid));
894
926
  }
895
927
 
928
+ const TIMER_TIME = /(\d{4})-(\d{2})-(\d{2}) (\d{2}:\d{2}):\d{2}/g;
929
+
930
+ /**
931
+ * The LAST column of the `systemctl list-timers` line: systemd forgets the
932
+ * service's start time when the host restarts, but the timer keeps it. NEXT
933
+ * comes first and is `-` when nothing is scheduled.
934
+ */
935
+ function timerLastRun(text: string): RegExpExecArray | null {
936
+ const line = text.split("\n").find((l) => /\.timer\s/.test(l));
937
+ if (!line) return null;
938
+ const times = [...line.matchAll(TIMER_TIME)];
939
+ const hasNext = !line.trimStart().startsWith("-");
940
+ return (hasNext ? times[1] : times[0]) ?? null;
941
+ }
942
+
896
943
  /** `restic-check-status`: systemd's `Result=` and the start of the last run, as printed (local time). */
897
944
  export function resticStatus(text: string): BackupFacts["restic"] {
898
945
  const result = /^Result=(\S+)/m.exec(text)?.[1];
899
- const started = /^ExecMainStartTimestamp=\S+ (\d{4})-(\d{2})-(\d{2}) (\d{2}:\d{2})/m.exec(text);
946
+ const started = /^ExecMainStartTimestamp=\S+ (\d{4})-(\d{2})-(\d{2}) (\d{2}:\d{2})/m.exec(text) ?? timerLastRun(text);
900
947
  if (!result) return null;
901
948
  const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
902
949
  return { result, at: started ? `${Number(started[3])} ${months[Number(started[2]) - 1]} ${started[4]}` : "never ran" };
@@ -943,31 +990,40 @@ function crlText(crl: WeeklyData["crl"], timeZone: string): string {
943
990
  }
944
991
 
945
992
  /** One item per open alert key the owners did not acknowledge: what changed, when, and where to acknowledge it, if anywhere. */
946
- function unacknowledgedItems(wazuh: WazuhDigest, alerts: readonly Pick<PostedAlert, "key" | "channelId">[], timeZone: string): string[] {
993
+ function unacknowledgedItems(wazuh: WazuhDigest, alerts: readonly PostedAlertRef[], timeZone: string, guildId?: string): string[] {
947
994
  const groups = new Map<string, WazuhEvent[]>();
948
995
  for (const e of wazuh.open) if (e.rule !== DEPLOYMENT_RULE) groups.set(alertKey(e), [...(groups.get(alertKey(e)) ?? []), e]);
949
996
  return [...groups.entries()].map(([key, events]) => {
950
997
  const last = events.reduce((a, b) => (Date.parse(b.timestamp) > Date.parse(a.timestamp) ? b : a));
951
998
  const what = last.path ? `\`${last.path.replace(/`/g, "'")}\` ${escapeDiscord(last.event ?? "changed")}` : escapeDiscord(issueLabel(last));
952
999
  const when = events.length > 1 ? ` × ${events.length}, last ${clockText(last.timestamp, timeZone)}` : `, ${clockText(last.timestamp, timeZone)}`;
953
- const posted = alerts.find((a) => a.key === key);
1000
+ const posted = alerts.filter((a) => a.key === key).at(-1);
954
1001
  const fact = `${what} on ${escapeDiscord(last.agent)}${when}`;
955
- return posted ? `urgent alert not acknowledged: ${fact}; Acknowledge it in <#${posted.channelId}>` : `urgent alert never posted, so it has no Acknowledge button: ${fact}; check that it was expected`;
1002
+ if (!posted) return `urgent alert never posted, so it has no Acknowledge button: ${fact}; check that it was expected`;
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}`;
956
1005
  });
957
1006
  }
958
1007
 
1008
+ /** The package name Wazuh gives a Mac's operating system in its vulnerability findings. */
1009
+ const MACOS_PACKAGE = "macOS";
1010
+
959
1011
  export function needsYou(d: WeeklyData): string[] {
960
1012
  const items: string[] = [];
961
1013
  for (const i of d.attention?.issues ?? []) items.push(escapeDiscord(i.message.replace(/\.$/, "")));
962
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`);
963
- items.push(...unacknowledgedItems(d.wazuh, d.alerts, d.timeZone));
1015
+ items.push(...unacknowledgedItems(d.wazuh, d.alerts, d.timeZone, d.guildId));
964
1016
  if (d.patching && d.patching.rebootPending.length > 0) items.push(`reboot ${d.patching.rebootPending.map(escapeDiscord).join(", ")} to load installed updates`);
965
1017
  const stuck = d.openWithFix.filter((v) => d.now - Date.parse(v.since) > 3 * DAY);
966
- if (stuck.length > 0) items.push(`${stuck.length} CVE${stuck.length === 1 ? "" : "s"} with a fixed version still open after 3 days (${[...new Set(stuck.map((v) => v.agent))].map(escapeDiscord).join(", ")}); unattended-upgrades may be stuck`);
1018
+ const agents = (list: readonly ReportedVuln[]) => [...new Set(list.map((v) => v.agent))].map(escapeDiscord).join(", ");
1019
+ // Wazuh reports a Mac's own CVEs under the package `macOS`; only a macOS update closes them, never unattended-upgrades.
1020
+ const mac = stuck.filter((v) => v.package === MACOS_PACKAGE);
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`);
967
1024
  const offered = offeredImages(d.images, d.offers);
968
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`);
969
- const rebuild = rebuildItem(d.images);
970
- if (rebuild) items.push(rebuild);
1026
+ items.push(...rebuildItems(d.images));
971
1027
  if (d.crl !== null && d.crl !== "unknown") items.push(`renew the RADIUS CRL (wifi-device.sh renew-crl), ${d.crl.days} days left`);
972
1028
  if (d.backups) {
973
1029
  const stale = d.backups.guests.filter((g) => d.now / 1000 - g.last > STALE_BACKUP_S);
@@ -71,6 +71,8 @@ describe("approvals", () => {
71
71
  expect(isRisky("backup", ["vzdump-run", "107"])).toBe(true);
72
72
  expect(isRisky("media", ["add-movies", "tt1160419"])).toBe(false);
73
73
  expect(isRisky("media", ["sabnzbd", "pause"])).toBe(false);
74
+ expect(isRisky("media", ["queue"])).toBe(false);
75
+ expect(isRisky("media", ["queue-remove", "radarr", "7"])).toBe(true);
74
76
  });
75
77
 
76
78
  it("creates a ticket and polls until decided", async () => {
@@ -47,7 +47,8 @@ export const RISKY: Readonly<Record<string, readonly RegExp[]>> = {
47
47
  inference: [/^(nexus-restart|nexus-start)\b/],
48
48
  // A person solves the challenge in the live view; the Approve button means it is solved.
49
49
  research: [/^captcha-help\b/],
50
- // media has no entry: trendarr cannot delete anything, and adds and queue toggles run on the caller's request.
50
+ // Adds and queue pauses run on the caller's request; removing a queue record deletes its download.
51
+ media: [/^queue-remove\b/],
51
52
  };
52
53
 
53
54
  export function isRisky(service: string, args: readonly string[]): boolean {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrofoundry/pi-astro",
3
- "version": "0.40.64",
3
+ "version": "0.40.66",
4
4
  "description": "Personal pi customizations (extensions, subagents, skills, prompts, themes) for the pi coding agent.",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -7,6 +7,8 @@ description: How the Arcane specialist operates the Arcane container platform an
7
7
 
8
8
  Arcane manages the Docker host on VM 100 (`10.0.40.30`). Every app is a Compose project synced from the GitOps repository `astronaute77/arcane`, branch `main`, into `/opt/docker`. The `arcane` tool wraps `arcane-cli` with a fresh short-lived token on every call and adds `git` subcommands for the repository checkout. `arcane-cli gitops ...` (server-side syncs) passes through untouched.
9
9
 
10
+ Since 2026-11-09 a second environment, `mira`, runs the `media-mira` project on media-mira (`10.1.40.30`, VM 111 on SPACE-X at Mira) through an Edge agent. `stack-update`, `stack-rollback`, `deployment`, and `release-notes` find a stack's environment themselves; `update-report`, `container-watch`, and `project-status` cover every environment and name the remote one in `environment`. A raw arcane-cli call on Mira needs `--env f1968df8-bce3-4a65-966f-72934727ae86`. The `host` commands reach VM 100 only.
11
+
10
12
  ## Calling the tool
11
13
 
12
14
  `arcane` takes one parameter, `args`, an array of strings, one element per argument.
@@ -55,6 +57,8 @@ The answer is JSON with `status`: `updated`, `rolled back`, `failed` (with `reas
55
57
 
56
58
  It refuses `arcane` (next section), stopped stacks (a redeploy would start them), a checkout with local or unpushed changes, and held stacks. Held stacks are listed in `update-holds.json` at the root of the GitOps repository, `{ "<stack>": "<reason>" }`; a key `<stack>/<service>` holds one service, which `stack-update` skips while the rest of the stack updates. `update-report` returns them in `holds`, and the daily report shows the reason without a button. Change that file only when the caller asks, through the `git` commands.
57
59
 
60
+ Never stop a stack or a service before `stack-update` to drain it: the redeploy pulls first, then Compose recreates each changed container, and Docker waits the service's `stop_grace_period` after SIGTERM before SIGKILL (Arcane 2.17.3 sets no shorter stop timeout and gives the redeploy its deploy wait plus 30 minutes). A README or ROLLOUT that asks for a graceful drain, such as grimoire-graphile's 750 seconds, is met by `stack-update` itself; a stopped stack is refused.
61
+
58
62
  An update across a major version is refused without `--confirm`: summarise its release notes first (next section), get the caller's go, then run `["stack-update", "<stack>", "--confirm"]`, which asks an owner for approval.
59
63
 
60
64
  ## Release notes
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: media
3
- description: How the media specialist finds trending titles, resolves and adds movies and series, and controls the SABnzbd queue through the media tool (trendarr).
3
+ description: How the media specialist finds trending titles, resolves and adds movies and series, controls the SABnzbd queue through the media tool (trendarr), and clears imports stuck in the Radarr and Sonarr queues.
4
4
  ---
5
5
 
6
6
  # Media specialist
@@ -18,6 +18,8 @@ description: How the media specialist finds trending titles, resolves and adds m
18
18
  | `["add-movies", "tt1160419", "tt0468569"]` | add to Radarr and search (at most 20 IDs) |
19
19
  | `["add-series", "tt0903747"]` | IMDb → TVDB through TMDB, add to Sonarr and search |
20
20
  | `["sabnzbd", "status"]`, `["sabnzbd", "pause"]`, `["sabnzbd", "resume"]` | queue pause state; `pause` and `resume` act, then report the new state |
21
+ | `["queue"]` | Radarr and Sonarr queue records that wait for a person: an import pending, blocked, or failed |
22
+ | `["queue-remove", "radarr", "7", "--confirm"]` | remove that record and delete its download from SABnzbd, without blocklisting the release; asks an owner for approval |
21
23
 
22
24
  ## Output
23
25
 
@@ -26,6 +28,12 @@ description: How the media specialist finds trending titles, resolves and adds m
26
28
  - `in_library: null` means Radarr or Sonarr could not answer or the series has no TVDB mapping: it is uncertainty, not absence. Try the add; its result decides.
27
29
  - `add-movies`, `add-series`: `{ "results": [{ "imdb_id", "title", "status", "detail" }], "sabnzbd_paused": true|false|null, "warnings": [...] }`. `status` is `added` (search started), `already_exists`, `not_found` (nothing added), or `error` (read `detail`). The tool succeeds even when an ID fails; always read each status.
28
30
  - `sabnzbd`: `{ "sabnzbd_paused": true|false }`.
31
+ - `queue`: `{ "records": [{ "app", "id", "title", "state", "status", "messages", "added", "size" }], "warnings": [...] }`; `state` is `importPending`, `importBlocked`, or `failedPending`, `messages` are Radarr's or Sonarr's reasons. An app that did not answer is a warning, not an empty queue.
32
+ - `queue-remove`: `{ "status": "removed", "app", "id" }`.
33
+
34
+ ## Stuck imports
35
+
36
+ The morning run lists each queue record older than a day under Media, with its reason and the `queue-remove` it needs; the owner's reply to that message comes to you. Run `queue` first and check that the record still exists and its reason. When the reason says the download is not an upgrade of the file already in the library (a lower custom format score, the same quality), removing it loses nothing: say so, then run `queue-remove` with `--confirm`, which asks an owner for approval. For any other reason (a wrong match, an unknown file, a missing episode), report it and ask what the owner wants before removing anything; never import by hand.
29
37
  - `warnings` carries trendarr's own warnings, such as an unreachable Radarr; mention them when they change the answer.
30
38
 
31
39
  ## Resolving a title
@@ -58,11 +58,11 @@ Wrappers ship as TypeScript and run under Node 24 type stripping: erasable synta
58
58
  - `entry/specialist-install.sh` runs as root, so it runs only `/usr/bin`, `/bin`, `/usr/sbin`, `/sbin` and the Node it installed, never Homebrew or anything else the main user can write; it checks that `/usr/local/libexec/specialist-node` (and each `specialist-<tool>` folder) and its parents belong to root and are writable by nobody else. Arguments are checked before the root test (tests exercise that part). Downloads go to a root-only temporary directory and are verified before use: Node against `SHASUMS256.txt` and the LTS flag in `index.json`, npm tarballs against the registry's `sha512` integrity, arcane-cli against the release's checksums file. Inside `/Users/specialist` it works only as `specialist` (`sudo -u specialist -H`), from a staging directory root hands over, so a link the specialist plants cannot redirect a root write. Each component switches by rename after a check (every installed wrapper's `--help`, `--version` of the new binary) and restores the previous copy when the check fails. Older versions are refused; `rollback` swaps current and previous. `python`, `gcloud`, `bw`, and `jq` follow the same rules: version folders under `/usr/local/libexec/specialist-<tool>/` behind the links `current` and `previous`, sealed `root:wheel` and not writable by others, smoke-tested as `specialist` before `current` moves; `python` refuses a switch that breaks the current gcloud. Consumers use the `current` paths: `provision.sh` for `bw` and `jq`, `edge.json` for `gcloud` and `gcloudPython`. Nothing a wrapper runs with secrets may come from Homebrew.
59
59
  - `main()` waits for stdout and stderr to flush before `process.exit`: on a pipe, exiting right after a write drops everything past the 64 KiB buffer, which cut large answers such as `projects list --all` until 2026-09-25 (`lib/flush.test.ts`).
60
60
  - `arcane update-report [--all]` is `lib/image-updates.ts` over `lib/registry.ts`: a fresh `images updates check --all`, then `projects list --all` for the stack and service of each image reference, then the registries' tag lists and manifest digests (anonymous bearer tokens from each registry's challenge; digests by HEAD, which Docker Hub does not count as a pull; lscr.io is read from ghcr.io). A floating or major-series tag is resolved to the release tag whose digest matches the running and the latest build, searching the newest tags of the three commonest release shapes; a fixed tag is compared with the newest tag of the same shape; a digest pin with the newest release. Checks older than one minute before the run count as stale and show as unknown. Private images (anonymous access refused with 401 or 403) are excluded from rows, counts, and table, listed in `privateImages`, and counted in the summary line. The table is fixed-width text for a code block, because Discord renders no Markdown tables. The answer adds `holds` from `update-holds.json` at origin's branch head (`git show`, no working-tree read), or `holdsError` when that file is malformed.
61
- - `arcane stack-update <stack> [--confirm]` (`lib/stack-update.ts` for the pure parts) is deterministic: refuses `arcane`, held stacks (the checkout's `update-holds.json` after `pull --ff-only`; a malformed file is an error; a `<stack>/<service>` key skips that service's rows instead), a dirty or ahead checkout, stopped stacks, and an update across a major version without `--confirm` (which the gate turns into an owner approval). Pending rows come from a fresh per-image check resolved like `update-report`. `edit tag`/`edit digest` rows rewrite `image:` lines that name exactly the old reference (`replaceImageRef`, quoted or not, trailing comment kept) in the sync's `composePath`, then commit, push, and wait for `gitops list` to report success at that commit (20 min, polled every 30 s). Then `projects redeploy <stack> --yes` (35 min), container checks through `containers list --all` and `containers get` (`composeInfo.projectName`, health; 5 min, polled every 15 s; a job that exited with code 0 counts as done whatever health its image's inherited check left, as bigcapital's migration did on 2026-10-28), and a fresh check that each service is current. A failure after a commit reverts, pushes, waits for the sync, redeploys, and checks again (`rolled back`); a pull-only failure stays `failed`. Every outcome prints JSON with `status` and exits 0. Worst case about 125 minutes, so the gate's `timeoutMs` for arcane must exceed it (8,100,000). It holds the `arcane-gitops` lock, so a second checkout call waits up to 2 minutes and then fails as busy; the bridge also runs one Arcane update at a time.
61
+ - `arcane stack-update <stack> [--confirm]` (`lib/stack-update.ts` for the pure parts) is deterministic: refuses `arcane`, held stacks (the checkout's `update-holds.json` after `pull --ff-only`; a malformed file is an error; a `<stack>/<service>` key skips that service's rows instead), a dirty or ahead checkout, stopped stacks, and an update across a major version without `--confirm` (which the gate turns into an owner approval). Pending rows come from a fresh per-image check resolved like `update-report`. `edit tag`/`edit digest` rows rewrite `image:` lines that name exactly the old reference (`replaceImageRef`, quoted or not, trailing comment kept) in the sync's `composePath`, then commit, push, and wait for `gitops list` to report success at that commit (20 min, polled every 30 s). Then `projects redeploy <stack> --yes` (35 min; Arcane v2.17.3 pulls every image, then runs Compose up without a stop timeout, so each recreated container gets its `stop_grace_period` before SIGKILL: grimoire-graphile's 750-second queue drain needs no separate stop, checked against the Arcane and Compose sources on 2026-11-10), container checks through `containers list --all` and `containers get` (`composeInfo.projectName`, health; 5 min, polled every 15 s; a job that exited with code 0 counts as done whatever health its image's inherited check left, as bigcapital's migration did on 2026-10-28), and a fresh check that each service is current. A failure after a commit reverts, pushes, waits for the sync, redeploys, and checks again (`rolled back`); a pull-only failure stays `failed`. Every outcome prints JSON with `status` and exits 0. Worst case about 125 minutes, so the gate's `timeoutMs` for arcane must exceed it (8,100,000). It holds the `arcane-gitops` lock, so a second checkout call waits up to 2 minutes and then fails as busy; the bridge also runs one Arcane update at a time.
62
62
  - `arcane host <command>` runs over the forced-command key of user `spc-arcane` on VM 100. `HOST_COMMANDS` in `lib/arcane-host.ts` must list exactly the operations of `entry/remote/spc-arcane-op.py` (a test compares them); the tracked copies live in the arcane repository's `host/` (`spc-arcane-host-entry`, `spc-arcane-op`, `spc-arcane-sudoers`, `spc-arcane-install.sh`) with the probes in `host/spc-arcane-probes/`. The entry only splits words (letters, digits, space, `._:/+-`) and hands them to `sudo -n /usr/local/sbin/spc-arcane-op`, the one command its sudoers line allows; the op checks the name and every argument and runs the reviewed arcane-ops probes, which print only allowlisted fields. Manager steps (`manager-*`) are internal to `manager-upgrade`/`manager-rollback` and refused through `host`. Nothing on the host deletes data: a manager rollback restores the image and Compose file, not the data volume (R3 stays manual), `db-restore` only fills an empty database, and dumps are never pruned by the tool. `supabase-backup` writes the pre-change backup of `supabase/AGENTS.md` (both databases with `pg_dump -Fc`, each listed and fully decoded by `pg_restore`, `pg_dumpall --globals-only`, and the `supabase-db-config` volume, which must hold `pgsodium_root.key`) into `/var/backups/supabase-upgrades/<UTC>`, the folder of the earlier manual backups. `host-audit` compares the host's hashes with `host/<name>` of the `arcane-gitops` checkout after a pull. The `bigcapital-*` commands run the base-image upgrade of `bigcapital/README.md`: an online backup, a rehearsal on an internal Docker network (restore into the current MariaDB, upgrade with the build's, migrations, server health, Envoy validation; everything it created removed afterwards), the owner-approved switch (stop, quiescent dump, Redis `SAVE`, volume copies compared entry by entry, the stack left stopped for the GitOps commit, the old volumes untouched), and a verify against the switch's row counts and ledger totals.
63
63
  - `arcane manager-upgrade <version>` (`lib/arcane-manager.ts`) follows arcane/AGENTS.md "Manager upgrades": the official image's revision label must equal the release tag's commit (GitHub API), `manager-prepare` records `compose.before.yaml` and every container before the pin commit, the pin goes through the `arcane-gitops` checkout (`git` is exported from `lib/repo.ts` for this), the wait polls `gitops list` and the deployed Compose hash every 30 s for up to 30 minutes, then pull, cold backup, `up -d --no-deps --pull never`, and checks. Any failure before the restart reverts the pin (`stopped`); a failed check after it reverts the pin and runs `manager-rollback` (`rolled back`). The answer always exits 0 with `status`, so the bridge and the agent both see it.
64
64
  - `research` is a pure forced-command wrapper: every call is one JSON request on stdin to `request` on VM 110 (`10.1.100.10`, user `spc-research`, key `SSH_KEY_SANDBOX`), whose entry hands it to `spc-research-op` as `researcher` (tracked in the homelab repository's `06-space-x-proxmox/research/system/`). The op attaches one playwright-cli session per Discord thread (`t<id>`) to the shared Chrome over CDP on `127.0.0.1:9222` and opens its own tab; cookie, storage, `run-code`, and browser lifecycle commands are refused. `script` runs the agent's code in the thread folder as `researcher` (5 minutes), on a VM that reaches only the internet (Mira's Sandbox zone plus the VM's own nftables). Defaults stay on Cortex in `work/research/defaults.json`, out of the sandbox's reach. `captcha-help` is in `RISKY`, so its owner approval is the moment the owner solved the challenge in the live view (`research-browser.37pla.net`); the bridge renders that ticket with the channel's `liveView` link.
65
- - `media` runs trendarr unchanged: `trendarrCli` in `media.json` is its `dist/cli.js`, started with `process.execPath` because sudo's PATH has no node. Each call gets `HOME` set to a fresh `0700` directory under `~/.specialists/work/media/` that holds only `.trendarr/config.json` (`0600`, trendarr's own schema, built from the note fields and `media.json`) and is removed in `finally`; trendarr reads no environment variables and has no config flag, and Node's `os.homedir()` follows `$HOME` on POSIX. Every call passes `--json`; `init` is refused. An add prints trendarr's per-ID `results` and exits 0 even when trendarr exits 1 for a failed ID, because the gate shows only stderr on failure; other failures carry trendarr's stderr without its `warning:` lines, which go into the JSON as `warnings`. The bridge's slash commands and Add buttons call the same wrapper through the entry point (`extensions/astro-discord/media.ts`).
65
+ - `media` runs trendarr unchanged: `trendarrCli` in `media.json` is its `dist/cli.js`, started with `process.execPath` because sudo's PATH has no node. Each call gets `HOME` set to a fresh `0700` directory under `~/.specialists/work/media/` that holds only `.trendarr/config.json` (`0600`, trendarr's own schema, built from the note fields and `media.json`) and is removed in `finally`; trendarr reads no environment variables and has no config flag, and Node's `os.homedir()` follows `$HOME` on POSIX. Every call passes `--json`; `init` is refused. An add prints trendarr's per-ID `results` and exits 0 even when trendarr exits 1 for a failed ID, because the gate shows only stderr on failure; other failures carry trendarr's stderr without its `warning:` lines, which go into the JSON as `warnings`. The bridge's slash commands and Add buttons call the same wrapper through the entry point (`extensions/astro-discord/media.ts`). `queue` and `queue-remove` (since 0.40.66) skip trendarr, which has no queue records: the wrapper calls `/api/v3/queue` of Radarr and Sonarr itself with the note's keys in the `X-Api-Key` header and prints only `stuckRecords` fields (no paths or download ids); `queue-remove` sends `DELETE /api/v3/queue/<id>?removeFromClient=true&blocklist=false`, needs `--confirm`, and is in `RISKY`.
66
66
  - `arcane release-notes <stack>[/<service>]` is `lib/releases.ts`: a single-image check and `resolveRef` give the running and latest versions, `HttpRegistry.labels` reads `org.opencontainers.image.source` from the latest image (index to linux/amd64 manifest to config blob), and the anonymous GitHub releases API (60 requests an hour, up to 3 pages of 100) gives the releases in between, oldest first. `condenseNotes` keeps each release under 12,000 characters by section priority; `capTotal` drops the oldest releases past 40,000 characters in total.
67
67
 
68
68
  ## Gate
@@ -13,7 +13,7 @@ A specialist is a Pi subagent that is the only way to operate one area of the ho
13
13
  | `astro.backup` | vzdump, the shared Restic repository (Pulsar host config, Arcane app backups), GCS offsite from LXC 102 | Status, journals, and manual runs of every layer; `restic-snapshots|stats|ls`, `restic-restore` into `/var/tmp/spc-restore` on Pulsar, `restore-clean` |
14
14
  | `astro.proxmox` | Proxmox VE on Pulsar (37) and SPACE-X (Mira) | API token: `guests`, `guest`, `get <path>`, `tasks`; `start`, `shutdown|reboot|stop --confirm`; snapshots create, delete, rollback; `set` of CPU, memory, options, network. Host key: `host-status`, `host-journal`, `updates`, `host-upgrade` (apt full-upgrade; a new Proxmox VE major is held), `host-reboot --confirm`, `guest-exec <vmid> <status|journal|df|updates>`, `nightly-journal <days>`; `nightly [days]` combines the vzdump tasks with that journal into a table of nightly run times. Every command runs on Pulsar, or on SPACE-X with the `space-x` prefix |
15
15
  | `astro.inference` | MLX embedding and reranking servers on Nexus, Europa health | `nexus-status|start|stop|restart|log|disk`, `macos-updates`; `europa-health` |
16
- | `astro.media` | trendarr over TMDB, OMDb, and the `media` project on VM 100 (Radarr, Sonarr, SABnzbd) | `trending`, `search`, `recommend`, `add-movies`, `add-series` (at most 20 IMDb IDs), `sabnzbd status|pause|resume`; always trendarr's JSON plus its warnings |
16
+ | `astro.media` | trendarr over TMDB, OMDb, and the `media` project on VM 100 (Radarr, Sonarr, SABnzbd) | `trending`, `search`, `recommend`, `add-movies`, `add-series` (at most 20 IMDb IDs), `sabnzbd status|pause|resume`, `queue`, `queue-remove <radarr|sonarr> <id> --confirm`; trendarr's JSON plus its warnings, the queue commands straight from Radarr and Sonarr |
17
17
  | `astro.research` | the research sandbox, VM 110 at Mira (Chrome on a virtual screen, scripts, thread folders), through the forced-command key of user `spc-research`; defaults in `~/.specialists/work/research/defaults.json` | `browser <session> <playwright-cli args>`, `captcha`, `captcha-help` (owner approval: solved in the live view), `script`, `read`, `files`, `toolbox`, `defaults list|set|unset`; the sandbox's JSON |
18
18
 
19
19
  Call one with `/run astro.<name> -- <task>` or through the `subagent` tool (both from the bundled `astro-subagents` extension). `/run` saves the specialist's session under `~/.pi/agent/subagent-sessions/<agent>/`; `/run astro.<name> --continue -- <task>` resumes the last one started from the same directory, so the specialist keeps what it saw. Sessions older than 7 days are deleted. Specialists may call each other once (`maxSubagentDepth: 1`). They run on `openai-codex/gpt-6-astra` with `xhigh` thinking, set by `model` and `thinking` in each `agents/<name>.md`; an agent without these fields inherits the caller's model and thinking. Each tool takes `args`, an array of strings; `["--help"]` lists the subcommands.
@@ -27,7 +27,7 @@ Call one with `/run astro.<name> -- <task>` or through the `subagent` tool (both
27
27
  - Every call is logged in `/Users/specialist/.specialists/audit.log`.
28
28
  - The `specialist-gate` extension registers the tool only inside the matching specialist child and blocks other agents from calling the CLIs or reading `/Users/specialist`. `security-guard` carries the same blocks.
29
29
 
30
- Limits: `network` writes through the UniFi Network API plus a few narrow commands on the Network application's own paths (`nat-write`, `device-network`, `client-fixed-ip`, `syslog`, `app-policy-delete`, `portforward-delete`); it cannot change Site Magic. `security` is read-only. `identity` deploys only `config.yaml` to the DMZ and upgrades Pomerium to an official release whose sha256 matches (`dmz pomerium-upgrade`). `edge` changes only `nginx.conf` on the VPS and can reboot it. `dns` writes zones, records, and the cluster only on the Technitium primary; on another node it only sets the server domain, resyncs a zone, or deletes a stale Secondary zone, and `technitium host` restarts or upgrades one node at a time. `proxmox` cannot create, clone, or destroy guests, change disks, or change the host configuration; on a host it only upgrades packages (`host-upgrade`) and reboots (`host-reboot --confirm`). `backup` cannot change retention or schedules. `inference` cannot start Europa or change models. `media` adds titles and toggles the download queue; it cannot delete anything or change Radarr, Sonarr, or SABnzbd settings.
30
+ Limits: `network` writes through the UniFi Network API plus a few narrow commands on the Network application's own paths (`nat-write`, `device-network`, `client-fixed-ip`, `syslog`, `app-policy-delete`, `portforward-delete`); it cannot change Site Magic. `security` is read-only. `identity` deploys only `config.yaml` to the DMZ and upgrades Pomerium to an official release whose sha256 matches (`dmz pomerium-upgrade`). `edge` changes only `nginx.conf` on the VPS and can reboot it. `dns` writes zones, records, and the cluster only on the Technitium primary; on another node it only sets the server domain, resyncs a zone, or deletes a stale Secondary zone, and `technitium host` restarts or upgrades one node at a time. `proxmox` cannot create, clone, or destroy guests, change disks, or change the host configuration; on a host it only upgrades packages (`host-upgrade`) and reboots (`host-reboot --confirm`). `backup` cannot change retention or schedules. `inference` cannot start Europa or change models. `media` adds titles, toggles the download queue, and removes a stuck queue record with its download after an owner's approval; it cannot delete library files or change Radarr, Sonarr, or SABnzbd settings.
31
31
 
32
32
  ## Enable specialists on a host
33
33