@srgay/cursor-extension 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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/mcp-followup/cursor-mcp-followup.js +17 -9
package/README.md
CHANGED
|
@@ -178,7 +178,7 @@ window.__cursorMcpFollowup.uninstall() // 卸载面板
|
|
|
178
178
|
|
|
179
179
|
- `scanStart` / `scanCount`:扫描起始端口与数量(默认从 `8765` 起、共 `5` 个,即 `8765–8769`)。
|
|
180
180
|
- `probeTimeoutMs`:单端口探测超时(默认 `2500` ms;含一次 `run_command` 读取窗口工作区的往返)。
|
|
181
|
-
- `reconnectMs
|
|
181
|
+
- `reconnectMs`:WebSocket 存活探测间隔(默认 `8000` ms;不做周期性重连)。
|
|
182
182
|
|
|
183
183
|
### 排障
|
|
184
184
|
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
styleId: "cursor-mcp-followup-style",
|
|
10
10
|
panelId: "cursor-mcp-followup-panel",
|
|
11
11
|
mountScanMs: 600,
|
|
12
|
-
reconnectMs:
|
|
12
|
+
reconnectMs: 8000,
|
|
13
13
|
scanStart: 8765,
|
|
14
14
|
scanCount: 5,
|
|
15
15
|
probeTimeoutMs: 2500,
|
|
@@ -1748,18 +1748,16 @@
|
|
|
1748
1748
|
}
|
|
1749
1749
|
}
|
|
1750
1750
|
|
|
1751
|
-
//
|
|
1752
|
-
//
|
|
1753
|
-
// 定期重连以抢占活跃连接并同步当前会话;仅在用户正在输入时不打断(输入期间一般无其他端抢占)。
|
|
1751
|
+
// 定期探测当前 WebSocket 是否仍存活。这里不主动重连,避免周期性关闭/新建连接扰动
|
|
1752
|
+
// Cursor renderer 和 MCP 服务端的「最后连接」状态;重连只在启动、手动切端口、聚焦输入框或发送前触发。
|
|
1754
1753
|
function refreshTick() {
|
|
1755
1754
|
if (state.scanning) return;
|
|
1756
1755
|
if (els.portSelect.value === config.customValue) return;
|
|
1757
1756
|
if (els.customInput === document.activeElement) return;
|
|
1758
1757
|
if (els.prompt === document.activeElement && els.prompt.value.trim()) return;
|
|
1759
1758
|
|
|
1760
|
-
//
|
|
1761
|
-
//
|
|
1762
|
-
// 端口已关时 onerror 会清归属并置 offline,等待用户展开下拉重新选择本窗口端口)。
|
|
1759
|
+
// 不做后台扫描(扫描仅发生在启动时与下拉展开期间),也不做周期性重连。
|
|
1760
|
+
// OPEN → 发 heartbeat 探活;CONNECTING → 等待;其它状态 → 标记离线,等待用户操作触发连接。
|
|
1763
1761
|
if (
|
|
1764
1762
|
state.socket &&
|
|
1765
1763
|
state.socket.readyState === WebSocket.OPEN &&
|
|
@@ -1768,12 +1766,22 @@
|
|
|
1768
1766
|
try {
|
|
1769
1767
|
state.socket.send(JSON.stringify({ type: "heartbeat", timestamp: Date.now() }));
|
|
1770
1768
|
} catch (error) {
|
|
1771
|
-
|
|
1769
|
+
setOptionLabel(els.portSelect.value, "offline");
|
|
1770
|
+
setVisualState("offline", els.portSelect.value + " WebSocket heartbeat 发送失败。");
|
|
1772
1771
|
}
|
|
1773
1772
|
return;
|
|
1774
1773
|
}
|
|
1775
1774
|
|
|
1776
|
-
|
|
1775
|
+
if (
|
|
1776
|
+
state.socket &&
|
|
1777
|
+
state.socket.readyState === WebSocket.CONNECTING &&
|
|
1778
|
+
state.socketPort === els.portSelect.value
|
|
1779
|
+
) {
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
setOptionLabel(els.portSelect.value, "offline");
|
|
1784
|
+
setVisualState("offline", els.portSelect.value + " WebSocket 未连接或已断开。");
|
|
1777
1785
|
}
|
|
1778
1786
|
|
|
1779
1787
|
function autoResize() {
|