clawmoney 0.15.60 → 0.15.62
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.js +36 -3
- package/dist/relay/provider.js +5 -0
- package/package.json +1 -1
package/dist/commands/relay.js
CHANGED
|
@@ -120,11 +120,44 @@ export async function relayRegisterCommand(options) {
|
|
|
120
120
|
// ── relay start ──
|
|
121
121
|
export async function relayStartCommand(options) {
|
|
122
122
|
const config = requireConfig();
|
|
123
|
-
//
|
|
123
|
+
// If an old daemon is still running, auto-stop and replace it instead
|
|
124
|
+
// of bailing with "already running, use stop first". Previously re-
|
|
125
|
+
// running `clawmoney relay setup` (or `relay start`) with a previous
|
|
126
|
+
// daemon alive produced a confusing error at the last step of an
|
|
127
|
+
// otherwise-successful flow. SIGTERM → poll for exit (3s) →
|
|
128
|
+
// SIGKILL on stubborn processes → clean PID file → start fresh.
|
|
124
129
|
const existingPid = readRelayPid();
|
|
125
130
|
if (existingPid && isRelayPidAlive(existingPid)) {
|
|
126
|
-
|
|
127
|
-
|
|
131
|
+
const stopSpin = ora(`Replacing existing daemon (PID ${existingPid})...`).start();
|
|
132
|
+
try {
|
|
133
|
+
process.kill(existingPid, "SIGTERM");
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
// Process may have exited between readPid and kill — ignore.
|
|
137
|
+
}
|
|
138
|
+
const deadline = Date.now() + 3000;
|
|
139
|
+
while (Date.now() < deadline) {
|
|
140
|
+
if (!isRelayPidAlive(existingPid))
|
|
141
|
+
break;
|
|
142
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
143
|
+
}
|
|
144
|
+
if (isRelayPidAlive(existingPid)) {
|
|
145
|
+
try {
|
|
146
|
+
process.kill(existingPid, "SIGKILL");
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
// ignore
|
|
150
|
+
}
|
|
151
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
152
|
+
stopSpin.warn(chalk.yellow(`Old daemon (PID ${existingPid}) didn't exit in 3s — forced SIGKILL`));
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
stopSpin.succeed(chalk.dim(`Stopped old daemon (PID ${existingPid})`));
|
|
156
|
+
}
|
|
157
|
+
// The graceful-shutdown path in the daemon removes its own PID
|
|
158
|
+
// file, but SIGKILL leaves a stale one. Make sure we start from
|
|
159
|
+
// a clean slate either way.
|
|
160
|
+
removeRelayPid();
|
|
128
161
|
}
|
|
129
162
|
const spinner = ora("Starting Relay Provider...").start();
|
|
130
163
|
try {
|
package/dist/relay/provider.js
CHANGED
|
@@ -94,6 +94,11 @@ function loadRelayConfig(cliOverride) {
|
|
|
94
94
|
const userRelay = (raw.relay ?? {});
|
|
95
95
|
const relay = {
|
|
96
96
|
cli_type: cliOverride ?? userRelay.cli_type ?? DEFAULT_RELAY.cli_type,
|
|
97
|
+
// Pass rate_guard through verbatim. Per-field merging happens
|
|
98
|
+
// inside each upstream module's configureRateGuard() which
|
|
99
|
+
// already knows its own defaults — we don't want to double-
|
|
100
|
+
// default here.
|
|
101
|
+
rate_guard: userRelay.rate_guard,
|
|
97
102
|
model: userRelay.model ?? DEFAULT_RELAY.model,
|
|
98
103
|
mode: userRelay.mode ?? DEFAULT_RELAY.mode,
|
|
99
104
|
concurrency: userRelay.concurrency ?? DEFAULT_RELAY.concurrency,
|