/
outbreak
/
kilocode
Обзор
Документация
Войти
/
outbreak
/
kilocode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/activate/humanRelay.ts
26 строк
848 B
cte
Follow the established pattern for command registration
10 мар 2025, 21:12
10 мар 2025, 21:12
5a3c207
Код
Авторство
О чём код?
// Callback mapping of human relay response. const humanRelayCallbacks = new Map<string, (response: string | undefined) => void>() /** * Register a callback function for human relay response. * @param requestId * @param callback */ export const registerHumanRelayCallback = (requestId: string, callback: (response: string | undefined) => void) => humanRelayCallbacks.set(requestId, callback) export const unregisterHumanRelayCallback = (requestId: string) => humanRelayCallbacks.delete(requestId) export const handleHumanRelayResponse = (response: { requestId: string; text?: string; cancelled?: boolean }) => { const callback = humanRelayCallbacks.get(response.requestId) if (callback) { if (response.cancelled) { callback(undefined) } else { callback(response.text) } humanRelayCallbacks.delete(response.requestId) } }