提交记录修改CHANGELOG.md+4 −1看文件
修改agent-vm.setup.sh+84 −4看文件
修改lib/code.sh+5 −0看文件
修改tests/06-help-and-setup-script.sh+56 −3看文件
修改tests/22-code.sh+4 −2看文件
修改www/src/i18n/en.ts+1 −1看文件
修改www/src/i18n/fr.ts+1 −1看文件
| @@ -12,7 +12,10 @@ | ||
| 12 | 12 | agents that have an extension get it, the command line, or both. An |
| 13 | 13 | extension ships its own copy of its agent: without the command line, |
| 14 | 14 | `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. | |
| 16 | 19 | - The editor's password is made in each VM on first use, never in the base, |
| 17 | 20 | of which every VM is a copy, and printed. Each VM's editor is at |
| 18 | 21 | `http://<vm-name>.localhost:<port>/`, a port of its own from 20000 to |
| @@ -321,6 +321,55 @@ toml_prepend() { | ||
| 321 | 321 | mv "$file.tmp" "$file" |
| 322 | 322 | } |
| 323 | 323 | |
| 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 | 新增: | |
| 324 | 373 | if [[ "$INSTALL_CODE_SERVER" == "1" ]]; then |
| 325 | 374 | # The editor of `agent-vm code` (lib/code.sh). No password here: every VM |
| 326 | 375 | # 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 | ||
| 335 | 384 | code-server "${extensions[@]}" </dev/null |
| 336 | 385 | fi |
| 337 | 386 | # 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. | |
| 340 | 395 | mkdir -p "$HOME/.local/share/code-server/User" |
| 341 | 396 | jq -n --arg claude "$INSTALL_CODE_CLAUDE" ' |
| 342 | 397 | { |
| 343 | 398 | "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 | |
| 345 | 415 | } + if $claude == "1" then { |
| 346 | 416 | "claudeCode.allowDangerouslySkipPermissions": true, |
| 347 | 删除: "claudeCode.initialPermissionMode": "bypassPermissions" | |
| 417 | 新增: "claudeCode.initialPermissionMode": "bypassPermissions", | |
| 418 | 新增: "claudeCode.hideOnboarding": true | |
| 348 | 419 | } 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" | |
| 349 | 429 | # Codex and Vibe have no setting for it: their extensions start in the mode |
| 350 | 430 | # the agent's own config names. These match the flags the command line gets |
| 351 | 431 | # (_agent_vm_agent in agent-vm.sh). |
| @@ -168,6 +168,9 @@ _agent_vm_code_session() { | ||
| 168 | 168 | # The cookie suffix keeps sessions apart at 127.0.0.1, where two editors |
| 169 | 169 | # would overwrite each other's cookie. --disable-proxy: no route from the |
| 170 | 170 | # 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). | |
| 171 | 174 | _agent_vm_lima_run "$vm_name" "$host_dir" "$want_tty" code-server \ |
| 172 | 175 | --config "$cfg" \ |
| 173 | 176 | --bind-addr "127.0.0.1:$port" \ |
| @@ -178,6 +181,8 @@ _agent_vm_code_session() { | ||
| 178 | 181 | --disable-workspace-trust \ |
| 179 | 182 | --disable-proxy \ |
| 180 | 183 | --disable-getting-started-override \ |
| 184 | 新增: --vscode-option disable-experiments \ | |
| 185 | 新增: --vscode-option disable-extension=GitHub.copilot-chat \ | |
| 181 | 186 | "$host_dir" || st=$? |
| 182 | 187 | [[ -z "$opener" ]] || kill "$opener" 2>/dev/null |
| 183 | 188 | return "$st" |
| @@ -213,6 +213,50 @@ else | ||
| 213 | 213 | check "pi: skipped without node" "$( [ -e "$PIH0/sudo.log" ] || [ -e "$PIH0/.pi" ]; echo $?)" "1" |
| 214 | 214 | fi |
| 215 | 215 | |
| 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 | 新增: | |
| 216 | 260 | # ============================================================================= |
| 217 | 261 | section "code-server install block" |
| 218 | 262 | # ============================================================================= |
| @@ -235,6 +279,7 @@ $(awk '/^configure_mcp\(\) \{/,/^\}/' "$SETUP_SH")" | ||
| 235 | 279 | HAS_CLAUDE="$2" HAS_CODEX="$3" HAS_VIBE="$4" INSTALL_OPENCODE=0 |
| 236 | 280 | curl() { echo "curl $*" >> "$HOME/calls.log"; } |
| 237 | 281 | code-server() { echo "code-server $*" >> "$HOME/calls.log"; } |
| 282 | 新增: code_server_schemas() { echo "schemas $*" >> "$HOME/calls.log"; } | |
| 238 | 283 | eval "$cs_block" |
| 239 | 284 | mkdir -p "$HOME/first" |
| 240 | 285 | 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")" | ||
| 250 | 295 | "$(jq -r '."chat.disableAIFeatures"' "$CSB/.local/share/code-server/User/settings.json")" "true" |
| 251 | 296 | check "code-server alone: dark theme" \ |
| 252 | 297 | "$(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" | |
| 253 | 306 | check "code-server alone: no Claude settings" \ |
| 254 | 307 | "$(jq -r 'keys | map(select(startswith("claudeCode"))) | length' "$CSB/.local/share/code-server/User/settings.json")" "0" |
| 255 | 308 | check "the password code-server wrote is not left in the base" \ |
| @@ -266,9 +319,9 @@ $(awk '/^configure_mcp\(\) \{/,/^\}/' "$SETUP_SH")" | ||
| 266 | 319 | check "the three extensions, in one call" \ |
| 267 | 320 | "$(grep '^code-server' "$CSA/calls.log" | head -n 1)" \ |
| 268 | 321 | "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" | |
| 272 | 325 | check "codex: full access, once, before any table" \ |
| 273 | 326 | "$(head -n 2 "$CSA/.codex/config.toml" | sort | tr '\n' ' '; grep -c '^approval_policy' "$CSA/.codex/config.toml")" \ |
| 274 | 327 | 'approval_policy = "never" sandbox_mode = "danger-full-access" 1' |
| @@ -24,8 +24,10 @@ else | ||
| 24 | 24 | 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" \ |
| 25 | 25 | && pass "code-server on the VM's loopback, the VM's own config and cookie" \ |
| 26 | 26 | || 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")" | |
| 29 | 31 | case "$out" in |
| 30 | 32 | *"Editor: http://$PV.localhost:$first/"*"Password: 0123456789abcdef0123456789abcdef"*) |
| 31 | 33 | pass "the VM's own host name, and the password" ;; |
| @@ -652,7 +652,7 @@ export const en = { | ||
| 652 | 652 | ['AI agents', 'Pi', 'pi', 'no'], |
| 653 | 653 | ['MCP', 'Chrome DevTools MCP, wired into every installed agent but Pi (no MCP support)', 'mcp-chrome', 'yes'], |
| 654 | 654 | ['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'], | |
| 656 | 656 | ['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'], |
| 657 | 657 | ], |
| 658 | 658 | contentsCode: |
| @@ -654,7 +654,7 @@ export const fr: Dictionary = { | ||
| 654 | 654 | ['Agents IA', 'Pi', 'pi', 'non'], |
| 655 | 655 | ['MCP', 'Chrome DevTools MCP, câblé dans chaque agent installé sauf Pi (pas de support MCP)', 'mcp-chrome', 'oui'], |
| 656 | 656 | ['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'], | |
| 658 | 658 | ['É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'], |
| 659 | 659 | ], |
| 660 | 660 | contentsCode: |

