import type { CompatibleRequestHandlerExtra, MCPAnalyticsData, MCPRequestLike, MCPServerLike, SessionInfo } from '../types'; /** * The revision that removed protocol-level sessions. A request declaring this or * anything later must not be answered with an `Mcp-Session-Id`. * * Compared as a string, which is safe and stable because MCP revisions are * ISO dates: any future revision sorts above this one and is treated as modern, * which is the right default — sessions were removed, not re-added. */ export declare const MODERN_PROTOCOL_REVISION = "2026-07-28"; /** * Whether *this request* is governed by 2026-07-28 or later. * * Era is a property of the request, never of the installed SDK: one v2 server * serves both, request by request, and v2's exported `LATEST_PROTOCOL_VERSION` * still reads `2025-11-25`. So the version is resolved from the request itself — * an `initialize` body declares the version it is asking for, and every other * request carries it in the envelope, `_meta`, or the `MCP-Protocol-Version` * header — and only then compared. * * Unknown means legacy. A request that declares nothing is a v1 client on a * transport that has always had a session header, and taking it away from them * would be the regression. */ export declare function isModernEraRequest(request: MCPRequestLike, extra?: CompatibleRequestHandlerExtra, server?: MCPServerLike): boolean; export declare function newSessionId(): string; /** * Derives the SDK session id deterministically from the MCP sessionId, so the * same MCP session correlates to one SDK session across server restarts. */ export declare function deriveSessionIdFromMCPSession(mcpSessionId: string): string; /** * Derives the SDK session id from the agent's conversation handle (ADR-0004). * Deterministic and unsalted on purpose: two pods that never met must agree on * the session, and the 2026-07-28 revision leaves them no shared state to agree * through. * * Hashed rather than used verbatim so an MCP session can never collide with a * Session Replay id — a bare uuidv7 would render a "View recording" button that * resolves to nothing. * * Exported because this *is* the cross-SDK contract: posthog-python has to * reproduce it byte for byte or the same conversation splits into two sessions * depending on which SDK served the call. */ export declare function deriveSessionIdFromConversation(conversationId: string): string; /** * Resolves the session id for a request. Three steps, first match wins: * * 1. the agent carried a `conversation_id` tool argument — 2026-07-28 * 2. the request carried a session id — 2025-11-25 * 3. nothing was carried, so reuse this instance's own id — stdio * * The split mirrors the two protocol revisions. 2026-07-28 removed protocol-level * sessions, so the only thing that can carry a session across calls is the agent * itself (1). 2025-11-25 kept the session on the connection, so the request * carries it (2). 3 is for stdio, where neither applies — there is no * HTTP request to carry anything, and no agent handle unless the host opted in. */ export declare function getSessionId(server: MCPServerLike, extra?: CompatibleRequestHandlerExtra, conversationId?: string): string; /** * Builds the session metadata stamped onto an event. The caller passes the * session id resolved for *this* request so identity attribution can't be * clobbered by a concurrent request mutating shared `data.sessionId`. */ export declare function getSessionInfo(server: MCPServerLike, data: MCPAnalyticsData | undefined, sessionId?: string): SessionInfo; //# sourceMappingURL=session.d.ts.map