@@ -13,6 +13,9 @@ import (
1313 "github.com/1Panel-dev/1Panel/agent/utils/cmd"
1414)
1515
16+ const clawhubGlobalRegistry = "https://clawhub.com"
17+ const clawhubChinaRegistry = "https://mirror-cn.clawhub.com"
18+
1619type openclawSkillsList struct {
1720 Skills []openclawSkillListItem `json:"skills"`
1821}
@@ -74,7 +77,7 @@ func (a AgentService) SearchSkills(req dto.AgentSkillSearchReq) ([]dto.AgentSkil
7477 case "skillhub" :
7578 return parseSkillhubSearchResult (output )
7679 default :
77- return parseClawhubSearchResult (output ), nil
80+ return parseClawhubSearchResult (output , req . Source ), nil
7881 }
7982}
8083
@@ -152,7 +155,13 @@ func loadOpenclawSkillSearchOutput(containerName, source, keyword string) (strin
152155 case "skillhub" :
153156 return runDockerExecWithStdout (30 * time .Second , containerName , "skillhub" , "search" , keyword , "--json" )
154157 default :
155- return runDockerExecWithStdout (30 * time .Second , containerName , "clawhub" , "search" , keyword )
158+ return runDockerExecWithStdout (
159+ 30 * time .Second ,
160+ containerName ,
161+ "sh" ,
162+ "-c" ,
163+ fmt .Sprintf ("CLAWHUB_REGISTRY=%q clawhub search %q" , resolveClawhubRegistry (source ), keyword ),
164+ )
156165 }
157166}
158167
@@ -182,7 +191,7 @@ func parseSkillhubSearchResult(output string) ([]dto.AgentSkillSearchItem, error
182191 return items , nil
183192}
184193
185- func parseClawhubSearchResult (output string ) []dto.AgentSkillSearchItem {
194+ func parseClawhubSearchResult (output , source string ) []dto.AgentSkillSearchItem {
186195 lines := strings .Split (strings .TrimSpace (output ), "\n " )
187196 items := make ([]dto.AgentSkillSearchItem , 0 , len (lines ))
188197 for _ , line := range lines {
@@ -194,18 +203,19 @@ func parseClawhubSearchResult(output string) []dto.AgentSkillSearchItem {
194203 Slug : matches [1 ],
195204 Name : matches [2 ],
196205 Score : matches [3 ],
197- Source : "clawhub" ,
206+ Source : source ,
198207 })
199208 }
200209 return items
201210}
202211
203212func buildOpenclawSkillInstallCommand (source , slug string ) string {
204213 switch source {
205- case "clawhub" :
214+ case "clawhub-global" , "clawhub-cn " :
206215 return fmt .Sprintf (
207- "mkdir -p %s && clawhub --workdir /home/node/.openclaw --dir skills install %q" ,
216+ "mkdir -p %s && CLAWHUB_REGISTRY=%q clawhub --workdir /home/node/.openclaw --dir skills install %q" ,
208217 openclawManagedSkillsDir ,
218+ resolveClawhubRegistry (source ),
209219 slug ,
210220 )
211221 default :
@@ -218,6 +228,15 @@ func buildOpenclawSkillInstallCommand(source, slug string) string {
218228 }
219229}
220230
231+ func resolveClawhubRegistry (source string ) string {
232+ switch source {
233+ case "clawhub-cn" :
234+ return clawhubChinaRegistry
235+ default :
236+ return clawhubGlobalRegistry
237+ }
238+ }
239+
221240func getOpenclawSkillKey (containerName , name string ) (string , error ) {
222241 output , err := runDockerExecWithStdout (30 * time .Second , containerName , "sh" , "-c" , fmt .Sprintf ("openclaw skills info %q --json 2>&1" , name ))
223242 if err != nil {
0 commit comments