mirror of
https://github.com/Finesssee/ProxyPilot.git
synced 2026-11-20 20:34:36 +00:00
feat(watcher): add Kiro auth handling
Add Kiro support in SnapshotCoreAuths(): - Synthesize auth entries from KiroKey config - Support token-file and direct access-token modes - Handle profile-arn, region, agent-task-type 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
b354ff8a21
commit
d407c7c779
@@ -1207,6 +1207,53 @@ func (w *Watcher) SnapshotCoreAuths() []*coreauth.Auth {
|
||||
applyAuthExcludedModelsMeta(a, cfg, ck.ExcludedModels, "apikey")
|
||||
out = append(out, a)
|
||||
}
|
||||
// Kiro keys -> synthesize auths
|
||||
for i := range cfg.KiroKey {
|
||||
kk := cfg.KiroKey[i]
|
||||
// Support either token file or direct access/refresh tokens
|
||||
tokenFile := strings.TrimSpace(kk.TokenFile)
|
||||
accessToken := strings.TrimSpace(kk.AccessToken)
|
||||
refreshToken := strings.TrimSpace(kk.RefreshToken)
|
||||
// Must have either token file or access token
|
||||
if tokenFile == "" && accessToken == "" {
|
||||
continue
|
||||
}
|
||||
id, token := idGen.next("kiro:apikey", tokenFile, accessToken, kk.Region)
|
||||
attrs := map[string]string{
|
||||
"source": fmt.Sprintf("config:kiro[%s]", token),
|
||||
}
|
||||
if tokenFile != "" {
|
||||
attrs["token_file"] = tokenFile
|
||||
}
|
||||
if accessToken != "" {
|
||||
attrs["access_token"] = accessToken
|
||||
}
|
||||
if refreshToken != "" {
|
||||
attrs["refresh_token"] = refreshToken
|
||||
}
|
||||
if kk.ProfileArn != "" {
|
||||
attrs["profile_arn"] = kk.ProfileArn
|
||||
}
|
||||
if kk.Region != "" {
|
||||
attrs["region"] = kk.Region
|
||||
}
|
||||
if kk.AgentTaskType != "" {
|
||||
attrs["agent_task_type"] = kk.AgentTaskType
|
||||
}
|
||||
proxyURL := strings.TrimSpace(kk.ProxyURL)
|
||||
a := &coreauth.Auth{
|
||||
ID: id,
|
||||
Provider: "kiro",
|
||||
Label: "kiro-apikey",
|
||||
Status: coreauth.StatusActive,
|
||||
ProxyURL: proxyURL,
|
||||
Attributes: attrs,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
}
|
||||
applyAuthExcludedModelsMeta(a, cfg, nil, "apikey")
|
||||
out = append(out, a)
|
||||
}
|
||||
for i := range cfg.OpenAICompatibility {
|
||||
compat := &cfg.OpenAICompatibility[i]
|
||||
providerName := strings.ToLower(strings.TrimSpace(compat.Name))
|
||||
|
||||
Reference in New Issue
Block a user