function agentLabel(session) {
    return `${session.provider}: ${session.title || session.provider}`;
}
function messageFor(kind, projectName, session) {
    const label = `${projectName}: ${agentLabel(session)}`;
    if (kind === 'waiting_for_approval') {
        return `${label} is waiting for approval.`;
    }
    return `${label} is done.`;
}
export class TelegramNotifier {
    async notify(settings, kind, projectName, session) {
        const token = settings.telegramBotToken?.trim();
        const chatId = settings.telegramChatId?.trim();
        if (!token || !chatId)
            return;
        const response = await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
            method: 'POST',
            headers: { 'content-type': 'application/json' },
            body: JSON.stringify({
                chat_id: chatId,
                text: messageFor(kind, projectName, session),
                disable_web_page_preview: true
            })
        });
        if (!response.ok) {
            throw new Error(`Telegram API returned ${response.status}`);
        }
    }
}
//# sourceMappingURL=telegram-notifier.js.map