tuxevil-rotator 3.9.0 → 3.10.0

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/src/cli.ts CHANGED
@@ -270,6 +270,113 @@ switch (command) {
270
270
  process.exit(1);
271
271
  }
272
272
  break;
273
+ case "install-agent": {
274
+ const { installAgents } = await import("./install-agent.js");
275
+
276
+ const targetIdx = args.indexOf("--target") >= 0 ? args.indexOf("--target") : args.indexOf("-t");
277
+ const targetStr = targetIdx >= 0 ? args[targetIdx + 1] : undefined;
278
+ const targets: ("opencode" | "hermes" | "pi" | "codex" | "auto" | "all")[] = targetStr
279
+ ? (targetStr.split(",").map((s) => s.trim().toLowerCase()) as ("opencode" | "hermes" | "pi" | "codex" | "auto" | "all")[])
280
+ : ["auto"];
281
+
282
+ const hostIdx = args.indexOf("--host");
283
+ const host = hostIdx >= 0 ? args[hostIdx + 1] : undefined;
284
+
285
+ const userIdx = args.indexOf("--user") >= 0 ? args.indexOf("--user") : args.indexOf("-u");
286
+ const user = userIdx >= 0 ? args[userIdx + 1] : undefined;
287
+
288
+ const portIdx = args.indexOf("--port") >= 0 ? args.indexOf("--port") : args.indexOf("-p");
289
+ const port = portIdx >= 0 ? Number(args[portIdx + 1]) : undefined;
290
+
291
+ const keyIdx = args.indexOf("--ssh-key") >= 0 ? args.indexOf("--ssh-key") : args.indexOf("-i");
292
+ const sshKey = keyIdx >= 0 ? args[keyIdx + 1] : undefined;
293
+
294
+ const urlIdx = args.indexOf("--rotator-url");
295
+ const rotatorUrl = urlIdx >= 0 ? args[urlIdx + 1] : undefined;
296
+
297
+ const provIdx = args.indexOf("--provider-id");
298
+ const providerId = provIdx >= 0 ? args[provIdx + 1] : undefined;
299
+
300
+ const nameIdx = args.indexOf("--provider-name");
301
+ const providerName = nameIdx >= 0 ? args[nameIdx + 1] : undefined;
302
+
303
+ const apiKeyIdx = args.indexOf("--api-key");
304
+ const apiKey = apiKeyIdx >= 0 ? args[apiKeyIdx + 1] : undefined;
305
+
306
+ const dryRun = args.includes("--dry-run");
307
+
308
+ try {
309
+ await installAgents({
310
+ targets,
311
+ host,
312
+ user,
313
+ port,
314
+ sshKey,
315
+ rotatorUrl,
316
+ providerId,
317
+ providerName,
318
+ apiKey,
319
+ dryRun,
320
+ });
321
+ process.exit(0);
322
+ } catch (err: unknown) {
323
+ console.error(`Install failed: ${err instanceof Error ? err.message : String(err)}`);
324
+ process.exit(1);
325
+ }
326
+ break;
327
+ }
328
+ case "install-opencode": {
329
+ const { installOpenCodePlugin } = await import("./install-opencode.js");
330
+
331
+ const hostIdx = args.indexOf("--host");
332
+ const host = hostIdx >= 0 ? args[hostIdx + 1] : undefined;
333
+
334
+ const userIdx = args.indexOf("--user");
335
+ const user = userIdx >= 0 ? args[userIdx + 1] : undefined;
336
+
337
+ const portIdx = args.indexOf("--port");
338
+ const port = portIdx >= 0 ? Number(args[portIdx + 1]) : undefined;
339
+
340
+ const keyIdx = args.indexOf("--ssh-key");
341
+ const sshKey = keyIdx >= 0 ? args[keyIdx + 1] : undefined;
342
+
343
+ const urlIdx = args.indexOf("--rotator-url");
344
+ const rotatorUrl = urlIdx >= 0 ? args[urlIdx + 1] : undefined;
345
+
346
+ const provIdx = args.indexOf("--provider-id");
347
+ const providerId = provIdx >= 0 ? args[provIdx + 1] : undefined;
348
+
349
+ const nameIdx = args.indexOf("--provider-name");
350
+ const providerName = nameIdx >= 0 ? args[nameIdx + 1] : undefined;
351
+
352
+ const apiKeyIdx = args.indexOf("--api-key");
353
+ const apiKey = apiKeyIdx >= 0 ? args[apiKeyIdx + 1] : undefined;
354
+
355
+ const dirIdx = args.indexOf("--target-dir");
356
+ const targetDir = dirIdx >= 0 ? args[dirIdx + 1] : undefined;
357
+
358
+ const dryRun = args.includes("--dry-run");
359
+
360
+ try {
361
+ await installOpenCodePlugin({
362
+ host,
363
+ user,
364
+ port,
365
+ sshKey,
366
+ rotatorUrl,
367
+ providerId,
368
+ providerName,
369
+ apiKey,
370
+ targetDir,
371
+ dryRun,
372
+ });
373
+ process.exit(0);
374
+ } catch (err: unknown) {
375
+ console.error(`Install failed: ${err instanceof Error ? err.message : String(err)}`);
376
+ process.exit(1);
377
+ }
378
+ break;
379
+ }
273
380
  default:
