clawcloud 1.0.1 → 1.1.0
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.
- package/index.js +85 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -158,6 +158,76 @@ async function setupWallet() {
|
|
|
158
158
|
// COMMANDS
|
|
159
159
|
// ============================================================================
|
|
160
160
|
|
|
161
|
+
async function cmdRegister() {
|
|
162
|
+
try {
|
|
163
|
+
log('Registering new AI agent...', 'loading');
|
|
164
|
+
|
|
165
|
+
// Generate unique agent ID
|
|
166
|
+
const timestamp = Math.floor(Date.now() / 1000);
|
|
167
|
+
const randomStr = Math.random().toString(36).substring(2, 7);
|
|
168
|
+
const agentId = `agent_${timestamp}_${randomStr}`;
|
|
169
|
+
|
|
170
|
+
console.log(`\n🤖 Generated Agent ID: ${agentId}`);
|
|
171
|
+
|
|
172
|
+
// Register with API
|
|
173
|
+
log('Registering with ClawCloud...', 'loading');
|
|
174
|
+
|
|
175
|
+
const response = await fetch(`${CONFIG.API_URL}/agents/register`, {
|
|
176
|
+
method: 'POST',
|
|
177
|
+
headers: { 'Content-Type': 'application/json' },
|
|
178
|
+
body: JSON.stringify({
|
|
179
|
+
agentId,
|
|
180
|
+
telegramUserId: null,
|
|
181
|
+
telegramChatId: null,
|
|
182
|
+
walletAddress: null
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
if (!response.ok) {
|
|
187
|
+
const error = await response.json();
|
|
188
|
+
log(`Registration failed: ${error.error || 'Unknown error'}`, 'error');
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const result = await response.json();
|
|
193
|
+
|
|
194
|
+
if (!result.success) {
|
|
195
|
+
log('Registration failed!', 'error');
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
log('Agent registered successfully!', 'success');
|
|
200
|
+
|
|
201
|
+
console.log('\n' + '='.repeat(80));
|
|
202
|
+
console.log('🎉 AGENT REGISTRATION SUCCESSFUL');
|
|
203
|
+
console.log('='.repeat(80));
|
|
204
|
+
console.log(`\n🤖 Your Agent ID:\n ${agentId}`);
|
|
205
|
+
console.log('\n📱 Next Steps:');
|
|
206
|
+
console.log('\n1️⃣ Open Telegram and find @clawcloud_devbot');
|
|
207
|
+
console.log(`2️⃣ Send this message:\n /start ${agentId}`);
|
|
208
|
+
console.log('3️⃣ The bot will create a wallet for your agent');
|
|
209
|
+
console.log('4️⃣ Fund the wallet with USDC on Base');
|
|
210
|
+
console.log('5️⃣ Your agent can now purchase VMs autonomously!');
|
|
211
|
+
console.log('\n💡 SAVE THIS AGENT ID - You\'ll need it to link your Telegram wallet!');
|
|
212
|
+
console.log('='.repeat(80) + '\n');
|
|
213
|
+
|
|
214
|
+
// Save agent ID to config
|
|
215
|
+
const config = loadConfig();
|
|
216
|
+
if (!config.agents) config.agents = [];
|
|
217
|
+
config.agents.push({
|
|
218
|
+
agentId,
|
|
219
|
+
createdAt: new Date().toISOString()
|
|
220
|
+
});
|
|
221
|
+
saveConfig(config);
|
|
222
|
+
|
|
223
|
+
log('Agent ID saved to local config!', 'success');
|
|
224
|
+
|
|
225
|
+
} catch (error) {
|
|
226
|
+
log(`Registration failed: ${error.message}`, 'error');
|
|
227
|
+
console.error(error);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
161
231
|
async function cmdTiers() {
|
|
162
232
|
try {
|
|
163
233
|
log('Fetching available VM tiers...', 'loading');
|
|
@@ -443,14 +513,18 @@ async function cmdInfo() {
|
|
|
443
513
|
console.log(`USDC: ${CONFIG.USDC_ADDRESS}`);
|
|
444
514
|
console.log(`API: ${CONFIG.API_URL}`);
|
|
445
515
|
console.log(`Explorer: ${CONFIG.EXPLORER_URL}`);
|
|
446
|
-
console.log(`\
|
|
516
|
+
console.log(`\nWebsite: https://clawcloud.co`);
|
|
517
|
+
console.log(`Documentation: https://docs.clawcloud.co`);
|
|
518
|
+
console.log(`X: https://x.com/clawcloudx`);
|
|
447
519
|
console.log(`Chart: https://dexscreener.com/base/0xe8850bBc9c289c34e7C92C9572BE38f77D61cB07`);
|
|
448
|
-
console.log(`X: x.com/clawcloudx`);
|
|
449
520
|
console.log('');
|
|
450
521
|
}
|
|
451
522
|
|
|
452
523
|
async function cmdHelp() {
|
|
453
524
|
console.log('\n🦞 ClawCloud CLI - Commands\n');
|
|
525
|
+
console.log('AGENT SETUP:');
|
|
526
|
+
console.log(' npx clawcloud register Register a new AI agent');
|
|
527
|
+
console.log('');
|
|
454
528
|
console.log('PURCHASE & MANAGE:');
|
|
455
529
|
console.log(' npx clawcloud purchase Purchase a new VM');
|
|
456
530
|
console.log(' npx clawcloud get <tokenId> Get VM credentials');
|
|
@@ -468,10 +542,11 @@ async function cmdHelp() {
|
|
|
468
542
|
console.log(' npx clawcloud help Show this help');
|
|
469
543
|
console.log('');
|
|
470
544
|
console.log('Examples:');
|
|
471
|
-
console.log(' npx clawcloud
|
|
472
|
-
console.log(' npx clawcloud
|
|
473
|
-
console.log(' npx clawcloud
|
|
474
|
-
console.log(' npx clawcloud
|
|
545
|
+
console.log(' npx clawcloud register # Register your AI agent first');
|
|
546
|
+
console.log(' npx clawcloud tiers # View available tiers');
|
|
547
|
+
console.log(' npx clawcloud purchase # Buy a VM');
|
|
548
|
+
console.log(' npx clawcloud get 42 # Get VM credentials');
|
|
549
|
+
console.log(' npx clawcloud list # List your VMs');
|
|
475
550
|
console.log('');
|
|
476
551
|
}
|
|
477
552
|
|
|
@@ -513,6 +588,9 @@ async function main() {
|
|
|
513
588
|
|
|
514
589
|
try {
|
|
515
590
|
switch (command) {
|
|
591
|
+
case 'register':
|
|
592
|
+
await cmdRegister();
|
|
593
|
+
break;
|
|
516
594
|
case 'tiers':
|
|
517
595
|
await cmdTiers();
|
|
518
596
|
break;
|
|
@@ -556,4 +634,4 @@ async function main() {
|
|
|
556
634
|
}
|
|
557
635
|
}
|
|
558
636
|
|
|
559
|
-
main();
|
|
637
|
+
main();
|