@astrofoundry/pi-astro 0.40.3 → 0.40.5

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.
@@ -83,8 +83,8 @@ describe("morning status lines", () => {
83
83
  expect(dnsStatus({ status: "ok" }, null)).toMatchObject({ problem: "DNS: the secondary resolver does not answer" });
84
84
  expect(inferenceStatus("embed \tstate = running \tpid = 80042 health=200\nrerank \tstate = running \tpid = 81670 health=200")).toEqual({ area: "Inference", line: "Nexus embed, rerank running and healthy" });
85
85
  expect(inferenceStatus("embed \tstate = running \tpid = 80042 health=503")).toMatchObject({ problem: "Inference: embed not healthy on Nexus" });
86
- expect(mediaStatus({ sabnzbd_paused: true, warnings: [] })).toEqual({ area: "Media", line: "SABnzbd paused" });
87
- expect(mediaStatus({ sabnzbd_paused: false, warnings: [{ text: "login failed" }] })).toMatchObject({ line: "SABnzbd downloading, 1 warning", route: "media" });
86
+ expect(mediaStatus({ sabnzbd_paused: true, warnings: [] })).toEqual({ area: "Media", line: "downloads paused" });
87
+ expect(mediaStatus({ sabnzbd_paused: false, warnings: [{ text: "login failed" }] })).toMatchObject({ line: "downloads running, 1 warning", problem: "Media: the downloader shows 1 warning", route: "media" });
88
88
  });
89
89
 
