/** * Tool merge helper for observability MCP plugin slots (Sprint 16). * * At diagnoser spawn time, the orchestrator calls mergeObsTools(providers) to: * 1. Start every enabled provider in parallel (ExternalMcpServer.start()). * 2. Enumerate each provider's tools (ExternalMcpServer.listTools()). * 3. Namespace each tool as obs____. * 4. Return the merged list, running servers, and a failure map. * * Provider failures are isolated via Promise.allSettled — a single failure * does NOT abort the whole merge. The diagnoser spawns with whatever providers * succeeded; failed providers appear only in the `failures` record and a warning * is written to stderr. * * SECURITY: error messages contain only the provider NAME and a sanitized error * string. The provider's mcpEnv (which may contain API tokens) is NEVER logged * or included in returned error values. * * Sprint 24 will import mergeObsTools and stopAll from this module at the * /bober-incident spawn site. This module intentionally takes ONLY the providers * array — not projectRoot or BoberConfig — so Sprint 24 can inject it freely. * * Downstream sprint notes: * - Sprint 22 (SLO verification) uses obs____query_metric — the * namespace convention obs____ is stable. * - Sprint 28 (telemetry) must NOT include observability MCP response bodies in * telemetry events. The sanitizeError helper here sets the precedent: redact * env var patterns before any external logging boundary. */ import type { ObservabilityProvider } from "../../config/schema.js"; import type { ToolDescriptor } from "../../mcp/external-client.js"; import { ExternalMcpServer } from "../../mcp/external-client.js"; export type { ToolDescriptor }; /** A tool that has been namespaced for the diagnoser's tool list. */ export interface NamespacedTool extends ToolDescriptor { /** Original tool name as reported by the upstream server. */ upstreamName: string; /** Provider name (alphanumeric/underscore). */ providerName: string; } export interface MergeResult { /** Tools successfully merged in obs____ form. */ tools: NamespacedTool[]; /** Running servers (caller must call stopAll on diagnoser exit). */ servers: ExternalMcpServer[]; /** Provider name → sanitized error message for providers that failed to start/list. */ failures: Record; } /** Produce the canonical `obs____` namespaced name. */ export declare function namespaceToolName(providerName: string, toolName: string): string; /** * Start every enabled provider in parallel and merge their tool lists. * Provider failures are isolated — a failure in one does NOT prevent others. * * Uses Promise.allSettled (NOT Promise.all) so partial failure never aborts * the entire batch. See Pattern C in the Sprint 16 briefing. * * SECURITY: error messages contain only the provider NAME and a sanitized * error string. The provider's mcpEnv (which may contain secrets) is * never logged. * * @param providers - The observability.providers array from bober.config.json. * Callers should pass `config.observability?.providers ?? []`. */ export declare function mergeObsTools(providers: readonly ObservabilityProvider[]): Promise; /** * Stop every server in parallel. Errors are isolated; each server implements * SIGTERM → 5s → SIGKILL internally (s16-c3). * * Callers MUST invoke this when the diagnoser exits to prevent zombie processes. */ export declare function stopAll(servers: readonly ExternalMcpServer[]): Promise; //# sourceMappingURL=merge.d.ts.map