import type { DebugSessionManager, SourceMapper, SdapiBreakpoint, SdapiScriptThread } from '@salesforce/b2c-tooling-sdk/operations/debug'; import type { CartridgeMapping } from '@salesforce/b2c-tooling-sdk/operations/code'; import type { ToolExecutionContext } from '../adapter.js'; export interface HaltWaiter { resolve: (thread: SdapiScriptThread) => void; reject: (error: Error) => void; timer: ReturnType; } export interface DebugSessionEntry { sessionId: string; hostname: string; clientId: string; manager: DebugSessionManager; sourceMapper: SourceMapper; cartridges: CartridgeMapping[]; breakpoints: SdapiBreakpoint[]; haltWaiters: HaltWaiter[]; createdAt: number; lastActivityAt: number; } export interface RegisterSessionOptions { hostname: string; clientId: string; manager: DebugSessionManager; sourceMapper: SourceMapper; cartridges: CartridgeMapping[]; } export declare class DebugSessionRegistry { private cleanupTimer; private readonly sessions; constructor(); destroyAll(): Promise; destroySession(sessionId: string): Promise; findByHostAndClientId(hostname: string, clientId: string): DebugSessionEntry | undefined; getSession(sessionId: string): DebugSessionEntry | undefined; getSessionOrThrow(sessionId: string): DebugSessionEntry; listSessions(): DebugSessionEntry[]; registerSession(opts: RegisterSessionOptions): DebugSessionEntry; /** * Wait for any thread in the session to halt. * * If a thread is already halted in the session's known threads, returns it * immediately. Otherwise registers a halt waiter that resolves when the * `onThreadStopped` callback fires, or returns null on timeout. */ waitForHalt(entry: DebugSessionEntry, timeoutMs: number): Promise; private cleanupIdleSessions; } /** * Resolve the registry from the tool execution context, throwing a clear * error if it's missing, then look up the session by ID. Used by every * debug tool that takes a session_id. */ export declare function getSessionEntry(context: ToolExecutionContext, sessionId: string): DebugSessionEntry; /** Resolve the registry from the tool context (for tools that don't need a specific session). */ export declare function getRegistry(context: ToolExecutionContext): DebugSessionRegistry;