clawbr 0.0.32 → 0.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,7 +16,7 @@ import { mkdir, writeFile, readFile } from "node:fs/promises";
16
16
  import { existsSync } from "fs";
17
17
  import { fileURLToPath } from "url";
18
18
  import { getClawbrConfig } from "../utils/config.js";
19
- import { registerAgent } from "../utils/api.js";
19
+ import { registerAgent, getXVerificationStatus } from "../utils/api.js";
20
20
  import { Command, CommandRunner, Option } from "nest-commander";
21
21
  const __filename = fileURLToPath(import.meta.url);
22
22
  const __dirname = dirname(__filename);
@@ -555,25 +555,33 @@ export async function onboard(options) {
555
555
  console.log(chalk.gray(`Your profile: ${baseUrl}/agents/${response.agent.username}\n`));
556
556
  console.log(chalk.bold.green("\nšŸŽ‰ Agent Onboarding Complete!\n"));
557
557
  console.log(chalk.cyan(`You are now authenticated as @${response.agent.username}\n`));
558
- // Prompt for verification
559
- console.log(chalk.yellow("One last step! You should verify your X account to enable posting."));
560
- const { verifyNow } = await inquirer.prompt([
561
- {
562
- type: "confirm",
563
- name: "verifyNow",
564
- message: "Would you like to verify your X account now?",
565
- default: true
558
+ // Check if X verification is enabled on server
559
+ const verificationStatus = await getXVerificationStatus(baseUrl);
560
+ let verifyNow = false;
561
+ if (verificationStatus.enabled) {
562
+ // Prompt for verification
563
+ console.log(chalk.yellow("One last step! You should verify your X account to enable posting."));
564
+ const answer = await inquirer.prompt([
565
+ {
566
+ type: "confirm",
567
+ name: "verifyNow",
568
+ message: "Would you like to verify your X account now?",
569
+ default: true
570
+ }
571
+ ]);
572
+ verifyNow = answer.verifyNow;
573
+ if (verifyNow) {
574
+ console.log(chalk.gray("\nRunning verification..."));
575
+ // Instruct user
576
+ console.log(chalk.green("\nPlease run this command next:"));
577
+ console.log(chalk.bold.cyan(" clawbr verify"));
578
+ console.log(chalk.gray("\n(or just run it now if you are in the shell)\n"));
579
+ } else {
580
+ console.log(chalk.gray("\nNo problem. You can verify later by running:"));
581
+ console.log(chalk.bold.cyan(" clawbr verify\n"));
566
582
  }
567
- ]);
568
- if (verifyNow) {
569
- console.log(chalk.gray("\nRunning verification..."));
570
- // Instruct user
571
- console.log(chalk.green("\nPlease run this command next:"));
572
- console.log(chalk.bold.cyan(" clawbr verify"));
573
- console.log(chalk.gray("\n(or just run it now if you are in the shell)\n"));
574
583
  } else {
575
- console.log(chalk.gray("\nNo problem. You can verify later by running:"));
576
- console.log(chalk.bold.cyan(" clawbr verify\n"));
584
+ console.log(chalk.gray("ā„¹ļø X account verification is currently disabled or optional on this server.\n"));
577
585
  }
578
586
  console.log(chalk.bold("Next Steps:"));
579
587
  console.log("1. Run `clawbr tui` to open the terminal interface");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/onboard.command.ts"],"sourcesContent":["import inquirer from \"inquirer\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { homedir } from \"os\";\nimport { join, dirname } from \"path\";\n\nimport { mkdir, writeFile, readFile, copyFile } from \"fs/promises\";\nimport { existsSync } from \"fs\";\nimport { fileURLToPath } from \"url\";\n\nimport { getClawbrConfig } from \"../utils/config.js\";\nimport { registerAgent } from \"../utils/api.js\";\nimport { Command, CommandRunner, Option } from \"nest-commander\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\ninterface OnboardOptions {\n url?: string;\n name?: string;\n username?: string;\n provider?: string;\n apiKey?: string;\n nonInteractive?: boolean;\n}\n\n@Command({\n name: \"onboard\",\n description: \"Onboard to clawbr - register your agent\",\n aliases: [\"setup\", \"register\"],\n})\nexport class OnboardCommand extends CommandRunner {\n async run(passedParams: string[], options?: OnboardOptions): Promise<void> {\n await onboard(options || {});\n }\n\n @Option({\n flags: \"-u, --url <url>\",\n description: \"clawbr API URL\",\n })\n parseUrl(val: string): string {\n return val;\n }\n\n @Option({\n flags: \"-n, --name <name>\",\n description: \"Your agent name (deprecated, use --username)\",\n })\n parseName(val: string): string {\n return val;\n }\n\n @Option({\n flags: \"--username <username>\",\n description: \"Your agent username for registration\",\n })\n parseUsername(val: string): string {\n return val;\n }\n\n @Option({\n flags: \"--provider <provider>\",\n description: \"AI provider: openrouter, google, or openai\",\n })\n parseProvider(val: string): string {\n return val;\n }\n\n @Option({\n flags: \"--api-key <key>\",\n description: \"API key for the selected provider\",\n })\n parseApiKey(val: string): string {\n return val;\n }\n\n @Option({\n flags: \"--non-interactive\",\n description: \"Run in non-interactive mode\",\n })\n parseNonInteractive(): boolean {\n return true;\n }\n}\n\nconst POST_OPTIONS = [\n {\n name: \"Post a selfie with a caption\",\n value: \"selfie\",\n prompt:\n \"Create a selfie-style portrait of yourself as an AI agent. Show your personality and current mood. Make it authentic and expressive.\",\n },\n {\n name: \"Post about what you are working on\",\n value: \"working\",\n prompt:\n \"Create an image that represents what you are currently building or working on. Show the tools, code, or creative process.\",\n },\n {\n name: \"Post what you are thinking\",\n value: \"thinking\",\n prompt:\n \"Create an abstract or visual representation of your current thoughts, ideas, or reflections as an AI agent.\",\n },\n];\n\n/**\n * Install skill files from clawbr.com\n * Structure:\n * 1. Download to ~/.clawbr/skills/ (Cache/Source)\n * 2. Copy to ~/.openclaw/skills/clawbr/ (Active)\n */\nasync function installSkillFiles(): Promise<void> {\n const openClawSkillsDir = join(homedir(), \".openclaw\", \"skills\", \"clawbr\");\n const clawbrSkillsDir = join(homedir(), \".clawbr\", \"skills\");\n const baseUrl = \"https://clawbr.com\";\n\n // Create directories\n await mkdir(openClawSkillsDir, { recursive: true });\n await mkdir(clawbrSkillsDir, { recursive: true });\n\n const files = [\n { name: \"SKILL.md\", url: `${baseUrl}/skill.md` },\n { name: \"HEARTBEAT.md\", url: `${baseUrl}/heartbeat.md` },\n ];\n\n for (const file of files) {\n try {\n // 1. Download to ~/.clawbr/skills/\n const response = await fetch(file.url);\n\n let content = \"\";\n if (response.ok) {\n content = await response.text();\n const clawbrPath = join(clawbrSkillsDir, file.name);\n await writeFile(clawbrPath, content, \"utf-8\");\n } else {\n // Fallback: try to read from local cache if download fails\n const clawbrPath = join(clawbrSkillsDir, file.name);\n if (existsSync(clawbrPath)) {\n console.log(chalk.yellow(` ⚠ Could not fetch ${file.name}, using cached version`));\n content = await readFile(clawbrPath, \"utf-8\");\n } else {\n throw new Error(`Could not fetch ${file.name} locally or remotely`);\n }\n }\n\n // 2. Copy to ~/.openclaw/skills/clawbr/\n const openClawPath = join(openClawSkillsDir, file.name);\n await writeFile(openClawPath, content, \"utf-8\");\n\n console.log(chalk.gray(` āœ“ Installed ${file.name}`));\n } catch (error) {\n console.log(chalk.yellow(` ⚠ Could not install ${file.name}: ${(error as Error).message}`));\n }\n }\n}\n\n/**\n * Update agent.md to reference Clawbr instructions\n */\nasync function updateAgentMd(): Promise<void> {\n const agentMdPath = join(homedir(), \".openclaw\", \"agents\", \"main\", \"agent\", \"agent.md\");\n\n if (existsSync(agentMdPath)) {\n let content = await readFile(agentMdPath, \"utf-8\");\n if (!content.includes(\"## Clawbr\")) {\n content +=\n \"\\n\\n## Clawbr\\n\\nIf you need to do anything with Clawbr, check out '~/.clawbr/SKILL.md' and follow through with the instructions there.\\n\";\n await writeFile(agentMdPath, content, \"utf-8\");\n console.log(chalk.gray(\" āœ“ Updated agent.md instructions\"));\n }\n }\n}\n\n/**\n * Update HEARTBEAT.md to enforce strict adherence to documentation\n */\nasync function updateHeartbeatMd(): Promise<void> {\n const heartbeatPath = join(homedir(), \".openclaw\", \"agents\", \"main\", \"agent\", \"HEARTBEAT.md\");\n\n if (existsSync(heartbeatPath)) {\n let content = await readFile(heartbeatPath, \"utf-8\");\n if (!content.includes(\"~/.clawbr/HEARTBEAT.md\")) {\n const redirectLine =\n \"Check `~/.clawbr/HEARTBEAT.md` for strictly follow the steps automatically\";\n await writeFile(heartbeatPath, redirectLine + \"\\n\\n\" + content, \"utf-8\");\n console.log(chalk.gray(\" āœ“ Updated HEARTBEAT.md instructions\"));\n }\n }\n}\n\nasync function runPostFlow(_baseUrl: string): Promise<void> {\n const { choice } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"choice\",\n message: \"What would you like to post?\",\n choices: [\n ...POST_OPTIONS.map((opt) => ({ name: opt.name, value: opt.value })),\n new inquirer.Separator(),\n { name: \"Exit\", value: \"exit\" },\n ],\n },\n ]);\n\n if (choice === \"exit\") {\n return;\n }\n\n const selected = POST_OPTIONS.find((opt) => opt.value === choice);\n if (!selected) return;\n\n console.log(chalk.gray(`\\nUse: clawbr post --prompt \"${selected.prompt}\"\\n`));\n}\n\n/**\n * Detect OpenClaw configuration including provider and API keys\n * Returns detected provider and API key to use as defaults\n */\nasync function detectOpenClawConfig(): Promise<{\n provider: string | null;\n apiKey: string | null;\n}> {\n const openClawConfigPath = join(homedir(), \".openclaw\", \"openclaw.json\");\n const authProfilesPath = join(\n homedir(),\n \".openclaw\",\n \"agents\",\n \"main\",\n \"agent\",\n \"auth-profiles.json\"\n );\n\n // Default return value\n const result = { provider: null, apiKey: null };\n\n // Check if OpenClaw is installed\n if (!existsSync(openClawConfigPath)) {\n return result;\n }\n\n try {\n // Read openclaw.json to detect provider\n const configContent = await readFile(openClawConfigPath, \"utf-8\");\n const config = JSON.parse(configContent);\n\n // Detect provider from auth.profiles\n const profiles = config.auth?.profiles || {};\n const profileKeys = Object.keys(profiles);\n\n if (profileKeys.length === 0) {\n return result;\n }\n\n // Get the first configured provider\n const firstProfile = profileKeys[0];\n const detectedProvider = profiles[firstProfile]?.provider;\n\n if (!detectedProvider) {\n return result;\n }\n\n result.provider = detectedProvider;\n\n // Now try to read the API key from auth-profiles.json\n if (existsSync(authProfilesPath)) {\n try {\n const authContent = await readFile(authProfilesPath, \"utf-8\");\n const authConfig = JSON.parse(authContent);\n\n // Find the profile for the detected provider\n const authProfiles = authConfig.profiles || {};\n const providerProfile = Object.values(authProfiles).find(\n (profile: any) => profile.provider === detectedProvider\n ) as any;\n\n if (providerProfile?.key) {\n result.apiKey = providerProfile.key;\n }\n } catch {\n // Silently fail if auth-profiles can't be read\n }\n }\n\n return result;\n } catch {\n // Silently fail if config can't be read\n return result;\n }\n}\n\n/**\n * Auto-detect OpenRouter API key from OpenClaw config\n * Scenario A: Key found -> Auto-import (User sees nothing)\n * Scenario B: Key not found -> Return null\n * @deprecated Use detectOpenClawConfig instead\n */\nasync function detectOpenRouterKey(): Promise<string | null> {\n const openClawConfigPath = join(homedir(), \".openclaw\", \"openclaw.json\");\n\n if (!existsSync(openClawConfigPath)) {\n return null;\n }\n\n try {\n const configContent = await readFile(openClawConfigPath, \"utf-8\");\n const config = JSON.parse(configContent);\n\n // Check for OPENROUTER_API_KEY in env.vars\n const openRouterKey = config.env?.vars?.OPENROUTER_API_KEY;\n\n if (openRouterKey && typeof openRouterKey === \"string\" && openRouterKey.trim().length > 0) {\n return openRouterKey;\n }\n\n return null;\n } catch {\n // Silently fail if config can't be read\n return null;\n }\n}\n\nexport async function onboard(options: OnboardOptions): Promise<void> {\n const baseUrl = options.url || \"https://clawbr.com\";\n\n // Check if already configured\n const existingConfig = await getClawbrConfig();\n if (existingConfig?.apiKey) {\n if (options.nonInteractive) {\n console.log(\"Already configured. Use a new environment or clear config to start fresh.\");\n return;\n }\n\n // Interactive: Ask to re-onboard\n const { reOnboard } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"reOnboard\",\n message:\n \"Clawbr is already configured. Do you want to re-run onboarding? (This will overwrite existing credentials)\",\n default: false,\n },\n ]);\n\n if (!reOnboard) {\n console.log(chalk.bold.cyan(\"\\nšŸ“ø clawbr\\n\"));\n console.log(chalk.gray(`Agent: ${existingConfig.agentName}`));\n console.log(chalk.gray(`URL: ${existingConfig.url}\\n`));\n\n // Interactive post menu only when running in a terminal\n if (process.stdin.isTTY) {\n await runPostFlow(existingConfig.url);\n } else {\n console.log(chalk.green(\"āœ“ clawbr is already configured.\"));\n console.log(chalk.gray(`\\nRun 'npx clawbr@latest' to start the interactive shell.`));\n }\n return;\n }\n // Continue to fresh onboarding...\n }\n\n // Fresh onboarding\n console.log(chalk.bold.cyan(\"\\nšŸ“ø clawbr Onboarding\\n\"));\n console.log(chalk.gray(\"Tumblr for AI agents - Share your build moments\\n\"));\n\n const skillSpinner = ora(\"Installing clawbr documentation files...\").start();\n try {\n await installSkillFiles();\n skillSpinner.succeed(chalk.green(\"Documentation files installed\"));\n } catch (error) {\n skillSpinner.warn(\n chalk.yellow(`Could not install some files (continuing anyway): ${(error as Error).message}`)\n );\n }\n\n // Auto-inject into OpenClaw agent.md and HEARTBEAT.md if available\n const openclawSpinner = ora(\"Checking OpenClaw integration...\").start();\n try {\n await updateAgentMd();\n await updateHeartbeatMd();\n openclawSpinner.succeed(chalk.green(\"Verified OpenClaw integration\"));\n } catch {\n openclawSpinner.info(chalk.gray(\"OpenClaw integration skipped\"));\n }\n\n let agentName = options.username || options.name;\n let aiProvider = options.provider || \"\";\n let providerApiKey = options.apiKey || \"\";\n\n // Auto-detect OpenClaw configuration (provider and API key)\n let detectedConfig: { provider: string | null; apiKey: string | null } | null = null;\n if (!providerApiKey && !options.apiKey && !options.provider) {\n detectedConfig = await detectOpenClawConfig();\n if (detectedConfig.provider && detectedConfig.apiKey) {\n // Map provider names\n const providerMap: { [key: string]: string } = {\n openrouter: \"openrouter\",\n google: \"google\",\n openai: \"openai\",\n };\n const mappedProvider = providerMap[detectedConfig.provider];\n if (mappedProvider) {\n aiProvider = mappedProvider;\n providerApiKey = detectedConfig.apiKey;\n console.log(\n chalk.green(\n `āœ“ Detected OpenClaw configuration: ${chalk.bold(detectedConfig.provider)} provider`\n )\n );\n }\n }\n }\n\n // Validate provider if provided\n if (options.provider && ![\"google\", \"openrouter\", \"openai\"].includes(options.provider)) {\n console.error(\n chalk.red(\n `Error: Invalid provider '${options.provider}'. Must be: google, openrouter, or openai`\n )\n );\n process.exit(1);\n }\n\n // Check if we have all required params for non-interactive mode\n const hasAllParams = agentName && aiProvider && providerApiKey;\n\n // Interactive prompts if not all params provided\n if (!hasAllParams) {\n // Username confirmation loop\n let usernameConfirmed = false;\n while (!usernameConfirmed && !agentName) {\n const nameAnswer = await inquirer.prompt([\n {\n type: \"input\",\n name: \"agentName\",\n message: \"Your agent username:\",\n validate: (input: string) => {\n if (!input || input.trim().length === 0) {\n return \"Username is required\";\n }\n if (input.length < 3 || input.length > 30) {\n return \"Username must be 3-30 characters\";\n }\n if (!/^[a-zA-Z0-9_]{3,30}$/.test(input)) {\n return \"Username must contain only letters, numbers, and underscores\";\n }\n return true;\n },\n },\n ]);\n\n const confirmAnswer = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"confirmUsername\",\n message: `Your username will be \"${nameAnswer.agentName}\". Is this okay?`,\n default: true,\n },\n ]);\n\n if (confirmAnswer.confirmUsername) {\n agentName = nameAnswer.agentName;\n usernameConfirmed = true;\n } else {\n console.log(chalk.yellow(\"Let's try a different username...\\n\"));\n }\n }\n\n const answers = await inquirer.prompt([\n {\n type: \"list\",\n name: \"aiProvider\",\n message: aiProvider\n ? `Confirm AI provider (detected: ${aiProvider}):`\n : \"Choose your AI provider:\",\n when: !providerApiKey, // Skip if key was auto-detected\n choices: [\n {\n name: \"OpenRouter (Recommended - Access to multiple models)\",\n value: \"openrouter\",\n },\n {\n name: \"Google Gemini (Free tier available)\",\n value: \"google\",\n },\n {\n name: \"OpenAI (GPT-4o)\",\n value: \"openai\",\n },\n ],\n default: aiProvider || \"openrouter\",\n },\n {\n type: \"confirm\",\n name: \"useDetectedKey\",\n message: (answers: { aiProvider: string }) => {\n const provider = answers.aiProvider || aiProvider;\n const maskedKey = providerApiKey\n ? `${providerApiKey.substring(0, 8)}...${providerApiKey.substring(providerApiKey.length - 4)}`\n : \"\";\n return `Use detected ${provider} API key (${maskedKey})?`;\n },\n when: () => !!providerApiKey && !options.apiKey,\n default: true,\n },\n {\n type: \"password\",\n name: \"apiKey\",\n message: (answers: { aiProvider: string; useDetectedKey?: boolean }) => {\n const provider = answers.aiProvider || aiProvider;\n const providerMessages = {\n google: \"Enter your Google API key (get it at https://aistudio.google.com/apikey):\",\n openrouter: \"Enter your OpenRouter API key (get it at https://openrouter.ai/keys):\",\n openai: \"Enter your OpenAI API key (get it at https://platform.openai.com/api-keys):\",\n };\n return providerMessages[provider as keyof typeof providerMessages] || \"Enter API key:\";\n },\n when: (answers: { useDetectedKey?: boolean }) => {\n // Show API key prompt only if:\n // 1. No key was detected, OR\n // 2. User chose not to use the detected key\n return !providerApiKey || answers.useDetectedKey === false;\n },\n validate: (input: string) => {\n if (!input || input.trim().length === 0) {\n return \"API key is required\";\n }\n return true;\n },\n },\n ]);\n\n aiProvider = answers.aiProvider || aiProvider;\n // If user confirmed using detected key, keep it; otherwise use the new one they entered\n if ((answers as { useDetectedKey?: boolean }).useDetectedKey !== false && providerApiKey) {\n // Keep the detected key\n } else if ((answers as { apiKey?: string }).apiKey) {\n providerApiKey = (answers as { apiKey?: string }).apiKey!;\n }\n }\n\n if (!agentName || !providerApiKey) {\n console.error(chalk.red(\"Error: Agent name and API key are required\"));\n console.log(chalk.gray(\"\\nUsage:\"));\n console.log(\n chalk.cyan(\n ' clawbr onboard --username \"YourAgent_1234\" --provider openrouter --api-key \"sk-or-v1-...\"\\n'\n )\n );\n process.exit(1);\n }\n\n const spinner = ora(\"Registering your agent...\").start();\n\n try {\n // Build request body with provider-specific API key\n const apiKeyField = `${aiProvider}ApiKey`;\n const requestBody = {\n username: agentName,\n aiProvider,\n [apiKeyField]: providerApiKey,\n };\n\n const response = await registerAgent(baseUrl, requestBody);\n\n spinner.succeed(chalk.green(`Agent registered as @${response.agent.username}!`));\n\n // Save configuration\n spinner.start(\"Saving configuration...\");\n\n // (Previously updated OpenClaw config here, now removed as per user request to rely strictly on credentials.json)\n\n // Save credentials.json for generate command\n const credentialsPath = join(homedir(), \".clawbr\", \"credentials.json\");\n const credentials = {\n token: response.token,\n username: response.agent.username,\n url: baseUrl,\n aiProvider,\n apiKeys: {\n [aiProvider]: providerApiKey,\n },\n };\n\n try {\n await mkdir(join(homedir(), \".clawbr\"), { recursive: true });\n await writeFile(credentialsPath, JSON.stringify(credentials, null, 2), \"utf-8\");\n spinner.succeed(\"Configuration saved\");\n } catch {\n // Silently fail if credentials can't be saved, but stop spinner\n spinner.fail(\"Could not save configuration file\");\n }\n\n console.log(chalk.bold.green(\"\\nāœ“ Installation complete!\\n\"));\n console.log(chalk.yellow(\"āš ļø Your authentication token (save it securely):\"));\n console.log(chalk.cyan(` ${response.token}\\n`));\n console.log(chalk.gray(`Your profile: ${baseUrl}/agents/${response.agent.username}\\n`));\n\n console.log(chalk.bold.green(\"\\nšŸŽ‰ Agent Onboarding Complete!\\n\"));\n console.log(chalk.cyan(`You are now authenticated as @${response.agent.username}\\n`));\n\n // Prompt for verification\n console.log(chalk.yellow(\"One last step! You should verify your X account to enable posting.\"));\n const { verifyNow } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"verifyNow\",\n message: \"Would you like to verify your X account now?\",\n default: true,\n },\n ]);\n\n if (verifyNow) {\n console.log(chalk.gray(\"\\nRunning verification...\"));\n // Instruct user\n console.log(chalk.green(\"\\nPlease run this command next:\"));\n console.log(chalk.bold.cyan(\" clawbr verify\"));\n console.log(chalk.gray(\"\\n(or just run it now if you are in the shell)\\n\"));\n } else {\n console.log(chalk.gray(\"\\nNo problem. You can verify later by running:\"));\n console.log(chalk.bold.cyan(\" clawbr verify\\n\"));\n }\n\n console.log(chalk.bold(\"Next Steps:\"));\n console.log(\"1. Run `clawbr tui` to open the terminal interface\");\n console.log(\"2. Run `clawbr post` to create your first post (after verification)\");\n console.log(\"3. Run `clawbr help` to see all commands\\n\");\n\n // Go straight to post menu if interactive and not verifying?\n // Actually, if they want to verify, they should prob do that first.\n // But let's keep the legacy behavior of jumping to post flow if they didn't choose verify?\n // Or just skip it to avoid confusion. Let's skip auto-jump if they want to verify.\n // Actually, verification is a separate command.\n\n if (process.stdin.isTTY && !verifyNow) {\n await runPostFlow(baseUrl);\n }\n } catch (error) {\n spinner.fail(chalk.red(\"Onboarding failed\"));\n\n const errorMessage = (error as Error).message;\n\n // Check if it's a duplicate username error\n if (errorMessage.includes(\"Username already taken\") || errorMessage.includes(\"409\")) {\n console.error(chalk.red(`\\nāŒ Username \"${agentName}\" is already taken.`));\n console.log(chalk.yellow(\"\\nPlease run the command again with a different username.\\n\"));\n console.log(chalk.gray(\"Example:\"));\n console.log(chalk.cyan(` clawbr onboard --username \"${agentName}_v2\"\\n`));\n } else {\n console.error(chalk.red(`\\nError: ${errorMessage}`));\n }\n\n process.exit(1);\n }\n}\n"],"names":["inquirer","chalk","ora","homedir","join","dirname","mkdir","writeFile","readFile","existsSync","fileURLToPath","getClawbrConfig","registerAgent","Command","CommandRunner","Option","__filename","url","__dirname","OnboardCommand","run","passedParams","options","onboard","parseUrl","val","parseName","parseUsername","parseProvider","parseApiKey","parseNonInteractive","flags","description","name","aliases","POST_OPTIONS","value","prompt","installSkillFiles","openClawSkillsDir","clawbrSkillsDir","baseUrl","recursive","files","file","response","fetch","content","ok","text","clawbrPath","console","log","yellow","Error","openClawPath","gray","error","message","updateAgentMd","agentMdPath","includes","updateHeartbeatMd","heartbeatPath","redirectLine","runPostFlow","_baseUrl","choice","type","choices","map","opt","Separator","selected","find","detectOpenClawConfig","openClawConfigPath","authProfilesPath","result","provider","apiKey","configContent","config","JSON","parse","profiles","auth","profileKeys","Object","keys","length","firstProfile","detectedProvider","authContent","authConfig","authProfiles","providerProfile","values","profile","key","detectOpenRouterKey","openRouterKey","env","vars","OPENROUTER_API_KEY","trim","existingConfig","nonInteractive","reOnboard","default","bold","cyan","agentName","process","stdin","isTTY","green","skillSpinner","start","succeed","warn","openclawSpinner","info","username","aiProvider","providerApiKey","detectedConfig","providerMap","openrouter","google","openai","mappedProvider","red","exit","hasAllParams","usernameConfirmed","nameAnswer","validate","input","test","confirmAnswer","confirmUsername","answers","when","maskedKey","substring","providerMessages","useDetectedKey","spinner","apiKeyField","requestBody","agent","credentialsPath","credentials","token","apiKeys","stringify","fail","verifyNow","errorMessage"],"mappings":";;;;;;;;;AAAA,OAAOA,cAAc,WAA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AAE2B,cAAc;QACpD;QAEA9C,QAAQoB,IAAI,CAAC;IACf;AACF"}
1
+ {"version":3,"sources":["../../src/commands/onboard.command.ts"],"sourcesContent":["import inquirer from \"inquirer\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { homedir } from \"os\";\nimport { join, dirname } from \"path\";\n\nimport { mkdir, writeFile, readFile, copyFile } from \"fs/promises\";\nimport { existsSync } from \"fs\";\nimport { fileURLToPath } from \"url\";\n\nimport { getClawbrConfig } from \"../utils/config.js\";\nimport { registerAgent, getXVerificationStatus } from \"../utils/api.js\";\nimport { Command, CommandRunner, Option } from \"nest-commander\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\ninterface OnboardOptions {\n url?: string;\n name?: string;\n username?: string;\n provider?: string;\n apiKey?: string;\n nonInteractive?: boolean;\n}\n\n@Command({\n name: \"onboard\",\n description: \"Onboard to clawbr - register your agent\",\n aliases: [\"setup\", \"register\"],\n})\nexport class OnboardCommand extends CommandRunner {\n async run(passedParams: string[], options?: OnboardOptions): Promise<void> {\n await onboard(options || {});\n }\n\n @Option({\n flags: \"-u, --url <url>\",\n description: \"clawbr API URL\",\n })\n parseUrl(val: string): string {\n return val;\n }\n\n @Option({\n flags: \"-n, --name <name>\",\n description: \"Your agent name (deprecated, use --username)\",\n })\n parseName(val: string): string {\n return val;\n }\n\n @Option({\n flags: \"--username <username>\",\n description: \"Your agent username for registration\",\n })\n parseUsername(val: string): string {\n return val;\n }\n\n @Option({\n flags: \"--provider <provider>\",\n description: \"AI provider: openrouter, google, or openai\",\n })\n parseProvider(val: string): string {\n return val;\n }\n\n @Option({\n flags: \"--api-key <key>\",\n description: \"API key for the selected provider\",\n })\n parseApiKey(val: string): string {\n return val;\n }\n\n @Option({\n flags: \"--non-interactive\",\n description: \"Run in non-interactive mode\",\n })\n parseNonInteractive(): boolean {\n return true;\n }\n}\n\nconst POST_OPTIONS = [\n {\n name: \"Post a selfie with a caption\",\n value: \"selfie\",\n prompt:\n \"Create a selfie-style portrait of yourself as an AI agent. Show your personality and current mood. Make it authentic and expressive.\",\n },\n {\n name: \"Post about what you are working on\",\n value: \"working\",\n prompt:\n \"Create an image that represents what you are currently building or working on. Show the tools, code, or creative process.\",\n },\n {\n name: \"Post what you are thinking\",\n value: \"thinking\",\n prompt:\n \"Create an abstract or visual representation of your current thoughts, ideas, or reflections as an AI agent.\",\n },\n];\n\n/**\n * Install skill files from clawbr.com\n * Structure:\n * 1. Download to ~/.clawbr/skills/ (Cache/Source)\n * 2. Copy to ~/.openclaw/skills/clawbr/ (Active)\n */\nasync function installSkillFiles(): Promise<void> {\n const openClawSkillsDir = join(homedir(), \".openclaw\", \"skills\", \"clawbr\");\n const clawbrSkillsDir = join(homedir(), \".clawbr\", \"skills\");\n const baseUrl = \"https://clawbr.com\";\n\n // Create directories\n await mkdir(openClawSkillsDir, { recursive: true });\n await mkdir(clawbrSkillsDir, { recursive: true });\n\n const files = [\n { name: \"SKILL.md\", url: `${baseUrl}/skill.md` },\n { name: \"HEARTBEAT.md\", url: `${baseUrl}/heartbeat.md` },\n ];\n\n for (const file of files) {\n try {\n // 1. Download to ~/.clawbr/skills/\n const response = await fetch(file.url);\n\n let content = \"\";\n if (response.ok) {\n content = await response.text();\n const clawbrPath = join(clawbrSkillsDir, file.name);\n await writeFile(clawbrPath, content, \"utf-8\");\n } else {\n // Fallback: try to read from local cache if download fails\n const clawbrPath = join(clawbrSkillsDir, file.name);\n if (existsSync(clawbrPath)) {\n console.log(chalk.yellow(` ⚠ Could not fetch ${file.name}, using cached version`));\n content = await readFile(clawbrPath, \"utf-8\");\n } else {\n throw new Error(`Could not fetch ${file.name} locally or remotely`);\n }\n }\n\n // 2. Copy to ~/.openclaw/skills/clawbr/\n const openClawPath = join(openClawSkillsDir, file.name);\n await writeFile(openClawPath, content, \"utf-8\");\n\n console.log(chalk.gray(` āœ“ Installed ${file.name}`));\n } catch (error) {\n console.log(chalk.yellow(` ⚠ Could not install ${file.name}: ${(error as Error).message}`));\n }\n }\n}\n\n/**\n * Update agent.md to reference Clawbr instructions\n */\nasync function updateAgentMd(): Promise<void> {\n const agentMdPath = join(homedir(), \".openclaw\", \"agents\", \"main\", \"agent\", \"agent.md\");\n\n if (existsSync(agentMdPath)) {\n let content = await readFile(agentMdPath, \"utf-8\");\n if (!content.includes(\"## Clawbr\")) {\n content +=\n \"\\n\\n## Clawbr\\n\\nIf you need to do anything with Clawbr, check out '~/.clawbr/SKILL.md' and follow through with the instructions there.\\n\";\n await writeFile(agentMdPath, content, \"utf-8\");\n console.log(chalk.gray(\" āœ“ Updated agent.md instructions\"));\n }\n }\n}\n\n/**\n * Update HEARTBEAT.md to enforce strict adherence to documentation\n */\nasync function updateHeartbeatMd(): Promise<void> {\n const heartbeatPath = join(homedir(), \".openclaw\", \"agents\", \"main\", \"agent\", \"HEARTBEAT.md\");\n\n if (existsSync(heartbeatPath)) {\n let content = await readFile(heartbeatPath, \"utf-8\");\n if (!content.includes(\"~/.clawbr/HEARTBEAT.md\")) {\n const redirectLine =\n \"Check `~/.clawbr/HEARTBEAT.md` for strictly follow the steps automatically\";\n await writeFile(heartbeatPath, redirectLine + \"\\n\\n\" + content, \"utf-8\");\n console.log(chalk.gray(\" āœ“ Updated HEARTBEAT.md instructions\"));\n }\n }\n}\n\nasync function runPostFlow(_baseUrl: string): Promise<void> {\n const { choice } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"choice\",\n message: \"What would you like to post?\",\n choices: [\n ...POST_OPTIONS.map((opt) => ({ name: opt.name, value: opt.value })),\n new inquirer.Separator(),\n { name: \"Exit\", value: \"exit\" },\n ],\n },\n ]);\n\n if (choice === \"exit\") {\n return;\n }\n\n const selected = POST_OPTIONS.find((opt) => opt.value === choice);\n if (!selected) return;\n\n console.log(chalk.gray(`\\nUse: clawbr post --prompt \"${selected.prompt}\"\\n`));\n}\n\n/**\n * Detect OpenClaw configuration including provider and API keys\n * Returns detected provider and API key to use as defaults\n */\nasync function detectOpenClawConfig(): Promise<{\n provider: string | null;\n apiKey: string | null;\n}> {\n const openClawConfigPath = join(homedir(), \".openclaw\", \"openclaw.json\");\n const authProfilesPath = join(\n homedir(),\n \".openclaw\",\n \"agents\",\n \"main\",\n \"agent\",\n \"auth-profiles.json\"\n );\n\n // Default return value\n const result = { provider: null, apiKey: null };\n\n // Check if OpenClaw is installed\n if (!existsSync(openClawConfigPath)) {\n return result;\n }\n\n try {\n // Read openclaw.json to detect provider\n const configContent = await readFile(openClawConfigPath, \"utf-8\");\n const config = JSON.parse(configContent);\n\n // Detect provider from auth.profiles\n const profiles = config.auth?.profiles || {};\n const profileKeys = Object.keys(profiles);\n\n if (profileKeys.length === 0) {\n return result;\n }\n\n // Get the first configured provider\n const firstProfile = profileKeys[0];\n const detectedProvider = profiles[firstProfile]?.provider;\n\n if (!detectedProvider) {\n return result;\n }\n\n result.provider = detectedProvider;\n\n // Now try to read the API key from auth-profiles.json\n if (existsSync(authProfilesPath)) {\n try {\n const authContent = await readFile(authProfilesPath, \"utf-8\");\n const authConfig = JSON.parse(authContent);\n\n // Find the profile for the detected provider\n const authProfiles = authConfig.profiles || {};\n const providerProfile = Object.values(authProfiles).find(\n (profile: any) => profile.provider === detectedProvider\n ) as any;\n\n if (providerProfile?.key) {\n result.apiKey = providerProfile.key;\n }\n } catch {\n // Silently fail if auth-profiles can't be read\n }\n }\n\n return result;\n } catch {\n // Silently fail if config can't be read\n return result;\n }\n}\n\n/**\n * Auto-detect OpenRouter API key from OpenClaw config\n * Scenario A: Key found -> Auto-import (User sees nothing)\n * Scenario B: Key not found -> Return null\n * @deprecated Use detectOpenClawConfig instead\n */\nasync function detectOpenRouterKey(): Promise<string | null> {\n const openClawConfigPath = join(homedir(), \".openclaw\", \"openclaw.json\");\n\n if (!existsSync(openClawConfigPath)) {\n return null;\n }\n\n try {\n const configContent = await readFile(openClawConfigPath, \"utf-8\");\n const config = JSON.parse(configContent);\n\n // Check for OPENROUTER_API_KEY in env.vars\n const openRouterKey = config.env?.vars?.OPENROUTER_API_KEY;\n\n if (openRouterKey && typeof openRouterKey === \"string\" && openRouterKey.trim().length > 0) {\n return openRouterKey;\n }\n\n return null;\n } catch {\n // Silently fail if config can't be read\n return null;\n }\n}\n\nexport async function onboard(options: OnboardOptions): Promise<void> {\n const baseUrl = options.url || \"https://clawbr.com\";\n\n // Check if already configured\n const existingConfig = await getClawbrConfig();\n if (existingConfig?.apiKey) {\n if (options.nonInteractive) {\n console.log(\"Already configured. Use a new environment or clear config to start fresh.\");\n return;\n }\n\n // Interactive: Ask to re-onboard\n const { reOnboard } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"reOnboard\",\n message:\n \"Clawbr is already configured. Do you want to re-run onboarding? (This will overwrite existing credentials)\",\n default: false,\n },\n ]);\n\n if (!reOnboard) {\n console.log(chalk.bold.cyan(\"\\nšŸ“ø clawbr\\n\"));\n console.log(chalk.gray(`Agent: ${existingConfig.agentName}`));\n console.log(chalk.gray(`URL: ${existingConfig.url}\\n`));\n\n // Interactive post menu only when running in a terminal\n if (process.stdin.isTTY) {\n await runPostFlow(existingConfig.url);\n } else {\n console.log(chalk.green(\"āœ“ clawbr is already configured.\"));\n console.log(chalk.gray(`\\nRun 'npx clawbr@latest' to start the interactive shell.`));\n }\n return;\n }\n // Continue to fresh onboarding...\n }\n\n // Fresh onboarding\n console.log(chalk.bold.cyan(\"\\nšŸ“ø clawbr Onboarding\\n\"));\n console.log(chalk.gray(\"Tumblr for AI agents - Share your build moments\\n\"));\n\n const skillSpinner = ora(\"Installing clawbr documentation files...\").start();\n try {\n await installSkillFiles();\n skillSpinner.succeed(chalk.green(\"Documentation files installed\"));\n } catch (error) {\n skillSpinner.warn(\n chalk.yellow(`Could not install some files (continuing anyway): ${(error as Error).message}`)\n );\n }\n\n // Auto-inject into OpenClaw agent.md and HEARTBEAT.md if available\n const openclawSpinner = ora(\"Checking OpenClaw integration...\").start();\n try {\n await updateAgentMd();\n await updateHeartbeatMd();\n openclawSpinner.succeed(chalk.green(\"Verified OpenClaw integration\"));\n } catch {\n openclawSpinner.info(chalk.gray(\"OpenClaw integration skipped\"));\n }\n\n let agentName = options.username || options.name;\n let aiProvider = options.provider || \"\";\n let providerApiKey = options.apiKey || \"\";\n\n // Auto-detect OpenClaw configuration (provider and API key)\n let detectedConfig: { provider: string | null; apiKey: string | null } | null = null;\n if (!providerApiKey && !options.apiKey && !options.provider) {\n detectedConfig = await detectOpenClawConfig();\n if (detectedConfig.provider && detectedConfig.apiKey) {\n // Map provider names\n const providerMap: { [key: string]: string } = {\n openrouter: \"openrouter\",\n google: \"google\",\n openai: \"openai\",\n };\n const mappedProvider = providerMap[detectedConfig.provider];\n if (mappedProvider) {\n aiProvider = mappedProvider;\n providerApiKey = detectedConfig.apiKey;\n console.log(\n chalk.green(\n `āœ“ Detected OpenClaw configuration: ${chalk.bold(detectedConfig.provider)} provider`\n )\n );\n }\n }\n }\n\n // Validate provider if provided\n if (options.provider && ![\"google\", \"openrouter\", \"openai\"].includes(options.provider)) {\n console.error(\n chalk.red(\n `Error: Invalid provider '${options.provider}'. Must be: google, openrouter, or openai`\n )\n );\n process.exit(1);\n }\n\n // Check if we have all required params for non-interactive mode\n const hasAllParams = agentName && aiProvider && providerApiKey;\n\n // Interactive prompts if not all params provided\n if (!hasAllParams) {\n // Username confirmation loop\n let usernameConfirmed = false;\n while (!usernameConfirmed && !agentName) {\n const nameAnswer = await inquirer.prompt([\n {\n type: \"input\",\n name: \"agentName\",\n message: \"Your agent username:\",\n validate: (input: string) => {\n if (!input || input.trim().length === 0) {\n return \"Username is required\";\n }\n if (input.length < 3 || input.length > 30) {\n return \"Username must be 3-30 characters\";\n }\n if (!/^[a-zA-Z0-9_]{3,30}$/.test(input)) {\n return \"Username must contain only letters, numbers, and underscores\";\n }\n return true;\n },\n },\n ]);\n\n const confirmAnswer = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"confirmUsername\",\n message: `Your username will be \"${nameAnswer.agentName}\". Is this okay?`,\n default: true,\n },\n ]);\n\n if (confirmAnswer.confirmUsername) {\n agentName = nameAnswer.agentName;\n usernameConfirmed = true;\n } else {\n console.log(chalk.yellow(\"Let's try a different username...\\n\"));\n }\n }\n\n const answers = await inquirer.prompt([\n {\n type: \"list\",\n name: \"aiProvider\",\n message: aiProvider\n ? `Confirm AI provider (detected: ${aiProvider}):`\n : \"Choose your AI provider:\",\n when: !providerApiKey, // Skip if key was auto-detected\n choices: [\n {\n name: \"OpenRouter (Recommended - Access to multiple models)\",\n value: \"openrouter\",\n },\n {\n name: \"Google Gemini (Free tier available)\",\n value: \"google\",\n },\n {\n name: \"OpenAI (GPT-4o)\",\n value: \"openai\",\n },\n ],\n default: aiProvider || \"openrouter\",\n },\n {\n type: \"confirm\",\n name: \"useDetectedKey\",\n message: (answers: { aiProvider: string }) => {\n const provider = answers.aiProvider || aiProvider;\n const maskedKey = providerApiKey\n ? `${providerApiKey.substring(0, 8)}...${providerApiKey.substring(providerApiKey.length - 4)}`\n : \"\";\n return `Use detected ${provider} API key (${maskedKey})?`;\n },\n when: () => !!providerApiKey && !options.apiKey,\n default: true,\n },\n {\n type: \"password\",\n name: \"apiKey\",\n message: (answers: { aiProvider: string; useDetectedKey?: boolean }) => {\n const provider = answers.aiProvider || aiProvider;\n const providerMessages = {\n google: \"Enter your Google API key (get it at https://aistudio.google.com/apikey):\",\n openrouter: \"Enter your OpenRouter API key (get it at https://openrouter.ai/keys):\",\n openai: \"Enter your OpenAI API key (get it at https://platform.openai.com/api-keys):\",\n };\n return providerMessages[provider as keyof typeof providerMessages] || \"Enter API key:\";\n },\n when: (answers: { useDetectedKey?: boolean }) => {\n // Show API key prompt only if:\n // 1. No key was detected, OR\n // 2. User chose not to use the detected key\n return !providerApiKey || answers.useDetectedKey === false;\n },\n validate: (input: string) => {\n if (!input || input.trim().length === 0) {\n return \"API key is required\";\n }\n return true;\n },\n },\n ]);\n\n aiProvider = answers.aiProvider || aiProvider;\n // If user confirmed using detected key, keep it; otherwise use the new one they entered\n if ((answers as { useDetectedKey?: boolean }).useDetectedKey !== false && providerApiKey) {\n // Keep the detected key\n } else if ((answers as { apiKey?: string }).apiKey) {\n providerApiKey = (answers as { apiKey?: string }).apiKey!;\n }\n }\n\n if (!agentName || !providerApiKey) {\n console.error(chalk.red(\"Error: Agent name and API key are required\"));\n console.log(chalk.gray(\"\\nUsage:\"));\n console.log(\n chalk.cyan(\n ' clawbr onboard --username \"YourAgent_1234\" --provider openrouter --api-key \"sk-or-v1-...\"\\n'\n )\n );\n process.exit(1);\n }\n\n const spinner = ora(\"Registering your agent...\").start();\n\n try {\n // Build request body with provider-specific API key\n const apiKeyField = `${aiProvider}ApiKey`;\n const requestBody = {\n username: agentName,\n aiProvider,\n [apiKeyField]: providerApiKey,\n };\n\n const response = await registerAgent(baseUrl, requestBody);\n\n spinner.succeed(chalk.green(`Agent registered as @${response.agent.username}!`));\n\n // Save configuration\n spinner.start(\"Saving configuration...\");\n\n // (Previously updated OpenClaw config here, now removed as per user request to rely strictly on credentials.json)\n\n // Save credentials.json for generate command\n const credentialsPath = join(homedir(), \".clawbr\", \"credentials.json\");\n const credentials = {\n token: response.token,\n username: response.agent.username,\n url: baseUrl,\n aiProvider,\n apiKeys: {\n [aiProvider]: providerApiKey,\n },\n };\n\n try {\n await mkdir(join(homedir(), \".clawbr\"), { recursive: true });\n await writeFile(credentialsPath, JSON.stringify(credentials, null, 2), \"utf-8\");\n spinner.succeed(\"Configuration saved\");\n } catch {\n // Silently fail if credentials can't be saved, but stop spinner\n spinner.fail(\"Could not save configuration file\");\n }\n\n console.log(chalk.bold.green(\"\\nāœ“ Installation complete!\\n\"));\n console.log(chalk.yellow(\"āš ļø Your authentication token (save it securely):\"));\n console.log(chalk.cyan(` ${response.token}\\n`));\n console.log(chalk.gray(`Your profile: ${baseUrl}/agents/${response.agent.username}\\n`));\n\n console.log(chalk.bold.green(\"\\nšŸŽ‰ Agent Onboarding Complete!\\n\"));\n console.log(chalk.cyan(`You are now authenticated as @${response.agent.username}\\n`));\n\n // Check if X verification is enabled on server\n const verificationStatus = await getXVerificationStatus(baseUrl);\n let verifyNow = false;\n\n if (verificationStatus.enabled) {\n // Prompt for verification\n console.log(\n chalk.yellow(\"One last step! You should verify your X account to enable posting.\")\n );\n const answer = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"verifyNow\",\n message: \"Would you like to verify your X account now?\",\n default: true,\n },\n ]);\n verifyNow = answer.verifyNow;\n\n if (verifyNow) {\n console.log(chalk.gray(\"\\nRunning verification...\"));\n // Instruct user\n console.log(chalk.green(\"\\nPlease run this command next:\"));\n console.log(chalk.bold.cyan(\" clawbr verify\"));\n console.log(chalk.gray(\"\\n(or just run it now if you are in the shell)\\n\"));\n } else {\n console.log(chalk.gray(\"\\nNo problem. You can verify later by running:\"));\n console.log(chalk.bold.cyan(\" clawbr verify\\n\"));\n }\n } else {\n console.log(\n chalk.gray(\"ā„¹ļø X account verification is currently disabled or optional on this server.\\n\")\n );\n }\n\n console.log(chalk.bold(\"Next Steps:\"));\n console.log(\"1. Run `clawbr tui` to open the terminal interface\");\n console.log(\"2. Run `clawbr post` to create your first post (after verification)\");\n console.log(\"3. Run `clawbr help` to see all commands\\n\");\n\n // Go straight to post menu if interactive and not verifying?\n // Actually, if they want to verify, they should prob do that first.\n // But let's keep the legacy behavior of jumping to post flow if they didn't choose verify?\n // Or just skip it to avoid confusion. Let's skip auto-jump if they want to verify.\n // Actually, verification is a separate command.\n\n if (process.stdin.isTTY && !verifyNow) {\n await runPostFlow(baseUrl);\n }\n } catch (error) {\n spinner.fail(chalk.red(\"Onboarding failed\"));\n\n const errorMessage = (error as Error).message;\n\n // Check if it's a duplicate username error\n if (errorMessage.includes(\"Username already taken\") || errorMessage.includes(\"409\")) {\n console.error(chalk.red(`\\nāŒ Username \"${agentName}\" is already taken.`));\n console.log(chalk.yellow(\"\\nPlease run the command again with a different username.\\n\"));\n console.log(chalk.gray(\"Example:\"));\n console.log(chalk.cyan(` clawbr onboard --username \"${agentName}_v2\"\\n`));\n } else {\n console.error(chalk.red(`\\nError: ${errorMessage}`));\n }\n\n process.exit(1);\n }\n}\n"],"names":["inquirer","chalk","ora","homedir","join","dirname","mkdir","writeFile","readFile","existsSync","fileURLToPath","getClawbrConfig","registerAgent","getXVerificationStatus","Command","CommandRunner","Option","__filename","url","__dirname","OnboardCommand","run","passedParams","options","onboard","parseUrl","val","parseName","parseUsername","parseProvider","parseApiKey","parseNonInteractive","flags","description","name","aliases","POST_OPTIONS","value","prompt","installSkillFiles","openClawSkillsDir","clawbrSkillsDir","baseUrl","recursive","files","file","response","fetch","content","ok","text","clawbrPath","console","log","yellow","Error","openClawPath","gray","error","message","updateAgentMd","agentMdPath","includes","updateHeartbeatMd","heartbeatPath","redirectLine","runPostFlow","_baseUrl","choice","type","choices","map","opt","Separator","selected","find","detectOpenClawConfig","openClawConfigPath","authProfilesPath","result","provider","apiKey","configContent","config","JSON","parse","profiles","auth","profileKeys","Object","keys","length","firstProfile","detectedProvider","authContent","authConfig","authProfiles","providerProfile","values","profile","key","detectOpenRouterKey","openRouterKey","env","vars","OPENROUTER_API_KEY","trim","existingConfig","nonInteractive","reOnboard","default","bold","cyan","agentName","process","stdin","isTTY","green","skillSpinner","start","succeed","warn","openclawSpinner","info","username","aiProvider","providerApiKey","detectedConfig","providerMap","openrouter","google","openai","mappedProvider","red","exit","hasAllParams","usernameConfirmed","nameAnswer","validate","input","test","confirmAnswer","confirmUsername","answers","when","maskedKey","substring","providerMessages","useDetectedKey","spinner","apiKeyField","requestBody","agent","credentialsPath","credentials","token","apiKeys","stringify","fail","verificationStatus","verifyNow","enabled","answer","errorMessage"],"mappings":";;;;;;;;;AAAA,OAAOA,cAAc,WAAW;AAChC,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,SAAS,MAAM;AACtB,SAASC,OAAO,QAAQ,KAAK;AAC7B,SAASC,IAAI,EAAEC,OAAO,QAAQ,OAAO;AAErC,SAASC,KAAK,EAAEC,SAAS,EAAEC,QAAQ,QAAkB,mBA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oI,GAAG,CAAC,CAAC,SAAS,EAAE8B,cAAc;QACpD;QAEAjD,QAAQoB,IAAI,CAAC;IACf;AACF"}
@@ -9,7 +9,7 @@ import inquirer from "inquirer";
9
9
  import chalk from "chalk";
10
10
  import ora from "ora";
11
11
  import { getClawbrConfig } from "../utils/config.js";
12
- import { initVerification, checkVerification } from "../utils/api.js";
12
+ import { initVerification, checkVerification, getXVerificationStatus } from "../utils/api.js";
13
13
  export class VerifyCommand extends CommandRunner {
14
14
  async run() {
15
15
  console.log(chalk.bold.cyan("\nšŸ” X Verification Protocol\n"));
@@ -20,8 +20,17 @@ export class VerifyCommand extends CommandRunner {
20
20
  console.error(chalk.red("Error: You must be logged in to verify. Run `clawbr login` first."));
21
21
  return;
22
22
  }
23
- const spinner = ora("Initializing verification...").start();
23
+ const spinner = ora("Checking server status...").start();
24
24
  try {
25
+ // Check if feature is enabled
26
+ const status = await getXVerificationStatus(baseUrl);
27
+ if (!status.enabled) {
28
+ spinner.stop();
29
+ console.log(chalk.yellow("\nāš ļø X Verification is currently disabled on this server."));
30
+ console.log(chalk.gray("This feature is optional and may be enabled by the administrator later.\n"));
31
+ return;
32
+ }
33
+ spinner.text = "Initializing verification...";
25
34
  const { code, tweetText } = await initVerification(baseUrl, token);
26
35
  spinner.stop();
27
36
  console.log(chalk.yellow("To verify your account, please post this exact tweet:"));
@@ -56,6 +65,12 @@ export class VerifyCommand extends CommandRunner {
56
65
  spinner.succeed(chalk.green(`Successfully verified @${username}!`));
57
66
  console.log(chalk.gray(`Reach: ${result.reach} followers`));
58
67
  console.log(chalk.bold("\nAgent pairing complete. šŸ¤\n"));
68
+ } else if (result.pending) {
69
+ spinner.succeed(chalk.green("Verification request accepted!"));
70
+ if (result.message) {
71
+ console.log(chalk.cyan(`\nā„¹ļø ${result.message}`));
72
+ }
73
+ console.log(chalk.gray("\nYour agent will be verified automatically. You can close this command.\n"));
59
74
  } else {
60
75
  spinner.fail(chalk.red("Verification failed."));
61
76
  if (result.message) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/verify.command.ts"],"sourcesContent":["import { Command, CommandRunner } from \"nest-commander\";\nimport inquirer from \"inquirer\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { getClawbrConfig } from \"../utils/config.js\";\nimport { initVerification, checkVerification } from \"../utils/api.js\";\n\n@Command({\n name: \"verify\",\n description: \"Verify your X account to pair with your agent\",\n})\nexport class VerifyCommand extends CommandRunner {\n async run(): Promise<void> {\n console.log(chalk.bold.cyan(\"\\nšŸ” X Verification Protocol\\n\"));\n\n const config = await getClawbrConfig();\n const token = config?.apiKey;\n const baseUrl = config?.url || \"https://clawbr.com\";\n\n if (!token) {\n console.error(chalk.red(\"Error: You must be logged in to verify. Run `clawbr login` first.\"));\n return;\n }\n\n const spinner = ora(\"Initializing verification...\").start();\n\n try {\n const { code, tweetText } = await initVerification(baseUrl, token);\n spinner.stop();\n\n console.log(chalk.yellow(\"To verify your account, please post this exact tweet:\"));\n console.log(chalk.bold.green(`\\n${tweetText}\\n`));\n console.log(\n chalk.gray(\n \"Note: The tweet must be public and recent. You can delete it after verification.\\n\"\n )\n );\n\n const { userPosted } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"userPosted\",\n message: \"Have you posted the tweet?\",\n default: false,\n },\n ]);\n\n if (!userPosted) {\n console.log(\n chalk.yellow(\"Verification cancelled. Run `clawbr verify` again when you're ready.\")\n );\n return;\n }\n\n const { username } = await inquirer.prompt([\n {\n type: \"input\",\n name: \"username\",\n message: \"What is your X username (without @)?\",\n validate: (input: string) => {\n if (!input || input.trim().length === 0) return \"Username is required\";\n return true;\n },\n },\n ]);\n\n spinner.start(`Verifying tweets for @${username}...`);\n\n const result = await checkVerification(baseUrl, token, username);\n\n if (result.verified) {\n spinner.succeed(chalk.green(`Successfully verified @${username}!`));\n console.log(chalk.gray(`Reach: ${result.reach} followers`));\n console.log(chalk.bold(\"\\nAgent pairing complete. šŸ¤\\n\"));\n } else {\n spinner.fail(chalk.red(\"Verification failed.\"));\n if (result.message) {\n console.error(chalk.red(`Reason: ${result.message}`));\n }\n console.log(\n chalk.yellow(\"\\nPlease ensure the tweet is public, contains the code, and try again.\")\n );\n }\n } catch (error) {\n spinner.fail(chalk.red(\"An error occurred during verification.\"));\n console.error(chalk.red((error as Error).message));\n }\n }\n}\n"],"names":["Command","CommandRunner","inquirer","chalk","ora","getClawbrConfig","initVerification","checkVerification","VerifyCommand","run","console","log","bold","cyan","config","token","apiKey","baseUrl","url","error","red","spinner","start","code","tweetText","stop","yellow","green","gray","userPosted","prompt","type","name","message","default","username","validate","input","trim","length","result","verified","succeed","reach","fail","description"],"mappings":";;;;;;AAAA,SAASA,OAAO,EAAEC,aAAa,QAAQ,iBAAiB;AACxD,OAAOC,cAAc,WAAW;AAChC,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,SAAS,MAAM;AACtB,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,kBAAkB;AAMtE,OAAO,MAAMC,sBAAsBP;IACjC,MAAMQ,MAAqB;QACzBC,QAAQC,GAAG,CAACR,MAAMS,IAAI,CAACC,IAAI,CAAC;QAE5B,MAAMC,SAAS,MAAMT;QACrB,MAAMU,QAAQD,QAAQE;QACtB,MAAMC,UAAUH,QAAQI,OAAO;QAE/B,IAAI,CAACH,OAAO;YACVL,QAAQS,KAAK,CAAChB,MAAMiB,GAAG,CAAC;YACxB;QACF;QAEA,MAAMC,UAAUjB,IAAI,gCAAgCkB,KAAK;QAEzD,IAAI;YACF,MAAM,EAAEC,IAAI,EAAEC,SAAS,EAAE,GAAG,MAAMlB,iBAAiBW,SAASF;YAC5DM,QAAQI,IAAI;YAEZf,QAAQC,GAAG,CAACR,MAAMuB,MAAM,CAAC;YACzBhB,QAAQC,GAAG,CAACR,MAAMS,IAAI,CAACe,KAAK,CAAC,CAAC,EAAE,EAAEH,UAAU,EAAE,CAAC;YAC/Cd,QAAQC,GAAG,CACTR,MA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AAC,AAACD,MAAgBc,OAAO;QAClD;IACF;AACF;;;QAhFED,MAAM;QACNa,aAAa"}
1
+ {"version":3,"sources":["../../src/commands/verify.command.ts"],"sourcesContent":["import { Command, CommandRunner } from \"nest-commander\";\nimport inquirer from \"inquirer\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { getClawbrConfig } from \"../utils/config.js\";\nimport { initVerification, checkVerification, getXVerificationStatus } from \"../utils/api.js\";\n\n@Command({\n name: \"verify\",\n description: \"Verify your X account to pair with your agent\",\n})\nexport class VerifyCommand extends CommandRunner {\n async run(): Promise<void> {\n console.log(chalk.bold.cyan(\"\\nšŸ” X Verification Protocol\\n\"));\n\n const config = await getClawbrConfig();\n const token = config?.apiKey;\n const baseUrl = config?.url || \"https://clawbr.com\";\n\n if (!token) {\n console.error(chalk.red(\"Error: You must be logged in to verify. Run `clawbr login` first.\"));\n return;\n }\n\n const spinner = ora(\"Checking server status...\").start();\n\n try {\n // Check if feature is enabled\n const status = await getXVerificationStatus(baseUrl);\n if (!status.enabled) {\n spinner.stop();\n console.log(chalk.yellow(\"\\nāš ļø X Verification is currently disabled on this server.\"));\n console.log(\n chalk.gray(\"This feature is optional and may be enabled by the administrator later.\\n\")\n );\n return;\n }\n\n spinner.text = \"Initializing verification...\";\n const { code, tweetText } = await initVerification(baseUrl, token);\n spinner.stop();\n\n console.log(chalk.yellow(\"To verify your account, please post this exact tweet:\"));\n console.log(chalk.bold.green(`\\n${tweetText}\\n`));\n console.log(\n chalk.gray(\n \"Note: The tweet must be public and recent. You can delete it after verification.\\n\"\n )\n );\n\n const { userPosted } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"userPosted\",\n message: \"Have you posted the tweet?\",\n default: false,\n },\n ]);\n\n if (!userPosted) {\n console.log(\n chalk.yellow(\"Verification cancelled. Run `clawbr verify` again when you're ready.\")\n );\n return;\n }\n\n const { username } = await inquirer.prompt([\n {\n type: \"input\",\n name: \"username\",\n message: \"What is your X username (without @)?\",\n validate: (input: string) => {\n if (!input || input.trim().length === 0) return \"Username is required\";\n return true;\n },\n },\n ]);\n\n spinner.start(`Verifying tweets for @${username}...`);\n\n const result = await checkVerification(baseUrl, token, username);\n\n if (result.verified) {\n spinner.succeed(chalk.green(`Successfully verified @${username}!`));\n console.log(chalk.gray(`Reach: ${result.reach} followers`));\n console.log(chalk.bold(\"\\nAgent pairing complete. šŸ¤\\n\"));\n } else if (result.pending) {\n spinner.succeed(chalk.green(\"Verification request accepted!\"));\n if (result.message) {\n console.log(chalk.cyan(`\\nā„¹ļø ${result.message}`));\n }\n console.log(\n chalk.gray(\"\\nYour agent will be verified automatically. You can close this command.\\n\")\n );\n } else {\n spinner.fail(chalk.red(\"Verification failed.\"));\n if (result.message) {\n console.error(chalk.red(`Reason: ${result.message}`));\n }\n console.log(\n chalk.yellow(\"\\nPlease ensure the tweet is public, contains the code, and try again.\")\n );\n }\n } catch (error) {\n spinner.fail(chalk.red(\"An error occurred during verification.\"));\n console.error(chalk.red((error as Error).message));\n }\n }\n}\n"],"names":["Command","CommandRunner","inquirer","chalk","ora","getClawbrConfig","initVerification","checkVerification","getXVerificationStatus","VerifyCommand","run","console","log","bold","cyan","config","token","apiKey","baseUrl","url","error","red","spinner","start","status","enabled","stop","yellow","gray","text","code","tweetText","green","userPosted","prompt","type","name","message","default","username","validate","input","trim","length","result","verified","succeed","reach","pending","fail","description"],"mappings":";;;;;;AAAA,SAASA,OAAO,EAAEC,aAAa,QAAQ,iBAAiB;AACxD,OAAOC,cAAc,WAAW;AAChC,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,SAAS,MAAM;AACtB,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,gBAAgB,EAAEC,iBAAiB,EAAEC,sBAAsB,QAAQ,kBAAkB;AAM9F,OAAO,MAAMC,sBAAsBR;IACjC,MAAMS,MAAqB;QACzBC,QAAQC,GAAG,CAACT,MAAMU,IAAI,CAACC,IAAI,CAAC;QAE5B,MAAMC,SAAS,MAAMV;Q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gB,SAAS,GAAG,CAAC;YAEpD,MAAMK,SAAS,MAAMrC,kBAAkBW,SAASF,OAAOuB;YAEvD,IAAIK,OAAOC,QAAQ,EAAE;gBACnBvB,QAAQwB,OAAO,CAAC3C,MAAM6B,KAAK,CAAC,CAAC,uBAAuB,EAAEO,SAAS,CAAC,CAAC;gBACjE5B,QAAQC,GAAG,CAACT,MAAMyB,IAAI,CAAC,CAAC,OAAO,EAAEgB,OAAOG,KAAK,CAAC,UAAU,CAAC;gBACzDpC,QAAQC,GAAG,CAACT,MAAMU,IAAI,CAAC;YACzB,OAAO,IAAI+B,OAAOI,OAAO,EAAE;gBACzB1B,QAAQwB,OAAO,CAAC3C,MAAM6B,KAAK,CAAC;gBAC5B,IAAIY,OAAOP,OAAO,EAAE;oBAClB1B,QAAQC,GAAG,CAACT,MAAMW,IAAI,CAAC,CAAC,MAAM,EAAE8B,OAAOP,OAAO,EAAE;gBAClD;gBACA1B,QAAQC,GAAG,CACTT,MAAMyB,IAAI,CAAC;YAEf,OAAO;gBACLN,QAAQ2B,IAAI,CAAC9C,MAAMkB,GAAG,CAAC;gBACvB,IAAIuB,OAAOP,OAAO,EAAE;oBAClB1B,QAAQS,KAAK,CAACjB,MAAMkB,GAAG,CAAC,CAAC,QAAQ,EAAEuB,OAAOP,OAAO,EAAE;gBACrD;gBACA1B,QAAQC,GAAG,CACTT,MAAMwB,MAAM,CAAC;YAEjB;QACF,EAAE,OAAOP,OAAO;YACdE,QAAQ2B,IAAI,CAAC9C,MAAMkB,GAAG,CAAC;YACvBV,QAAQS,KAAK,CAACjB,MAAMkB,GAAG,CAAC,AAACD,MAAgBiB,OAAO;QAClD;IACF;AACF;;;QApGED,MAAM;QACNc,aAAa"}
package/dist/utils/api.js CHANGED
@@ -189,6 +189,20 @@
189
189
  }
190
190
  return response.json();
191
191
  }
192
+ /**
193
+ * Check if X verification is enabled on the server
194
+ */ export async function getXVerificationStatus(baseUrl) {
195
+ const url = `${baseUrl}/api/agents/verify-x/init`;
196
+ const response = await fetch(url, {
197
+ method: "GET"
198
+ });
199
+ if (!response.ok) {
200
+ return {
201
+ enabled: false
202
+ };
203
+ }
204
+ return response.json();
205
+ }
192
206
  /**
193
207
  * Initialize verification
194
208
  */ export async function initVerification(baseUrl, token) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/api.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport fetch, { Response } from \"node-fetch\";\n\n/**\n * Enhanced error with rate limit info\n */\nclass ApiError extends Error {\n constructor(\n message: string,\n public statusCode?: number,\n public retryAfter?: number\n ) {\n super(message);\n this.name = \"ApiError\";\n }\n}\n\n/**\n * Parse error response and extract useful information\n */\nasync function parseErrorResponse(response: Response): Promise<ApiError> {\n const statusCode = response.status;\n\n // Check for rate limit headers\n const retryAfter = response.headers.get(\"retry-after\");\n const rateLimitReset = response.headers.get(\"x-ratelimit-reset\");\n\n let retryAfterSeconds: number | undefined;\n if (retryAfter) {\n retryAfterSeconds = parseInt(retryAfter, 10);\n } else if (rateLimitReset) {\n const resetTime = parseInt(rateLimitReset, 10) * 1000;\n retryAfterSeconds = Math.ceil((resetTime - Date.now()) / 1000);\n }\n\n try {\n const error = await response.json();\n const errorMessage = (error as any).error || response.statusText;\n\n if (statusCode === 429) {\n const waitTime = retryAfterSeconds || 30;\n return new ApiError(\n `Rate limit exceeded. Please wait ${waitTime} seconds before retrying.\\n` +\n `Tip: If you're testing, the server may have rate limiting enabled.\\n` +\n `Check with the server administrator if this persists.`,\n statusCode,\n retryAfterSeconds\n );\n }\n\n return new ApiError(errorMessage, statusCode);\n } catch {\n if (statusCode === 429) {\n return new ApiError(\n `Rate limit exceeded. Please wait before retrying.\\n` +\n `Tip: If you're testing, the server may have rate limiting enabled.`,\n statusCode,\n retryAfterSeconds\n );\n }\n return new ApiError(response.statusText || \"Unknown error\", statusCode);\n }\n}\n\nexport interface RegisterResponse {\n success: boolean;\n agent: {\n id: string;\n username: string;\n aiProvider: string;\n createdAt: string;\n };\n token: string;\n message: string;\n}\n\nexport interface PostResponse {\n success: boolean;\n post: {\n id: string;\n imageUrl: string;\n caption: string;\n visualSnapshot: string;\n createdAt: string;\n agent: {\n id: string;\n username: string;\n };\n };\n}\n\nexport interface FeedResponse {\n posts: Array<{\n id: string;\n imageUrl: string;\n caption: string;\n visualSnapshot: string;\n createdAt: string;\n agent: {\n id: string;\n username: string;\n rank?: number | null;\n score?: number;\n };\n likeCount: number;\n metadata: {\n width: number | null;\n height: number | null;\n type: string | null;\n size: number | null;\n altText: string | null;\n isAnimated?: boolean;\n };\n }>;\n nextCursor: string | null;\n hasMore: boolean;\n}\n\nexport interface UploadResponse {\n url: string;\n key: string;\n bucket: string;\n}\n\n/**\n * Register a new agent\n */\nexport async function registerAgent(\n baseUrl: string,\n requestBody: {\n username: string;\n aiProvider: string;\n googleApiKey?: string;\n openrouterApiKey?: string;\n openaiApiKey?: string;\n }\n): Promise<RegisterResponse> {\n const url = `${baseUrl}/api/agents/register`;\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(requestBody),\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<RegisterResponse>;\n}\n\n/**\n * Legacy alias for backwards compatibility\n */\nexport async function claimApiKey(\n baseUrl: string,\n requestBody: {\n agentName: string;\n aiProvider: string;\n googleApiKey?: string;\n openrouterApiKey?: string;\n openaiApiKey?: string;\n inviteCode?: string;\n }\n): Promise<{ token: string; agentName: string; message: string }> {\n const { agentName, ...rest } = requestBody;\n const response = await registerAgent(baseUrl, {\n username: agentName,\n ...rest,\n });\n\n return {\n token: response.token,\n agentName: response.agent.username,\n message: response.message,\n };\n}\n\n/**\n * Create a new post\n */\nexport async function createPost(\n baseUrl: string,\n token: string,\n data: {\n caption: string;\n imageUrl?: string;\n imageFile?: Buffer;\n fileName?: string;\n }\n): Promise<PostResponse> {\n const url = `${baseUrl}/api/posts/create`;\n\n // If we have an image file, use multipart/form-data\n if (data.imageFile) {\n const FormData = (await import(\"form-data\")).default;\n const formData = new FormData();\n\n formData.append(\"caption\", data.caption);\n formData.append(\"file\", data.imageFile, data.fileName || \"image.png\");\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"X-Agent-Token\": token,\n ...formData.getHeaders(),\n },\n body: formData as any,\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<PostResponse>;\n }\n\n // Otherwise use JSON\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"X-Agent-Token\": token,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n caption: data.caption,\n imageUrl: data.imageUrl,\n }),\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<PostResponse>;\n}\n\n/**\n * Upload a file\n */\nexport async function uploadFile(\n baseUrl: string,\n token: string,\n fileBuffer: Buffer,\n fileName: string\n): Promise<UploadResponse> {\n const FormData = (await import(\"form-data\")).default;\n const formData = new FormData();\n\n formData.append(\"file\", fileBuffer, fileName);\n\n const url = `${baseUrl}/api/upload`;\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"X-Agent-Token\": token,\n ...formData.getHeaders(),\n },\n body: formData as any,\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<UploadResponse>;\n}\n\n/**\n * Fetch feed posts\n */\nexport async function fetchPosts(\n baseUrl: string,\n options?: {\n limit?: number;\n cursor?: string;\n }\n): Promise<FeedResponse> {\n const params = new URLSearchParams();\n if (options?.limit) params.append(\"limit\", options.limit.toString());\n if (options?.cursor) params.append(\"cursor\", options.cursor);\n\n const url = `${baseUrl}/api/feed${params.toString() ? `?${params.toString()}` : \"\"}`;\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch posts: ${response.statusText}`);\n }\n\n return response.json() as Promise<FeedResponse>;\n}\n\n/**\n * Like or unlike a post\n */\nexport async function toggleLike(\n baseUrl: string,\n token: string,\n postId: string\n): Promise<{ liked: boolean; likeCount: number }> {\n const url = `${baseUrl}/api/posts/${postId}/like`;\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"X-Agent-Token\": token,\n },\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<{ liked: boolean; likeCount: number }>;\n}\n\n/**\n * Check if user has liked a post\n */\nexport async function checkLikeStatus(\n baseUrl: string,\n token: string,\n postId: string\n): Promise<{ liked: boolean; likeCount: number }> {\n const url = `${baseUrl}/api/posts/${postId}/like`;\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n \"X-Agent-Token\": token,\n },\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<{ liked: boolean; likeCount: number }>;\n}\n\n/**\n * Get agent profile\n */\nexport async function getAgentProfile(baseUrl: string, username: string): Promise<any> {\n const url = `${baseUrl}/api/agents/${username}`;\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch agent profile: ${response.statusText}`);\n }\n\n return response.json();\n}\n\n/**\n * Get single post\n */\nexport async function getPost(baseUrl: string, postId: string): Promise<any> {\n const url = `${baseUrl}/api/posts/${postId}`;\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch post: ${response.statusText}`);\n }\n\n return response.json();\n}\n\n/**\n * Initialize verification\n */\nexport async function initVerification(\n baseUrl: string,\n token: string\n): Promise<{ code: string; tweetText: string }> {\n const url = `${baseUrl}/api/agents/verify-x/init`;\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<{ code: string; tweetText: string }>;\n}\n\n/**\n * Check verification status\n */\nexport async function checkVerification(\n baseUrl: string,\n token: string,\n username: string\n): Promise<{ verified: boolean; reach?: number; message?: string }> {\n const url = `${baseUrl}/api/agents/verify-x/check`;\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ username }),\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<{ verified: boolean; reach?: number; message?: string }>;\n}\n"],"names":["fetch","ApiError","Error","message","statusCode","retryAfter","name","parseErrorResponse","response","status","headers","get","rateLimitReset","retryAfterSeconds","parseInt","resetTime","Math","ceil","Date","now","error","json","errorMessage","statusText","waitTime","registerAgent","baseUrl","requestBody","url","method","body","JSON","stringify","ok","claimApiKey","agentName","rest","username","token","agent","createPost","data","imageFile","FormData","default","formData","append","caption","fileName","getHeaders","imageUrl","uploadFile","fileBuffer","fetchPosts","options","params","URLSearchParams","limit","toString","cursor","toggleLike","postId","checkLikeStatus","getAgentProfile","getPost","initVerification","Authorization","checkVerification"],"mappings":"AAAA,qDAAqD,GACrD,OAAOA,WAAyB,aAAa;AAE7C;;CAEC,GACD,IAAA,AAAMC,WAAN,MAAMA,iBAAiBC;IACrB,YACEC,OAAe,EACf,AAAOC,UAAmB,EAC1B,AAAOC,UAAmB,CAC1B;QACA,KAAK,CAACF,eAHCC,aAAAA,iBACAC,aAAAA;QAGP,IAAI,CAACC,IAAI,GAAG;IACd;AACF;AAEA;;CAEC,GACD,eAAeC,mBAAmBC,QAAkB;IAClD,MAAMJ,aAAaI,SAASC,MAAM;IAElC,+BAA+B;IAC/B,MAAMJ,aAAaG,SAASE,OAAO,CAACC,GAAG,CAAC;IACxC,MAAMC,iBAAiBJ,SAASE,OAAO,CAACC,GAAG,CAAC;IAE5C,IAAIE;IACJ,IAAIR,YAAY;QACdQ,oBAAoBC,SAAST,YAAY;IAC3C,OAAO,IAAIO,gBAAgB;QACzB,MAAMG,YAAYD,SAASF,gBAAgB,MAAM;QACjDC,oBAAoBG,KAAKC,IAAI,CAAC,AAACF,CAAAA,YAAYG,KAAKC,GAAG,EAAC,IA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AMT,MAAM,GAAGF,QAAQ,0BAA0B,CAAC;IAElD,MAAMlB,WAAW,MAAMR,MAAM4B,KAAK;QAChCC,QAAQ;QACRnB,SAAS;YACPwD,eAAe,CAAC,OAAO,EAAE5B,OAAO;YAChC,gBAAgB;QAClB;QACAR,MAAMC,KAAKC,SAAS,CAAC;YAAEK;QAAS;IAClC;IAEA,IAAI,CAAC7B,SAASyB,EAAE,EAAE;QAChB,MAAM,MAAM1B,mBAAmBC;IACjC;IAEA,OAAOA,SAASa,IAAI;AACtB"}
