跳到主要内容

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

浏览文件

inspect.go

64 行 · 2.1 KB历史下载
1// Package guestos checks host prerequisites for a local guest system.
2package guestos
3
4import (
5 "os"
6 "path/filepath"
7)
8
9// Guest system IDs are shared with the workbench installer.
10const (
11 Debian13 = "debian-13"
12 MacOS = "macos"
13 Windows11 = "windows-11"
14)
15
16// MacRestore comes from Apple's compatibility catalog for this particular host.
17type MacRestore struct {
18 Version string `json:"version"`
19 Build string `json:"build"`
20 URL string `json:"url"`
21 MinimumCPUs int `json:"minimumCPUs"`
22 MinimumMemoryBytes uint64 `json:"minimumMemoryBytes"`
23}
24
25// Inspection keeps host capability separate from availability in the workbench.
26type Inspection struct {
27 Guest string `json:"guest"`
28 HostCheckPassed bool `json:"hostCheckPassed"`
29 WorkbenchSupport string `json:"workbenchSupport"`
30 Detail string `json:"detail"`
31 Restore *MacRestore `json:"restore,omitempty"`
32}
33
34// HasNativeWorkbenchKit checks the resources shipped alongside this backend.
35// A standalone diagnostic binary can inspect a host without the desktop kit.
36func HasNativeWorkbenchKit(executable, system string) bool {
37 var files []string
38 switch system {
39 case MacOS:
40 files = []string{"prepare-macos-media.sh", "provision-macos-workbench.sh", "project/cage-sshfs", "native-browser/macos-native-browser.mjs", "cage-finish-initial-setup"}
41 case Windows11:
42 files = []string{"new-windows-guest.ps1", "setup-windows-guest.ps1", "windows-host-image.ps1", "complete-windows-guest.ps1", "install-windows-host-manager.ps1", "payload/Cage.HyperVManager.exe", "payload/Cage.GuestClipboard.exe"}
43 default:
44 return false
45 }
46 for _, name := range files {
47 info, err := os.Stat(filepath.Join(filepath.Dir(executable), "guest-os", name))
48 if err != nil || !info.Mode().IsRegular() {
49 return false
50 }
51 }
52 return true
53}
54
55func nativeWorkbenchSupport(system string, hostReady bool) string {
56 if !hostReady {
57 return "host-not-ready"
58 }
59 exe, err := os.Executable()
60 if err != nil || !HasNativeWorkbenchKit(exe, system) {
61 return "installation-kit-missing"
62 }
63 return "desktop-installer"
64}