made-bridge 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/server.mjs +12 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "made-bridge",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "码得(made)独立语音编程设备的电脑侧桥接器:工作台 API、设备接口、任务调度与插件运行时。一条命令启动,配合 ESP32 固件使用,源码在 github.com/jobop/made。",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/server.mjs CHANGED
@@ -903,7 +903,18 @@ export function createApp(config, { run, transcribe, tunnel: providedTunnel, ena
903
903
  };
904
904
  }
905
905
 
906
- if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
906
+ // 入口判断要用 realpath:npm bin / npx 通过 node_modules/.bin 里的符号链接调过来,
907
+ // argv[1] 是链接路径,直接和本文件路径比永远不相等——表现为静默退出、什么都不干。
908
+ const isEntry = (() => {
909
+ if (!process.argv[1]) return false;
910
+ try {
911
+ return fs.realpathSync(process.argv[1]) === fs.realpathSync(fileURLToPath(import.meta.url));
912
+ } catch {
913
+ return false;
914
+ }
915
+ })();
916
+
917
+ if (isEntry) {
907
918
  if (process.argv.includes('--doctor')) {
908
919
  // 自检只做检查并打印,不监听任何端口;有阻断性缺项时退出码为 1。
909
920
  const { runDoctor } = await import('./doctor.mjs');