@pptalker/agent 1.0.3 → 1.0.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.
Files changed (2) hide show
  1. package/dist/index.js +15 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { realpathSync } from 'node:fs';
2
3
  import { createRequire } from 'node:module';
3
4
  import { resolve } from 'node:path';
4
5
  import { fileURLToPath } from 'node:url';
@@ -95,7 +96,20 @@ async function main() {
95
96
  console.error(`[pptalker-agent] v${PKG.version} 就绪`);
96
97
  }
97
98
 
98
- if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
99
+ // npx / node_modules/.bin 通过符号链接执行本文件,process.argv[1] 是链接路径,
100
+ // 而 import.meta.url 已被 Node 解析成真实路径。必须 realpath 归一后再比较,
101
+ // 否则直接运行为“静默退出”(exit 0、无任何输出),表现为 MCP 客户端 -32000。
102
+ function isDirectRun() {
103
+ const entry = process.argv[1];
104
+ if (!entry) return false;
105
+ try {
106
+ return realpathSync(resolve(entry)) === realpathSync(fileURLToPath(import.meta.url));
107
+ } catch {
108
+ return false;
109
+ }
110
+ }
111
+
112
+ if (isDirectRun()) {
99
113
  main().catch(() => {
100
114
  console.error(`[pptalker-agent] 启动失败。${CONFIG_HELP}`);
101
115
  process.exitCode = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pptalker/agent",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "独立 PPTalker Agent MCP:异步准备、讲稿确认、私有视频与可取消的短状态查询。",
5
5
  "keywords": [
6
6
  "mcp",