clawmoney 0.15.18 → 0.15.20
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/commands/relay-setup.js +53 -13
- package/package.json +1 -1
|
@@ -352,25 +352,65 @@ export async function relaySetupCommand() {
|
|
|
352
352
|
failures.push({ cli: r.cli, model: r.model, error: msg });
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
// ── Step 7:
|
|
356
|
-
log.step(chalk.bold("
|
|
357
|
-
log.message(`${chalk.green(succeeded.toString())}
|
|
355
|
+
// ── Step 7: registration done, offer to auto-start ──
|
|
356
|
+
log.step(chalk.bold("Registered"));
|
|
357
|
+
log.message(`${chalk.green(succeeded.toString())} provider(s) registered`);
|
|
358
358
|
if (failed > 0) {
|
|
359
359
|
log.warn(`${failed} registrations failed`);
|
|
360
360
|
for (const f of failures) {
|
|
361
361
|
log.message(chalk.dim(` ${f.cli}/${f.model}: ${f.error.slice(0, 120)}`));
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
364
|
+
// ── Step 8: auto-start the daemon ──
|
|
365
|
+
//
|
|
366
|
+
// Daemon limitation: a single clawmoney process can only serve ONE
|
|
367
|
+
// cli_type today (single ~/.clawmoney/relay.pid file). When the user
|
|
368
|
+
// registered providers across multiple cli_types we can still
|
|
369
|
+
// auto-start ONE of them and tell them how to switch later. Tracked
|
|
370
|
+
// separately as a daemon refactor task.
|
|
371
|
+
const uniqueClis = Array.from(new Set(selectedClis));
|
|
372
|
+
if (uniqueClis.length === 1) {
|
|
373
|
+
// Single cli_type — go straight into the daemon. The user already
|
|
374
|
+
// confirmed "Register all N providers?" above, so asking a second
|
|
375
|
+
// time just adds friction.
|
|
376
|
+
const cli = uniqueClis[0];
|
|
377
|
+
const { relayStartCommand } = await import("./relay.js");
|
|
378
|
+
try {
|
|
379
|
+
await relayStartCommand({ cli });
|
|
380
|
+
}
|
|
381
|
+
catch (err) {
|
|
382
|
+
log.error(`Failed to start daemon: ${err.message}\n` +
|
|
383
|
+
`Try manually: ${chalk.cyan(`clawmoney relay start --cli ${cli}`)}`);
|
|
384
|
+
outro(chalk.yellow("Setup complete (daemon not started)"));
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
log.message("");
|
|
388
|
+
log.message(chalk.dim("Useful follow-up commands:"));
|
|
389
|
+
log.message(` ${chalk.cyan("clawmoney relay status")} # check daemon health + provider list`);
|
|
390
|
+
log.message(` ${chalk.cyan("clawmoney relay credits")} # check earnings + payout balance`);
|
|
391
|
+
log.message(` ${chalk.cyan("clawmoney relay stop")} # stop the daemon`);
|
|
392
|
+
outro(chalk.green("Setup complete · daemon running"));
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
// Multi cli_type — daemon can only host one at a time today. Start
|
|
396
|
+
// the first registered cli_type directly and tell the user how to
|
|
397
|
+
// switch to the others later.
|
|
398
|
+
const firstCli = uniqueClis[0];
|
|
399
|
+
log.warn(`You registered providers across ${uniqueClis.length} CLI families ` +
|
|
400
|
+
`(${uniqueClis.join(", ")}). The daemon currently serves ONE cli_type ` +
|
|
401
|
+
`per process — starting ${chalk.cyan(firstCli)} first.`);
|
|
402
|
+
const { relayStartCommand } = await import("./relay.js");
|
|
403
|
+
try {
|
|
404
|
+
await relayStartCommand({ cli: firstCli });
|
|
405
|
+
}
|
|
406
|
+
catch (err) {
|
|
407
|
+
log.error(`Failed to start daemon: ${err.message}\n` +
|
|
408
|
+
`Try manually: ${chalk.cyan(`clawmoney relay start --cli ${firstCli}`)}`);
|
|
409
|
+
outro(chalk.yellow("Setup complete (daemon not started)"));
|
|
410
|
+
return;
|
|
369
411
|
}
|
|
370
412
|
log.message("");
|
|
371
|
-
log.message("
|
|
372
|
-
log.message(` ${chalk.cyan("clawmoney relay
|
|
373
|
-
|
|
374
|
-
log.message(` ${chalk.cyan("clawmoney relay stop")} # stop the daemon`);
|
|
375
|
-
outro(chalk.green("Setup complete"));
|
|
413
|
+
log.message(chalk.dim("To switch to a different cli_type later:"));
|
|
414
|
+
log.message(chalk.dim(` ${chalk.cyan("clawmoney relay stop")} && ${chalk.cyan("clawmoney relay start --cli <other-cli>")}`));
|
|
415
|
+
outro(chalk.green(`Setup complete · ${firstCli} daemon running`));
|
|
376
416
|
}
|