@dollhousemcp/mcp-server
Version:
DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.
84 lines • 3.48 kB
TypeScript
/**
* Forwarding sinks for follower MCP servers.
*
* When a server becomes a follower in the unified console election, it
* registers these sinks with its LogManager and MetricsManager. Instead
* of broadcasting to local SSE clients, entries are batch-POSTed to
* the leader's ingestion endpoints.
*
* Features:
* - Batch buffering (50 entries or 1s flush, whichever comes first)
* - In-memory buffer up to 10,000 entries on leader failure
* - Exponential backoff on POST failure (1s → 2s → 4s, max 30s)
* - Automatic drain on leader recovery
*
* @since v2.1.0 — Issue #1700
*/
import type { ILogSink, UnifiedLogEntry } from '../../logging/types.js';
import type { MetricSnapshot } from '../../metrics/types.js';
import { type SessionClientPlatformId } from './sessionClientPlatform.js';
/**
* ILogSink that batch-POSTs entries to the leader's /api/ingest/logs.
*/
export declare class LeaderForwardingLogSink implements ILogSink {
private readonly leaderUrl;
private readonly sessionId;
/** Optional console auth token (#1780). Included as Bearer header on ingest POSTs. */
private readonly authToken;
/** Callback invoked when the leader is presumed dead after MAX_CONSECUTIVE_FAILURES (#1850). */
private readonly onLeaderDeath?;
private readonly buffer;
private flushTimer;
private backoffMs;
private flushing;
private consecutiveFailures;
private gaveUp;
constructor(leaderUrl: string, sessionId: string,
/** Optional console auth token (#1780). Included as Bearer header on ingest POSTs. */
authToken?: string | null,
/** Callback invoked when the leader is presumed dead after MAX_CONSECUTIVE_FAILURES (#1850). */
onLeaderDeath?: (() => void) | undefined);
write(entry: UnifiedLogEntry): void;
flush(): Promise<void>;
close(): Promise<void>;
private flushBuffer;
private requeueBatch;
private handleFailure;
}
/**
* Forwards metric snapshots to the leader's /api/ingest/metrics.
*/
export declare class LeaderForwardingMetricsSink {
private readonly leaderUrl;
private readonly sessionId;
/** Optional console auth token (#1780). Included as Bearer header on ingest POSTs. */
private readonly authToken;
constructor(leaderUrl: string, sessionId: string,
/** Optional console auth token (#1780). Included as Bearer header on ingest POSTs. */
authToken?: string | null);
onSnapshot(snapshot: MetricSnapshot): Promise<void>;
}
/**
* Sends session lifecycle events to the leader.
*/
export declare class SessionHeartbeat {
private readonly leaderUrl;
private readonly sessionId;
private readonly pid;
/** Optional console auth token (#1780). Included as Bearer header on ingest POSTs. */
private readonly authToken;
/** Explicit MCP host platform metadata for this runtime. */
private readonly clientPlatform;
private heartbeatTimer;
constructor(leaderUrl: string, sessionId: string, pid: number,
/** Optional console auth token (#1780). Included as Bearer header on ingest POSTs. */
authToken?: string | null,
/** Explicit MCP host platform metadata for this runtime. */
clientPlatform?: SessionClientPlatformId | null);
/** Notify the leader that this session has started */
start(): Promise<void>;
/** Notify the leader that this session is stopping */
stop(): Promise<void>;
private sendEvent;
}
//# sourceMappingURL=LeaderForwardingSink.d.ts.map