跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

提交记录
修改CHANGELOG.md+4 −1看文件
@@ -12,7 +12,10 @@
1212 agents that have an extension get it, the command line, or both. An
1313 extension ships its own copy of its agent: without the command line,
1414 `agent-vm claude` (or `codex`, `vibe`) says it is not installed. Dark
15删除: theme, GitHub Copilot off, no telemetry or update checks.
15新增: theme, GitHub Copilot disabled, no telemetry, no welcome page, tips,
16新增: recommendations or experiments. The JSON schemas the editor validates
17新增: files with (`package.json`, `tsconfig.json`...) are downloaded once by
18新增: `setup`: opening a file sends no request.
1619- The editor's password is made in each VM on first use, never in the base,
1720 of which every VM is a copy, and printed. Each VM's editor is at
1821 `http://<vm-name>.localhost:<port>/`, a port of its own from 20000 to
修改agent-vm.setup.sh+84 −4看文件
@@ -321,6 +321,55 @@ toml_prepend() {
321321 mv "$file.tmp" "$file"
322322}
323323
324新增:# Write to <out> code-server's machine settings with every JSON schema its
325新增:# built-in extensions (in <ext-dir>) name by URL, and every schema those refer
326新增:# to, downloaded now. A json.schemas entry with a URL and its content makes
327新增:# the editor use the content instead of fetching the URL, so with downloads
328新增:# off (the user settings) opening a file sends no request. A failed download
329新增:# only leaves its files unvalidated.
330新增:code_server_schemas() {
331新增: local ext_dir="$1" out="$2" dir u f r base fetch n=0
332新增: local -a queue
333新增: local -A seen
334新增: dir="$(mktemp -d)"
335新增: : > "$dir/entries"
336新增: mapfile -t queue < <(jq -r '.contributes.jsonValidation[]?.url | select(test("^https?://"))' \
337新增: "$ext_dir"/*/package.json | sort -u)
338新增: while [[ ${#queue[@]} -gt 0 ]]; do
339新增: u="${queue[0]}"
340新增: queue=("${queue[@]:1}")
341新增: [[ -z "${seen[$u]:-}" ]] || continue
342新增: seen[$u]=1
343新增: n=$((n + 1))
344新增: f="$dir/$n.json"
345新增: # json.schemastore.org only redirects to www.schemastore.org.
346新增: fetch="${u%%#*}"
347新增: fetch="${fetch/#https:\/\/json.schemastore.org\//https://www.schemastore.org/}"
348新增: if ! curl -fsSL --max-time 30 -o "$f" "$fetch" </dev/null || ! jq -e . "$f" >/dev/null 2>&1; then
349新增: echo "Warning: could not download the JSON schema $u: files using it are not validated." >&2
350新增: continue
351新增: fi
352新增: jq -c --arg u "$u" '{url: $u, schema: .}' "$f" >> "$dir/entries"
353新增: # Relative references resolve against the URL the schema was loaded from.
354新增: # Other schemes (vscode://) are the editor's own.
355新增: base="${u%%#*}"
356新增: while IFS= read -r r; do
357新增: case "$r" in
358新增: http://*|https://*) ;;
359新增: *://*) continue ;;
360新增: /*) r="${base%%://*}://$(printf '%s' "${base#*://}" | cut -d/ -f1)$r" ;;
361新增: *) r="${base%/*}/$r" ;;
362新增: esac
363新增: while [[ "$r" == */./* ]]; do r="${r/\/.\///}"; done
364新增: while [[ "$r" =~ ^(.*://.*)/[^/]+/\.\./(.*)$ ]]; do r="${BASH_REMATCH[1]}/${BASH_REMATCH[2]}"; done
365新增: queue+=("$r")
366新增: done < <(jq -r '[.. | objects | ."$ref"? | strings | sub("#.*$"; "") | select(length > 0)] | unique[]' "$f")
367新增: done
368新增: mkdir -p "$(dirname "$out")"
369新增: jq -sc '{"json.schemas": .}' "$dir/entries" > "$out"
370新增: rm -rf "$dir"
371新增:}
372新增:
324373if [[ "$INSTALL_CODE_SERVER" == "1" ]]; then
325374 # The editor of `agent-vm code` (lib/code.sh). No password here: every VM
326375 # is a copy of this disk, so each one makes its own on first use.
@@ -335,17 +384,48 @@ if [[ "$INSTALL_CODE_SERVER" == "1" ]]; then
335384 code-server "${extensions[@]}" </dev/null
336385 fi
337386 # chat.disableAIFeatures turns off the GitHub Copilot chat and completions
338删除: # that code-server ships. The Claude keys start its conversations in bypass
339删除: # mode, as the managed settings above do for the CLI.
387新增: # that code-server ships (lib/code.sh also disables the extension).
388新增: # telemetry.telemetryLevel: code-server's --disable-telemetry leaves the
389新增: # built-in extensions sending telemetry. The editor downloads no JSON
390新增: # schema: setup does, once, into the machine settings (code_server_schemas).
391新增: # The rest is the welcome page, tips, recommendations, experiments and
392新增: # online settings search.
393新增: # The Claude keys start its conversations in bypass mode, as the managed
394新增: # settings above do for the CLI.
340395 mkdir -p "$HOME/.local/share/code-server/User"
341396 jq -n --arg claude "$INSTALL_CODE_CLAUDE" '
342397 {
343398 "workbench.colorTheme": "Dark 2026",
344删除: "chat.disableAIFeatures": true
399新增: "chat.disableAIFeatures": true,
400新增: "chat.mcp.gallery.enabled": false,
401新增: "telemetry.telemetryLevel": "off",
402新增: "telemetry.feedback.enabled": false,
403新增: "json.schemaDownload.enable": false,
404新增: "workbench.enableExperiments": false,
405新增: "workbench.settings.enableNaturalLanguageSearch": false,
406新增: "workbench.settings.showAISearchToggle": false,
407新增: "extensions.ignoreRecommendations": true,
408新增: "workbench.startupEditor": "none",
409新增: "workbench.tips.enabled": false,
410新增: "workbench.welcomePage.walkthroughs.openOnInstall": false,
411新增: "workbench.secondarySideBar.defaultVisibility": "hidden",
412新增: "remote.autoForwardPorts": false,
413新增: "update.mode": "none",
414新增: "update.showReleaseNotes": false
345415 } + if $claude == "1" then {
346416 "claudeCode.allowDangerouslySkipPermissions": true,
347删除: "claudeCode.initialPermissionMode": "bypassPermissions"
417新增: "claudeCode.initialPermissionMode": "bypassPermissions",
418新增: "claudeCode.hideOnboarding": true
348419 } else {} end' > "$HOME/.local/share/code-server/User/settings.json"
420新增: # The .deb's /usr/bin/code-server is a script running /usr/lib/code-server;
421新增: # a standalone install is a link into its own directory.
422新增: cs_root=/usr/lib/code-server
423新增: if [[ ! -d "$cs_root/lib/vscode/extensions" ]]; then
424新增: cs_root="$(dirname "$(dirname "$(readlink -f "$(command -v code-server)")")")"
425新增: fi
426新增: echo "Downloading the JSON schemas the editor uses..."
427新增: code_server_schemas "$cs_root/lib/vscode/extensions" \
428新增: "$HOME/.local/share/code-server/Machine/settings.json"
349429 # Codex and Vibe have no setting for it: their extensions start in the mode
350430 # the agent's own config names. These match the flags the command line gets
351431 # (_agent_vm_agent in agent-vm.sh).
修改lib/code.sh+5 −0看文件
@@ -168,6 +168,9 @@ _agent_vm_code_session() {
168168 # The cookie suffix keeps sessions apart at 127.0.0.1, where two editors
169169 # would overwrite each other's cookie. --disable-proxy: no route from the
170170 # browser to the VM's other ports, and the proxy is where CVE-2025-47269 was.
171新增: # The --vscode-option ones reach the VS Code server inside: no experiments,
172新增: # and the built-in Copilot Chat never loads (it updates itself otherwise).
173新增: # The settings written at setup do the rest (agent-vm.setup.sh).
171174 _agent_vm_lima_run "$vm_name" "$host_dir" "$want_tty" code-server \
172175 --config "$cfg" \
173176 --bind-addr "127.0.0.1:$port" \
@@ -178,6 +181,8 @@ _agent_vm_code_session() {
178181 --disable-workspace-trust \
179182 --disable-proxy \
180183 --disable-getting-started-override \
184新增: --vscode-option disable-experiments \
185新增: --vscode-option disable-extension=GitHub.copilot-chat \
181186 "$host_dir" || st=$?
182187 [[ -z "$opener" ]] || kill "$opener" 2>/dev/null
183188 return "$st"
修改tests/06-help-and-setup-script.sh+56 −3看文件
@@ -213,6 +213,50 @@ else
213213 check "pi: skipped without node" "$( [ -e "$PIH0/sudo.log" ] || [ -e "$PIH0/.pi" ]; echo $?)" "1"
214214fi
215215
216新增:# =============================================================================
217新增:section "code-server JSON schemas"
218新增:# =============================================================================
219新增:# code_server_schemas against a fake code-server and a curl serving files of
220新增:# $SCH/web, named after the URL, recording what it was asked for. It runs in
221新增:# the VM, under bash 4 or later.
222新增:if ! command -v jq >/dev/null 2>&1 || [ "${BASH_VERSINFO[0]}" -lt 4 ]; then
223新增: printf ' skip code-server schema tests (needs jq and bash 4)\n'
224新增:else
225新增: SCH="$SB/schemas"; mkdir -p "$SCH/ext/a" "$SCH/ext/b" "$SCH/web"
226新增: web() { printf '%s' "$1" | tr -c 'a-zA-Z0-9' _; }
227新增: echo '{"contributes":{"jsonValidation":[{"fileMatch":"a.json","url":"https://h.test/s/a"},{"fileMatch":"x","url":"vscode://schemas/x"}]}}' > "$SCH/ext/a/package.json"
228新增: echo '{"contributes":{"jsonValidation":[{"fileMatch":"b.json","url":"https://json.schemastore.org/b"},{"fileMatch":"g","url":"https://h.test/gone"}]}}' > "$SCH/ext/b/package.json"
229新增: # a: an absolute ref, a relative one with ./ and a fragment, a local one,
230新增: # and one to the editor's own schemas.
231新增: echo '{"$ref":"#/definitions/x","definitions":{"x":{"$ref":"https://h.test/abs.json"},"y":{"$ref":"./rel.json#/z"},"z":{"$ref":"vscode://schemas/settings"},"w":{"properties":{"$ref":{"type":"string"}}}}}' > "$SCH/web/$(web https://h.test/s/a)"
232新增: echo '{"type":"object"}' > "$SCH/web/$(web https://h.test/abs.json)"
233新增: echo '{"$ref":"../top.json"}' > "$SCH/web/$(web https://h.test/s/rel.json)"
234新增: echo '{"type":"string"}' > "$SCH/web/$(web https://h.test/top.json)"
235新增: echo '{"type":"number"}' > "$SCH/web/$(web https://www.schemastore.org/b)"
236新增: out="$( ( curl() {
237新增: local o="" u=""
238新增: while [ $# -gt 0 ]; do case "$1" in -o) o="$2"; shift 2 ;; -*) shift ;; *) u="$1"; shift ;; esac; done
239新增: echo "$u" >> "$SCH/fetched"
240新增: [ -f "$SCH/web/$(web "$u")" ] || return 22
241新增: cp "$SCH/web/$(web "$u")" "$o"
242新增: }
243新增: set -euo pipefail
244新增: eval "$(awk '/^code_server_schemas\(\) \{/,/^\}/' "$SETUP_SH")"
245新增: code_server_schemas "$SCH/ext" "$SCH/machine/settings.json"; echo "rc=$?" ) 2>&1)"
246新增: check "every schema named, and every one they refer to, by the URL the editor asks" \
247新增: "$(jq -r '."json.schemas"[].url' "$SCH/machine/settings.json" 2>/dev/null | sort | tr '\n' ' ')" \
248新增: "https://h.test/abs.json https://h.test/s/a https://h.test/s/rel.json https://h.test/top.json https://json.schemastore.org/b "
249新增: check "each with its content" \
250新增: "$(jq -r '."json.schemas"[] | select(.url == "https://h.test/top.json") | .schema.type' "$SCH/machine/settings.json" 2>/dev/null)" "string"
251新增: check "json.schemastore.org fetched from www.schemastore.org, where it redirects" \
252新增: "$(grep -c 'json.schemastore.org' "$SCH/fetched"; grep -c '^https://www.schemastore.org/b$' "$SCH/fetched")" "$(printf '0\n1')"
253新增: check "the editor's own schemas are left alone" "$(grep -c vscode "$SCH/fetched")" "0"
254新增: case "$out" in
255新增: *"could not download the JSON schema https://h.test/gone"*"rc=0") pass "a failed download is a warning, not a failure" ;;
256新增: *) fail "failed download: $out" ;;
257新增: esac
258新增:fi
259新增:
216260# =============================================================================
217261section "code-server install block"
218262# =============================================================================
@@ -235,6 +279,7 @@ $(awk '/^configure_mcp\(\) \{/,/^\}/' "$SETUP_SH")"
235279 HAS_CLAUDE="$2" HAS_CODEX="$3" HAS_VIBE="$4" INSTALL_OPENCODE=0
236280 curl() { echo "curl $*" >> "$HOME/calls.log"; }
237281 code-server() { echo "code-server $*" >> "$HOME/calls.log"; }
282新增: code_server_schemas() { echo "schemas $*" >> "$HOME/calls.log"; }
238283 eval "$cs_block"
239284 mkdir -p "$HOME/first"
240285 for f in .codex/config.toml .vibe/config.toml; do [ ! -f "$HOME/$f" ] || cp "$HOME/$f" "$HOME/first/${f%%/*}"; done
@@ -250,6 +295,14 @@ $(awk '/^configure_mcp\(\) \{/,/^\}/' "$SETUP_SH")"
250295 "$(jq -r '."chat.disableAIFeatures"' "$CSB/.local/share/code-server/User/settings.json")" "true"
251296 check "code-server alone: dark theme" \
252297 "$(jq -r '."workbench.colorTheme"' "$CSB/.local/share/code-server/User/settings.json")" "Dark 2026"
298新增: check "code-server alone: no telemetry, no experiments" \
299新增: "$(jq -r '[."telemetry.telemetryLevel", ."workbench.enableExperiments"] | map(tostring) | join(" ")' \
300新增: "$CSB/.local/share/code-server/User/settings.json")" "off false"
301新增: check "code-server alone: the editor downloads no schema" \
302新增: "$(jq -r '."json.schemaDownload.enable"' "$CSB/.local/share/code-server/User/settings.json")" "false"
303新增: check "code-server alone: setup puts them in the machine settings" \
304新增: "$(grep '^schemas' "$CSB/calls.log" | head -n 1 | sed 's|^schemas [^ ]*/lib/vscode/extensions |schemas <ext> |')" \
305新增: "schemas <ext> $CSB/.local/share/code-server/Machine/settings.json"
253306 check "code-server alone: no Claude settings" \
254307 "$(jq -r 'keys | map(select(startswith("claudeCode"))) | length' "$CSB/.local/share/code-server/User/settings.json")" "0"
255308 check "the password code-server wrote is not left in the base" \
@@ -266,9 +319,9 @@ $(awk '/^configure_mcp\(\) \{/,/^\}/' "$SETUP_SH")"
266319 check "the three extensions, in one call" \
267320 "$(grep '^code-server' "$CSA/calls.log" | head -n 1)" \
268321 "code-server --install-extension anthropic.claude-code --install-extension openai.chatgpt --install-extension mistralai.mistral-vibe-code"
269删除: check "claude: bypass mode allowed and picked" \
270删除: "$(jq -r '[."claudeCode.allowDangerouslySkipPermissions", ."claudeCode.initialPermissionMode"] | join(" ")' \
271删除: "$CSA/.local/share/code-server/User/settings.json")" "true bypassPermissions"
322新增: check "claude: bypass mode allowed and picked, no onboarding checklist" \
323新增: "$(jq -r '[."claudeCode.allowDangerouslySkipPermissions", ."claudeCode.initialPermissionMode", ."claudeCode.hideOnboarding"] | map(tostring) | join(" ")' \
324新增: "$CSA/.local/share/code-server/User/settings.json")" "true bypassPermissions true"
272325 check "codex: full access, once, before any table" \
273326 "$(head -n 2 "$CSA/.codex/config.toml" | sort | tr '\n' ' '; grep -c '^approval_policy' "$CSA/.codex/config.toml")" \
274327 'approval_policy = "never" sandbox_mode = "danger-full-access" 1'
修改tests/22-code.sh+4 −2看文件
@@ -24,8 +24,10 @@ else
2424 rec_has "agent-vm code-server --config /home/u/.config/code-server/agent-vm-lima-x.yaml --bind-addr 127.0.0.1:$first --cookie-suffix $PV" \
2525 && pass "code-server on the VM's loopback, the VM's own config and cookie" \
2626 || fail "code: $(grep 'code-server --config' "$REC")"
27删除: rec_has "--disable-proxy --disable-getting-started-override $PROJ" \
28删除: && pass "no port proxy, and the project opened" || fail "code flags: $(grep 'code-server --config' "$REC")"
27新增: rec_has "--disable-telemetry --disable-update-check --disable-workspace-trust --disable-proxy" \
28新增: && pass "no telemetry, update check or port proxy" || fail "code flags: $(grep 'code-server --config' "$REC")"
29新增: rec_has "--vscode-option disable-experiments --vscode-option disable-extension=GitHub.copilot-chat $PROJ" \
30新增: && pass "no experiments, Copilot never loaded, and the project opened" || fail "code flags: $(grep 'code-server --config' "$REC")"
2931 case "$out" in
3032 *"Editor: http://$PV.localhost:$first/"*"Password: 0123456789abcdef0123456789abcdef"*)
3133 pass "the VM's own host name, and the password" ;;
修改www/src/i18n/en.ts+1 −1看文件
@@ -652,7 +652,7 @@ export const en = {
652652 ['AI agents', 'Pi', 'pi', 'no'],
653653 ['MCP', 'Chrome DevTools MCP, wired into every installed agent but Pi (no MCP support)', 'mcp-chrome', 'yes'],
654654 ['MCP', 'Playwright MCP, reusing the same Chromium', 'mcp-playwright', 'no'],
655删除: ['Editor', 'code-server (VS Code in the browser, for `agent-vm code`), dark theme, GitHub Copilot off', 'code-server', 'no'],
655新增: ['Editor', 'code-server (VS Code in the browser, for `agent-vm code`), dark theme, GitHub Copilot off, no telemetry', 'code-server', 'no'],
656656 ['Editor', 'The Claude Code, Codex or Mistral Vibe extension, each starting with no permission prompts, with code-server', 'code-claude, code-codex, code-vibe', 'no'],
657657 ],
658658 contentsCode:
修改www/src/i18n/fr.ts+1 −1看文件
@@ -654,7 +654,7 @@ export const fr: Dictionary = {
654654 ['Agents IA', 'Pi', 'pi', 'non'],
655655 ['MCP', 'Chrome DevTools MCP, câblé dans chaque agent installé sauf Pi (pas de support MCP)', 'mcp-chrome', 'oui'],
656656 ['MCP', 'Playwright MCP, réutilisant le même Chromium', 'mcp-playwright', 'non'],
657删除: ['Éditeur', 'code-server (VS Code dans le navigateur, pour `agent-vm code`), thème sombre, GitHub Copilot désactivé', 'code-server', 'non'],
657新增: ['Éditeur', 'code-server (VS Code dans le navigateur, pour `agent-vm code`), thème sombre, GitHub Copilot désactivé, sans télémétrie', 'code-server', 'non'],
658658 ['Éditeur', 'L\'extension Claude Code, Codex ou Mistral Vibe, chacune démarrant sans demande de permission, avec code-server', 'code-claude, code-codex, code-vibe', 'non'],
659659 ],
660660 contentsCode: