chore(go): audit providers kirocli kiroide opencode
Move Kiro IDE onto managed_runtime.go and shell_command.go, share cloneJSONObject across providers, make OpenCode status verify the managed runtime contract instead of any hook.js, propagate script removal errors, and build the legacy runtime config through buildManagedRuntimeConfig. Claude-Session: https://claude.ai/code/session_01Agoc9bRVE9KL7mmWtey9Vq
This commit is contained in:
1 parent
34ff4c1ea8
commit
96489cd051
20 files changed
+185
-650
No files matched your search
@@ -2,6 +2,7 @@ package plugins
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -49,6 +50,20 @@ func hookScriptPath(agentId string) (string, error) {
|
||||
return filepath.Join(agentDirectory, "hook.js"), nil
|
||||
}
|
||||
|
||||
// removeAgentScripts deletes hook.js and guard.js; missing files are fine.
|
||||
func removeAgentScripts(agentID string) error {
|
||||
for _, resolve := range []func(string) (string, error){hookScriptPath, guardScriptPath} {
|
||||
path, err := resolve(agentID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := os.Remove(path); err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
return fmt.Errorf("remove %s: %w", path, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// guardScriptPath returns ~/.elydora/<agentId>/guard.js.
|
||||
func guardScriptPath(agentId string) (string, error) {
|
||||
agentDirectory, err := ResolveAgentRuntimeDirectory(agentId)
|
||||
|
||||
Reference in new issue
Block a user