274
381
  console.log("Tuxevil Rotator");
275
382
  console.log();
@@ -299,6 +406,29 @@ switch (command) {
299
406
  console.log(
300
407
  " delete <hash> - Delete a virtual key",
301
408
  );
409
+ console.log(" tuxevil-rotator install-agent Install rotator config across multiple agents");
410
+ console.log(
411
+ " [--target <auto|all|opencode,hermes,pi,codex>]",
412
+ );
413
+ console.log(
414
+ " [--host <ip|hostname>] [--user <ssh-user>] [--ssh-key <path>]",
415
+ );
416
+ console.log(
417
+ " [--rotator-url <url>] [--provider-id <id>] [--api-key <key>]",
418
+ );
419
+ console.log(
420
+ " [--dry-run]",
421
+ );
422
+ console.log(" tuxevil-rotator install-opencode Install auto-discovery plugin for OpenCode");
423
+ console.log(
424
+ " [--host <ip|hostname>] [--user <ssh-user>] [--ssh-key <path>]",
425
+ );
426
+ console.log(
427
+ " [--rotator-url <url>] [--provider-id <id>] [--api-key <key>]",
428
+ );
429
+ console.log(
430
+ " [--dry-run]",
431
+ );
302
432
  console.log();
303
433
  console.log("Options:");
304
434
  console.log(
@@ -1,81 +1,82 @@
1
1
  import { dynamicCatalog } from "../providers/google-antigravity/dynamic-catalog.js";
2
2
 
3
- export interface ModelSpec {
4
- maxOutputTokens: number;
5
- thinkingBudget: number; // -1 = adaptive (model decides), >=0 = fixed
3
+ export interface ModelSpec {
4
+ maxOutputTokens: number;
5
+ thinkingBudget: number; // -1 = adaptive (model decides), >=0 = fixed
6
6
  minThinkingBudget?: number;
7
- isThinking: boolean;
8
- /** Upstream-published context window (input tokens). Optional. */
9
- contextWindow?: number;
10
- }
11
-
7
+ isThinking: boolean;
8
+ /** Upstream-published context window (input tokens). Optional. */
9
+ contextWindow?: number;
10
+ }
11
+
12
12
  export type ModelSpecOverride = Partial<ModelSpec>;
13
13
 
14
- export const DEFAULT_MODEL_SPECS: Record<string, ModelSpec> = {
15
- "gemini-pro-agent": { maxOutputTokens: 65535, thinkingBudget: 10001, isThinking: true, contextWindow: 1_000_000 },
16
- "gemini-3-flash-agent": { maxOutputTokens: 65536, thinkingBudget: 10000, isThinking: true, contextWindow: 1_000_000 },
17
- "gemini-3-pro-high": { maxOutputTokens: 65535, thinkingBudget: 10001, isThinking: true, contextWindow: 1_000_000 },
18
- "gemini-3-pro-low": { maxOutputTokens: 65535, thinkingBudget: 1001, isThinking: true, contextWindow: 1_000_000 },
19
- "gemini-3.1-pro": { maxOutputTokens: 65535, thinkingBudget: 10001, isThinking: true, contextWindow: 1_000_000 },
20
- "gemini-3.1-pro-high": { maxOutputTokens: 65535, thinkingBudget: 10001, isThinking: true, contextWindow: 1_000_000 },
21
- "gemini-3.1-pro-low": { maxOutputTokens: 65535, thinkingBudget: 1001, isThinking: true, contextWindow: 1_000_000 },
22
- "gemini-3.1-pro-preview": { maxOutputTokens: 65535, thinkingBudget: 10001, isThinking: true, contextWindow: 1_000_000 },
23
- "gemini-3.6-flash-high": { maxOutputTokens: 65536, thinkingBudget: 10000, isThinking: true, contextWindow: 1_000_000 },
24
- "gemini-3.6-flash-medium": { maxOutputTokens: 65536, thinkingBudget: 4000, isThinking: true, contextWindow: 1_000_000 },
25
- "gemini-3.6-flash-low": { maxOutputTokens: 65536, thinkingBudget: 1000, isThinking: true, contextWindow: 1_000_000 },
26
- "gemini-3.6-flash-tiered": { maxOutputTokens: 65536, thinkingBudget: -1, isThinking: true, contextWindow: 1_000_000 },
27
- "gemini-3.7-flash-tiered": { maxOutputTokens: 65536, thinkingBudget: -1, isThinking: true, contextWindow: 1_000_000 },
28
- "gemini-3.8-flash-high": { maxOutputTokens: 65536, thinkingBudget: -1, isThinking: true, contextWindow: 1_000_000 },
29
- "gemini-3.8-flash-medium": { maxOutputTokens: 65536, thinkingBudget: -1, isThinking: true, contextWindow: 1_000_000 },
30
- "gemini-3.8-flash-low": { maxOutputTokens: 65536, thinkingBudget: -1, isThinking: true, contextWindow: 1_000_000 },
31
- "gemini-3-flash": { maxOutputTokens: 65536, thinkingBudget: 4000, isThinking: true, contextWindow: 1_000_000 },
32
- "gemini-2.5-flash": { maxOutputTokens: 65535, thinkingBudget: 24576, isThinking: true, contextWindow: 1_000_000 },
33
- "gemini-2.5-pro": { maxOutputTokens: 65535, thinkingBudget: 1024, isThinking: true, contextWindow: 1_000_000 },
34
- "claude-sonnet-4-6": { maxOutputTokens: 64000, thinkingBudget: 32768, isThinking: true, contextWindow: 1_000_000 },
35
- "claude-sonnet-4-6-thinking":{ maxOutputTokens: 64000, thinkingBudget: 32768, isThinking: true, contextWindow: 1_000_000 },
36
- "claude-opus-4-6-thinking": { maxOutputTokens: 64000, thinkingBudget: 32768, isThinking: true, contextWindow: 1_000_000 },
37
- "claude-opus-4-6": { maxOutputTokens: 64000, thinkingBudget: 32768, isThinking: true, contextWindow: 1_000_000 },
14
+ export const DEFAULT_MODEL_SPECS: Record<string, ModelSpec> = {
15
+ "gemini-pro-agent": { maxOutputTokens: 65535, thinkingBudget: 10001, isThinking: true, contextWindow: 1_000_000 },
16
+ "gemini-3-flash-agent": { maxOutputTokens: 65536, thinkingBudget: 10000, isThinking: true, contextWindow: 1_000_000 },
17
+ "gemini-3-pro-high": { maxOutputTokens: 65535, thinkingBudget: 10001, isThinking: true, contextWindow: 1_000_000 },
18
+ "gemini-3-pro-low": { maxOutputTokens: 65535, thinkingBudget: 1001, isThinking: true, contextWindow: 1_000_000 },
19
+ "gemini-3.1-pro": { maxOutputTokens: 65535, thinkingBudget: 10001, isThinking: true, contextWindow: 1_000_000 },
20
+ "gemini-3.1-pro-high": { maxOutputTokens: 65535, thinkingBudget: 10001, isThinking: true, contextWindow: 1_000_000 },
21
+ "gemini-3.1-pro-low": { maxOutputTokens: 65535, thinkingBudget: 1001, isThinking: true, contextWindow: 1_000_000 },
22
+ "gemini-3.1-pro-preview": { maxOutputTokens: 65535, thinkingBudget: 10001, isThinking: true, contextWindow: 1_000_000 },
23
+ "gemini-3.6-flash-high": { maxOutputTokens: 65536, thinkingBudget: 10000, isThinking: true, contextWindow: 1_000_000 },
24
+ "gemini-3.6-flash-medium": { maxOutputTokens: 65536, thinkingBudget: 4000, isThinking: true, contextWindow: 1_000_000 },
25
+ "gemini-3.6-flash-low": { maxOutputTokens: 65536, thinkingBudget: 1000, isThinking: true, contextWindow: 1_000_000 },
26
+ "gemini-3.6-flash-tiered": { maxOutputTokens: 65536, thinkingBudget: -1, isThinking: true, contextWindow: 1_000_000 },
27
+ "gemini-3.7-flash-tiered": { maxOutputTokens: 65536, thinkingBudget: -1, isThinking: true, contextWindow: 1_000_000 },
28
+ "gemini-3.8-flash-high": { maxOutputTokens: 65536, thinkingBudget: -1, isThinking: true, contextWindow: 1_000_000 },
29
+ "gemini-3.8-flash-medium": { maxOutputTokens: 65536, thinkingBudget: -1, isThinking: true, contextWindow: 1_000_000 },
30
+ "gemini-3.8-flash-low": { maxOutputTokens: 65536, thinkingBudget: -1, isThinking: true, contextWindow: 1_000_000 },
31
+ "gemini-3.5-flash-lite": { maxOutputTokens: 65536, thinkingBudget: -1, isThinking: true, contextWindow: 1_000_000 },
32
+ "gemini-3-flash": { maxOutputTokens: 65536, thinkingBudget: 4000, isThinking: true, contextWindow: 1_000_000 },
33
+ "gemini-2.5-flash": { maxOutputTokens: 65535, thinkingBudget: 24576, isThinking: true, contextWindow: 1_000_000 },
34
+ "gemini-2.5-pro": { maxOutputTokens: 65535, thinkingBudget: 1024, isThinking: true, contextWindow: 1_000_000 },
35
+ "claude-sonnet-4-6": { maxOutputTokens: 64000, thinkingBudget: 32768, isThinking: true, contextWindow: 1_000_000 },
36
+ "claude-sonnet-4-6-thinking":{ maxOutputTokens: 64000, thinkingBudget: 32768, isThinking: true, contextWindow: 1_000_000 },
37
+ "claude-opus-4-6-thinking": { maxOutputTokens: 64000, thinkingBudget: 32768, isThinking: true, contextWindow: 1_000_000 },
38
+ "claude-opus-4-6": { maxOutputTokens: 64000, thinkingBudget: 32768, isThinking: true, contextWindow: 1_000_000 },
38
39
  "claude-sonnet-4-5": { maxOutputTokens: 64000, thinkingBudget: 32768, isThinking: true, contextWindow: 200_000 },
39
40
  "claude-sonnet-4-5-thinking":{ maxOutputTokens: 64000, thinkingBudget: 32768, isThinking: true, contextWindow: 200_000 },
40
41
  "claude-opus-4-5": { maxOutputTokens: 64000, thinkingBudget: 32768, isThinking: true, contextWindow: 200_000 },
41
42
  "claude-opus-4-5-thinking": { maxOutputTokens: 64000, thinkingBudget: 32768, isThinking: true, contextWindow: 200_000 },
42
- "gpt-oss-120b-medium": { maxOutputTokens: 32768, thinkingBudget: 8192, isThinking: true, contextWindow: 131_072 },
43
- "gpt-oss-120b": { maxOutputTokens: 32768, thinkingBudget: 8192, isThinking: true, contextWindow: 131_072 },
44
- };
45
-
43
+ "gpt-oss-120b-medium": { maxOutputTokens: 32768, thinkingBudget: 8192, isThinking: true, contextWindow: 131_072 },
44
+ "gpt-oss-120b": { maxOutputTokens: 32768, thinkingBudget: 8192, isThinking: true, contextWindow: 131_072 },
45
+ };
46
+
46
47
  let modelSpecsOverride: Record<string, ModelSpecOverride> | null = null;
47
-
48
- /**
48
+
49
+ /**
49
50
  * Apply operator-provided partial overrides over effective model specs.
50
- * Pass `null` to restore defaults. Called once at startup from index.ts.
51
- */
51
+ * Pass `null` to restore defaults. Called once at startup from index.ts.
52
+ */
52
53
  export function setModelSpecsOverride(specs: Record<string, ModelSpecOverride> | null): void {
53
54
  modelSpecsOverride = specs && Object.keys(specs).length > 0
54
55
  ? Object.fromEntries(
55
56
  Object.entries(specs).map(([key, spec]) => [key.toLowerCase(), spec]),
56
57
  )
57
58
  : null;
58
- }
59
-
60
- export function getActiveModelSpecs(): Record<string, ModelSpec> {
59
+ }
60
+
61
+ export function getActiveModelSpecs(): Record<string, ModelSpec> {
61
62
  if (!modelSpecsOverride) return DEFAULT_MODEL_SPECS;
62
63
  return Object.fromEntries(
63
64
  Object.keys(modelSpecsOverride).map((model) => [model, getModelSpec(model)]),
64
65
  );
65
- }
66
-
67
- const GEMINI_MAX_OUTPUT_TOKENS = 65536;
68
- const CLAUDE_MAX_OUTPUT_TOKENS = 64000;
69
- const FALLBACK_THINKING_BUDGET = 24576;
70
- const CLAUDE_DEFAULT_THINKING_BUDGET = 32768;
71
-
72
- export function getModelFamily(model: string): "claude" | "gemini" | "unknown" {
73
- const l = model.toLowerCase();
74
- if (l.includes("claude")) return "claude";
75
- if (l.includes("gemini")) return "gemini";
76
- return "unknown";
77
- }
78
-
66
+ }
67
+
68
+ const GEMINI_MAX_OUTPUT_TOKENS = 65536;
69
+ const CLAUDE_MAX_OUTPUT_TOKENS = 64000;
70
+ const FALLBACK_THINKING_BUDGET = 24576;
71
+ const CLAUDE_DEFAULT_THINKING_BUDGET = 32768;
72
+
73
+ export function getModelFamily(model: string): "claude" | "gemini" | "unknown" {
74
+ const l = model.toLowerCase();
75
+ if (l.includes("claude")) return "claude";
76
+ if (l.includes("gemini")) return "gemini";
77
+ return "unknown";
78
+ }
79
+
79
80
  /** Resolve bundled static metadata without consulting the dynamic registry. */
80
81
  export function getStaticModelSpec(model: string): ModelSpec | undefined {
81
82
  const lower = model.toLowerCase();
@@ -145,7 +146,7 @@ export function getModelSpec(model: string): ModelSpec {
145
146
  const override = getModelSpecOverride(lower);
146
147
  return override ? mergeModelSpec(defaults, override) : defaults;
147
148
  }
148
-
149
+
149
150
  export function isThinkingModel(model: string): boolean {
150
151
  return getModelSpec(model).isThinking;
151
152
  }
@@ -108,7 +108,7 @@ export function sanitizeClaudeViaGeminiSchema(schema: unknown): unknown {
108
108
  "patternProperties", "unevaluatedProperties", "unevaluatedItems",
109
109
  "contentEncoding", "contentMediaType",
110
110
  // Gemini's protobuf layer rejects these regardless of target model
111
- "exclusiveMinimum", "exclusiveMaximum", "propertyNames", "deprecated",
111
+ "exclusiveMinimum", "exclusiveMaximum", "propertyNames", "uniqueItems", "deprecated",
112
112
  ]);
113
113
 
114
114
  const out: Record<string, unknown> = {};
@@ -280,5 +280,13 @@ export function sanitizeClaudeViaGeminiSchema(schema: unknown): unknown {
280
280
 
281
281
  out[key] = isRecord(value) ? sanitizeClaudeViaGeminiSchema(value) : value;
282
282
  }
283
- return out;
284
- }
283
+ // Gemini's Schema proto accepts only strings in enum, even for Claude-bound
284
+ // requests. Preserve the primitive type and drop unsupported enum values.
285
+ if (Array.isArray(out.enum) && !out.enum.every((value) => typeof value === "string")) {
286
+ if (!out.type && out.enum.length > 0 && out.enum.every((value) => typeof value === "boolean")) {
287
+ out.type = "boolean";
288
+ }
289
+ delete out.enum;
290
+ }
291
+ return out;
292
+ }
package/src/compat.ts CHANGED
@@ -2567,16 +2567,16 @@ const MODEL_CATALOG = [
2567
2567
  tools: true,
2568
2568
  },