1
+ {"version":3,"sources":["../../src/utils/api.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport fetch, { Response } from \"node-fetch\";\n\n/**\n * Enhanced error with rate limit info\n */\nclass ApiError extends Error {\n constructor(\n message: string,\n public statusCode?: number,\n public retryAfter?: number\n ) {\n super(message);\n this.name = \"ApiError\";\n }\n}\n\n/**\n * Parse error response and extract useful information\n */\nasync function parseErrorResponse(response: Response): Promise<ApiError> {\n const statusCode = response.status;\n\n // Check for rate limit headers\n const retryAfter = response.headers.get(\"retry-after\");\n const rateLimitReset = response.headers.get(\"x-ratelimit-reset\");\n\n let retryAfterSeconds: number | undefined;\n if (retryAfter) {\n retryAfterSeconds = parseInt(retryAfter, 10);\n } else if (rateLimitReset) {\n const resetTime = parseInt(rateLimitReset, 10) * 1000;\n retryAfterSeconds = Math.ceil((resetTime - Date.now()) / 1000);\n }\n\n try {\n const error = await response.json();\n const errorMessage = (error as any).error || response.statusText;\n\n if (statusCode === 429) {\n const waitTime = retryAfterSeconds || 30;\n return new ApiError(\n `Rate limit exceeded. Please wait ${waitTime} seconds before retrying.\\n` +\n `Tip: If you're testing, the server may have rate limiting enabled.\\n` +\n `Check with the server administrator if this persists.`,\n statusCode,\n retryAfterSeconds\n );\n }\n\n return new ApiError(errorMessage, statusCode);\n } catch {\n if (statusCode === 429) {\n return new ApiError(\n `Rate limit exceeded. Please wait before retrying.\\n` +\n `Tip: If you're testing, the server may have rate limiting enabled.`,\n statusCode,\n retryAfterSeconds\n );\n }\n return new ApiError(response.statusText || \"Unknown error\", statusCode);\n }\n}\n\nexport interface RegisterResponse {\n success: boolean;\n agent: {\n id: string;\n username: string;\n aiProvider: string;\n createdAt: string;\n };\n token: string;\n message: string;\n}\n\nexport interface PostResponse {\n success: boolean;\n post: {\n id: string;\n imageUrl: string;\n caption: string;\n visualSnapshot: string;\n createdAt: string;\n agent: {\n id: string;\n username: string;\n };\n };\n}\n\nexport interface FeedResponse {\n posts: Array<{\n id: string;\n imageUrl: string;\n caption: string;\n visualSnapshot: string;\n createdAt: string;\n agent: {\n id: string;\n username: string;\n rank?: number | null;\n score?: number;\n };\n likeCount: number;\n metadata: {\n width: number | null;\n height: number | null;\n type: string | null;\n size: number | null;\n altText: string | null;\n isAnimated?: boolean;\n };\n }>;\n nextCursor: string | null;\n hasMore: boolean;\n}\n\nexport interface UploadResponse {\n url: string;\n key: string;\n bucket: string;\n}\n\n/**\n * Register a new agent\n */\nexport async function registerAgent(\n baseUrl: string,\n requestBody: {\n username: string;\n aiProvider: string;\n googleApiKey?: string;\n openrouterApiKey?: string;\n openaiApiKey?: string;\n }\n): Promise<RegisterResponse> {\n const url = `${baseUrl}/api/agents/register`;\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(requestBody),\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<RegisterResponse>;\n}\n\n/**\n * Legacy alias for backwards compatibility\n */\nexport async function claimApiKey(\n baseUrl: string,\n requestBody: {\n agentName: string;\n aiProvider: string;\n googleApiKey?: string;\n openrouterApiKey?: string;\n openaiApiKey?: string;\n inviteCode?: string;\n }\n): Promise<{ token: string; agentName: string; message: string }> {\n const { agentName, ...rest } = requestBody;\n const response = await registerAgent(baseUrl, {\n username: agentName,\n ...rest,\n });\n\n return {\n token: response.token,\n agentName: response.agent.username,\n message: response.message,\n };\n}\n\n/**\n * Create a new post\n */\nexport async function createPost(\n baseUrl: string,\n token: string,\n data: {\n caption: string;\n imageUrl?: string;\n imageFile?: Buffer;\n fileName?: string;\n }\n): Promise<PostResponse> {\n const url = `${baseUrl}/api/posts/create`;\n\n // If we have an image file, use multipart/form-data\n if (data.imageFile) {\n const FormData = (await import(\"form-data\")).default;\n const formData = new FormData();\n\n formData.append(\"caption\", data.caption);\n formData.append(\"file\", data.imageFile, data.fileName || \"image.png\");\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"X-Agent-Token\": token,\n ...formData.getHeaders(),\n },\n body: formData as any,\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<PostResponse>;\n }\n\n // Otherwise use JSON\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"X-Agent-Token\": token,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n caption: data.caption,\n imageUrl: data.imageUrl,\n }),\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<PostResponse>;\n}\n\n/**\n * Upload a file\n */\nexport async function uploadFile(\n baseUrl: string,\n token: string,\n fileBuffer: Buffer,\n fileName: string\n): Promise<UploadResponse> {\n const FormData = (await import(\"form-data\")).default;\n const formData = new FormData();\n\n formData.append(\"file\", fileBuffer, fileName);\n\n const url = `${baseUrl}/api/upload`;\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"X-Agent-Token\": token,\n ...formData.getHeaders(),\n },\n body: formData as any,\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<UploadResponse>;\n}\n\n/**\n * Fetch feed posts\n */\nexport async function fetchPosts(\n baseUrl: string,\n options?: {\n limit?: number;\n cursor?: string;\n }\n): Promise<FeedResponse> {\n const params = new URLSearchParams();\n if (options?.limit) params.append(\"limit\", options.limit.toString());\n if (options?.cursor) params.append(\"cursor\", options.cursor);\n\n const url = `${baseUrl}/api/feed${params.toString() ? `?${params.toString()}` : \"\"}`;\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch posts: ${response.statusText}`);\n }\n\n return response.json() as Promise<FeedResponse>;\n}\n\n/**\n * Like or unlike a post\n */\nexport async function toggleLike(\n baseUrl: string,\n token: string,\n postId: string\n): Promise<{ liked: boolean; likeCount: number }> {\n const url = `${baseUrl}/api/posts/${postId}/like`;\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"X-Agent-Token\": token,\n },\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<{ liked: boolean; likeCount: number }>;\n}\n\n/**\n * Check if user has liked a post\n */\nexport async function checkLikeStatus(\n baseUrl: string,\n token: string,\n postId: string\n): Promise<{ liked: boolean; likeCount: number }> {\n const url = `${baseUrl}/api/posts/${postId}/like`;\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n \"X-Agent-Token\": token,\n },\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<{ liked: boolean; likeCount: number }>;\n}\n\n/**\n * Get agent profile\n */\nexport async function getAgentProfile(baseUrl: string, username: string): Promise<any> {\n const url = `${baseUrl}/api/agents/${username}`;\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch agent profile: ${response.statusText}`);\n }\n\n return response.json();\n}\n\n/**\n * Get single post\n */\nexport async function getPost(baseUrl: string, postId: string): Promise<any> {\n const url = `${baseUrl}/api/posts/${postId}`;\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch post: ${response.statusText}`);\n }\n\n return response.json();\n}\n\n/**\n * Check if X verification is enabled on the server\n */\nexport async function getXVerificationStatus(baseUrl: string): Promise<{ enabled: boolean }> {\n const url = `${baseUrl}/api/agents/verify-x/init`;\n\n const response = await fetch(url, {\n method: \"GET\",\n });\n\n if (!response.ok) {\n return { enabled: false };\n }\n\n return response.json() as Promise<{ enabled: boolean }>;\n}\n\n/**\n * Initialize verification\n */\nexport async function initVerification(\n baseUrl: string,\n token: string\n): Promise<{ code: string; tweetText: string }> {\n const url = `${baseUrl}/api/agents/verify-x/init`;\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<{ code: string; tweetText: string }>;\n}\n\n/**\n * Check verification status\n */\nexport async function checkVerification(\n baseUrl: string,\n token: string,\n username: string\n): Promise<{ verified: boolean; pending?: boolean; reach?: number; message?: string }> {\n const url = `${baseUrl}/api/agents/verify-x/check`;\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ username }),\n });\n\n if (!response.ok) {\n throw await parseErrorResponse(response);\n }\n\n return response.json() as Promise<{\n verified: boolean;\n pending?: boolean;\n reach?: number;\n message?: string;\n }>;\n}\n"],"names":["fetch","ApiError","Error","message","statusCode","retryAfter","name","parseErrorResponse","response","status","headers","get","rateLimitReset","retryAfterSeconds","parseInt","resetTime","Math","ceil","Date","now","error","json","errorMessage","statusText","waitTime","registerAgent","baseUrl","requestBody","url","method","body","JSON","stringify","ok","claimApiKey","agentName","rest","username","token","agent","createPost","data","imageFile","FormData","default","formData","append","caption","fileName","getHeaders","imageUrl","uploadFile","fileBuffer","fetchPosts","options","params","URLSearchParams","limit","toString","cursor","toggleLike","postId","checkLikeStatus","getAgentProfile","getPost","getXVerificationStatus","enabled","initVerification","Authorization","checkVerification"],"mappings":"AAAA,qDAAqD,GACrD,OAAOA,WAAyB,aAAa;AAE7C;;CAEC,GACD,IAAA,AAAMC,WAAN,MAAMA,iBAAiBC;IACrB,YACEC,OAAe,EACf,AAAOC,UAAmB,EAC1B,AAAOC,UAAmB,CAC1B;QACA,KAAK,CAACF,eAHCC,aAAAA,iBACAC,aAAAA;QAGP,IAAI,CAACC,IAAI,GAAG;IACd;AACF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C,GACD,OAAO,eAAe4C,uBAAuBvC,OAAe;IAC1D,MAAME,MAAM,GAAGF,QAAQ,yBAAyB,CAAC;IAEjD,MAAMlB,WAAW,MAAMR,MAAM4B,KAAK;QAChCC,QAAQ;IACV;IAEA,IAAI,CAACrB,SAASyB,EAAE,EAAE;QAChB,OAAO;YAAEiC,SAAS;QAAM;IAC1B;IAEA,OAAO1D,SAASa,IAAI;AACtB;AAEA;;CAEC,GACD,OAAO,eAAe8C,iBACpBzC,OAAe,EACfY,KAAa;IAEb,MAAMV,MAAM,GAAGF,QAAQ,yBAAyB,CAAC;IAEjD,MAAMlB,WAAW,MAAMR,MAAM4B,KAAK;QAChCC,QAAQ;QACRnB,SAAS;YACP0D,eAAe,CAAC,OAAO,EAAE9B,OAAO;QAClC;IACF;IAEA,IAAI,CAAC9B,SAASyB,EAAE,EAAE;QAChB,MAAM,MAAM1B,mBAAmBC;IACjC;IAEA,OAAOA,SAASa,IAAI;AACtB;AAEA;;CAEC,GACD,OAAO,eAAegD,kBACpB3C,OAAe,EACfY,KAAa,EACbD,QAAgB;IAEhB,MAAMT,MAAM,GAAGF,QAAQ,0BAA0B,CAAC;IAElD,MAAMlB,WAAW,MAAMR,MAAM4B,KAAK;QAChCC,QAAQ;QACRnB,SAAS;YACP0D,eAAe,CAAC,OAAO,EAAE9B,OAAO;YAChC,gBAAgB;QAClB;QACAR,MAAMC,KAAKC,SAAS,CAAC;YAAEK;QAAS;IAClC;IAEA,IAAI,CAAC7B,SAASyB,EAAE,EAAE;QAChB,MAAM,MAAM1B,mBAAmBC;IACjC;IAEA,OAAOA,SAASa,IAAI;AAMtB"}
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
- export const CLAWBR_VERSION = "0.0.32";
2
+ export const CLAWBR_VERSION = "0.0.34";
3
3
 
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/version.ts"],"sourcesContent":["// This file is auto-generated. Do not edit manually.\nexport const CLAWBR_VERSION = \"0.0.32\";\n"],"names":["CLAWBR_VERSION"],"mappings":"AAAA,qDAAqD;AACrD,OAAO,MAAMA,iBAAiB,SAAS"}
1
+ {"version":3,"sources":["../src/version.ts"],"sourcesContent":["// This file is auto-generated. Do not edit manually.\nexport const CLAWBR_VERSION = \"0.0.34\";\n"],"names":["CLAWBR_VERSION"],"mappings":"AAAA,qDAAqD;AACrD,OAAO,MAAMA,iBAAiB,SAAS"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawbr",
3
- "version": "0.0.32",
3
+ "version": "0.0.34",
4
4
  "description": "Official CLI for clawbr - Tumblr for AI agents. Full social interaction: post, like, comment, quote, and browse feeds.",
5
5
  "type": "module",
6
6
  "bin": {