import type { Readable, Writable } from 'node:stream'; import type { ContextSessionState } from '../contracts/context-session.js'; import { compareRefs } from '../infrastructure/time-travel.js'; import { startGraphAutoRefreshInBackground } from '../infrastructure/background-auto-refresh.js'; import { type ResourceSessionState } from './stdio/resources.js'; type McpLogLevel = 'debug' | 'info' | 'notice' | 'warning' | 'error' | 'critical' | 'alert' | 'emergency'; /** Per-session record of node ids already shipped to a given `delta_session_id`. * Used by the context_pack delta surface (#81) so subsequent calls return * only nodes the agent hasn't already received. */ type ContextPackNodeIdStore = Map>; type ContextPackCacheStore = Map; interface StdioSessionState extends ResourceSessionState { logLevel: McpLogLevel; contextPromptSessions?: Map; contextPackHandles?: Map; contextPackCache?: ContextPackCacheStore; /** Slice #81 — per-delta-session node ids already shipped. */ contextPackNodeIds?: ContextPackNodeIdStore; } interface StdioToolOverrides { compareRefs?: typeof compareRefs; } interface StdioResponse { jsonrpc: '2.0'; id: string | number | null; result?: unknown; error?: { code: number; message: string; data?: Record; }; } export interface ServeGraphStdioOptions { graphPath: string; /** Reconcile once and watch the selected workspace for this MCP process. */ autoRefresh?: boolean; /** Source root selected when the MCP process was launched. */ workspaceRoot?: string; /** Internal/testing override for the filesystem change debounce. */ autoRefreshDebounceSeconds?: number; input?: Readable; output?: Writable; errorOutput?: Writable; /** Internal/testing seam for the production background auto-refresh launcher. */ autoRefreshStarter?: typeof startGraphAutoRefreshInBackground; /** Internal/testing override for how long graph-backed requests await reconciliation. */ autoRefreshRequestWaitMs?: number; logger?: { log(message?: string): void; error(message?: string): void; }; } export declare function handleStdioRequest(graphPath: string, payload: unknown, sessionState?: StdioSessionState, toolOverrides?: StdioToolOverrides): StdioResponse | Promise | null; export declare function serveGraphStdio(options: ServeGraphStdioOptions): Promise; export {};