class InterventionRunResumeRegistry {
    chatHandlers = new Map();
    threadHandlers = new Map();
    registerChatSession(sessionId, handler) {
        this.chatHandlers.set(sessionId, handler);
        return () => {
            if (this.chatHandlers.get(sessionId) === handler) {
                this.chatHandlers.delete(sessionId);
            }
        };
    }
    registerThread(threadId, handler) {
        this.threadHandlers.set(threadId, handler);
        return () => {
            if (this.threadHandlers.get(threadId) === handler) {
                this.threadHandlers.delete(threadId);
            }
        };
    }
    async resumeChatSession(sessionId, message) {
        const handler = this.chatHandlers.get(sessionId);
        if (!handler)
            return { status: "not-running" };
        try {
            return await handler(message);
        }
        catch (error) {
            return {
                status: "error",
                error: error instanceof Error ? error.message : String(error),
            };
        }
    }
    async resumeThread(threadId, message) {
        const handler = this.threadHandlers.get(threadId);
        if (!handler)
            return { status: "not-running" };
        try {
            return await handler(message);
        }
        catch (error) {
            return {
                status: "error",
                error: error instanceof Error ? error.message : String(error),
            };
        }
    }
    clearForTests() {
        this.chatHandlers.clear();
        this.threadHandlers.clear();
    }
}
export const interventionRunResumeRegistry = new InterventionRunResumeRegistry();
//# sourceMappingURL=intervention-run-resume.js.map