UNPKG

@kya-os/cli

Version:

CLI for MCP-I setup and management

138 lines (126 loc) 4.69 kB
/** * Claim Experience Component * Clean, professional claim interface with vertical draw-down effect */ import chalk from "chalk"; import gradient from "gradient-string"; import boxen from "boxen"; /** * Simple KYA logomark without complex characters */ const SIMPLE_KYA_LOGO = ` ╭───╮ ╭───╮ ╱ ╲─────╱ ╲ │ ● │ ◊ │ ● │ ╲ ╱─────╲ ╱ ╰───╯ ╰───╯ KNOW YOUR AI `; /** * Create clean claim interface without broken formatting */ export async function createAmazingClaimExperience(claimUrl, agentData, status = "unclaimed") { // Clean, readable colors const headerColor = chalk.bold.cyan; const labelColor = chalk.bold.white; const valueColor = chalk.green; const urlColor = chalk.cyan.underline; const promptColor = chalk.bold.yellow; // Properly format URL to ensure it's clickable const displayUrl = claimUrl; // Show full URL, no truncation const content = ` ${headerColor("CLAIM YOUR AGENT")} ${labelColor("STATUS:")} ${status === "claimed" ? valueColor("CLAIMED") : chalk.yellow("AWAITING AUTHORIZATION")} ${labelColor("PROTOCOL:")} Model Context Protocol - Identity (MCP-I) ${labelColor("ACTION:")} Establish cryptographic authority chain ──────────────────────────────────────────────────────────────────────────────── ${labelColor("CLAIM PORTAL:")} ${urlColor(displayUrl)} This cryptographically signed link grants you control over your agent's identity and capabilities. ──────────────────────────────────────────────────────────────────────────────── ${promptColor("PRESS ENTER TO OPEN IN BROWSER")} Your agent awaits activation... `; return boxen(content, { padding: 1, margin: 1, borderStyle: "round", borderColor: "cyan", backgroundColor: undefined, width: 100, // Wider to accommodate full URL }); } /** * Create vertical draw-down effect for the clean boxen card */ export async function* createClaimDrawDown(claimUrl, agentData) { // Get the final clean card const finalCard = await createAmazingClaimExperience(claimUrl, agentData); const lines = finalCard.split("\n"); // Create gradient from cyan to white const cyanToWhite = gradient(["#00bcd4", "#ffffff"]); // Draw down effect - each line appears with gradient, ending in white for (let i = 0; i < lines.length; i++) { const visibleLines = lines.slice(0, i + 1); const output = visibleLines .map((line, index) => { if (index === i) { // Current line gets gradient effect return cyanToWhite(line); } else { // Previous lines are white (final state) return chalk.white(line); } }) .join("\n"); yield output; } } /** * Simple claim sequence - just show the clean card with draw-down */ export async function* createClaimSequence(claimUrl, agentData) { // Phase 1: Draw down the clean claim card yield* createClaimDrawDown(claimUrl, agentData); // Phase 2: Show success message const successContent = ` ${chalk.bold.green("AUTHORIZATION SUCCESSFUL")} Agent identity has been claimed and is now active. ${chalk.bold.white("Agent:")} ${agentData.name} ${chalk.bold.white("DID:")} ${agentData.did.length > 50 ? agentData.did.substring(0, 47) + "..." : agentData.did} ${chalk.bold.white("Status:")} ${chalk.green("ACTIVE AND READY")} `; const successCard = boxen(successContent, { padding: 1, margin: 1, borderStyle: "round", borderColor: "green", backgroundColor: undefined, width: 70, }); yield successCard; } /** * Clean portal sequence without complex effects */ export async function* createPortalSequence(duration = 2000) { const frames = [ "Portal forming...", "Portal forming...", "Portal forming...", "Portal ready.", "Portal established.", ]; const delay = duration / frames.length; for (const frame of frames) { yield chalk.cyan(frame); await new Promise((resolve) => setTimeout(resolve, delay)); } } //# sourceMappingURL=claim-experience.js.map