histoire
Version:
A fast story book powered by Vite
23 lines • 1.63 kB
TypeScript
import type { UiMcpOperationInfo, UiMcpSnapshot } from '@histoire/shared';
import type { Context } from '../../context.js';
import type { McpRuntimeController } from '../project/dev-facade.js';
/** Dev-only safe MCP observation exposed to the websocket channel. */
export interface DevMcpObserver {
/** Current listener and bounded activity projections. */
snapshot: () => UiMcpSnapshot;
/** Snapshot changes for listener policy, restart, and connected clients. */
onClientChange: (listener: (snapshot: UiMcpSnapshot) => void) => () => void;
/** Upserts for safe operation lifecycle changes. */
onOperationChange: (listener: (operation: UiMcpOperationInfo) => void) => () => void;
/** Uses existing principal and runtime ownership validation before cancellation. */
cancelFromUi: (operationId: string) => unknown;
}
/** Bind observation to one context without keeping retired runtime contexts alive. */
export declare function attachMcpObserver(context: Context, observer: DevMcpObserver): () => void;
/** Read only the observer owned by this exact dev runtime context. */
export declare function getMcpObserver(context: Context): DevMcpObserver;
/** Observe late MCP startup on a channel whose Vite server already exists. */
export declare function onMcpObserverChange(context: Context, listener: (observer?: DevMcpObserver) => void): () => void;
/** Share exact current-context attachment across dev HTTP and stdio runtimes. */
export declare function bindMcpObserver(controller: McpRuntimeController, observer: DevMcpObserver, reset: () => void): () => void;
//# sourceMappingURL=context.d.ts.map