Files
hermes-agent/apps/desktop/src/store/clarify.ts
T
2026-05-02 03:19:39 -05:00

33 lines
816 B
TypeScript

import { atom } from 'nanostores'
export interface ClarifyRequest {
requestId: string
question: string
choices: string[] | null
sessionId: string | null
}
// Holds the request_id (and metadata) for the most recent in-flight
// clarify call. The inline ClarifyTool component (rendered inside the
// assistant message stream) reads this to know which request_id to send
// back over `clarify.respond`.
export const $clarifyRequest = atom<ClarifyRequest | null>(null)
export function setClarifyRequest(request: ClarifyRequest): void {
$clarifyRequest.set(request)
}
export function clearClarifyRequest(requestId?: string): void {
const current = $clarifyRequest.get()
if (!current) {
return
}
if (requestId && current.requestId !== requestId) {
return
}
$clarifyRequest.set(null)
}