跳到主要内容

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

提交记录
修改agent-vm.sh+28 −8看文件
@@ -1103,6 +1103,29 @@ EOF
11031103 echo "Note: Existing VMs were not updated. Use --reset to re-clone them from the new base."
11041104}
11051105
1106新增:# Run a command in the VM through a login zsh.
1107新增:#
1108新增:# `limactl shell VM cmd` runs cmd under the shell configured for the instance,
1109新增:# and Lima >= 2.2.0 defaults that to /bin/bash whatever the guest login shell
1110新增:# is (lima-vm/lima#5194); older versions used "$SHELL", i.e. the login shell
1111新增:# `agent-vm.setup.sh` sets with chsh. Agent PATH entries and the
1112新增:# ~/.agent-vm.env sourcing both live in ~/.zshenv, so under bash the agents are
1113新增:# not found and anything that is found starts without its API keys. Forcing
1114新增:# `zsh -l -c` here works on every Lima version.
1115新增:#
1116新增:# The command and its arguments are passed as positional parameters, so the
1117新增:# guest shell never re-parses them; `env` runs the command and keeps leading
1118新增:# VAR=value assignments working.
1119新增:#
1120新增:# Usage: _agent_vm_lima_run <vm_name> <host_dir> <tty:1|""> <command> [args...]
1121新增:_agent_vm_lima_run() {
1122新增: local vm_name="$1" host_dir="$2" want_tty="$3"
1123新增: shift 3
1124新增: local shell_opts=(--workdir "$host_dir")
1125新增: [[ -n "$want_tty" ]] && shell_opts+=(--tty)
1126新增: limactl shell "${shell_opts[@]}" "$vm_name" -- zsh -l -c 'exec env "$@"' agent-vm "$@"
1127新增:}
1128新增:
11061129_agent_vm_claude() {
11071130 local vm_opts=()
11081131 local args=()
@@ -1129,7 +1152,7 @@ _agent_vm_claude() {
11291152 _agent_vm_print_resources "$vm_name"
11301153
11311154 local exit_code=0
1132删除: limactl shell --workdir "$host_dir" "$vm_name" -- claude --dangerously-skip-permissions "${args[@]}"
1155新增: _agent_vm_lima_run "$vm_name" "$host_dir" "" claude --dangerously-skip-permissions "${args[@]}"
11331156 exit_code=$?
11341157 [[ -n "$rm" ]] && { echo "Removing VM..."; _agent_vm_destroy; }
11351158 return $exit_code
@@ -1164,7 +1187,7 @@ _agent_vm_opencode() {
11641187 # giving full autonomy (safe inside the sandbox). This is OpenCode's shipped
11651188 # equivalent of a "yolo" mode; the proposed --yolo flag was never merged.
11661189 local exit_code=0
1167删除: limactl shell --tty --workdir "$host_dir" "$vm_name" opencode --auto "${args[@]}"
1190新增: _agent_vm_lima_run "$vm_name" "$host_dir" 1 opencode --auto "${args[@]}"
11681191 exit_code=$?
11691192 [[ -n "$rm" ]] && { echo "Removing VM..."; _agent_vm_destroy; }
11701193 return $exit_code
@@ -1196,7 +1219,7 @@ _agent_vm_codex() {
11961219 _agent_vm_print_resources "$vm_name"
11971220
11981221 local exit_code=0
1199删除: limactl shell --workdir "$host_dir" "$vm_name" codex --dangerously-bypass-approvals-and-sandbox "${args[@]}"
1222新增: _agent_vm_lima_run "$vm_name" "$host_dir" "" codex --dangerously-bypass-approvals-and-sandbox "${args[@]}"
12001223 exit_code=$?
12011224 [[ -n "$rm" ]] && { echo "Removing VM..."; _agent_vm_destroy; }
12021225 return $exit_code
@@ -1230,7 +1253,7 @@ _agent_vm_vibe() {
12301253 # Vibe is a full-screen TUI, so allocate a tty (like opencode).
12311254 # --agent auto-approve gives full autonomy (safe inside the sandbox).
12321255 local exit_code=0
1233删除: limactl shell --tty --workdir "$host_dir" "$vm_name" vibe --agent auto-approve "${args[@]}"
1256新增: _agent_vm_lima_run "$vm_name" "$host_dir" 1 vibe --agent auto-approve "${args[@]}"
12341257 exit_code=$?
12351258 [[ -n "$rm" ]] && { echo "Removing VM..."; _agent_vm_destroy; }
12361259 return $exit_code
@@ -1322,11 +1345,8 @@ _agent_vm_run() {
13221345 # full-screen TUIs (opencode, vibe, htop, …) need to render correctly when
13231346 # invoked through `agent-vm run`. Without it, line-mode tools work fine but
13241347 # ncurses-style UIs break.
1325删除: local shell_opts=(--workdir "$host_dir")
1326删除: [[ -n "$tty_flag" ]] && shell_opts+=(--tty)
1327删除:
13281348 local exit_code=0
1329删除: limactl shell "${shell_opts[@]}" "$vm_name" "${args[@]}"
1349新增: _agent_vm_lima_run "$vm_name" "$host_dir" "$tty_flag" "${args[@]}"
13301350 exit_code=$?
13311351 [[ -n "$rm" ]] && { echo "Removing VM..."; _agent_vm_destroy; }
13321352 return $exit_code