clawmoney 0.9.13 → 0.9.14

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.
@@ -27,5 +27,9 @@ interface RegisterOptions {
27
27
  }
28
28
  export declare function hubRegisterCommand(options: RegisterOptions): Promise<void>;
29
29
  export declare function hubSkillsCommand(): Promise<void>;
30
+ export declare function hubHistoryCommand(options: {
31
+ type?: string;
32
+ limit?: number;
33
+ }): Promise<void>;
30
34
  export declare function hubOrderCommand(orderId: string): Promise<void>;
31
35
  export {};
@@ -409,6 +409,104 @@ export async function hubSkillsCommand() {
409
409
  throw err;
410
410
  }
411
411
  }
412
+ export async function hubHistoryCommand(options) {
413
+ const config = requireConfig();
414
+ const limit = options.limit ?? 10;
415
+ const showType = options.type ?? "all";
416
+ console.log(chalk.bold("\n Hub Activity History\n"));
417
+ // Escrow tasks I submitted to (assigned)
418
+ if (showType === "all" || showType === "escrow") {
419
+ try {
420
+ const resp = await apiGet(`/api/v1/hub/escrow/assigned?limit=${limit}`, config.api_key);
421
+ if (resp.ok && resp.data.data?.length > 0) {
422
+ console.log(chalk.bold(` Escrow Tasks (${resp.data.count} total)`));
423
+ console.log(chalk.dim(" ─────────────────────────────────────────────"));
424
+ for (const task of resp.data.data) {
425
+ const statusColor = task.status === "settled" ? chalk.green :
426
+ task.status === "open" ? chalk.yellow :
427
+ task.status === "cancelled" ? chalk.gray :
428
+ chalk.white;
429
+ const age = timeAgo(task.created_at);
430
+ console.log(` ${statusColor(task.status.toUpperCase().padEnd(9))} ` +
431
+ `${chalk.bold(task.title.slice(0, 40).padEnd(40))} ` +
432
+ `${chalk.cyan("$" + task.budget.toFixed(2).padStart(6))} ` +
433
+ `${chalk.dim(age)}`);
434
+ if (task.mode === "multi") {
435
+ console.log(` ${"".padEnd(9)} ` +
436
+ `${chalk.dim(`${task.submission_count} submissions · by ${task.creator_agent_name ?? "?"}`)}`);
437
+ }
438
+ }
439
+ console.log("");
440
+ }
441
+ else {
442
+ console.log(chalk.dim(" No escrow tasks found.\n"));
443
+ }
444
+ }
445
+ catch {
446
+ console.log(chalk.dim(" Could not fetch escrow tasks.\n"));
447
+ }
448
+ }
449
+ // Service call orders (as provider)
450
+ if (showType === "all" || showType === "orders") {
451
+ try {
452
+ const resp = await apiGet(`/api/v1/hub/orders/mine?role=provider&limit=${limit}`, config.api_key);
453
+ if (resp.ok && resp.data.data?.length > 0) {
454
+ console.log(chalk.bold(` Service Orders (${resp.data.count} total)`));
455
+ console.log(chalk.dim(" ─────────────────────────────────────────────"));
456
+ for (const order of resp.data.data) {
457
+ const statusColor = order.status === "completed" ? chalk.green :
458
+ order.status === "pending" ? chalk.yellow :
459
+ order.status === "failed" ? chalk.red :
460
+ chalk.gray;
461
+ const age = timeAgo(order.created_at);
462
+ const dur = order.duration ? `${order.duration.toFixed(1)}s` : "--";
463
+ console.log(` ${statusColor(order.status.toUpperCase().padEnd(9))} ` +
464
+ `${chalk.dim("from")} ${chalk.bold((order.caller_agent_name ?? "?").slice(0, 15).padEnd(15))} ` +
465
+ `${chalk.cyan("$" + order.price.toFixed(3).padStart(7))} ` +
466
+ `${chalk.dim(dur.padStart(6))} ` +
467
+ `${chalk.dim(age)}`);
468
+ }
469
+ console.log("");
470
+ }
471
+ else {
472
+ console.log(chalk.dim(" No service orders found.\n"));
473
+ }
474
+ }
475
+ catch {
476
+ console.log(chalk.dim(" Could not fetch orders.\n"));
477
+ }
478
+ }
479
+ // Recent provider log
480
+ if (showType === "all" || showType === "log") {
481
+ try {
482
+ const { readFileSync } = await import("node:fs");
483
+ const lines = readFileSync(LOG_FILE, "utf-8").trim().split("\n");
484
+ const recent = lines.slice(-8);
485
+ console.log(chalk.bold(" Recent Provider Log"));
486
+ console.log(chalk.dim(" ─────────────────────────────────────────────"));
487
+ for (const line of recent) {
488
+ const isError = line.includes("[ERROR]");
489
+ const isInfo = line.includes("[INFO]");
490
+ console.log(` ${isError ? chalk.red(line) : isInfo ? chalk.dim(line) : chalk.yellow(line)}`);
491
+ }
492
+ console.log("");
493
+ }
494
+ catch {
495
+ console.log(chalk.dim(" No provider log found.\n"));
496
+ }
497
+ }
498
+ }
499
+ function timeAgo(iso) {
500
+ const diff = Date.now() - new Date(iso).getTime();
501
+ const min = Math.floor(diff / 60000);
502
+ if (min < 60)
503
+ return `${min}m ago`;
504
+ const hr = Math.floor(min / 60);
505
+ if (hr < 24)
506
+ return `${hr}h ago`;
507
+ const d = Math.floor(hr / 24);
508
+ return `${d}d ago`;
509
+ }
412
510
  // ── hub order ──
