/** * MCP resources for Brains wiki pages (GH #564 / BRA-3466). * * Before this, `src/server.ts` declared `capabilities: { tools: {} }` — * tools only. A page could only be reached by calling a tool that dumped * its text into the conversation; there was nothing a human could list or * open directly. This module implements `resources/list` and * `resources/read` on top of the existing `listPages`/`readPage` tool * logic, so a resource can never expose more than the equivalent tool call * already would — same auth context, same governance/grant scoping. * * Addressing: `brains://page/{name}`, where `{name}` is the page's * URI-encoded relative path (the same identifier `read_page`/`update_page` * already use). Storage's `fileId` is NOT a stable identifier independent * of path — for both LocalClient and the Supabase client, `fileId === name` * and `renameFile` changes it (see src/storage/client.ts). A durable, * rename-surviving resource ID would need a real stable-ID column in * storage, which is out of scope here (storage is a CODEOWNERS-gated * surface — see .github/CODEOWNERS). Per the issue's acceptance criterion, * the fallback is an EXPLICIT failure on a stale URI rather than a silent * 404 or wrong content: `readPageResource` surfaces the same * `DriveNotFoundError` `read_page` would for a renamed/missing page, with * the page name in the message. Tracked as follow-up scope, not silently * dropped. */ import type { StorageClient } from "./storage/client.js"; import { type AccessContext } from "./governance/accessControl.js"; export declare const PAGE_RESOURCE_URI_PREFIX = "brains://page/"; export declare function pageNameToResourceUri(name: string): string; export declare function resourceUriToPageName(uri: string): string; /** Registered with `resources/templates/list` so a client can address any page without enumerating first. */ export declare const PAGE_RESOURCE_TEMPLATE: { uriTemplate: string; name: string; title: string; description: string; mimeType: string; }; export interface PageResourceEntry { uri: string; name: string; title?: string; mimeType: string; } /** * Enumerates every page the caller can see as an MCP resource, by paging * through `listPages` (which already applies the same governance/grant * scoping `read_page` does) until exhausted. */ export declare function listPageResources(drive: StorageClient, userId?: string, accessCtx?: AccessContext): Promise; export interface PageResourceContent { uri: string; mimeType: string; text: string; } /** * Reads a page through the same `readPage` path the `read_page` tool uses, * so a resource can never surface content or bypass a governance check that * `read_page` would have blocked. */ export declare function readPageResource(drive: StorageClient, uri: string, userId?: string, accessCtx?: AccessContext): Promise; //# sourceMappingURL=resources.d.ts.map