@rikaidev/yomi 0.6.4 → 0.6.5
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/mcp/daemon.js +11 -4
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/run.mjs +13 -9
package/dist/mcp/daemon.js
CHANGED
|
@@ -59,7 +59,7 @@ export function readDaemonInfo() {
|
|
|
59
59
|
export async function isDaemonHealthy(info) {
|
|
60
60
|
try {
|
|
61
61
|
const controller = new AbortController();
|
|
62
|
-
const timer = setTimeout(() => controller.abort(),
|
|
62
|
+
const timer = setTimeout(() => controller.abort(), 3000);
|
|
63
63
|
const res = await fetch(`http://${info.host}:${info.port}/health`, {
|
|
64
64
|
signal: controller.signal,
|
|
65
65
|
});
|
|
@@ -83,11 +83,18 @@ export async function getRunningDaemon() {
|
|
|
83
83
|
if (healthy) {
|
|
84
84
|
return info;
|
|
85
85
|
}
|
|
86
|
+
// Check if PID is still alive. If alive, do NOT delete daemon.json (avoid competing instances)
|
|
86
87
|
try {
|
|
87
|
-
|
|
88
|
+
process.kill(info.pid, 0);
|
|
89
|
+
return info;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
try {
|
|
93
|
+
rmSync(daemonInfoPath());
|
|
94
|
+
}
|
|
95
|
+
catch { }
|
|
96
|
+
return null;
|
|
88
97
|
}
|
|
89
|
-
catch { }
|
|
90
|
-
return null;
|
|
91
98
|
}
|
|
92
99
|
export async function startDaemonServer(options = {}) {
|
|
93
100
|
const host = options.host ?? DEFAULT_DAEMON_HOST;
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"engines": {
|
|
4
4
|
"node": ">=22.13.0 <23.0.0 || >=23.4.0"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.6.
|
|
6
|
+
"version": "0.6.5",
|
|
7
7
|
"description": "Open-source personal LINE MCP server for AI agents. Read, reply, send images, and search LINE conversations locally with Letter-Sealing E2EE.",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"license": "MIT",
|
package/run.mjs
CHANGED
|
@@ -434,7 +434,7 @@ switch (cmd) {
|
|
|
434
434
|
await load('mcp/server');
|
|
435
435
|
break;
|
|
436
436
|
case 'daemon': {
|
|
437
|
-
const subCmd = args[1]
|
|
437
|
+
const subCmd = args[1] && !args[1].startsWith('-') ? args[1] : 'start';
|
|
438
438
|
const { startDaemonServer, stopDaemon, getRunningDaemon } = await load('mcp/daemon');
|
|
439
439
|
|
|
440
440
|
if (subCmd === 'status') {
|
|
@@ -474,15 +474,19 @@ switch (cmd) {
|
|
|
474
474
|
}
|
|
475
475
|
|
|
476
476
|
const { spawn } = await import('node:child_process');
|
|
477
|
-
const child = spawn(
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
477
|
+
const child = spawn(
|
|
478
|
+
process.execPath,
|
|
479
|
+
[process.argv[1], 'daemon', 'start', '--foreground', ...(port ? ['--port', String(port)] : [])],
|
|
480
|
+
{
|
|
481
|
+
detached: true,
|
|
482
|
+
stdio: 'ignore',
|
|
483
|
+
env: process.env,
|
|
484
|
+
},
|
|
485
|
+
);
|
|
482
486
|
child.unref();
|
|
483
487
|
|
|
484
488
|
let running = null;
|
|
485
|
-
for (let i = 0; i <
|
|
489
|
+
for (let i = 0; i < 100; i++) {
|
|
486
490
|
await new Promise((r) => setTimeout(r, 100));
|
|
487
491
|
running = await getRunningDaemon();
|
|
488
492
|
if (running) break;
|
|
@@ -501,14 +505,14 @@ switch (cmd) {
|
|
|
501
505
|
await stopDaemon();
|
|
502
506
|
await new Promise((r) => setTimeout(r, 500));
|
|
503
507
|
const { spawn } = await import('node:child_process');
|
|
504
|
-
const child = spawn(process.execPath, [process.argv[1], 'daemon', '--foreground'], {
|
|
508
|
+
const child = spawn(process.execPath, [process.argv[1], 'daemon', 'start', '--foreground'], {
|
|
505
509
|
detached: true,
|
|
506
510
|
stdio: 'ignore',
|
|
507
511
|
env: process.env,
|
|
508
512
|
});
|
|
509
513
|
child.unref();
|
|
510
514
|
let running = null;
|
|
511
|
-
for (let i = 0; i <
|
|
515
|
+
for (let i = 0; i < 100; i++) {
|
|
512
516
|
await new Promise((r) => setTimeout(r, 100));
|
|
513
517
|
running = await getRunningDaemon();
|
|
514
518
|
if (running) break;
|