2569
2569
  {
2570
- id: "models/proactive-observer-v10",
2571
- family: "proactive-observer",
2570
+ id: "gemini-3.5-flash-lite",
2571
+ family: "gemini-3.5-flash",
2572
2572
  ctx: 1048576,
2573
2573
  quotaPool: "gemini",
2574
2574
  multimodal: true,
2575
- tools: false,
2575
+ tools: true,
2576
2576
  },
2577
2577
  {
2578
2578
  id: "whisper-1",
2579
- family: "proactive-observer",
2579
+ family: "gemini-3.8-flash",
2580
2580
  ctx: 1048576,
2581
2581
  quotaPool: "gemini",
2582
2582
  multimodal: true,
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ import { join } from "node:path";
4
4
  import type { Config } from "./types.js";
5
5
  import { AccountRotator } from "./rotator.js";
6
6
  import { startProxy } from "./proxy.js";
7
+ import { closeAllAudioWebSockets } from "./audio-transcription.js";
7
8
  import { getConfigDir } from "./paths.js";
8
9
  import { TelemetryReporter, setActiveReporter } from "./telemetry.js";
9
10
  import { loadConfig as loadConfigFromStore, importLegacyOllamaRotatorAccounts } from "./account-store.js";
@@ -47,6 +48,8 @@ function loadConfig(): Config {
47
48
  }
48
49
 
49
50
  const TWENTY_FOUR_HOURS_MS = 24 * 60 * 60 * 1000;
51
+ const SHUTDOWN_SERVER_CLOSE_TIMEOUT_MS = 3_000;
52
+ const SHUTDOWN_FORCE_EXIT_MS = 10_000;
50
53
 
51
54
  /**
52
55
  * Show a one-time, non-intrusive star reminder after 24h since first install.
@@ -242,10 +245,44 @@ export async function main(): Promise<void> {
242
245
  setActiveReporter(telemetry);
243
246
  void telemetry.start();
244
247
 
248
+ let server: ReturnType<typeof startProxy> | null = null;
249
+ let shuttingDown = false;
250
+
245
251
  // ── Graceful shutdown ──
246
252
  const shutdown = async (): Promise<void> => {
253
+ // npm/tsx wrappers can deliver the same Ctrl+C twice; a forced exit here would skip the flushes.
254
+ if (shuttingDown) {
255
+ console.log("Shutdown already in progress");
256
+ return;
257
+ }
258
+ shuttingDown = true;
247
259
  console.log("\nShutting down...");
260
+ // Last resort if a flush hangs; cleared before the normal exit so it can never fire later.
261
+ const forceExitTimer = setTimeout(() => {
262
+ console.error(`Shutdown did not finish within ${SHUTDOWN_FORCE_EXIT_MS}ms; forcing exit`);
263
+ process.exit(1);
264
+ }, SHUTDOWN_FORCE_EXIT_MS);
265
+ forceExitTimer.unref();
248
266
  stopRetentionCleanup();
267
+ closeAllAudioWebSockets();
268
+ const currentServer = server;
269
+ if (currentServer) {
270
+ // Bounded: a peer that never finishes closing must not keep the flushes below from running.
271
+ await new Promise<void>((resolve) => {
272
+ const closeTimer = setTimeout(() => {
273
+ console.warn(
274
+ `Proxy server did not close within ${SHUTDOWN_SERVER_CLOSE_TIMEOUT_MS}ms; continuing shutdown`,
275
+ );
276
+ resolve();
277
+ }, SHUTDOWN_SERVER_CLOSE_TIMEOUT_MS);
278
+ closeTimer.unref();
279
+ currentServer.close(() => {
280
+ clearTimeout(closeTimer);
281
+ resolve();
282
+ });
283
+ (currentServer as any).closeAllConnections?.();
284
+ });
285
+ }
249
286
  await flushSpendLogs();
250
287
  await flushResponsesStore();
251
288
  await rotator.flushPendingStateSave();
@@ -256,12 +293,13 @@ export async function main(): Promise<void> {
256
293
  await closeProxyDispatchers();
257
294
  const { closeDb } = await import("./db-store.js");
258
295
  await closeDb();
296
+ clearTimeout(forceExitTimer);
259
297
  process.exit(0);
260
298
  };
261
299
  process.on("SIGINT", () => void shutdown());
262
300
  process.on("SIGTERM", () => void shutdown());
263
301
 
264
- startProxy(rotator, config.proxyPort, config.bindHost || "0.0.0.0");
302
+ server = startProxy(rotator, config.proxyPort, config.bindHost || "0.0.0.0");
265
303
  }
266
304
 
267
305
  // Direct execution