chore(go): audit providers kimi grok qwen letta

Move Kimi, Grok, and Qwen onto managed_runtime.go and shell_command.go;
share the encoded and shell command builders and the quoted Windows
legacy parser with Droid; split managed_changes.go; dedupe Letta's hook
entry filtering and stop swallowing settings read errors.

Claude-Session: https://claude.ai/code/session_01Agoc9bRVE9KL7mmWtey9Vq
This commit is contained in:
雷电芽衣 committed 2026-09-03 02:16:58 -04:00
1 parent 1ede03d989
commit 34ff4c1ea8
34 files changed
+421 -1876

No files matched your search

+4 -36
View File
@@ -172,53 +172,21 @@ for (const entry of entries) {
return nil
}
func buildDroidCommand(nodePath, scriptPath string) string {
if runtime.GOOS == "windows" {
return powerShellSource(nodePath, scriptPath)
}
return posixSource(nodePath, scriptPath)
}
func buildDroidGroup(nodePath, scriptPath string) map[string]any {
return map[string]any{
"matcher": "*",
"hooks": []any{map[string]any{
"type": "command", "command": buildDroidCommand(nodePath, scriptPath), "timeout": droidHookTimeout,
"type": "command", "command": buildShellCommand(nodePath, scriptPath), "timeout": droidHookTimeout,
}},
}
}
func parseDroidCommand(command string, includeLegacy ...bool) (string, string, bool) {
if runtime.GOOS != "windows" {
return parsePOSIXCommand(command)
}
executable, script, ok := parsePowerShellSource(command)
if ok || len(includeLegacy) == 0 || !includeLegacy[0] {
executable, script, ok := parseShellCommand(command)
if ok || runtime.GOOS != "windows" || len(includeLegacy) == 0 || !includeLegacy[0] {
return executable, script, ok
}
return parseDroidLegacyWindowsCommand(command)
}
func parseDroidLegacyWindowsCommand(command string) (string, string, bool) {
executable, next, ok := readDroidLegacyWindowsArgument(command, 0)
if !ok || next >= len(command) || command[next] != ' ' {
return "", "", false
}
script, end, ok := readDroidLegacyWindowsArgument(command, next+1)
return executable, script, ok && end == len(command) && executable != "" && script != ""
}
func readDroidLegacyWindowsArgument(command string, start int) (string, int, bool) {
if start >= len(command) || command[start] != '"' {
return "", start, false
}
end := strings.IndexByte(command[start+1:], '"')
if end < 0 {
return "", start, false
}
end += start + 1
value := command[start+1 : end]
return value, end + 1, value != "" && !strings.ContainsAny(value, "\r\n")
return parseQuotedWindowsCommand(command)
}
func managedDroidAgentID(