import { CAPABILITIES, getOnboardingFlow } from "../services/onboarding-flow.mjs";
//#region extensions/crypto/src/commands/onboarding-commands.ts
/**
* Onboarding slash commands — tappable options for persona, capabilities, and skip.
*
* These let users tap instead of type during the onboarding flow.
* Each command calls into the OnboardingFlow state machine and returns
* the response text. OpenClaw's command system handles sending it.
*/
/** Helper: extract sender ID from command context. */
function getSenderId(ctx) {
	return ctx?.senderId ?? ctx?.from ?? ctx?.metadata?.senderId ?? "unknown";
}
function makePersonaCommand(id, label, description) {
	return {
		name: id,
		description: `Set communication style: ${description}`,
		acceptsArgs: false,
		requireAuth: true,
		handler: async (ctx) => {
			const response = getOnboardingFlow(getSenderId(ctx)).onPersonaSelected(id);
			if (response) return { text: response.text };
			return { text: `${label} persona noted. (You can change this anytime with /${id})` };
		}
	};
}
const professionalCommand = makePersonaCommand("professional", "Professional", "Clear, concise, business-like");
const degenCommand = makePersonaCommand("degen", "Degen", "CT native, crypto twitter energy");
const chillCommand = makePersonaCommand("chill", "Chill", "Relaxed, like texting a friend");
const technicalCommand = makePersonaCommand("technical", "Technical", "Data-heavy, on-chain metrics");
const mentorCommand = makePersonaCommand("mentor", "Mentor", "Educational, explains as it goes");
const capAllCommand = {
	name: "all",
	description: "Select all capabilities during onboarding",
	acceptsArgs: false,
	requireAuth: true,
	handler: async (ctx) => {
		const response = getOnboardingFlow(getSenderId(ctx)).onCapabilitiesSelected("all");
		if (response) return { text: response.text };
		return { text: "All capabilities enabled." };
	}
};
function makeCapCommand(capId, name) {
	return {
		name: `cap_${capId}`,
		description: `Select capability: ${name}`,
		acceptsArgs: false,
		requireAuth: true,
		handler: async (ctx) => {
			const flow = getOnboardingFlow(getSenderId(ctx));
			const idx = CAPABILITIES.findIndex((c) => c.id === capId);
			if (idx < 0) return { text: `Unknown capability: ${capId}` };
			const response = flow.onCapabilitiesSelected(String(idx + 1));
			if (response) return { text: response.text };
			return { text: `${name} enabled.` };
		}
	};
}
const capCommands = CAPABILITIES.map((c) => makeCapCommand(c.id, c.name));
const createWalletCommand = {
	name: "create_wallet",
	description: "Generate a new encrypted wallet (stored locally)",
	acceptsArgs: false,
	requireAuth: true,
	handler: async (ctx) => {
		const response = await getOnboardingFlow(getSenderId(ctx)).onCreateWallet();
		if (response) return { text: response.text };
		return { text: "Wallet creation is only available during the wallet connection step. Use /connect for other wallet options." };
	}
};
const importWalletCommand = {
	name: "import_wallet",
	description: "Import wallet from a 12/24-word seed phrase",
	acceptsArgs: false,
	requireAuth: true,
	handler: async (ctx) => {
		const response = getOnboardingFlow(getSenderId(ctx)).onImportWallet();
		if (response) return { text: response.text };
		return { text: "Wallet import is only available during the wallet connection step. Use /connect for other wallet options." };
	}
};
const backCommand = {
	name: "back",
	description: "Go back one step during onboarding",
	acceptsArgs: false,
	requireAuth: true,
	handler: async (ctx) => {
		const flow = getOnboardingFlow(getSenderId(ctx));
		if (flow.isActive) {
			const response = flow.back();
			if (response) return { text: response.text };
			return { text: "Can't go back from the current step." };
		}
		return { text: "No active onboarding. Use /help to see available commands." };
	}
};
const skipCommand = {
	name: "skip",
	description: "Skip the onboarding tutorial",
	acceptsArgs: false,
	requireAuth: true,
	handler: async (ctx) => {
		const flow = getOnboardingFlow(getSenderId(ctx));
		if (flow.isActive) return { text: flow.skip().text };
		return { text: "No active onboarding to skip." };
	}
};
const restartCommand = {
	name: "reonboard",
	description: "Restart the onboarding tutorial from the beginning",
	acceptsArgs: false,
	requireAuth: true,
	handler: async (ctx) => {
		return { text: getOnboardingFlow(getSenderId(ctx)).restart().text };
	}
};
//#endregion
export { backCommand, capAllCommand, capCommands, chillCommand, createWalletCommand, degenCommand, importWalletCommand, mentorCommand, professionalCommand, restartCommand, skipCommand, technicalCommand };

//# sourceMappingURL=onboarding-commands.mjs.map