antenna-fyi 1.2.25 → 1.2.26
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/lib/cli.js +27 -2
- package/package.json +1 -1
- package/skill/SKILL.md +2 -0
package/lib/cli.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { scan, getProfile, setProfile, accept, checkMatches, checkin, createBindToken, discover, createEvent, endEvent, eventCheckin, joinEvent, eventScan, pass as passUser, uploadEventImage, updateEvent, approveParticipant, rejectParticipant, addCohost, getClient } from "./core.js";
|
|
4
4
|
import { createInterface } from "readline";
|
|
5
|
-
import { existsSync, mkdirSync, copyFileSync, readFileSync } from "fs";
|
|
5
|
+
import { existsSync, mkdirSync, copyFileSync, readFileSync, writeFileSync, unlinkSync } from "fs";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import os from "os";
|
|
6
8
|
import { join, dirname, extname } from "path";
|
|
7
9
|
import { fileURLToPath } from "url";
|
|
8
10
|
import { homedir } from "os";
|
|
@@ -334,9 +336,21 @@ export async function handleSetup(f) {
|
|
|
334
336
|
|
|
335
337
|
export async function handleStatus(f) {
|
|
336
338
|
const supabaseUrl = process.env.ANTENNA_SUPABASE_URL || process.env.ANTENNA_URL || "https://bcudjloikmpcqwcptuyd.supabase.co";
|
|
337
|
-
console.log("📡 Antenna Status\n");
|
|
339
|
+
console.log("\n📡 Antenna Status\n");
|
|
338
340
|
console.log(` Supabase URL: ${supabaseUrl}`);
|
|
339
341
|
|
|
342
|
+
// Check watch process
|
|
343
|
+
const pidFile = path.join(os.homedir(), '.antenna', 'watch.pid');
|
|
344
|
+
try {
|
|
345
|
+
if (existsSync(pidFile)) {
|
|
346
|
+
const pid = parseInt(readFileSync(pidFile, 'utf8').trim());
|
|
347
|
+
try { process.kill(pid, 0); console.log(` Watch: ✅ running (PID ${pid})`); }
|
|
348
|
+
catch { console.log(' Watch: ❌ stale PID file (process dead)'); }
|
|
349
|
+
} else {
|
|
350
|
+
console.log(' Watch: ❌ not running');
|
|
351
|
+
}
|
|
352
|
+
} catch { console.log(' Watch: ❌ not running'); }
|
|
353
|
+
|
|
340
354
|
if (f.id) {
|
|
341
355
|
const profile = await getProfile({ device_id: f.id });
|
|
342
356
|
if (profile) {
|
|
@@ -466,6 +480,17 @@ export async function handleWatch(f) {
|
|
|
466
480
|
process.exit(1);
|
|
467
481
|
}
|
|
468
482
|
|
|
483
|
+
// Write PID file for health check
|
|
484
|
+
const pidDir = path.join(os.homedir(), '.antenna');
|
|
485
|
+
const pidFile = path.join(pidDir, 'watch.pid');
|
|
486
|
+
try {
|
|
487
|
+
if (!existsSync(pidDir)) mkdirSync(pidDir, { recursive: true });
|
|
488
|
+
writeFileSync(pidFile, String(process.pid));
|
|
489
|
+
} catch {}
|
|
490
|
+
process.on('exit', () => { try { unlinkSync(pidFile); } catch {} });
|
|
491
|
+
process.on('SIGINT', () => { try { unlinkSync(pidFile); } catch {} process.exit(0); });
|
|
492
|
+
process.on('SIGTERM', () => { try { unlinkSync(pidFile); } catch {} process.exit(0); });
|
|
493
|
+
|
|
469
494
|
const sb = getClient();
|
|
470
495
|
const notified = new Set();
|
|
471
496
|
|
package/package.json
CHANGED
package/skill/SKILL.md
CHANGED
|
@@ -68,6 +68,8 @@ antenna watch --id <device_id> &
|
|
|
68
68
|
```
|
|
69
69
|
这会保持一个 WebSocket 连接,有新匹配或活动审批变更时立即通知。比 cron 更实时。
|
|
70
70
|
|
|
71
|
+
**Health check:** 每次对话开始时,跑 `antenna status --id <device_id>` 检查 watch 是否在跑。如果显示 "Watch: ❌ not running",重新启动 `antenna watch --id <device_id> &`。
|
|
72
|
+
|
|
71
73
|
如果 exec 不支持后台进程,cron 是 fallback。
|
|
72
74
|
|
|
73
75
|
## When to use
|