plex, redis: module runtime containers + declare self-consumed events (ADR 0052/0046)
plex gains a broker-bound tools/events runtime container (mesh-runtime-plex) alongside its server, and a never-throwing plex_reachable health probe. redis and postgres subscribe to their own lifecycle events in index.ts but declared no consumes — so the substrate never made the queue the runtime binds and it crashed on start (404). Declare the consume, as ADR 0046 requires. Proven end-to-end in the mesh-lab: assigned-plex and assigned-redis both green. Claude-Session: https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF
This commit is contained in:
@@ -128,4 +128,18 @@ export class PlexClient {
|
||||
async refreshAll(): Promise<void> {
|
||||
for (const library of await this.getLibraries()) await this.refreshLibrary(library.key);
|
||||
}
|
||||
|
||||
/**
|
||||
* A health probe that never throws: report whether the Plex server this client is pointed at
|
||||
* answers, and identify it when it does. Every other call assumes the server is up; this is the
|
||||
* one that tells the mesh whether it is, so a diagnosis does not start from a stack trace.
|
||||
*/
|
||||
async reachable(): Promise<{ reachable: boolean; url: string; server?: { name: string; version: string }; error?: string }> {
|
||||
try {
|
||||
const info = await this.getServerInfo();
|
||||
return { reachable: true, url: this.baseUrl, server: { name: info.name, version: info.version } };
|
||||
} catch (err) {
|
||||
return { reachable: false, url: this.baseUrl, error: err instanceof Error ? err.message : String(err) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,22 @@
|
||||
"/services/media/music:/music",
|
||||
"/services/media/audiobooks:/audiobooks"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "runtime",
|
||||
"type": "container",
|
||||
"name": "mesh-plex",
|
||||
"image": "mesh-runtime-plex@sha256:0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"network": "host",
|
||||
"volumes": [
|
||||
"/var/lib/mesh/plex/broker:/run/secrets/broker:ro",
|
||||
"/services/plex/config:/var/lib/plex/config:ro"
|
||||
],
|
||||
"env": {
|
||||
"MESH_BROKER_FILE": "/run/secrets/broker",
|
||||
"MESH_PLEX_URL": "http://127.0.0.1:32400",
|
||||
"MESH_PLEX_DATA_DIR": "/var/lib/plex"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -20,6 +20,12 @@ export function getPlexTools(plex: PlexClient): ToolDefinition[] {
|
||||
return { server, libraries, sessions, recentlyAdded: recent };
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "plex_reachable",
|
||||
description: "Health probe: whether the Plex server answers, and which server it is. Never fails.",
|
||||
input: {},
|
||||
run: async () => plex.reachable(),
|
||||
},
|
||||
{
|
||||
name: "plex_search",
|
||||
description: "Search across all Plex libraries — movies, shows, episodes, music.",
|
||||
|
||||
Reference in New Issue
Block a user