@raolin2025/claude-code-node 2.6.2 → 2.6.3
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/package.json +1 -1
- package/src/core/cli.js +9 -1
- package/src/core/paths.js +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raolin2025/claude-code-node",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3",
|
|
4
4
|
"description": "Node.js AI Code Agent CLI - Zero dependencies, pure JavaScript, security hardened, multi-channel notifications, Telegram & QQ Bot remote programming, rich media upload, multi-account management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/core/index.js",
|
package/src/core/cli.js
CHANGED
|
@@ -98,11 +98,19 @@ function startSocketServer(engine, session, sessionManager, channelManager, verb
|
|
|
98
98
|
|
|
99
99
|
server.listen(SOCK_PATH, () => {
|
|
100
100
|
// v1.1 修复: socket 文件权限 0600(仅所有者可读写),阻止其他用户连接
|
|
101
|
-
|
|
101
|
+
// Windows named pipe 不支持 chmod,跳过
|
|
102
|
+
try { if (!process.platform.startsWith('win')) chmodSync(SOCK_PATH, 0o600) } catch {}
|
|
102
103
|
// 写 PID 文件(权限 0644)
|
|
103
104
|
writeFileSync(CC_NODE_PID, String(process.pid), { mode: 0o644 })
|
|
104
105
|
})
|
|
105
106
|
|
|
107
|
+
// 关键修复: 监听 socket 失败时绝不能崩溃(如 Windows 权限 / 端口占用)。
|
|
108
|
+
// 否则触发 Unhandled 'error' event 导致整个 cc-node 进程退出。
|
|
109
|
+
server.on('error', (err) => {
|
|
110
|
+
console.error(`⚠️ Socket 监听失败(${err.code || err.message})— cc-notify 远程转发将不可用,但 REPL 仍可正常使用。`)
|
|
111
|
+
console.error(` Path: ${SOCK_PATH}`)
|
|
112
|
+
})
|
|
113
|
+
|
|
106
114
|
// 退出时清理
|
|
107
115
|
const cleanup = () => {
|
|
108
116
|
try { unlinkSync(SOCK_PATH) } catch {}
|
package/src/core/paths.js
CHANGED
|
@@ -3,9 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { join } from 'path'
|
|
5
5
|
import { homedir } from 'os'
|
|
6
|
+
import { platform } from 'process'
|
|
7
|
+
|
|
8
|
+
const isWindows = platform === 'win32'
|
|
6
9
|
|
|
7
10
|
export const SOCK_DIR = join(homedir(), '.cc-node')
|
|
8
|
-
|
|
11
|
+
// Windows 不支持传统 Unix domain socket(会抛 EACCES),改用 named pipe。
|
|
12
|
+
// Unix socket: C:\Users\xxx\.cc-node\repl.sock → 报错
|
|
13
|
+
// named pipe : \\.\pipe\cc-node → 正常
|
|
14
|
+
export const SOCK_PATH = isWindows ? '\\\\.\\pipe\\cc-node' : join(SOCK_DIR, 'repl.sock')
|
|
9
15
|
export const CC_NODE_PID = join(SOCK_DIR, 'cc-node.pid')
|
|
10
16
|
export const CC_NOTIFY_PID = join(SOCK_DIR, 'cc-notify.pid')
|
|
11
17
|
export const CC_NOTIFY_LOG = join(SOCK_DIR, 'cc-notify.log')
|