Unified Agent + reusable Go agent core.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix CI

Lyric c6935540 23c2ce49

+74 -31
+61 -6
desktop/wails/backend_binary.go
··· 45 45 out := make([]string, 0, 8) 46 46 seen := map[string]struct{}{} 47 47 add := func(raw string) { 48 - raw = strings.TrimSpace(raw) 49 - if raw == "" { 48 + clean := normalizeDesktopPathCandidate(raw) 49 + if clean == "" { 50 50 return 51 51 } 52 - clean := filepath.Clean(raw) 53 52 if _, ok := seen[clean]; ok { 54 53 return 55 54 } ··· 65 64 add(filepath.Join(appDir, desktopBackendBinaryBaseName())) 66 65 } 67 66 if strings.TrimSpace(selfExePath) != "" { 68 - exeDir := filepath.Dir(selfExePath) 67 + exeDir := filepath.Dir(filepath.Clean(selfExePath)) 69 68 add(filepath.Join(exeDir, desktopBackendBinaryBaseName())) 70 - add(filepath.Join(exeDir, "bin", desktopBackendBinaryBaseName())) 69 + if shouldSearchDesktopExecutableChildBin(exeDir) { 70 + add(filepath.Join(exeDir, "bin", desktopBackendBinaryBaseName())) 71 + } 71 72 } 72 73 if wd, err := os.Getwd(); err == nil { 73 74 add(filepath.Join(wd, "bin", desktopBackendBinaryBaseName())) ··· 79 80 return out 80 81 } 81 82 83 + func normalizeDesktopPathCandidate(raw string) string { 84 + raw = strings.TrimSpace(raw) 85 + if raw == "" { 86 + return "" 87 + } 88 + clean := filepath.Clean(raw) 89 + if resolved, err := filepath.EvalSymlinks(clean); err == nil { 90 + return filepath.Clean(resolved) 91 + } 92 + 93 + ancestor, suffix := splitExistingPathPrefix(clean) 94 + if ancestor == "" { 95 + return clean 96 + } 97 + resolvedAncestor, err := filepath.EvalSymlinks(ancestor) 98 + if err != nil { 99 + return clean 100 + } 101 + if suffix == "" || suffix == "." { 102 + return filepath.Clean(resolvedAncestor) 103 + } 104 + return filepath.Clean(filepath.Join(resolvedAncestor, suffix)) 105 + } 106 + 107 + func splitExistingPathPrefix(path string) (string, string) { 108 + clean := filepath.Clean(path) 109 + suffix := "" 110 + for { 111 + if _, err := os.Lstat(clean); err == nil { 112 + return clean, suffix 113 + } 114 + next := filepath.Dir(clean) 115 + if next == clean { 116 + return "", "" 117 + } 118 + base := filepath.Base(clean) 119 + if suffix == "" { 120 + suffix = base 121 + } else { 122 + suffix = filepath.Join(base, suffix) 123 + } 124 + clean = next 125 + } 126 + } 127 + 128 + func shouldSearchDesktopExecutableChildBin(exeDir string) bool { 129 + switch strings.ToLower(strings.TrimSpace(filepath.Base(exeDir))) { 130 + case "bin", "macos": 131 + return false 132 + default: 133 + return true 134 + } 135 + } 136 + 82 137 func isExecutableFile(path string) bool { 83 - path = filepath.Clean(strings.TrimSpace(path)) 138 + path = normalizeDesktopPathCandidate(path) 84 139 if path == "" { 85 140 return false 86 141 }
+8 -8
desktop/wails/backend_binary_test.go
··· 112 112 if appIdx >= wdIdx { 113 113 t.Fatalf("appdir candidate index = %d, wd candidate index = %d, want appdir before wd in %#v", appIdx, wdIdx, candidates) 114 114 } 115 + unexpected := filepath.Join(appDir, "usr", "bin", "bin", desktopBackendBinaryBaseName()) 116 + for _, c := range candidates { 117 + if sameCleanPath(c, unexpected) { 118 + t.Fatalf("unexpected nested bin candidate %q in %#v", c, candidates) 119 + } 120 + } 115 121 } 116 122 117 123 func TestIsExecutableFile(t *testing.T) { ··· 125 131 } 126 132 127 133 func sameCleanPath(a, b string) bool { 128 - a = filepath.Clean(a) 129 - b = filepath.Clean(b) 130 - if resolved, err := filepath.EvalSymlinks(a); err == nil { 131 - a = filepath.Clean(resolved) 132 - } 133 - if resolved, err := filepath.EvalSymlinks(b); err == nil { 134 - b = filepath.Clean(resolved) 135 - } 134 + a = normalizeDesktopPathCandidate(a) 135 + b = normalizeDesktopPathCandidate(b) 136 136 return a == b 137 137 }
+2 -14
desktop/wails/host.go
··· 12 12 "net/url" 13 13 "os" 14 14 "os/exec" 15 - "path/filepath" 16 15 "strings" 17 16 "sync" 18 17 "time" ··· 163 162 } 164 163 165 164 func sameExecutablePath(a, b string) bool { 166 - a = filepath.Clean(strings.TrimSpace(a)) 167 - b = filepath.Clean(strings.TrimSpace(b)) 165 + a = normalizeDesktopPathCandidate(a) 166 + b = normalizeDesktopPathCandidate(b) 168 167 if a == "" || b == "" { 169 168 return false 170 - } 171 - if a == b { 172 - return true 173 - } 174 - aEval, aErr := filepath.EvalSymlinks(a) 175 - if aErr == nil { 176 - a = filepath.Clean(aEval) 177 - } 178 - bEval, bErr := filepath.EvalSymlinks(b) 179 - if bErr == nil { 180 - b = filepath.Clean(bEval) 181 169 } 182 170 return a == b 183 171 }
+1 -1
go.mod
··· 8 8 github.com/lyricat/goutils v1.2.3 9 9 github.com/modelcontextprotocol/go-sdk v1.4.0 10 10 github.com/nickalie/go-webpbin v0.0.0-20220110095747-f10016bf2dc1 11 - github.com/quailyquaily/uniai v0.1.5 11 + github.com/quailyquaily/uniai v0.1.6 12 12 github.com/spf13/cast v1.10.0 13 13 github.com/spf13/cobra v1.8.1 14 14 github.com/spf13/viper v1.19.0
+2 -2
go.sum
··· 151 151 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 152 152 github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= 153 153 github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 154 - github.com/quailyquaily/uniai v0.1.5 h1:pqRuqCc1YRU9O57Zq6XATu1aDbkdoeYhlAEDlNy73O8= 155 - github.com/quailyquaily/uniai v0.1.5/go.mod h1:C3kQuLcZ+QvU1+uRmRXkHx3Jo8gaZxa6Da54aUI9nj4= 154 + github.com/quailyquaily/uniai v0.1.6 h1:Oju8I8NTLw1PG+Kj5THDh2zCukHYjE3KCtBGXs+7BaU= 155 + github.com/quailyquaily/uniai v0.1.6/go.mod h1:C3kQuLcZ+QvU1+uRmRXkHx3Jo8gaZxa6Da54aUI9nj4= 156 156 github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= 157 157 github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= 158 158 github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=