fix(go-cli): confine agent runtime paths
This commit is contained in:
1 parent
1d83323d16
commit
78cb95e288
10 files changed
+588
-78
No files matched your search
@@ -55,18 +55,18 @@ func writeJSONFile(path string, data map[string]interface{}) error {
|
||||
|
||||
// hookScriptPath returns the default path for the hook script inside ~/.elydora/<agentId>/.
|
||||
func hookScriptPath(agentId string) (string, error) {
|
||||
home, err := os.UserHomeDir()
|
||||
agentDirectory, err := ResolveAgentRuntimeDirectory(agentId)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("resolve home directory: %w", err)
|
||||
return "", err
|
||||
}
|
||||
return filepath.Join(home, ".elydora", agentId, "hook.js"), nil
|
||||
return filepath.Join(agentDirectory, "hook.js"), nil
|
||||
}
|
||||
|
||||
// guardScriptPath returns the default path for the guard script inside ~/.elydora/<agentId>/.
|
||||
func guardScriptPath(agentId string) (string, error) {
|
||||
home, err := os.UserHomeDir()
|
||||
agentDirectory, err := ResolveAgentRuntimeDirectory(agentId)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("resolve home directory: %w", err)
|
||||
return "", err
|
||||
}
|
||||
return filepath.Join(home, ".elydora", agentId, "guard.js"), nil
|
||||
return filepath.Join(agentDirectory, "guard.js"), nil
|
||||
}
|
||||
Reference in new issue
Block a user