//#region extensions/crypto/src/services/onboarding-flow.d.ts /** * OpenClawnch Onboarding Flow — first-run tutorial state machine. * * Detects new users and walks them through: * 1. Welcome — professional greeting with capabilities overview * 2. Persona selection — choose communication style (professional, degen, chill, etc.) * 3. Capabilities overview — show what's available, note what needs deploy-time config * 4. Wallet connect — pair a mobile wallet via deep link * 5. First read action — try a read-only query * 6. First write action — try a transaction (user approves on phone) * 7. Complete — command reference card * * All infrastructure config (LLM keys, WalletConnect project ID, etc.) is handled * at deploy time via `openclawnch deploy`. This flow only handles user preferences * and wallet pairing. * * State persists on volume so interrupted tutorials resume. */ type OnboardingStep = 'welcome' | 'choose_persona' | 'choose_capabilities' | 'connect_wallet' | 'create_wallet_confirm' | 'create_wallet_password' | 'import_wallet_mnemonic' | 'import_wallet_password' | 'wallet_connected' | 'first_read' | 'first_write' | 'complete' | 'skipped'; /** Preset personas the user can choose from. */ type PersonaId = 'professional' | 'degen' | 'chill' | 'technical' | 'mentor' | 'custom'; interface PersonaOption { id: PersonaId; label: string; description: string; /** Short example of how the bot would talk in this persona. */ example: string; } /** Capability categories that map to groups of tools. */ interface CapabilityCategory { id: string; name: string; description: string; tools: string[]; /** Env var that must be set at deploy time for this to work. Empty = works out of the box. */ deployRequirement?: string; /** Whether this capability requires a connected wallet. */ needsWallet: boolean; } interface OnboardingState { userId: string; step: OnboardingStep; /** Selected persona ID, or 'custom' with customPersona text. */ persona?: PersonaId; customPersona?: string; /** Selected capability category IDs. */ selectedCapabilities?: string[]; walletConnected: boolean; walletAddress?: string; firstReadDone: boolean; firstWriteDone: boolean; startedAt: number; completedAt?: number; lastInteraction: number; /** Transient: mnemonic during wallet creation (never persisted to disk). */ _pendingMnemonic?: string; /** Transient: confirmation words the user must verify. */ _pendingConfirmation?: Array<{ index: number; word: string; }>; /** Transient: imported mnemonic awaiting password. */ _pendingImportMnemonic?: string; } interface OnboardingMessage { text: string; /** Markdown format hint (channels that support it will render accordingly) */ parseMode?: 'HTML' | 'Markdown'; /** If true, include WalletConnect deep link */ showConnectLink?: boolean; /** Suggested next action for the user */ suggestion?: string; /** If true, this is the last onboarding message */ final?: boolean; } declare const PERSONAS: PersonaOption[]; declare const CAPABILITIES: CapabilityCategory[]; declare function loadState(userId: string): OnboardingState | null; declare function saveState(state: OnboardingState): void; declare class OnboardingFlow { private state; constructor(userId: string); /** Is this user still in the onboarding flow? */ get isActive(): boolean; /** Current step name. */ get currentStep(): OnboardingStep; /** Get the current state (read-only). */ getState(): Readonly; /** * Check if an incoming message is the user's first-ever message. * If so, return the welcome message. Otherwise return null. */ getWelcomeMessage(): OnboardingMessage | null; /** * Navigate back one step during onboarding. * choose_capabilities → choose_persona * connect_wallet → choose_capabilities * first_read → connect_wallet * Returns null if /back isn't applicable at the current step. */ back(): OnboardingMessage | null; /** Call when the user sends /skip-tutorial or /skip. */ skip(): OnboardingMessage; /** Reset onboarding to the beginning — shows the welcome message again. */ restart(): OnboardingMessage; /** * Process a persona selection from the user. */ onPersonaSelected(message: string): OnboardingMessage | null; /** * Process a capability selection from the user. * After selection, goes directly to wallet connect (if wallet capabilities selected) * or first_read (if no wallet needed). No guided setup step — all infrastructure * config is handled at deploy time. */ onCapabilitiesSelected(message: string): OnboardingMessage | null; /** * Start the "Create new wallet" flow. Generates a mnemonic and shows it. */ onCreateWallet(): Promise; /** * Process mnemonic confirmation words during wallet creation. */ onConfirmMnemonic(message: string): Promise; /** * Process password during wallet creation — encrypt and store. */ onSetWalletPassword(password: string): Promise; /** * Start the "Import existing wallet" flow — prompt for mnemonic. */ onImportWallet(): OnboardingMessage | null; /** * Process imported mnemonic — validate and ask for password. */ onImportMnemonic(message: string): Promise; /** * Process password during import — encrypt and store. */ onImportPassword(password: string): Promise; /** * Call when wallet connection succeeds. * Returns the "wallet connected" message with balance info. */ onWalletConnected(address: string, balance: string): OnboardingMessage | null; /** * Call after the agent successfully completes a read operation. * Returns the "try a write" message if we're on that step. */ onReadComplete(): OnboardingMessage | null; /** * Call after the agent successfully completes a write operation * (user approved the transaction). */ onWriteComplete(): OnboardingMessage | null; /** * Process an incoming message and return any onboarding-specific * response. Returns null if no onboarding action is needed. */ processMessage(message: string): OnboardingMessage | null | Promise; /** * Determine if the agent should trigger an onboarding response * after a tool call completes. Hook into after_tool_call. */ processToolResult(toolName: string, success: boolean): OnboardingMessage | null; } /** * Get (or create) the onboarding flow for a user. * The userId should be the sender ID from any channel (Telegram, Discord, etc.). */ declare function getOnboardingFlow(userId: string): OnboardingFlow; /** * Check if a user is new (no persisted state). */ declare function isNewUser(userId: string): boolean; /** * Clear in-memory flow cache. Used in tests. */ declare function resetOnboardingFlows(): void; //#endregion export { CAPABILITIES, CapabilityCategory, OnboardingFlow, OnboardingMessage, OnboardingState, OnboardingStep, PERSONAS, PersonaId, PersonaOption, getOnboardingFlow, isNewUser, loadState, resetOnboardingFlows, saveState }; //# sourceMappingURL=onboarding-flow.d.mts.map