import { type PrincipalsCache } from '@nacre.work/api'; import { type Config } from '@nacre.work/core'; import { postgresVerification, type UploadTicketStore } from '@nacre.work/api'; import type { Pool } from 'pg'; import { type AdminRunner } from './admin-services.js'; import { type Layers, type SkillSource, type ToolRunner } from './factory.js'; /** * Everything behind the MCP tools, independent of how a client reached us. * * Built once and shared by both transports. Streamable HTTP and STDIO differ in * how a request arrives and how the caller is authenticated, and in nothing * else — a second copy of the tool bodies would be a second place for the * permission rules to drift, which is the failure docs/mcp.md is written * against. */ export declare const APP_ROLE = "nacre_app"; export interface Services { readonly pool: Pool; /** * The database-backed halves of `VerifyOptions`: service account keys, which * is what local mode authenticates with, and the delegation lookup a * delegated token is checked against on every request. * * One object from one function rather than a field per port, so a port added * to a Postgres verifier arrives on both transports instead of on whichever * the author remembered. See the API's verification.ts. */ readonly verification: ReturnType; readonly layers: Layers; readonly tools: ToolRunner; readonly skills: SkillSource; /** The administrative MCP's tools. Served on Streamable HTTP only. */ readonly admin: AdminRunner; } /** * Upload tickets, as the MCP surface needs them: the store, and where a * ticket's URL points — the **API's** canonical origin, never this transport's, * because the ticket is redeemed on the API by whoever holds the bytes. */ export interface UploadTickets { readonly store: UploadTicketStore; readonly baseUrl: string; readonly maxBytes: number; } /** * The layer catalog, per caller. * * It runs the same resolve() the search does and lists only what the plan * reaches. The catalog is permission data — a layer name is a fact about the * organization — which is why tools/list is cached per user and never * globally. * * Through `contextFor`, which is what puts a delegation's **ceiling** into the * resolve input, and narrowed by the delegation's **narrowing** before the * statement. It built its own input with neither, so a connection narrowed to * layer L was listed M too — name, description, document count — and a * `{write}` connection was listed every layer its person reads, while * `GET /v1/layers` answered the same token with the ceiling applied. Every * other resolve input in the product came from `contextFor`; this one was the * fourth copy its own comment said a compile error would catch. T40. * * Exported so the authorization suite can ask it directly, rather than * through a server whose other halves it would have to stub. */ export declare function layerCatalog(pool: Pool, principalsCache?: PrincipalsCache): Layers; export declare function buildServices(config: Config, options?: { principalsCache?: PrincipalsCache; uploads?: UploadTickets; }): Services; //# sourceMappingURL=services.d.ts.map