From d407c7c7798120a4de77243f32aecc66430e7f28 Mon Sep 17 00:00:00 2001 From: Finessse Date: Fri, 26 Dec 2025 00:53:53 +0700 Subject: [PATCH] feat(watcher): add Kiro auth handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- internal/watcher/watcher.go | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/internal/watcher/watcher.go b/internal/watcher/watcher.go index bc0854e2..3ca11c19 100644 --- a/internal/watcher/watcher.go +++ b/internal/watcher/watcher.go @@ -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))