Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline (Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/* packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
27 lines
918 B
TypeScript
27 lines
918 B
TypeScript
import { abortableDelay } from "@rakazo/core";
|
|
|
|
/** Delay before the setup focus card for a non-first bot. */
|
|
export const FOCUS_PROMPT_DELAY_MS = 10_000;
|
|
|
|
/**
|
|
* Schedule posting the focus choice card. First bot shows immediately; later
|
|
* bots wait so the user can type freely. Abort the signal to cancel when the
|
|
* user has already engaged (sent a message, dismissed, or left the thread).
|
|
*/
|
|
export async function scheduleFocusPrompt(options: {
|
|
immediate: boolean;
|
|
signal: AbortSignal;
|
|
prompt: () => Promise<void>;
|
|
}): Promise<"prompted" | "cancelled"> {
|
|
if (options.signal.aborted) return "cancelled";
|
|
const delayMs = options.immediate ? 0 : FOCUS_PROMPT_DELAY_MS;
|
|
try {
|
|
await abortableDelay(delayMs, options.signal);
|
|
} catch {
|
|
return "cancelled";
|
|
}
|
|
if (options.signal.aborted) return "cancelled";
|
|
await options.prompt();
|
|
return options.signal.aborted ? "cancelled" : "prompted";
|
|
}
|