@otonix/cli 1.6.0 → 1.7.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/dist/cli.js +81 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -28,7 +28,7 @@ var import_sdk = require("@otonix/sdk");
|
|
|
28
28
|
var fs = __toESM(require("fs"));
|
|
29
29
|
var path = __toESM(require("path"));
|
|
30
30
|
var readline = __toESM(require("readline"));
|
|
31
|
-
var VERSION = "1.
|
|
31
|
+
var VERSION = "1.7.0";
|
|
32
32
|
var CONFIG_DIR = path.join(process.env.HOME || "~", ".otonix");
|
|
33
33
|
var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
34
34
|
function loadConfig() {
|
|
@@ -162,8 +162,15 @@ function showDashboard() {
|
|
|
162
162
|
console.log(cmd("trade:create", "Create a service listing"));
|
|
163
163
|
console.log(cmd("trade:buy", "Buy a service from another agent"));
|
|
164
164
|
console.log(cmd("trade:orders", "Show trading order history"));
|
|
165
|
+
console.log(cmd("trade:rate <id> <1-5>", "Rate a completed trading order"));
|
|
165
166
|
console.log(cmd("marketplace", "List static marketplace services"));
|
|
166
167
|
console.log();
|
|
168
|
+
console.log(section("LEADERBOARD", "\u{1F3C6}"));
|
|
169
|
+
console.log(cmd("leaderboard", "Show agent leaderboard (all categories)"));
|
|
170
|
+
console.log(cmd("leaderboard --sort revenue", "Sort by revenue earned"));
|
|
171
|
+
console.log(cmd("leaderboard --sort trades", "Sort by trade count"));
|
|
172
|
+
console.log(cmd("leaderboard --sort rating", "Sort by average rating"));
|
|
173
|
+
console.log();
|
|
167
174
|
console.log(section("BV-7X FLEET", "\u{1F6F0}\uFE0F"));
|
|
168
175
|
console.log(cmd("bv7x:fleet", "Show full fleet overview"));
|
|
169
176
|
console.log(cmd("bv7x:promote <id>", "Promote agent to mothership"));
|
|
@@ -1266,6 +1273,73 @@ async function cmdActivity(args) {
|
|
|
1266
1273
|
}
|
|
1267
1274
|
console.log();
|
|
1268
1275
|
}
|
|
1276
|
+
async function cmdTradeRate(args) {
|
|
1277
|
+
const client = getClient();
|
|
1278
|
+
const orderId = args[0];
|
|
1279
|
+
const score = parseInt(args[1]);
|
|
1280
|
+
if (!orderId) {
|
|
1281
|
+
console.error(" Usage: otonix trade:rate <orderId> <1-5> [--comment 'text']");
|
|
1282
|
+
process.exit(1);
|
|
1283
|
+
}
|
|
1284
|
+
if (!score || score < 1 || score > 5) {
|
|
1285
|
+
console.error(" Rating score must be between 1 and 5.");
|
|
1286
|
+
process.exit(1);
|
|
1287
|
+
}
|
|
1288
|
+
let comment = "";
|
|
1289
|
+
for (let i = 2; i < args.length; i++) {
|
|
1290
|
+
if (args[i] === "--comment" && args[i + 1]) comment = args[++i];
|
|
1291
|
+
}
|
|
1292
|
+
const result = await client.rateOrder(orderId, {
|
|
1293
|
+
ratingScore: score,
|
|
1294
|
+
ratingComment: comment || void 0
|
|
1295
|
+
});
|
|
1296
|
+
const stars = "\u2605".repeat(score) + "\u2606".repeat(5 - score);
|
|
1297
|
+
console.log(`
|
|
1298
|
+
${C.green}\u2713 Rating submitted${C.reset}`);
|
|
1299
|
+
console.log(` Score: ${C.yellow}${stars}${C.reset} (${score}/5)`);
|
|
1300
|
+
console.log(` New rating: ${C.bold}${result.newRating.toFixed(1)}/5${C.reset}`);
|
|
1301
|
+
if (comment) console.log(` Comment: ${C.gray}${comment}${C.reset}`);
|
|
1302
|
+
console.log();
|
|
1303
|
+
}
|
|
1304
|
+
async function cmdLeaderboard(args) {
|
|
1305
|
+
const client = getClient();
|
|
1306
|
+
let sortBy = "revenue";
|
|
1307
|
+
for (let i = 0; i < args.length; i++) {
|
|
1308
|
+
if (args[i] === "--sort" && args[i + 1]) sortBy = args[++i];
|
|
1309
|
+
}
|
|
1310
|
+
const leaderboard = await client.getLeaderboard();
|
|
1311
|
+
if (!leaderboard.length) {
|
|
1312
|
+
console.log("\n No agents on the leaderboard yet.\n");
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
const sorted = [...leaderboard].sort((a, b) => {
|
|
1316
|
+
if (sortBy === "trades") return b.tradeCount - a.tradeCount;
|
|
1317
|
+
if (sortBy === "rating") return (b.avgRating ?? -1) - (a.avgRating ?? -1);
|
|
1318
|
+
if (sortBy === "actions") return b.totalActions - a.totalActions;
|
|
1319
|
+
if (sortBy === "fleet") return b.childrenCount - a.childrenCount;
|
|
1320
|
+
return b.revenue - a.revenue;
|
|
1321
|
+
});
|
|
1322
|
+
const medals = ["\u{1F947}", "\u{1F948}", "\u{1F949}"];
|
|
1323
|
+
const sortLabel = { revenue: "Revenue", trades: "Trades", rating: "Rating", actions: "Actions", fleet: "Fleet" }[sortBy] || "Revenue";
|
|
1324
|
+
console.log(`
|
|
1325
|
+
${C.bold}\u{1F3C6} Agent Leaderboard \u2014 Top by ${sortLabel}${C.reset}
|
|
1326
|
+
`);
|
|
1327
|
+
console.log(` ${"#".padEnd(4)} ${"Agent".padEnd(22)} ${"Tier".padEnd(10)} ${"Revenue".padEnd(10)} ${"Trades".padEnd(8)} ${"Rating".padEnd(8)} Online`);
|
|
1328
|
+
console.log(` ${"\u2500".repeat(70)}`);
|
|
1329
|
+
sorted.slice(0, 10).forEach((a, i) => {
|
|
1330
|
+
const rank = medals[i] || ` ${String(i + 1).padStart(2)}.`;
|
|
1331
|
+
const name = a.name.slice(0, 20).padEnd(22);
|
|
1332
|
+
const tier = a.survivalTier.padEnd(10);
|
|
1333
|
+
const rev = `$${a.revenue.toFixed(1)}`.padEnd(10);
|
|
1334
|
+
const trades = String(a.tradeCount).padEnd(8);
|
|
1335
|
+
const rating = a.avgRating !== null ? `${a.avgRating.toFixed(1)}\u2605`.padEnd(8) : `\u2014`.padEnd(8);
|
|
1336
|
+
const online = a.isOnline ? `${C.green}\u25CF${C.reset}` : `${C.dim}\u25CB${C.reset}`;
|
|
1337
|
+
console.log(` ${rank} ${name} ${tier} ${rev} ${trades} ${rating} ${online}`);
|
|
1338
|
+
});
|
|
1339
|
+
console.log(`
|
|
1340
|
+
Sort: ${C.dim}--sort revenue | trades | rating | actions | fleet${C.reset}`);
|
|
1341
|
+
console.log();
|
|
1342
|
+
}
|
|
1269
1343
|
function cmdWhoami() {
|
|
1270
1344
|
const config = loadConfig();
|
|
1271
1345
|
if (!config) {
|
|
@@ -1399,6 +1473,12 @@ async function main() {
|
|
|
1399
1473
|
case "trade:orders":
|
|
1400
1474
|
await cmdTradeOrders(rest);
|
|
1401
1475
|
break;
|
|
1476
|
+
case "trade:rate":
|
|
1477
|
+
await cmdTradeRate(rest);
|
|
1478
|
+
break;
|
|
1479
|
+
case "leaderboard":
|
|
1480
|
+
await cmdLeaderboard(rest);
|
|
1481
|
+
break;
|
|
1402
1482
|
case "activity":
|
|
1403
1483
|
await cmdActivity(rest);
|
|
1404
1484
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@otonix/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "CLI tool for the Otonix sovereign compute platform — initialize agents, generate API keys, register, monitor status, BV-7X fleet orchestration, webhook management, and manage infrastructure from the terminal.",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"node": ">=18"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@otonix/sdk": "^1.
|
|
41
|
+
"@otonix/sdk": "^1.6.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"tsup": "^8.0.0",
|