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:
雷电芽衣 committed 2026-09-03 02:32:20 -04:00
1 parent 34ff4c1ea8
commit 96489cd051
20 files changed
+185 -650

No files matched your search

+4 -29
View File
@@ -1,7 +1,6 @@
package plugins
import (
"encoding/json"
"errors"
"fmt"
"os"
@@ -13,15 +12,6 @@ const (
maxRuntimeConfigBytes = 512 * 1024
)
type agentRuntimeConfig struct {
OrgID string `json:"org_id"`
AgentID string `json:"agent_id"`
KID string `json:"kid"`
BaseURL string `json:"base_url"`
Token string `json:"token"`
AgentName string `json:"agent_name"`
}
// WriteRuntimeFileAtomic replaces one managed runtime file atomically.
func WriteRuntimeFileAtomic(
path string,
@@ -54,27 +44,12 @@ func generateHookScriptWithRename(
return err
}
baseURL := config.BaseURL
if baseURL == "" {
baseURL = "https://api.elydora.com"
if config.BaseURL == "" {
return fmt.Errorf("base URL is required")
}
encodedConfig, err := json.MarshalIndent(agentRuntimeConfig{
OrgID: config.OrgID,
AgentID: config.AgentID,
KID: config.KID,
BaseURL: baseURL,
Token: config.Token,
AgentName: config.AgentName,
}, "", " ")
encodedConfig, err := buildManagedRuntimeConfig(config, config.AgentName)
if err != nil {
return fmt.Errorf("encode Elydora runtime config: %w", err)
}
encodedConfig = append(encodedConfig, '\n')
if len(encodedConfig) > maxRuntimeConfigBytes {
return fmt.Errorf(
"Elydora runtime config exceeds %d bytes after JSON encoding",
maxRuntimeConfigBytes,
)
return err
}
items := []struct {