searxng, icecast, photos: full nox modules (ADR 0044/0046)
searxng: a search tool — tools-only, a stateless search has nothing to observe. icecast: status tool, emits stream.started/.stopped by diffing live mountpoints. photos: status/albums/recent tools, emits item.added (immich-shaped API, coded defensively since the stub ships a placeholder image — flagged in the code). Typecheck; manifests parse.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// photos' tools (novox/hq ADR 0044), importing photos' own client.
|
||||
|
||||
import { registerModuleTools, type ToolDefinition } from "@novox/mesh-sdk/tools";
|
||||
import { PhotosClient } from "../client.js";
|
||||
|
||||
export function getPhotosTools(photos: PhotosClient): ToolDefinition[] {
|
||||
return [
|
||||
{
|
||||
name: "photos_status",
|
||||
description: "Photo library status: server version and, where the key allows, photo/video counts and storage used.",
|
||||
input: {},
|
||||
run: async () => {
|
||||
const [server, albums] = await Promise.all([photos.getServerInfo(), photos.getAlbums()]);
|
||||
return { server, albumCount: albums.length };
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "photos_albums",
|
||||
description: "List the albums in the photo library, each with its asset count and whether it is shared.",
|
||||
input: {},
|
||||
run: async () => {
|
||||
const albums = await photos.getAlbums();
|
||||
return { count: albums.length, albums };
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "photos_recent",
|
||||
description: "Most recently added assets in the photo library, newest first.",
|
||||
input: { limit: { type: "number", description: "how many assets (default 20)" } },
|
||||
run: async (args) => ({ items: await photos.getRecentAssets(args.limit ? Number(args.limit) : 20) }),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
// The tools exist only when an API key is configured; without one, photos contributes none rather
|
||||
// than reaching an unauthenticated endpoint or failing the whole runtime.
|
||||
registerModuleTools("photos", (env) => {
|
||||
try {
|
||||
return getPhotosTools(PhotosClient.fromEnv(env));
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user