ZqinKing
83e5f60b8b
fix(kiro): scale description compression by needed size
...
Compute a size-reduction based keep ratio and use it to trim
tool descriptions, avoiding forced minimum truncation when the
target size already fits. This aligns compression with actual
payload reduction needs and prevents over-compression.
2026-01-14 16:22:46 +08:00
ZqinKing
5b433f962f
feat(kiro): 实现动态工具压缩功能
...
## 背景
当 Claude Code 发送过多工具信息时,可能超出 Kiro API 请求限制导致 500 错误。
现有的工具描述截断(KiroMaxToolDescLen = 10237)只能限制单个工具的描述长度,
无法解决整体工具列表过大的问题。
## 解决方案
实现动态工具压缩功能,采用两步压缩策略:
1. 先检查原始大小,超过 20KB 才进行压缩
2. 第一步:简化 input_schema,只保留 type/enum/required 字段
3. 第二步:按比例缩短 description(最短 50 字符)
4. 保留全部工具和 skills 可调用,不丢弃任何工具
## 新增文件
- internal/translator/kiro/claude/tool_compression.go
- calculateToolsSize(): 计算工具列表的 JSON 序列化大小
- simplifyInputSchema(): 简化 input_schema,递归处理嵌套 properties
- compressToolDescription(): 按比例压缩描述,支持 UTF-8 安全截断
- compressToolsIfNeeded(): 主压缩函数,实现两步压缩策略
- internal/translator/kiro/claude/tool_compression_test.go
- 完整的单元测试覆盖所有新增函数
- 测试 UTF-8 安全性
- 测试压缩效果
## 修改文件
- internal/translator/kiro/common/constants.go
- 新增 ToolCompressionTargetSize = 20KB (压缩目标大小阈值)
- 新增 MinToolDescriptionLength = 50 (描述最短长度)
- internal/translator/kiro/claude/kiro_claude_request.go
- 在 convertClaudeToolsToKiro() 函数末尾调用 compressToolsIfNeeded()
## 测试结果
- 70KB 工具压缩至 17KB (74.7% 压缩率)
- 所有单元测试通过
## 预期效果
- 80KB+ tools 压缩至 ~15KB
- 不影响工具调用功能
2026-01-14 11:07:07 +08:00
Luis Pater
9b33fbf1cd
Merge branch 'router-for-me:main' into main
2026-01-13 03:15:46 +08:00
Luis Pater
43652d044c
refactor(config): replace nonstream-keepalive with nonstream-keepalive-interval
...
- Updated `SDKConfig` to use `nonstream-keepalive-interval` (seconds) instead of the boolean `nonstream-keepalive`.
- Refactored handlers and logic to incorporate the new interval-based configuration.
- Updated config diff, tests, and example YAML to reflect the changes.
2026-01-13 03:14:38 +08:00
Luis Pater
b1b379ea18
feat(api): add non-streaming keep-alive support for idle timeout prevention
...
- Introduced `StartNonStreamingKeepAlive` to emit periodic blank lines during non-streaming responses.
- Added `nonstream-keepalive` configuration option in `SDKConfig`.
- Updated handlers to utilize `StartNonStreamingKeepAlive` and ensure proper cleanup.
- Extended config diff and tests to include `nonstream-keepalive` changes.
2026-01-13 02:36:07 +08:00
Luis Pater
94e979865e
Fixed : #897
...
refactor(executor): remove `prompt_cache_retention` from request payloads
2026-01-12 10:46:47 +08:00
Luis Pater
6c324f2c8b
Fixed : #936
...
feat(cliproxy): support multiple aliases for OAuth model mappings
- Updated mapping logic to allow multiple aliases per upstream model name.
- Adjusted `SanitizeOAuthModelMappings` to ensure aliases remain unique within channels.
- Added test cases to validate multi-alias scenarios.
- Updated example config to clarify multi-alias support.
2026-01-12 10:40:34 +08:00
Luis Pater
216dafe44b
Merge branch 'router-for-me:main' into main
2026-01-12 00:27:15 +08:00
Luis Pater
543dfd67e0
refactor(cache): remove max entries logic and extend signature TTL to 3 hours
2026-01-12 00:20:44 +08:00
Woohyun Rho
b477aff611
fix(login): use response project ID when API returns different project
2026-01-12 01:05:57 +09:00
hkfires
220ca45f74
fix(codex): only override instructions when upstream provides them
2026-01-11 15:52:21 +08:00
hkfires
70a82d80ac
fix(codex): only override instructions in responses for OpenCode UA
2026-01-11 15:19:37 +08:00
hkfires
ac626111ac
feat(codex): add OpenCode instructions based on user agent
2026-01-11 13:36:35 +08:00
Woohyun Rho
d829ac4cf7
docs(config): add github-copilot and kiro to oauth-excluded-models documentation
2026-01-11 02:48:05 +09:00
Woohyun Rho
f064f6e59d
feat(config): add github-copilot to oauth-model-mappings supported channels
2026-01-11 01:59:38 +09:00
Luis Pater
8f27fd5c42
feat(executor): add HttpRequest method with credential injection for GitHub Copilot and Kiro executors
2026-01-10 16:44:58 +08:00
Luis Pater
a9823ba58a
Merge branch 'router-for-me:main' into main
2026-01-10 16:27:52 +08:00
Luis Pater
8cfe26f10c
Merge branch 'sdk' into dev
2026-01-10 16:26:23 +08:00
Luis Pater
80db2dc254
Merge pull request #955 from router-for-me/api
...
feat(codex): add subscription date fields to ID token claims
2026-01-10 16:26:07 +08:00
Luis Pater
e8e3bc8616
feat(executor): add HttpRequest support across executors for better http request handling
2026-01-10 16:25:25 +08:00
Luis Pater
ab5f5386e4
Merge branch 'router-for-me:main' into main
2026-01-10 14:53:04 +08:00
Luis Pater
bc3195c8d8
refactor(logger): remove unnecessary request details limit logic
2026-01-10 14:46:59 +08:00
hkfires
6494330c6b
feat(codex): add subscription date fields to ID token claims
2026-01-10 11:15:20 +08:00
Luis Pater
514b9bf9fc
Merge origin/main into pr-92
2026-01-10 01:12:22 +08:00
Luis Pater
4d7f389b69
Fixed : #941
...
fix(translator): ensure fallback to valid originalRequestRawJSON in response handling
2026-01-10 01:01:09 +08:00
Luis Pater
95f87d5669
Merge pull request #947 from pykancha/fix-memory-leak
...
Resolve memory leaks causing OOM in k8s deployment
2026-01-10 00:40:47 +08:00
Luis Pater
c83365a349
Merge pull request #938 from router-for-me/log
...
refactor(logging): clean up oauth logs and debugs
2026-01-10 00:02:45 +08:00
Luis Pater
6b3604cf2b
Merge pull request #943 from ben-vargas/fix-tool-mappings
...
Fix Claude OAuth tool name mapping (proxy_)
2026-01-09 23:52:29 +08:00
Luis Pater
af6bdca14f
Fixed : #942
...
fix(executor): ignore non-SSE lines in OpenAI-compatible streams
2026-01-09 23:41:50 +08:00
Luis Pater
1906ebcfce
Merge branch 'main' into plus
2026-01-09 21:52:24 +08:00
hemanta212
1c773c428f
fix: Remove investigation artifacts
2026-01-09 17:47:59 +05:45
Ben Vargas
e785bfcd12
Use unprefixed Claude request for translation
...
Keep the upstream payload prefixed for OAuth while passing the unprefixed request body into response translators. This avoids proxy_ leaking into OpenAI Responses echoed tool metadata while preserving the Claude OAuth workaround.
2026-01-09 00:54:35 -07:00
hemanta212
47dacce6ea
fix(server): resolve memory leaks causing OOM in k8s deployment
...
- usage/logger_plugin: cap modelStats.Details at 1000 entries per model
- cache/signature_cache: add background cleanup for expired sessions (10 min)
- management/handler: add background cleanup for stale IP rate-limit entries (1 hr)
- executor/cache_helpers: add mutex protection and TTL cleanup for codexCacheMap (15 min)
- executor/codex_executor: use thread-safe cache accessors
Add reproduction tests demonstrating leak behavior before/after fixes.
Amp-Thread-ID: https://ampcode.com/threads/T-019ba0fc-1d7b-7338-8e1d-ca0520412777
Co-authored-by: Amp <amp@ampcode.com >
2026-01-09 13:33:46 +05:45
Ben Vargas
dcac3407ab
Fix Claude OAuth tool name mapping
...
Prefix tool names with proxy_ for Claude OAuth requests and strip the prefix from streaming and non-streaming responses to restore client-facing names.
Updates the Claude executor to:
- add prefixing for tools, tool_choice, and tool_use messages when using OAuth tokens
- strip the prefix from tool_use events in SSE and non-streaming payloads
- add focused unit tests for prefix/strip helpers
2026-01-09 00:10:38 -07:00
hkfires
ee62ef4745
refactor(logging): clean up oauth logs and debugs
2026-01-09 11:20:55 +08:00
Luis Pater
ef6bafbf7e
fix(executor): handle context cancellation and deadline errors explicitly
2026-01-09 10:48:29 +08:00
Luis Pater
ed28b71e87
refactor(amp): remove duplicate comments in response rewriter
2026-01-09 08:21:13 +08:00
Luis Pater
d47b7dc79a
refactor(response): enhance parameter handling for Codex to Claude conversion
2026-01-09 05:20:19 +08:00
Luis Pater
49b9709ce5
Merge pull request #787 from sususu98/fix/antigravity-429-retry-delay-parsing
...
fix(antigravity): parse retry-after delay from 429 response body
2026-01-09 04:45:25 +08:00
Luis Pater
3d01b3cfe8
Merge pull request #553 from XInTheDark/fix/builtin-tools-web-search
...
fix(translator): preserve built-in tools (web_search) to Responses API
2026-01-09 04:40:13 +08:00
Luis Pater
af2efa6f7e
Merge pull request #605 from soilSpoon/feature/amp-compat
...
feature: Improves Amp client compatibility
2026-01-09 04:28:17 +08:00
Luis Pater
d3533f81fc
Merge branch 'router-for-me:main' into main
2026-01-08 21:06:24 +08:00
Luis Pater
59a448b645
feat(executor): centralize systemInstruction handling for Claude and Gemini-3-Pro models
2026-01-08 21:05:33 +08:00
Luis Pater
3de7a7f0cd
Merge branch 'router-for-me:main' into main
2026-01-08 20:32:08 +08:00
hkfires
b6a0f7a07f
fix(executor): update gemini model identifier to gemini-3-pro-preview
...
Update the model name check in `buildRequest` to target "gemini-3-pro-preview" instead of "gemini-3-pro" when applying specific system instruction handling.
2026-01-08 19:14:52 +08:00
Luis Pater
b2566368f8
Merge branch 'router-for-me:main' into main
2026-01-08 12:45:39 +08:00
Luis Pater
1b2f907671
feat(executor): update system instruction handling for Claude and Gemini-3-Pro models
2026-01-08 12:42:26 +08:00
Luis Pater
bda04eed8a
feat(executor): add model-specific support for "gemini-3-pro" in execution and payload handling
2026-01-08 12:27:03 +08:00
Luis Pater
e0735977b5
Merge branch 'router-for-me:main' into main
2026-01-08 11:17:28 +08:00
Luis Pater
67985d8226
feat(executor): enhance Antigravity payload with user role and dynamic system instructions
2026-01-08 10:55:25 +08:00