claude-cac 1.4.0-beta.5 → 1.4.1
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 +2 -2
- package/cac +7 -2
- package/package.json +1 -1
- package/scripts/postinstall.js +16 -13
package/README.md
CHANGED
|
@@ -202,7 +202,7 @@ cac docker port 6287 # 端口转发
|
|
|
202
202
|
- **首次登录**:启动 `claude` 后,输入 `/login` 完成 OAuth 授权
|
|
203
203
|
- **安全验证**:随时运行 `cac env check` 确认隐私保护状态,也可以 `which claude` 确认使用的是 cac 托管的 claude
|
|
204
204
|
- **自动安全检查**:每次启动 Claude Code 会话时,cac 会快速检查环境。如有异常会终止会话,不会发送任何数据
|
|
205
|
-
-
|
|
205
|
+
- **网络稳定性**:流量严格走代理——代理断开时流量完全停止,不会回退直连。内置心跳检测和自动恢复,断线后无需手动重启
|
|
206
206
|
- **IPv6**:建议系统级关闭,防止真实地址泄露
|
|
207
207
|
|
|
208
208
|
---
|
|
@@ -377,7 +377,7 @@ Proxy formats: `ip:port:user:pass` (SOCKS5), `ss://...`, `vmess://...`, `vless:/
|
|
|
377
377
|
- **First login**: Run `claude`, then type `/login`. Health check is automatically bypassed.
|
|
378
378
|
- **Verify your setup**: Run `cac env check` anytime. Use `which claude` to confirm you're using the cac-managed wrapper.
|
|
379
379
|
- **Automatic safety checks**: Every new Claude Code session runs a quick cac check. If anything is wrong, the session is terminated before any data is sent.
|
|
380
|
-
- **Network resilience**: Traffic is strictly routed through your proxy. If the proxy drops, traffic stops entirely — no fallback to direct connection.
|
|
380
|
+
- **Network resilience**: Traffic is strictly routed through your proxy. If the proxy drops, traffic stops entirely — no fallback to direct connection. Built-in heartbeat detection and auto-recovery — no manual restart needed after disconnections.
|
|
381
381
|
- **IPv6**: Recommend disabling system-wide to prevent real address exposure.
|
|
382
382
|
|
|
383
383
|
---
|
package/cac
CHANGED
|
@@ -11,7 +11,7 @@ VERSIONS_DIR="$CAC_DIR/versions"
|
|
|
11
11
|
# ── utils: colors, read/write, UUID, proxy parsing ───────────────────────
|
|
12
12
|
|
|
13
13
|
# shellcheck disable=SC2034 # used in build-concatenated cac script
|
|
14
|
-
CAC_VERSION="1.4.
|
|
14
|
+
CAC_VERSION="1.4.1"
|
|
15
15
|
|
|
16
16
|
_read() { [[ -f "$1" ]] && tr -d '[:space:]' < "$1" || echo "${2:-}"; }
|
|
17
17
|
_die() { printf '%b\n' "$(_red "error:") $*" >&2; exit 1; }
|
|
@@ -1356,15 +1356,20 @@ fi
|
|
|
1356
1356
|
# ── Concurrent session check ──
|
|
1357
1357
|
_max_sessions=10
|
|
1358
1358
|
[[ -f "$CAC_DIR/max_sessions" ]] && _ms=$(tr -d '[:space:]' < "$CAC_DIR/max_sessions") && [[ -n "$_ms" ]] && _max_sessions="$_ms"
|
|
1359
|
-
|
|
1359
|
+
# pgrep exits 1 when no match; with pipefail + set -e that would abort the wrapper
|
|
1360
|
+
_claude_count=$(pgrep -x "claude" 2>/dev/null | wc -l | tr -d '[:space:]') || _claude_count=0
|
|
1360
1361
|
if [[ "$_claude_count" -gt "$_max_sessions" ]]; then
|
|
1361
1362
|
echo "[cac] warning: $_claude_count claude sessions running (threshold: $_max_sessions)" >&2
|
|
1362
1363
|
echo "[cac] hint: concurrent sessions on the same device may trigger detection" >&2
|
|
1363
1364
|
echo "[cac] hint: adjust threshold with: echo '{\"max_sessions\": 20}' > ~/.cac/settings.json" >&2
|
|
1364
1365
|
fi
|
|
1365
1366
|
|
|
1367
|
+
# claude non-zero exit must not leave _ec unset (set -u) or abort before cleanup (set -e)
|
|
1368
|
+
_ec=0
|
|
1369
|
+
set +e
|
|
1366
1370
|
"$_real" "$@"
|
|
1367
1371
|
_ec=$?
|
|
1372
|
+
set -e
|
|
1368
1373
|
_cleanup_all
|
|
1369
1374
|
exit "$_ec"
|
|
1370
1375
|
WRAPPER_EOF
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -5,25 +5,28 @@ const fs = require('fs');
|
|
|
5
5
|
|
|
6
6
|
const cacBin = path.join(__dirname, '..', 'cac');
|
|
7
7
|
|
|
8
|
-
//
|
|
8
|
+
// Ensure cac is executable
|
|
9
9
|
try {
|
|
10
10
|
fs.chmodSync(cacBin, 0o755);
|
|
11
11
|
} catch (e) {
|
|
12
|
-
// Windows
|
|
12
|
+
// Windows or insufficient permissions — ignore
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
// Auto-regenerate wrapper + runtime JS files on install/upgrade
|
|
16
|
+
// This ensures bug fixes (e.g. dns-guard, wrapper crash) take effect immediately
|
|
17
|
+
try {
|
|
18
|
+
execSync('"' + cacBin + '" -v', { stdio: 'ignore', timeout: 10000 });
|
|
19
|
+
} catch (e) {
|
|
20
|
+
// First install or no environment yet — fine, _ensure_initialized runs on first cac command
|
|
21
|
+
}
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
cac add <名字> <host:port:u:p> 添加代理配置
|
|
21
|
-
cac <名字> 切换配置
|
|
22
|
-
claude 启动 Claude Code
|
|
23
|
+
console.log(`
|
|
24
|
+
claude-cac installed successfully
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
cac -
|
|
26
|
-
cac
|
|
26
|
+
Quick start:
|
|
27
|
+
cac env create <name> [-p <proxy>] Create an isolated environment
|
|
28
|
+
cac <name> Switch environment
|
|
29
|
+
claude Start Claude Code
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
Docs: https://cac.nextmind.space/docs
|
|
29
32
|
`);
|