From 778cf4af9ea1f0f498aa6c9abec367135588b8fe Mon Sep 17 00:00:00 2001 From: Cc Date: Fri, 16 Jan 2026 14:21:38 +0800 Subject: [PATCH] feat(kiro): add agent-mode and optout headers for non-IDC auth - Add x-amzn-kiro-agent-mode: vibe for non-IDC auth (Social, Builder ID) IDC auth continues to use "spec" mode - Add x-amzn-codewhisperer-optout: true for all auth types This opts out of data sharing for service improvement (privacy) These changes align with other Kiro implementations (kiro.rs, KiroGate, kiro-gateway, AIClient-2-API) and make requests more similar to real Kiro IDE clients. Co-Authored-By: Claude Opus 4.5 --- internal/runtime/executor/kiro_executor.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/runtime/executor/kiro_executor.go b/internal/runtime/executor/kiro_executor.go index fe90b403..3d152955 100644 --- a/internal/runtime/executor/kiro_executor.go +++ b/internal/runtime/executor/kiro_executor.go @@ -53,6 +53,7 @@ const ( kiroIDEUserAgent = "aws-sdk-js/1.0.18 ua/2.1 os/darwin#25.0.0 lang/js md/nodejs#20.16.0 api/codewhispererstreaming#1.0.18 m/E KiroIDE-0.2.13-66c23a8c5d15afabec89ef9954ef52a119f10d369df04d548fc6c1eac694b0d1" kiroIDEAmzUserAgent = "aws-sdk-js/1.0.18 KiroIDE-0.2.13-66c23a8c5d15afabec89ef9954ef52a119f10d369df04d548fc6c1eac694b0d1" kiroIDEAgentModeSpec = "spec" + kiroAgentModeVibe = "vibe" ) // Real-time usage estimation configuration @@ -232,7 +233,9 @@ func (e *KiroExecutor) PrepareRequest(req *http.Request, auth *cliproxyauth.Auth } else { req.Header.Set("User-Agent", kiroUserAgent) req.Header.Set("X-Amz-User-Agent", kiroFullUserAgent) + req.Header.Set("x-amzn-kiro-agent-mode", kiroAgentModeVibe) } + req.Header.Set("x-amzn-codewhisperer-optout", "true") req.Header.Set("Amz-Sdk-Request", "attempt=1; max=3") req.Header.Set("Amz-Sdk-Invocation-Id", uuid.New().String()) req.Header.Set("Authorization", "Bearer "+accessToken) @@ -350,7 +353,9 @@ func (e *KiroExecutor) executeWithRetry(ctx context.Context, auth *cliproxyauth. } else { httpReq.Header.Set("User-Agent", kiroUserAgent) httpReq.Header.Set("X-Amz-User-Agent", kiroFullUserAgent) + httpReq.Header.Set("x-amzn-kiro-agent-mode", kiroAgentModeVibe) } + httpReq.Header.Set("x-amzn-codewhisperer-optout", "true") httpReq.Header.Set("Amz-Sdk-Request", "attempt=1; max=3") httpReq.Header.Set("Amz-Sdk-Invocation-Id", uuid.New().String()) @@ -683,7 +688,9 @@ func (e *KiroExecutor) executeStreamWithRetry(ctx context.Context, auth *cliprox } else { httpReq.Header.Set("User-Agent", kiroUserAgent) httpReq.Header.Set("X-Amz-User-Agent", kiroFullUserAgent) + httpReq.Header.Set("x-amzn-kiro-agent-mode", kiroAgentModeVibe) } + httpReq.Header.Set("x-amzn-codewhisperer-optout", "true") httpReq.Header.Set("Amz-Sdk-Request", "attempt=1; max=3") httpReq.Header.Set("Amz-Sdk-Invocation-Id", uuid.New().String())