@nanocollective/nanocoder
Version:
A local-first CLI coding agent that brings the power of agentic coding tools like Claude Code and Gemini CLI to local models or controlled APIs like OpenRouter
25 lines • 985 B
JavaScript
// Global question queue - allows the ask_question tool to present
// interactive questions to the user via the UI.
//
// Pattern mirrors message-queue.tsx: a module-level singleton handler
// set by App.tsx, called from the tool's execute function.
// The handler set by App.tsx. It receives the question data and returns
// a Promise<string> that resolves when the user picks an answer.
let globalQuestionHandler = null;
/**
* Called once from App.tsx to wire up the UI handler.
*/
export function setGlobalQuestionHandler(handler) {
globalQuestionHandler = handler;
}
/**
* Called from the ask_question tool's execute function.
* Returns a Promise that resolves with the user's answer string.
*/
export async function signalQuestion(question) {
if (!globalQuestionHandler) {
return 'Error: Question handler not initialized. The UI is not ready to accept questions.';
}
return globalQuestionHandler(question);
}
//# sourceMappingURL=question-queue.js.map