clawmoney 0.15.17 → 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 +97 -26
- package/package.json +1 -1
|
@@ -253,28 +253,28 @@ export async function relaySetupCommand() {
|
|
|
253
253
|
const dailyLimitChoice = await select({
|
|
254
254
|
message: "Daily quota share per model? (applies independently to each model you register)",
|
|
255
255
|
options: [
|
|
256
|
-
{
|
|
257
|
-
value: 6,
|
|
258
|
-
label: "~10% · Minimal",
|
|
259
|
-
hint: "barely touches your subscription, leaves nearly all of it for personal use",
|
|
260
|
-
},
|
|
261
256
|
{
|
|
262
257
|
value: 15,
|
|
263
|
-
label: "~25% ·
|
|
264
|
-
hint: "
|
|
258
|
+
label: "~25% · Light",
|
|
259
|
+
hint: "share a quarter, leaves 75% for your personal use",
|
|
265
260
|
},
|
|
266
261
|
{
|
|
267
262
|
value: 30,
|
|
268
|
-
label: "~50% ·
|
|
263
|
+
label: "~50% · Balanced (recommended)",
|
|
269
264
|
hint: "splits each model's quota evenly between you and the relay",
|
|
270
265
|
},
|
|
266
|
+
{
|
|
267
|
+
value: 45,
|
|
268
|
+
label: "~75% · Heavy",
|
|
269
|
+
hint: "most of your subscription goes to relay, 25% reserved for personal use",
|
|
270
|
+
},
|
|
271
271
|
{
|
|
272
272
|
value: 60,
|
|
273
273
|
label: "~100% · Full",
|
|
274
|
-
hint: "dedicates your subscription to relay
|
|
274
|
+
hint: "dedicates your subscription to relay — best for accounts you don't use personally",
|
|
275
275
|
},
|
|
276
276
|
],
|
|
277
|
-
initialValue:
|
|
277
|
+
initialValue: 30,
|
|
278
278
|
});
|
|
279
279
|
if (isCancel(dailyLimitChoice)) {
|
|
280
280
|
cancel("Setup cancelled");
|
|
@@ -286,9 +286,9 @@ export async function relaySetupCommand() {
|
|
|
286
286
|
// label the user picked, so what they see in the summary matches what
|
|
287
287
|
// they answered in the prompt.
|
|
288
288
|
const limitLabel = {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
289
|
+
15: "~25% (Light)",
|
|
290
|
+
30: "~50% (Balanced)",
|
|
291
|
+
45: "~75% (Heavy)",
|
|
292
292
|
60: "~100% (Full)",
|
|
293
293
|
};
|
|
294
294
|
log.step(chalk.bold("Summary"));
|
|
@@ -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
|
}
|