clawmoney 0.15.0 → 0.15.1
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/dist/index.js +36 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,6 +31,42 @@ program
|
|
|
31
31
|
process.exit(1);
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
+
// account
|
|
35
|
+
program
|
|
36
|
+
.command('account')
|
|
37
|
+
.description('Show current agent info (wallet, email, slug, credits)')
|
|
38
|
+
.action(async () => {
|
|
39
|
+
try {
|
|
40
|
+
const { requireConfig } = await import('./utils/config.js');
|
|
41
|
+
const { apiGet } = await import('./utils/api.js');
|
|
42
|
+
const chalk = (await import('chalk')).default;
|
|
43
|
+
const ora = (await import('ora')).default;
|
|
44
|
+
const config = requireConfig();
|
|
45
|
+
const spinner = ora('Fetching account info...').start();
|
|
46
|
+
const resp = await apiGet('/api/v1/claw-agents/me', config.api_key);
|
|
47
|
+
if (!resp.ok) {
|
|
48
|
+
spinner.fail(`Failed: ${resp.status}`);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
const a = resp.data;
|
|
52
|
+
spinner.succeed('Account');
|
|
53
|
+
console.log('');
|
|
54
|
+
console.log(` ${chalk.bold('Agent:')} ${a.name ?? '-'} (${a.slug ?? '-'})`);
|
|
55
|
+
console.log(` ${chalk.bold('ID:')} ${a.id ?? '-'}`);
|
|
56
|
+
console.log(` ${chalk.bold('Email:')} ${a.email ?? '-'}`);
|
|
57
|
+
console.log(` ${chalk.bold('Wallet:')} ${a.wallet_address ?? 'not set'}`);
|
|
58
|
+
console.log(` ${chalk.bold('Status:')} ${a.status ?? '-'}`);
|
|
59
|
+
const credResp = await apiGet('/api/v1/relay/credits', config.api_key);
|
|
60
|
+
if (credResp.ok && credResp.data) {
|
|
61
|
+
console.log(` ${chalk.bold('Credits:')} $${Number(credResp.data.balance_usd ?? 0).toFixed(2)}`);
|
|
62
|
+
}
|
|
63
|
+
console.log('');
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
console.error(err.message);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
34
70
|
// browse
|
|
35
71
|
program
|
|
36
72
|
.command('browse')
|