@tina_summer/codepocket 2.6.8 → 2.6.10

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/bin/codepocket.js CHANGED
@@ -682,7 +682,11 @@ function connectRelay() {
682
682
  if (proxyAgent) {
683
683
  log(`[codepocket] 使用代理: ${detectProxyUrl()}`)
684
684
  }
685
- const wsOptions = proxyAgent ? { agent: proxyAgent } : {}
685
+ // handshakeTimeout: a wedged TLS/WS upgrade (TCP accepted but no response,
686
+ // e.g. CF edge holding the connection) fires neither open/close/error —
687
+ // without a timeout the daemon stays CONNECTING forever and the phone
688
+ // sees hub_offline while the process looks alive.
689
+ const wsOptions = { handshakeTimeout: 15000, ...(proxyAgent ? { agent: proxyAgent } : {}) }
686
690
 
687
691
  relayWs = new WebSocket(relayUrl, wsOptions)
688
692
 
package/bin/run.js CHANGED
@@ -138,7 +138,8 @@ function connectRelay() {
138
138
  let savedSession = null
139
139
  try { savedSession = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8')) } catch {}
140
140
 
141
- relayWs = new WebSocket(relayUrl)
141
+ // handshakeTimeout — see bin/codepocket.js connectRelay for rationale
142
+ relayWs = new WebSocket(relayUrl, { handshakeTimeout: 15000 })
142
143
 
143
144
  relayWs.on('open', () => {
144
145
  console.log('[Relay] connected')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tina_summer/codepocket",
3
- "version": "2.6.8",
3
+ "version": "2.6.10",
4
4
  "description": "CodePocket — 基于ClaudeCode的微信小程序工作台",
5
5
  "bin": {
6
6
  "codepocket": "bin/codepocket.js",
@@ -20,10 +20,10 @@
20
20
  "ws": "^8.18.0"
21
21
  },
22
22
  "optionalDependencies": {
23
- "@tina_summer/codepocket-darwin-arm64": "2.6.8",
24
- "@tina_summer/codepocket-darwin-x64": "2.6.8",
25
- "@tina_summer/codepocket-linux-x64": "2.6.8",
26
- "@tina_summer/codepocket-win32-x64": "2.6.8"
23
+ "@tina_summer/codepocket-darwin-arm64": "2.6.10",
24
+ "@tina_summer/codepocket-darwin-x64": "2.6.10",
25
+ "@tina_summer/codepocket-linux-x64": "2.6.10",
26
+ "@tina_summer/codepocket-win32-x64": "2.6.10"
27
27
  },
28
28
  "engines": {
29
29
  "node": ">=18"
package/src/index.ts CHANGED
@@ -156,7 +156,9 @@ function startSSE() {
156
156
 
157
157
  function connectRelay() {
158
158
  try {
159
- relayWs = new WebSocket(relayUrl)
159
+ // handshakeTimeout — a wedged TLS/WS upgrade fires neither open nor error;
160
+ // without it the connector can hang in CONNECTING forever.
161
+ relayWs = new WebSocket(relayUrl, { handshakeTimeout: 15000 })
160
162
  } catch (err) {
161
163
  console.error(`[Relay] connect failed, retrying in 5s...`)
162
164
  setTimeout(connectRelay, 5000)