eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
39 lines (38 loc) • 2 kB
TypeScript
import { type Asker, type SelectOption } from "../ask.js";
import type { ChannelKind, ChatPreference, SetupState } from "../state.js";
import type { SetupBox } from "../step.js";
/** The scaffolded facts the chat option list is derived from. */
export interface ChatPreferenceContext {
/** Channels scaffolded earlier in the flow; controls option visibility. */
availableChannels: ChannelKind[];
/** Whether the Slack app was attached to the channel route and is ready to use. */
slackbotAttached: boolean;
}
/**
* Builds the chat-preference option list. Channel-backed options come
* first (in the order Web -> Slack) when available, then the framework
* built-ins (Terminal UI, API), then the explicit skip option last. Exported
* for the unit test.
*/
export declare function buildChatPreferenceOptions(args: ChatPreferenceContext): SelectOption<ChatPreference>[];
export interface SelectChatOptions {
/** Resolves the chat question; the composed stack decides how. */
asker: Asker;
/**
* Resolve to this value without asking. The headless default ("skip") lives
* at the composition site, not here, so a missing headless preset fails
* fast. Stays a factory option (not a `withAnswers` rung) because a preset
* must keep bypassing the option list, which hides choices the current
* state did not scaffold, exactly as the dual-face box did.
*/
presetPreference?: ChatPreference;
}
/**
* THE CHAT BOX: final prompt of the create flow. Asks one required "chat"
* select through the box's asker: where the user wants to chat with their
* agent. Options are dynamic on what was scaffolded earlier. Web Chat appears
* only if `web` is in the scaffolded channels, Slack appears only if `slack`
* was scaffolded AND the bot was attached during the channel setup step.
* REPL, API, and Skip are always present.
*/
export declare function selectChat(options: SelectChatOptions): SetupBox<SetupState, ChatPreference, ChatPreference>;