@zy_zhou/vps-mcp-server 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/tools/agy.js +26 -0
  2. package/package.json +1 -1
package/dist/tools/agy.js CHANGED
@@ -14,7 +14,33 @@ async function checkCommand(cmd) {
14
14
  return false;
15
15
  }
16
16
  }
17
+ const sessionLocks = new Map();
17
18
  export async function handleAgyAsk(args) {
19
+ const { sessionId } = args;
20
+ if (sessionId) {
21
+ const currentLock = sessionLocks.get(sessionId) || Promise.resolve();
22
+ let releaseLock = () => { };
23
+ const nextLock = new Promise((resolve) => {
24
+ releaseLock = resolve;
25
+ });
26
+ sessionLocks.set(sessionId, nextLock);
27
+ try {
28
+ await currentLock;
29
+ return await doHandleAgyAsk(args);
30
+ }
31
+ finally {
32
+ releaseLock();
33
+ // 🛡️ 垃圾回收:若当前队列中已无后续并发任务排队,直接从 Map 中移除该键,确保 0 内存残留
34
+ if (sessionLocks.get(sessionId) === nextLock) {
35
+ sessionLocks.delete(sessionId);
36
+ }
37
+ }
38
+ }
39
+ else {
40
+ return await doHandleAgyAsk(args);
41
+ }
42
+ }
43
+ async function doHandleAgyAsk(args) {
18
44
  const { prompt, sessionId, clear = true, dangerouslySkipPermissions = true, model, agent, effort, mode, project, addDir, } = args;
19
45
  if (!prompt) {
20
46
  throw new Error('prompt required');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zy_zhou/vps-mcp-server",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "MCP Server for VPS sandbox execution — run commands, scripts, and manage sessions remotely via MCP protocol. Supports stdio and SSE transports.",
5
5
  "type": "module",
6
6
  "main": "dist/server.js",