MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / installLocalSkillPackage

Function installLocalSkillPackage

agent/app/service/agents_skills.go:211–242  ·  view source on GitHub ↗
(mgr *cmd.CommandHelper, containerName, agentType, configPath, hostPath, skillName string)

Source from the content-addressed store, hash-verified

209}
210
211func installLocalSkillPackage(mgr *cmd.CommandHelper, containerName, agentType, configPath, hostPath, skillName string) error {
212 targetDir, err := resolveAgentLocalSkillDir(agentType)
213 if err != nil {
214 return err
215 }
216 tempDir, err := os.MkdirTemp("", "1panel-agent-skill-*")
217 if err != nil {
218 return err
219 }
220 defer os.RemoveAll(tempDir)
221 extractRoot := filepath.Join(tempDir, "extract")
222 if err := os.MkdirAll(extractRoot, 0755); err != nil {
223 return err
224 }
225 if err := extractLocalSkillPackage(hostPath, extractRoot); err != nil {
226 return err
227 }
228 copyRoot, installedSkillName, err := normalizeLocalSkillInstallRoot(extractRoot, filepath.Join(tempDir, "install"), skillName)
229 if err != nil {
230 return err
231 }
232 if err := mgr.Run("docker", "exec", containerName, "mkdir", "-p", targetDir); err != nil {
233 return err
234 }
235 if err := mgr.Run("docker", "cp", copyRoot+"/.", containerName+":"+targetDir); err != nil {
236 return err
237 }
238 if agentType == constant.AppOpenclaw {
239 return registerOpenclawLocalSkill(containerName, configPath, installedSkillName)
240 }
241 return nil
242}
243
244func resolveAgentLocalSkillDir(agentType string) (string, error) {
245 switch agentType {

Callers 2

BatchInstallSkillMethod · 0.85
InstallSkillMethod · 0.85

Calls 7

extractLocalSkillPackageFunction · 0.85
RemoveAllMethod · 0.80
MkdirAllMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected