clawmoney 0.15.18 → 0.15.19
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 +84 -13
- package/package.json +1 -1
|
@@ -352,25 +352,96 @@ 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 — straightforward auto-start.
|
|
374
|
+
const cli = uniqueClis[0];
|
|
375
|
+
const startNow = await confirm({
|
|
376
|
+
message: `Start the ${chalk.cyan(cli)} relay daemon now?`,
|
|
377
|
+
initialValue: true,
|
|
378
|
+
});
|
|
379
|
+
if (isCancel(startNow) || !startNow) {
|
|
380
|
+
log.message("");
|
|
381
|
+
log.message(chalk.dim("You can start it later with:"));
|
|
382
|
+
log.message(` ${chalk.cyan(`clawmoney relay start --cli ${cli}`)}`);
|
|
383
|
+
outro(chalk.green("Setup complete"));
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
// Hand off to the existing relay start command. Importing lazily
|
|
387
|
+
// to keep the wizard's startup time down.
|
|
388
|
+
const { relayStartCommand } = await import("./relay.js");
|
|
389
|
+
try {
|
|
390
|
+
await relayStartCommand({ cli });
|
|
391
|
+
}
|
|
392
|
+
catch (err) {
|
|
393
|
+
log.error(`Failed to start daemon: ${err.message}\n` +
|
|
394
|
+
`Try manually: ${chalk.cyan(`clawmoney relay start --cli ${cli}`)}`);
|
|
395
|
+
outro(chalk.yellow("Setup complete (daemon not started)"));
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
log.message("");
|
|
399
|
+
log.message(chalk.dim("Useful follow-up commands:"));
|
|
400
|
+
log.message(` ${chalk.cyan("clawmoney relay status")} # check daemon health + provider list`);
|
|
401
|
+
log.message(` ${chalk.cyan("clawmoney relay credits")} # check earnings + payout balance`);
|
|
402
|
+
log.message(` ${chalk.cyan("clawmoney relay stop")} # stop the daemon`);
|
|
403
|
+
outro(chalk.green("Setup complete · daemon running"));
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
// Multi cli_type — daemon can only host one at a time. Let the user
|
|
407
|
+
// pick which one to start now; explain the limitation honestly.
|
|
408
|
+
log.warn(`You registered providers across ${uniqueClis.length} CLI families ` +
|
|
409
|
+
`(${uniqueClis.join(", ")}). The daemon currently can only serve ONE ` +
|
|
410
|
+
`cli_type per process — pick which one to start first.`);
|
|
411
|
+
const startChoice = await select({
|
|
412
|
+
message: "Which cli_type's daemon to start now?",
|
|
413
|
+
options: [
|
|
414
|
+
...uniqueClis.map((cli) => ({
|
|
415
|
+
value: cli,
|
|
416
|
+
label: `Start ${chalk.cyan(cli)} daemon`,
|
|
417
|
+
hint: undefined,
|
|
418
|
+
})),
|
|
419
|
+
{ value: "__none__", label: "Don't start anything yet (I'll start manually)", hint: undefined },
|
|
420
|
+
],
|
|
421
|
+
initialValue: uniqueClis[0],
|
|
422
|
+
});
|
|
423
|
+
if (isCancel(startChoice) || startChoice === "__none__") {
|
|
424
|
+
log.message("");
|
|
425
|
+
log.message(chalk.dim("Manual start commands:"));
|
|
426
|
+
for (const cli of uniqueClis) {
|
|
427
|
+
log.message(` ${chalk.cyan(`clawmoney relay start --cli ${cli}`)}`);
|
|
428
|
+
}
|
|
429
|
+
log.message(chalk.dim(" (only one can run at a time today — switch with `clawmoney relay stop` first)"));
|
|
430
|
+
outro(chalk.green("Setup complete"));
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
const { relayStartCommand } = await import("./relay.js");
|
|
434
|
+
try {
|
|
435
|
+
await relayStartCommand({ cli: startChoice });
|
|
436
|
+
}
|
|
437
|
+
catch (err) {
|
|
438
|
+
log.error(`Failed to start daemon: ${err.message}\n` +
|
|
439
|
+
`Try manually: ${chalk.cyan(`clawmoney relay start --cli ${startChoice}`)}`);
|
|
440
|
+
outro(chalk.yellow("Setup complete (daemon not started)"));
|
|
441
|
+
return;
|
|
369
442
|
}
|
|
370
443
|
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"));
|
|
444
|
+
log.message(chalk.dim(`To switch to a different cli_type later:`));
|
|
445
|
+
log.message(chalk.dim(` ${chalk.cyan("clawmoney relay stop")} && ${chalk.cyan(`clawmoney relay start --cli <other-cli>`)}`));
|
|
446
|
+
outro(chalk.green(`Setup complete · ${startChoice} daemon running`));
|
|
376
447
|
}
|