90
90
  it("checks last night's Proxmox archives and the restic check", () => {
@@ -111,8 +111,8 @@ export function mediaStatus(sab: unknown): AreaStatus {
111
111
  const r = sab as { sabnzbd_paused?: unknown; warnings?: unknown } | null;
112
112
  if (!r || typeof r.sabnzbd_paused !== "boolean") return failed("Media", "media", "sabnzbd status");
113
113
  const warnings = Array.isArray(r.warnings) ? r.warnings.length : 0;
114
- const line = `SABnzbd ${r.sabnzbd_paused ? "paused" : "downloading"}${warnings > 0 ? `, ${warnings} warning${warnings === 1 ? "" : "s"}` : ""}`;
115
- return { area: "Media", line, ...(warnings > 0 ? { problem: `Media: SABnzbd shows ${warnings} warning${warnings === 1 ? "" : "s"}`, route: "media" as const } : {}) };
114
+ const line = `downloads ${r.sabnzbd_paused ? "paused" : "running"}${warnings > 0 ? `, ${warnings} warning${warnings === 1 ? "" : "s"}` : ""}`;
115
+ return { area: "Media", line, ...(warnings > 0 ? { problem: `Media: the downloader shows ${warnings} warning${warnings === 1 ? "" : "s"}`, route: "media" as const } : {}) };
116
116
  }
117
117
 
118
118
  /** Every guest is backed up nightly at 02:30; an archive older than this means last night's run missed it. */
@@ -1379,7 +1379,7 @@ class Bridge {
1379
1379
  if (command.view === "downloads") {
1380
1380
  const paused = parseQueueState(output);
1381
1381
  if (paused === null) throw new Error("the media wrapper returned no queue state");
1382
- await this.rest.editOriginal(app, interaction.token, { content: queueLine(paused) });
1382
+ await this.rest.editOriginal(app, interaction.token, { content: queueLine(paused), ...(paused ? { components: unpauseRow() } : {}) });
1383
1383
  return;
1384
1384
  }
1385
1385
  const list = parseMediaList(output);
@@ -82,7 +82,8 @@ describe("media slash commands", () => {
82
82
  expect(parseAddReport(null)).toBeNull();
83
83
  expect(parseQueueState({ sabnzbd_paused: false })).toBe(false);
84
84
  expect(parseQueueState({})).toBeNull();
85
- expect(queueLine(true)).toBe("SABnzbd paused: yes");
85
+ expect(queueLine(true)).toBe("⏸️ Downloads are paused");
86
+ expect(queueLine(false)).toBe("▶️ Downloads are running");
86
87
  });
87
88
  });
88
89
 
@@ -74,7 +74,7 @@ export const MEDIA_COMMANDS = [
74
74
  {
75
75
  name: "downloads",
76
76
  type: 1,
77
- description: "SABnzbd queue: status, pause, or resume (unpause)",
77
+ description: "Downloads: status, pause, or resume (unpause)",
78
78
  contexts: [GUILD_CONTEXT],
79
79
  options: [
80
80
  {
@@ -331,7 +331,7 @@ export function mediaPointer(config: DiscordConfig, configured: readonly string[
331
331
  }
332
332
 
333
333
  export function queueLine(paused: boolean): string {
334
- return `SABnzbd paused: ${paused ? "yes" : "no"}`;
334
+ return paused ? PAUSED_TEXT : "▶️ Downloads are running";
335
335
  }
336
336
 
337
337
  /**
@@ -299,7 +299,8 @@ describe("security monitor", () => {
299
299
  h.answers.set("arcane images vulnerabilities list", () => JSON.stringify({ data: [{ vulnerabilityId: "CVE-7", pkgName: "zlib", fixedVersion: "1.3.1", ignored: false, imageName: "nginx:latest" }] }));
300
300
  await h.monitor.dailyReport(SCHEDULE, "2026-10-21");
301
301
  const text = h.rest.messages[0].message.content;
302
- expect(text).toContain("Arcane images · 1 critical CVE with a fix in 1 image: nginx:latest: CVE-7 (zlib); no newer image offered yet");
302
+ expect(text).toContain("Arcane images · 1 critical CVE whose package has a fix, in 1 image · waiting on the publisher: nginx 1");
303
+ expect(h.calls).toContainEqual(["arcane", "images", "list", "--all"]);
303
304
  expect(h.calls).toContainEqual(["arcane", "images", "vulnerabilities", "list", "--severity", "critical", "--all"]);
304
305
  expect(text.split("\n")[0]).toBe("**Security Daily Report:** quiet day (24 h to 06:05 CEST)");
305
306
  expect(text).toContain("CrowdSec · 2 bans, all front door SNI scanning");
@@ -33,6 +33,7 @@ import {
33
33
  type OriginVerdict,
34
34
  originArgs,
35
35
  parseAttention,
36
+ parseImageBuilds,
36
37
  parseImageVulns,
37
38
  parseOrigin,
38
39
  parseSecurityButton,
@@ -452,8 +453,10 @@ export class SecurityMonitor {
452
453
  private async imageFacts(): Promise<{ images: ImageVulnFacts | null; offers: Map<string, ImageOffer>; arcaneChannelId?: string }> {
453
454
  const summary = await this.read("images vulnerabilities summary", "arcane", ["images", "vulnerabilities", "summary"], (v) => (v && typeof v === "object" ? v : null));
454
455
  const list = summary ? await this.read("images vulnerabilities list", "arcane", ["images", "vulnerabilities", "list", "--severity", "critical", "--all"], (v) => (v && typeof v === "object" ? v : null), 5 * MINUTE) : null;
455
- const images = summary && list ? parseImageVulns(summary, list) : null;
456
- if (summary && list && !images) this.deps.log("security report: images vulnerabilities returned an unexpected answer");
456
+ const parsed = summary && list ? parseImageVulns(summary, list) : null;
457
+ if (summary && list && !parsed) this.deps.log("security report: images vulnerabilities returned an unexpected answer");
458
+ const builds = parsed ? await this.read("images list", "arcane", ["images", "list", "--all"], (v) => (v && typeof v === "object" ? v : null), 5 * MINUTE) : null;
459
+ const images = parsed && builds ? { ...parsed, builds: parseImageBuilds(builds) } : parsed;
457
460
  const arcaneChannelId = reportSchedule(this.deps.config(), "arcane")?.channelId;
458
461
  return { images, offers: imageOffers(readPostedArcane()?.stacks ?? []), ...(arcaneChannelId ? { arcaneChannelId } : {}) };
459
462
  }
@@ -37,6 +37,8 @@ import {
37
37
  imageOffers,
38
38
  imageVulnLine,
39
39
  type ImageVulnFacts,
40
+ parseImageBuilds,
41
+ shortImageName,
40
42
  offeredImages,
41
43
  parseImageVulns,
42
44
  nasOutage,
@@ -417,13 +419,42 @@ describe("Arcane image scans", () => {
417
419
  ],
418
420
  };
419
421
  expect(imageVulnLine(facts, offers, "1549873938140499999")).toBe(
420
- "Arcane images · 5 critical CVEs with a fix in 3 images: ghcr.io/mealie-recipes/mealie:latest: CVE-1 (openssl), CVE-2 (zlib), +1 more; update offered: Update on mealie in the Arcane Daily Report (<#1549873938140499999>) · nginx:latest: CVE-5 (curl); no newer image offered yet · supabase/postgres:15.8.1.085: CVE-4 (libpq); supabase is held: coordinated release: review first",
422
+ "Arcane images · 5 critical CVEs whose package has a fix, in 3 images · update offered in <#1549873938140499999>: mealie 3 (mealie) · held: postgres:15.8.1.085 1 (supabase: coordinated release: review first) · waiting on the publisher: nginx 1",
421
423
  );
422
424
  expect(offeredImages(facts, offers)).toEqual(["mealie"]);
423
425
  expect(offeredImages(null, offers)).toEqual([]);
424
426
  expect(imageVulnLine(null, offers)).toBe("Arcane images · the check failed");
425
427
  expect(imageVulnLine({ scanned: 0, total: 57, critical: [] }, offers)).toBe("Arcane images · no Trivy scan yet (57 images)");
426
- expect(imageVulnLine({ ...facts, critical: facts.critical.slice(4) }, new Map(), undefined, 0)).toBe("Arcane images · 1 critical CVE with a fix in 1 image: · +1 more images");
428
+ expect(imageVulnLine({ ...facts, critical: facts.critical.slice(4) }, new Map(), undefined, 0)).toBe("Arcane images · 1 critical CVE whose package has a fix, in 1 image · waiting on the publisher: +1 more");
429
+ });
430
+
431
+ it("names our own images with their build date and a newer build waiting in the registry", () => {
432
+ const list = { data: [
433
+ { repoTags: ["ghcr.io/astronaute77/arcane-graphile-worker:latest"], created: 1788801615, updateInfo: { hasUpdate: true } },
434
+ { repoTags: ["ghcr.io/monadeo/grimoire-server:v0.27.57"], created: 1790000000, updateInfo: null },
435
+ { repoTags: "bad" },
436
+ ] };
437
+ const builds = parseImageBuilds(list);
438
+ expect(builds.get("ghcr.io/astronaute77/arcane-graphile-worker:latest")).toEqual({ created: 1788801615, newer: true });
439
+ expect(parseImageBuilds([{ repoTags: ["a:1"], created: 1 }]).get("a:1")).toEqual({ created: 1, newer: false });
440
+ expect(parseImageBuilds(null).size).toBe(0);
441
+ const facts: ImageVulnFacts = {
442
+ scanned: 20,
443
+ total: 57,
444
+ critical: [
445
+ { id: "CVE-1", pkg: "glib", image: "ghcr.io/astronaute77/arcane-graphile-worker:latest" },
446
+ { id: "CVE-2", pkg: "glib", image: "ghcr.io/astronaute77/arcane-graphile-worker:latest" },
447
+ { id: "CVE-3", pkg: "zlib", image: "ghcr.io/monadeo/grimoire-server:v0.27.57@sha256:a86042bb83d85203283135f6f2762c85161a0d2458d9a5378e1a59174b946147" },
448
+ { id: "CVE-4", pkg: "openssl", image: "ghcr.io/astrofoundry/bigcapital-redis:astrofoundry" },
449
+ { id: "CVE-5", pkg: "pyjwt", image: "unclecode/crawl4ai:latest" },
450
+ { id: "CVE-6", pkg: "openssl", image: "ghcr.io/hotio/lidarr:pr-plugins" },
451
+ ],
452
+ builds,
453
+ };
454
+ expect(imageVulnLine(facts, new Map(), undefined, 1)).toBe(
455
+ "Arcane images · 6 critical CVEs whose package has a fix, in 5 images · ours to rebuild: arcane-graphile-worker 2 (built 7 Sept, a newer build waits in the registry), bigcapital-redis:astrofoundry 1 (build date unknown), grimoire-server:v0.27.57 1 (built 21 Sept) · waiting on the publisher: lidarr:pr-plugins 1, +1 more",
456
+ );
457
+ expect(shortImageName("postgres:18.6")).toBe("postgres:18.6");
427
458
  });
428
459
  });
429
460
 
@@ -575,12 +575,24 @@ export interface ImageVuln {
575
575
  image: string;
576
576
  }
577
577
 
578
+ /** What `images list` says about one image tag: when it was built, and whether its registry has a newer build. */
579
+ export interface ImageBuild {
580
+ /** Unix seconds. */
581
+ created: number | null;
582
+ newer: boolean;
583
+ }
584
+
578
585
  export interface ImageVulnFacts {
579
586
  scanned: number;
580
587
  total: number;
581
588
  critical: ImageVuln[];
589
+ /** Build facts by tag, for the images we build ourselves. */
590
+ builds?: ReadonlyMap<string, ImageBuild>;
582
591
  }
583
592
 
593
+ /** Image namespaces our own CI builds: their CVEs wait on our rebuild, everything else on its publisher. */
594
+ export const OWN_IMAGE_PREFIXES = ["ghcr.io/astronaute77/", "ghcr.io/astrofoundry/", "ghcr.io/monadeo/"];
595
+
584
596
  /** What the newest Arcane Daily Report offers for the stack that runs an image. */
585
597
  export interface ImageOffer {
586
598
  stack: string;
@@ -603,6 +615,19 @@ export function parseImageVulns(summary: unknown, list: unknown): ImageVulnFacts
603
615
  return { scanned: s.scannedImages, total: s.totalImages, critical };
604
616
  }
605
617
 
618
+ /** `images list --all`: build time and pending newer build for every tag. */
619
+ export function parseImageBuilds(list: unknown): Map<string, ImageBuild> {
620
+ const rows = Array.isArray(list) ? list : (list as { data?: unknown } | null)?.data;
621
+ const out = new Map<string, ImageBuild>();
622
+ if (!Array.isArray(rows)) return out;
623
+ for (const row of rows as Record<string, unknown>[]) {
624
+ const tags = Array.isArray(row.repoTags) ? row.repoTags.filter((t): t is string => typeof t === "string") : [];
625
+ const build = { created: typeof row.created === "number" ? row.created : null, newer: (row.updateInfo as { hasUpdate?: unknown } | null | undefined)?.hasUpdate === true };
626
+ for (const tag of tags) out.set(tag, build);
627
+ }
628
+ return out;
629
+ }
630
+
606
631
  function repositoryOf(ref: string): string | null {
607
632
  try {
608
633
  const r = parseImageRef(ref);
@@ -624,12 +649,6 @@ export function imageOffers(stacks: readonly { stack: string; lines: { ref?: str
624
649
  return out;
625
650
  }
626
651
 
627
- function offerText(offer: ImageOffer | undefined, arcaneChannelId: string | undefined): string {
628
- if (offer?.offered) return `update offered: Update on ${escapeDiscord(offer.stack)} in the Arcane Daily Report${arcaneChannelId ? ` (<#${arcaneChannelId}>)` : ""}`;
629
- if (offer?.held) return `${escapeDiscord(offer.stack)} is held: ${escapeDiscord(offer.held)}`;
630
- return "no newer image offered yet";
631
- }
632
-
633
652
  /** Images with critical CVEs that an update in the newest Arcane Daily Report would replace. */
634
653
  export function offeredImages(facts: ImageVulnFacts | null, offers: ReadonlyMap<string, ImageOffer>): string[] {
635
654
  if (!facts) return [];
@@ -641,21 +660,59 @@ export function offeredImages(facts: ImageVulnFacts | null, offers: ReadonlyMap<
641
660
  return [...stacks].sort();
642
661
  }
643
662
 
644
- export function imageVulnLine(facts: ImageVulnFacts | null, offers: ReadonlyMap<string, ImageOffer>, arcaneChannelId?: string, maxShown = 3): string {
663
+ function isOwnImage(image: string): boolean {
664
+ const repo = repositoryOf(image);
665
+ return repo !== null && OWN_IMAGE_PREFIXES.some((p) => repo.startsWith(p));
666
+ }
667
+
668
+ /** `crawl4ai`, `lidarr:pr-plugins`, `grimoire-server:v0.27.57`: the last path segment, with its tag unless it is latest. */
669
+ export function shortImageName(image: string): string {
670
+ try {
671
+ const r = parseImageRef(image);
672
+ const name = r.repository.split("/").pop() ?? r.repository;
673
+ return r.tag && r.tag !== "latest" ? `${name}:${r.tag}` : name;
674
+ } catch {
675
+ return image;
676
+ }
677
+ }
678
+
679
+ function buildText(build: ImageBuild | undefined): string {
680
+ 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";
681
+ return build?.newer ? `${built}, a newer build waits in the registry` : built;
682
+ }
683
+
684
+ /**
685
+ * Critical CVEs whose package has a fixed version, grouped by who can act:
686
+ * our own images (with their build date), images an update in the Arcane
687
+ * Daily Report replaces, held stacks, and images waiting on their publisher.
688
+ */
689
+ export function imageVulnLine(facts: ImageVulnFacts | null, offers: ReadonlyMap<string, ImageOffer>, arcaneChannelId?: string, maxWaiting = 5): string {
645
690
  if (!facts) return "Arcane images · the check failed";
646
691
  if (facts.scanned === 0) return `Arcane images · no Trivy scan yet (${facts.total} images)`;
647
692
  if (facts.critical.length === 0) return `Arcane images · no critical CVE with a fix (${facts.scanned} of ${facts.total} images scanned)`;
648
- const byImage = new Map<string, ImageVuln[]>();
649
- for (const v of facts.critical) byImage.set(v.image, [...(byImage.get(v.image) ?? []), v]);
650
- const groups = [...byImage.entries()].sort((x, y) => y[1].length - x[1].length || x[0].localeCompare(y[0]));
651
- const shown = groups.slice(0, maxShown).map(([image, vulns]) => {
652
- const named = vulns.slice(0, 2).map((v) => `${escapeDiscord(v.id)} (${escapeDiscord(v.pkg)})`);
653
- const rest = vulns.length > 2 ? `, +${vulns.length - 2} more` : "";
654
- return `${escapeDiscord(image)}: ${named.join(", ")}${rest}; ${offerText(offers.get(repositoryOf(image) ?? ""), arcaneChannelId)}`;
655
- });
656
- const more = groups.length > maxShown ? ` · +${groups.length - maxShown} more images` : "";
693
+ const counts = new Map<string, number>();
694
+ for (const v of facts.critical) counts.set(v.image, (counts.get(v.image) ?? 0) + 1);
695
+ const images = [...counts.entries()].sort((x, y) => y[1] - x[1] || x[0].localeCompare(y[0]));
696
+ const own: string[] = [];
697
+ const offered: string[] = [];
698
+ const held: string[] = [];
699
+ const waiting: string[] = [];
700
+ for (const [image, n] of images) {
701
+ const name = `${escapeDiscord(shortImageName(image))} ${n}`;
702
+ const offer = offers.get(repositoryOf(image) ?? "");
703
+ if (isOwnImage(image)) own.push(`${name} (${buildText(facts.builds?.get(image) ?? facts.builds?.get(image.split("@")[0]))})`);
704
+ else if (offer?.offered) offered.push(`${name} (${escapeDiscord(offer.stack)})`);
705
+ else if (offer?.held) held.push(`${name} (${escapeDiscord(offer.stack)}: ${escapeDiscord(offer.held)})`);
706
+ else waiting.push(name);
707
+ }
657
708
  const n = facts.critical.length;
658
- return `Arcane images · ${n} critical CVE${n === 1 ? "" : "s"} with a fix in ${groups.length} image${groups.length === 1 ? "" : "s"}: ${shown.join(" · ")}${more}`;
709
+ const parts = [`Arcane images · ${n} critical CVE${n === 1 ? "" : "s"} whose package has a fix, in ${images.length} image${images.length === 1 ? "" : "s"}`];
710
+ if (own.length > 0) parts.push(`ours to rebuild: ${own.join(", ")}`);
711
+ if (offered.length > 0) parts.push(`update offered${arcaneChannelId ? ` in <#${arcaneChannelId}>` : " in the Arcane Daily Report"}: ${offered.join(", ")}`);
712
+ if (held.length > 0) parts.push(`held: ${held.join(", ")}`);
713
+ const rest = waiting.length - Math.min(waiting.length, maxWaiting);
714
+ if (waiting.length > 0) parts.push(`waiting on the publisher: ${[...waiting.slice(0, maxWaiting), ...(rest > 0 ? [`+${rest} more`] : [])].join(", ")}`);
715
+ return parts.join(" · ");
659
716
  }
660
717
 
661
718
  // ---------------------------------------------------------------- reports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrofoundry/pi-astro",
3
- "version": "0.40.3",
3
+ "version": "0.40.5",
4
4
  "description": "Personal pi customizations (extensions, subagents, skills, prompts, themes) for the pi coding agent.",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -141,7 +141,7 @@ Check: `sudo -n -u specialist -H /usr/local/bin/specialist-cli arcane --caller t
141
141
  The `astro-discord` extension gives Discord users access to the specialists from a channel. It runs in a headless Pi host on Cortex (LaunchAgent `com.astrofoundry.astro-discord`, user `cortex`), never in interactive sessions.
142
142
 
143
143
  - Channels are configured one by one (`channels.<id>`): `trigger` is `always` (every message that names a specialist counts) or `mention` (only messages that start with `@Cortex` or reply to the bot); `specialists` is `*` or a list. A channel with one specialist needs no prefix: every message there is a task for it. In a channel with several, `dns list the zones` names the specialist; an addressed message without a name gets a reply asking for one. Threads inherit their parent channel's entry; unlisted channels are ignored. The bot replies at once with "<specialist> is working on your task" and shows the typing indicator until the answer replaces that reply. Reactions on your message: ⏳ running, 🔒 waiting for an owner's approval, ✅ done, ❌ failed. `help` shows the specialists you may use in that channel and the commands (`status` lists running tasks; owners in the admin channel also see the `config` commands). Each channel and specialist has one conversation: a reply to the bot's answer, or another task for that specialist within 30 minutes, continues it with everything the specialist saw before; otherwise a new one starts, and a task beginning with `new` forces that. Replied-to and forwarded messages (text, embeds, attachment names) travel with the task, so "check this" on a forwarded alert works. Image attachments on the message or on what it quotes (up to 4, 8 MiB each) are downloaded and passed to the specialist, which sees them; other file types are named only. Sessions live under `~/.config/astro-discord/sessions/<specialist>/` and are deleted after 7 days. Long answers arrive as a `.md` attachment. When the bridge restarts, open approval requests are marked cancelled and running tasks interrupted in Discord; ask again. Scheduled reports are a list in the config, one entry per report: `"reports": [{ "report": "arcane", "channelId": "<id>", "time": "06:00", "timeZone": "Europe/Madrid" }, { "report": "tools", "channelId": "<admin channel id>", "time": "06:00", "timeZone": "Europe/Madrid" }]` (the earlier single `dailyReport` key is refused; move it into the list). The Arcane report posts an "Arcane Daily Report:" message every morning from a fresh `update-report`: one section per stack with updates, each service as current to target version with the kind of change, a release-notes verdict on every major version, and an Update button per stack that only owners can press (it runs `arcane stack-update <stack>`; the button turns into the outcome and the reason arrives as a note only the clicker sees). Stacks held in `update-holds.json` at the root of the arcane GitOps repository (`{ "supabase": "coordinated release: review first" }`) show the reason and get no button. Replying to the report asks the arcane specialist with the report as context. The tools report posts "Cortex Tools Report:": every tool on Cortex with a newer version (Homebrew packages installed on request and casks, Pi, pi-astro, and through `specialist-install` the wrappers, arcane-cli at the Arcane server's version, trendarr, and the specialist Node at the latest LTS), a release-notes verdict from `astro.release-reviewer` for the tools the specialists build on, an Update button per line, and one Upgrade everything for Homebrew. Only owners can press them; nothing is installed otherwise. After an update that needs it, the bridge, herdr, or Astrogate restarts as soon as nothing runs on it; after a day of waiting, a Restart now button appears. The bridge calls `sudo -n /usr/local/sbin/specialist-install` through the sudoers rule from step 4.
144
- - Media: where the `media` specialist is present (`config channel <#channel> always media`), `/trending [type] [min_rating] [count]`, `/search <title> [type]`, and `/downloads <status|pause|resume|unpause>` run the wrapper without a model. Lists arrive as two messages, Movies and Series, each title with a button beside it: **Add** adds it at once and turns into Added, In library, or Not found (Retry after a failure); a greyed-out In library or No IMDb ID button needs nothing. Notes go only to the user who clicked; when downloads are paused, the note has an **Unpause** button. When the media specialist adds a title by name and downloads stay paused, the bridge posts "⏸️ Downloads are paused" with Unpause under its answer; a click resumes the queue and the message names who resumed it. Owners and `access.media` users may use them; anyone else gets a refusal only they see, and in a channel without `media` the bot names the channels that have it. Plain messages in the channel still go to the agent, for requests by name ("add the new Dune"). A `media-weekly` report entry posts the weekly picks there every Friday at its time: three movies and three series from `recommend`, each with the library titles that led to it, an Add button, and a Not interested button; the owners are tagged when there is something new. A pick nobody acts on stays out for six months; Not interested keeps it out for good (`media-picks.json`). At startup the bridge sets the three commands as the application's global commands (servers only).
144
+ - Media: where the `media` specialist is present (`config channel <#channel> always media`), `/trending [type] [min_rating] [count]`, `/search <title> [type]`, and `/downloads <status|pause|resume|unpause>` run the wrapper without a model. `/downloads` answers "⏸️ Downloads are paused" with an Unpause button, or "▶️ Downloads are running"; no answer names the tool behind it. Lists arrive as two messages, Movies and Series, each title with a button beside it: **Add** adds it at once and turns into Added, In library, or Not found (Retry after a failure); a greyed-out In library or No IMDb ID button needs nothing. Notes go only to the user who clicked; when downloads are paused, the note has an **Unpause** button. When the media specialist adds a title by name and downloads stay paused, the bridge posts "⏸️ Downloads are paused" with Unpause under its answer; a click resumes the queue and the message names who resumed it. Owners and `access.media` users may use them; anyone else gets a refusal only they see, and in a channel without `media` the bot names the channels that have it. Plain messages in the channel still go to the agent, for requests by name ("add the new Dune"). A `media-weekly` report entry posts the weekly picks there every Friday at its time: three movies and three series from `recommend`, each with the library titles that led to it, an Add button, and a Not interested button; the owners are tagged when there is something new. A pick nobody acts on stays out for six months; Not interested keeps it out for good (`media-picks.json`). At startup the bridge sets the three commands as the application's global commands (servers only).
145
145
  - Arcane manager: when the morning Arcane Daily Report shows a newer manager release, the `arcane` section carries an **Upgrade Arcane to vX** button. Only an owner's click on the newest report runs `arcane manager-upgrade <version>` through the entry point (one at a time, counted as open work so no bridge restart interrupts it); the button turns into the outcome, a reply gives the result, and a successful upgrade installs the matching `arcane-cli` with `specialist-install`.
146
146
  - Access: `owners` may use every specialist and decide approvals; `access.<specialist>` lists extra users for that specialist; everyone else gets no reply. Owners change the configuration from the admin channel (`adminChannelId`) without a shell: `config show`, `config channel <#channel> <always|mention> <*|dns,edge>`, `config channel <#channel> remove`, `config access <specialist> add|remove <@user>`; the bot writes `~/.config/astro-discord/config.json` on Cortex, which is also editable by hand and re-read on every message. Deny the bot's role View Channel on channels it must never read; that is the boundary the map cannot provide.
147
147
  - Approvals: a risky call (anything with `--confirm`, plus writes such as record or zone deletes, Zitadel changes, Pomerium deploys, service restarts, and on Arcane destructive actions: `down`, deletes, prunes, image, volume, or network removal, `system upgrade`, `gitops delete`, plus `manager-upgrade`, `manager-rollback`, `host db-restore`, and the Radarr host-config reads; `stack-update` asks only across a major version, through its `--confirm`; an owner's Update click on the report needs no approval; help lookups never ask) pauses the specialist and posts Approve/Deny buttons; only owners' clicks count; no decision within `approvalTimeoutMinutes` denies it. The specialist then reports the denial. Ambiguous tasks get a question back instead of an action.