413
511
  export async function hubOrderCommand(orderId) {
414
512
  const config = requireConfig();
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { promoteSubmitCommand, promoteVerifyCommand } from './commands/promote.j
6
6
  import { walletStatusCommand, walletBalanceCommand, walletAddressCommand, walletSendCommand, } from './commands/wallet.js';
7
7
  import { tweetCommand } from './commands/tweet.js';
8
8
  import { gigCreateCommand, gigBrowseCommand, gigDetailCommand, gigAcceptCommand, gigDeliverCommand, gigApproveCommand, gigDisputeCommand, } from './commands/gig.js';
9
- import { hubStartCommand, hubStopCommand, hubStatusCommand, hubSearchCommand, hubCallCommand, hubRegisterCommand, hubSkillsCommand, hubOrderCommand, } from './commands/hub.js';
9
+ import { hubStartCommand, hubStopCommand, hubStatusCommand, hubSearchCommand, hubCallCommand, hubRegisterCommand, hubSkillsCommand, hubOrderCommand, hubHistoryCommand, } from './commands/hub.js';
10
10
  import { createRequire } from 'node:module';
11
11
  const require = createRequire(import.meta.url);
12
12
  const pkg = require('../package.json');
@@ -223,6 +223,20 @@ hub
223
223
  process.exit(1);
224
224
  }
225
225
  });
226
+ hub
227
+ .command('history')
228
+ .description('View Hub activity: escrow tasks, orders, and provider log')
229
+ .option('-t, --type <type>', 'Filter: all, escrow, orders, log', 'all')
230
+ .option('-l, --limit <n>', 'Number of items to show', '10')
231
+ .action(async (options) => {
232
+ try {
233
+ await hubHistoryCommand({ type: options.type, limit: parseInt(options.limit ?? '10', 10) });
234
+ }
235
+ catch (err) {
236
+ console.error(err.message);
237
+ process.exit(1);
238
+ }
239
+ });
226
240
  hub
227
241
  .command('search')
228
242
  .description('Search for agent services on the Hub')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawmoney",
3
- "version": "0.9.13",
3
+ "version": "0.9.14",
4
4
  "description": "ClawMoney CLI -- Earn rewards with your AI agent",
5
5
  "type": "module",
6
6
  "bin": {