Merge remote-tracking branch 'upstream/main'
Resolves conflicts in config/config.go and proxy/kiro.go while preserving local proxy/auth/logger/pool enhancements. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -50,10 +50,15 @@ type Account struct {
|
||||
StartUrl string `json:"startUrl,omitempty"` // AWS SSO start URL
|
||||
ExpiresAt int64 `json:"expiresAt,omitempty"` // Token expiration timestamp (Unix seconds)
|
||||
MachineId string `json:"machineId,omitempty"` // UUID machine identifier for request tracking
|
||||
ProfileArn string `json:"profileArn,omitempty"` // CodeWhisperer/Kiro profile ARN for generation requests
|
||||
|
||||
// Priority weight for load balancing (higher = more requests)
|
||||
Weight int `json:"weight,omitempty"` // 0 or 1 = normal, 2+ = higher priority
|
||||
|
||||
// Overage behavior after the main usage limit is reached.
|
||||
AllowOverage bool `json:"allowOverage,omitempty"` // Whether to keep using the account after UsageLimit is reached
|
||||
OverageWeight int `json:"overageWeight,omitempty"` // 1-10, lower values reduce overage request frequency
|
||||
|
||||
// Account status
|
||||
Enabled bool `json:"enabled"` // Whether account is active in the pool
|
||||
BanStatus string `json:"banStatus,omitempty"` // Ban status: "ACTIVE", "BANNED", "SUSPENDED"
|
||||
@@ -105,9 +110,13 @@ type Config struct {
|
||||
OpenAIThinkingFormat string `json:"openaiThinkingFormat,omitempty"` // OpenAI output format: "reasoning_content", "thinking", or "think"
|
||||
ClaudeThinkingFormat string `json:"claudeThinkingFormat,omitempty"` // Claude output format: "reasoning_content", "thinking", or "think"
|
||||
|
||||
// Endpoint configuration: "auto", "codewhisperer", or "amazonq"
|
||||
// Endpoint configuration: "auto", "kiro", "codewhisperer", or "amazonq"
|
||||
PreferredEndpoint string `json:"preferredEndpoint,omitempty"`
|
||||
|
||||
// EndpointFallback controls whether to try other endpoints when the preferred one fails.
|
||||
// Defaults to true. Set to false to only use the preferred endpoint.
|
||||
EndpointFallback *bool `json:"endpointFallback,omitempty"`
|
||||
|
||||
// Proxy configuration: optional outbound proxy for Kiro API requests
|
||||
// Format: "socks5://host:port", "socks5://user:pass@host:port",
|
||||
// "http://host:port", "http://user:pass@host:port"
|
||||
@@ -119,6 +128,11 @@ type Config struct {
|
||||
FirstByteTimeoutSec int `json:"firstByteTimeoutSec,omitempty"` // First-byte timeout in seconds (default: 10, 0=disabled)
|
||||
FirstByteRetries int `json:"firstByteRetries,omitempty"` // Same-endpoint retry count on first-byte timeout (default: 1)
|
||||
|
||||
// LogLevel controls verbosity of application logs.
|
||||
// Accepted values: "debug", "info", "warn", "error". Defaults to "info".
|
||||
// Can be overridden by the LOG_LEVEL environment variable.
|
||||
LogLevel string `json:"logLevel,omitempty"`
|
||||
|
||||
// Global statistics (persisted across restarts)
|
||||
TotalRequests int `json:"totalRequests,omitempty"` // Total API requests received
|
||||
SuccessRequests int `json:"successRequests,omitempty"` // Successful requests count
|
||||
@@ -148,7 +162,7 @@ type AccountInfo struct {
|
||||
}
|
||||
|
||||
// Version current version
|
||||
const Version = "1.0.6"
|
||||
const Version = "1.0.7"
|
||||
|
||||
var (
|
||||
cfg *Config
|
||||
@@ -279,6 +293,18 @@ func UpdateAccount(id string, account Account) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func UpdateAccountProfileArn(id, profileArn string) error {
|
||||
cfgLock.Lock()
|
||||
defer cfgLock.Unlock()
|
||||
for i, a := range cfg.Accounts {
|
||||
if a.ID == id {
|
||||
cfg.Accounts[i].ProfileArn = profileArn
|
||||
return Save()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeleteAccount(id string) error {
|
||||
cfgLock.Lock()
|
||||
defer cfgLock.Unlock()
|
||||
@@ -456,6 +482,24 @@ func UpdatePreferredEndpoint(endpoint string) error {
|
||||
return Save()
|
||||
}
|
||||
|
||||
// GetEndpointFallback returns whether endpoint fallback is enabled. Defaults to true.
|
||||
func GetEndpointFallback() bool {
|
||||
cfgLock.RLock()
|
||||
defer cfgLock.RUnlock()
|
||||
if cfg.EndpointFallback == nil {
|
||||
return true
|
||||
}
|
||||
return *cfg.EndpointFallback
|
||||
}
|
||||
|
||||
// UpdateEndpointFallback sets the endpoint fallback switch and persists the change.
|
||||
func UpdateEndpointFallback(enabled bool) error {
|
||||
cfgLock.Lock()
|
||||
defer cfgLock.Unlock()
|
||||
cfg.EndpointFallback = &enabled
|
||||
return Save()
|
||||
}
|
||||
|
||||
// GetProxyURL 获取出站代理地址
|
||||
func GetProxyURL() string {
|
||||
cfgLock.RLock()
|
||||
@@ -543,6 +587,24 @@ func UpdateFirstByteRetries(n int) error {
|
||||
return Save()
|
||||
}
|
||||
|
||||
// GetLogLevel returns the configured log level (debug/info/warn/error). Defaults to "info".
|
||||
func GetLogLevel() string {
|
||||
cfgLock.RLock()
|
||||
defer cfgLock.RUnlock()
|
||||
if cfg == nil || cfg.LogLevel == "" {
|
||||
return "info"
|
||||
}
|
||||
return cfg.LogLevel
|
||||
}
|
||||
|
||||
// UpdateLogLevel updates the log level setting and persists the change.
|
||||
func UpdateLogLevel(level string) error {
|
||||
cfgLock.Lock()
|
||||
defer cfgLock.Unlock()
|
||||
cfg.LogLevel = level
|
||||
return Save()
|
||||
}
|
||||
|
||||
type KiroClientConfig struct {
|
||||
KiroVersion string
|
||||
SystemVersion string
|
||||
|
||||
Reference in New Issue
Block a user