mslxdff 0.1.3 → 0.1.4

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/README.md CHANGED
@@ -46,16 +46,21 @@ Priority: `-port` arg > persisted port > `PORT` env > default `8989`.
46
46
 
47
47
  ### Daemon (background, stays resident)
48
48
 
49
+ Just run `mslxdff` (no args): if no daemon is running yet, it **starts a background
50
+ daemon and exits** — the command never holds your terminal, so `npx mslxdff` works
51
+ the same way. If a daemon is already up, the bare command shows status + help.
52
+
49
53
  ```
50
- mslxdff -d # start detached background daemon
51
- mslxdff -stop # stop it
54
+ mslxdff # starts the background daemon (if none running); exits immediately
55
+ mslxdff -d # same, explicit
56
+ mslxdff -stop # stop it
52
57
  ```
53
58
 
54
59
  Logs go to `~/.config/mslxdff/daemon.log`, the daemon pid to `daemon.pid` (both overridable via `MSLXDFF_DAEMON_DIR`). The daemon keeps running after your shell exits.
55
60
 
56
61
  ### Status
57
62
 
58
- Running `mslxdff` with no args shows a status panel when a daemon is already up (or use `mslxdff -status` anytime): the free model list, the last 5 calls (model/status/latency), and the most recent error. Call and error history are stored as JSON-lines at `calls.log` / `errors.log` in the state dir.
63
+ Running `mslxdff` with no args shows a status panel when a daemon is already up: joined groups with their members, failover targets, the free model list, the last 5 calls (model/status/latency), and the most recent error (`mslxdff -status` for status only, `mslxdff -help` for the full command reference). Call and error history are stored as JSON-lines at `calls.log` / `errors.log` in the state dir.
59
64
 
60
65
  ```
61
66
  $ mslxdff -status
package/bin/mslxdff.js CHANGED
@@ -250,10 +250,22 @@ if (args.includes("-d") || args.includes("--daemon")) {
250
250
  // we ARE the daemon; stdout/stderr already point at the log file via startDaemon stdio
251
251
  }
252
252
 
253
- // Bare run: if a daemon is already running, show status + help instead of starting another.
254
- if (!process.env.MSLXDFF_DAEMON && readPid()) {
255
- await printStatus();
256
- printHelp();
253
+ // Bare run: show status + help when the daemon is already up; otherwise spawn it
254
+ // as a background daemon and exit — never holds the terminal (npx-friendly).
255
+ if (!process.env.MSLXDFF_DAEMON) {
256
+ if (readPid()) {
257
+ await printStatus();
258
+ printHelp();
259
+ process.exit(0);
260
+ }
261
+ const port = effectivePort();
262
+ const spawnedPid = startDaemon([]);
263
+ await waitForHealth(port, 4000);
264
+ console.log(`mslxdff v${VERSION} started as a background daemon (pid ${spawnedPid})`);
265
+ console.log(`endpoint: http://localhost:${port}/v1`);
266
+ console.log(`log: ${logFile()}`);
267
+ console.log(`pid: ${pidFile()}`);
268
+ console.log(`status: run \`mslxdff\` again (or \`mslxdff -status\`)`);
257
269
  process.exit(0);
258
270
  }
259
271
 
@@ -383,7 +395,7 @@ function printHelp() {
383
395
  console.log(`mslxdff v${VERSION} — OpenCode Free OpenAI-compatible proxy
384
396
 
385
397
  Usage:
386
- mslxdff start the server (if none running); shows status when a daemon is already up
398
+ mslxdff start as a background daemon and exit (status + help if one is already running)
387
399
  mslxdff -d start as a background daemon
388
400
  mslxdff -status show current status (daemon, models, recent calls, last error)
389
401
  mslxdff -stop stop the running daemon
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mslxdff",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "测试项目,请勿使用。",
5
5
  "type": "module",
6
6
  "bin": {