Ravens2121
c3ed3b40ea
feat(kiro): Add token usage cross-validation and simplify thinking mode handling
2025-12-14 16:40:33 +08:00
Ravens2121
9c04c18c04
feat(kiro): enhance request translation and fix streaming issues
...
English:
- Fix <thinking> tag parsing: only parse at response start, avoid misinterpreting discussion text
- Add token counting support using tiktoken for local estimation
- Support top_p parameter in inference config
- Handle max_tokens=-1 as maximum (32000 tokens)
- Add tool_choice and response_format parameter handling via system prompt hints
- Support multiple thinking mode detection formats (Claude API, OpenAI reasoning_effort, AMP/Cursor)
- Shorten MCP tool names exceeding 64 characters
- Fix duplicate [DONE] marker in OpenAI SSE streaming
- Enhance token usage statistics with multiple event format support
- Add code fence markers to constants
中文:
- 修复 <thinking> 标签解析:仅在响应开头解析,避免误解析讨论文本中的标签
- 使用 tiktoken 实现本地 token 计数功能
- 支持 top_p 推理配置参数
- 处理 max_tokens=-1 转换为最大值(32000 tokens)
- 通过系统提示词注入实现 tool_choice 和 response_format 参数支持
- 支持多种思考模式检测格式(Claude API、OpenAI reasoning_effort、AMP/Cursor)
- 截断超过64字符的 MCP 工具名称
- 修复 OpenAI SSE 流中重复的 [DONE] 标记
- 增强 token 使用量统计,支持多种事件格式
- 添加代码围栏标记常量
2025-12-14 11:57:16 +08:00
Ravens2121
01cf221167
feat(kiro): 代码优化重构 + OpenAI翻译器实现
2025-12-14 06:58:50 +08:00
Luis Pater
7f4f6bc9ca
Merge branch 'main' into plus
2025-12-12 18:41:39 +08:00
hkfires
d131435e25
fix(codex): raise default reasoning effort to medium
2025-12-12 18:18:48 +08:00
Ravens2121
84920cb670
feat(kiro): add multi-endpoint fallback & thinking mode support
2025-12-12 13:43:36 +08:00
Luis Pater
ef0edbfe69
refactor(claude): replace strings.Builder with simpler output string concatenation
2025-12-11 22:34:06 +08:00
Luis Pater
4ce7c61a17
Merge branch 'main' into plus
2025-12-11 21:33:49 +08:00
Luis Pater
a74ee3f319
Merge pull request #481 from sususu98/fix/increase-buffer-size
...
fix: increase buffer size for stream scanners to 50MB across multiple executors
2025-12-11 21:20:54 +08:00
Luis Pater
1da03bfe15
Merge pull request #479 from router-for-me/claude
...
fix(claude): prevent final events when no content streamed
2025-12-11 08:18:59 +08:00
Ravens2121
cd4e84a360
feat(kiro): enhance request format, stream handling, and usage tracking
...
## English Description
### Request Format Fixes
- Fix conversationState field order (chatTriggerType must be first)
- Add conditional profileArn inclusion based on auth method
- builder-id auth (AWS SSO) doesn't require profileArn
- social auth (Google OAuth) requires profileArn
### Stream Processing Enhancements
- Add headersLen boundary validation to prevent slice out of bounds
- Handle incomplete tool use at EOF by flushing pending data
- Separate message_delta and message_stop events for proper streaming
- Add error logging for JSON unmarshal failures
### JSON Repair Improvements
- Add escapeNewlinesInStrings() to handle control characters in JSON strings
- Remove incorrect unquotedKeyPattern that broke valid JSON content
- Fix handling of streaming fragments with embedded newlines/tabs
### Debug Info Filtering (Optional)
- Add filterHeliosDebugInfo() to remove [HELIOS_CHK] blocks
- Pattern matches internal state tracking from Kiro/Amazon Q
- Currently disabled pending further testing
### Usage Tracking
- Add usage information extraction in message_delta response
- Include prompt_tokens, completion_tokens, total_tokens in OpenAI format
---
## 中文描述
### 请求格式修复
- 修复 conversationState 字段顺序(chatTriggerType 必须在第一位)
- 根据认证方式条件性包含 profileArn
- builder-id 认证(AWS SSO)不需要 profileArn
- social 认证(Google OAuth)需要 profileArn
### 流处理增强
- 添加 headersLen 边界验证,防止切片越界
- 在 EOF 时处理未完成的工具调用,刷新待处理数据
- 分离 message_delta 和 message_stop 事件以实现正确的流式传输
- 添加 JSON 反序列化失败的错误日志
### JSON 修复改进
- 添加 escapeNewlinesInStrings() 处理 JSON 字符串中的控制字符
- 移除错误的 unquotedKeyPattern,该模式会破坏有效的 JSON 内容
- 修复包含嵌入换行符/制表符的流式片段处理
### 调试信息过滤(可选)
- 添加 filterHeliosDebugInfo() 移除 [HELIOS_CHK] 块
- 模式匹配来自 Kiro/Amazon Q 的内部状态跟踪信息
- 目前已禁用,等待进一步测试
### 使用量跟踪
- 在 message_delta 响应中添加 usage 信息提取
- 以 OpenAI 格式包含 prompt_tokens、completion_tokens、total_tokens
2025-12-11 05:37:22 +08:00
Luis Pater
b27a175fef
Merge pull request #17 from Ravens2121/master
...
由AI进行更改修复了Kiro供应商的Claude协议与OpenAI协议。(对比AIClient-2-API项目进行变更)
2025-12-11 01:31:47 +08:00
Ravens
8d5f89ccfd
fix(kiro): fix translator format mismatch for OpenAI protocol
...
Amp-Thread-ID: https://ampcode.com/threads/T-019b092b-f2de-72a1-b428-72511c0de628
Co-authored-by: Amp <amp@ampcode.com >
2025-12-11 01:15:00 +08:00
Ravens
084e2666cb
fix(kiro): add SSE event: prefix for Claude client compatibility
...
Amp-Thread-ID: https://ampcode.com/threads/T-019b08fc-ff96-766e-a942-63dd35ed28c6
Co-authored-by: Amp <amp@ampcode.com >
2025-12-11 00:14:20 +08:00
Luis Pater
2eb2dbb266
Merge branch 'router-for-me:main' into main
2025-12-10 23:56:59 +08:00
Luis Pater
e717939edb
Fixed : #478
...
feat(antigravity): add support for inline image data in client responses
2025-12-10 23:55:53 +08:00
sususu
76c563d161
fix(executor): increase buffer size for stream scanners to 50MB across multiple executors
2025-12-10 23:20:04 +08:00
hkfires
a89514951f
fix(claude): prevent final events when no content streamed
2025-12-10 22:19:55 +08:00
Luis Pater
f999650322
Merge branch 'router-for-me:main' into main
2025-12-10 16:04:18 +08:00
Luis Pater
1249b07eb8
feat(responses): add unique identifiers for responses, function calls, and tool uses
2025-12-10 16:02:54 +08:00
Luis Pater
38319b0483
Merge branch 'router-for-me:main' into main
2025-12-10 15:29:19 +08:00
Luis Pater
6b37f33d31
feat(antigravity): add unique identifier for tool use blocks in response
2025-12-10 15:27:57 +08:00
Luis Pater
1fd1ccca17
Merge branch 'router-for-me:main' into main
2025-12-09 21:13:08 +08:00
hkfires
9b202b6c1c
fix(executor): centralize default thinking config
2025-12-09 21:05:06 +08:00
hkfires
5b6d201408
refactor(translator): remove thinking budget normalization across all translators
2025-12-09 21:05:06 +08:00
Luis Pater
ab9e9442ec
v6.5.56 ( #12 )
...
* feat(api): add comprehensive ampcode management endpoints
Add new REST API endpoints under /v0/management/ampcode for managing
ampcode configuration including upstream URL, API key, localhost
restriction, model mappings, and force model mappings settings.
- Move force-model-mappings from config_basic to config_lists
- Add GET/PUT/PATCH/DELETE endpoints for all ampcode settings
- Support model mapping CRUD with upsert (PATCH) capability
- Add comprehensive test coverage for all ampcode endpoints
* refactor(api): simplify request body parsing in ampcode handlers
* feat(logging): add upstream API request/response capture to streaming logs
* style(logging): remove redundant separator line from response section
* feat(antigravity): enforce thinking budget limits for Claude models
* refactor(logging): remove unused variable in `ensureAttempt` and redundant function call
---------
Co-authored-by: hkfires <10558748+hkfires@users.noreply.github.com >
2025-12-08 22:32:29 +08:00
hkfires
a283545b6b
feat(antigravity): enforce thinking budget limits for Claude models
2025-12-08 20:36:17 +08:00
Luis Pater
0d4f32a881
Merge branch 'router-for-me:main' into main
2025-12-08 10:20:08 +08:00
Luis Pater
d26ed069fa
Merge pull request #441 from huynguyen03dev/fix/claude-to-openai-whitespace-text
...
fix: filter whitespace-only text in Claude to OpenAI translation
2025-12-08 09:43:44 +08:00
Ravens2121
a0c6cffb0d
fix(kiro):修复 base64 图片格式转换问题 ( #10 )
2025-12-07 21:55:13 +08:00
hkfires
a174d015f2
feat(openai): handle thinking.budget_tokens from Anthropic-style requests
2025-12-07 19:14:05 +08:00
huynguyen03.dev
549c0c2c5a
fix: filter whitespace-only text content in Claude to OpenAI translation
...
Remove redundant existence check since TrimSpace handles empty strings
2025-12-07 16:08:12 +07:00
huynguyen03.dev
f092801b61
fix: filter whitespace-only text in Claude to OpenAI translation
...
Skip text content blocks that are empty or contain only whitespace
when translating Claude messages to OpenAI format. This fixes GLM-4.6
and other strict OpenAI-compatible providers that reject empty text
with error 'text cannot be empty'.
2025-12-07 15:39:58 +07:00
Luis Pater
15353a6b6a
Merge branch 'router-for-me:main' into main
2025-12-07 13:37:43 +08:00
Luis Pater
76af454034
**feat(antigravity): enhance handling of "thinking" content and refine Claude model response processing**
2025-12-07 13:19:12 +08:00
Luis Pater
04f0070a80
Merge branch 'router-for-me:main' into main
2025-12-07 02:38:32 +08:00
Luis Pater
f383840cf9
fix(antigravity): update toolNode role from "tool" to "user" in chat completions
2025-12-07 02:37:46 +08:00
Luis Pater
239fc4a8c4
Merge branch 'router-for-me:main' into main
2025-12-07 01:58:03 +08:00
Luis Pater
fd29ab418a
Fixed : #424
...
**feat(antigravity): add support for maxOutputTokens and refine Claude model handling**
2025-12-07 01:55:57 +08:00
Luis Pater
df91408919
Merge branch 'router-for-me:main' into main
2025-12-07 01:49:20 +08:00
Luis Pater
7a628426dc
Fixed : #433
...
refactor(translator): normalize finish reason casing across all OpenAI response handlers
2025-12-07 01:48:24 +08:00
Mansi
02d8a1cfec
feat(kiro): add AWS Builder ID authentication support
...
- Add --kiro-aws-login flag for AWS Builder ID device code flow
- Add DoKiroAWSLogin function for AWS SSO OIDC authentication
- Complete Kiro integration with AWS, Google OAuth, and social auth
- Add kiro executor, translator, and SDK components
- Update browser support for Kiro authentication flows
2025-12-05 22:46:24 +03:00
Luis Pater
412148af0e
feat(antigravity): add function ID to FunctionCall and FunctionResponse models
2025-12-05 23:05:35 +08:00
Luis Pater
41ee44432d
**fix(translator): rename responseSchema key for generationConfig**
...
- Renamed `generationConfig.responseSchema` to `generationConfig.responseJsonSchema` in Gemini request transformation to align with updated schema expectations.
2025-12-02 18:32:23 +08:00
Luis Pater
72c7ef7647
**fix(translator): handle non-JSON output parsing for OpenAI function responses**
...
- Updated `antigravity_openai_request.go` to process non-JSON outputs gracefully by verifying and distinguishing between JSON and plain string formats.
- Ensured proper assignment of parsed or raw response to `functionResponse`.
2025-11-27 16:18:49 +08:00
Luis Pater
7e30157590
Fixed : #354
...
**fix(translator): add support for "xhigh" reasoning effort in OpenAI responses**
- Updated handling in `openai_openai-responses_request.go` to include the new "xhigh" reasoning effort level.
2025-11-27 15:59:15 +08:00
Luis Pater
39621a0340
**fix(translator): normalize function calls and outputs for consistent input processing**
...
- Implemented logic to pair consecutive function calls and their outputs, ensuring proper sequencing for processing.
- Adjusted `gemini_openai-responses_request.go` to normalize message structures and maintain expected flow.
2025-11-27 10:25:45 +08:00
Luis Pater
346b663079
**fix(translator): handle non-JSON output gracefully in function call outputs**
...
- Updated handling of `output` in `gemini_openai-responses_request.go` to use `.Str` instead of `.Raw` when parsing non-JSON string outputs.
- Added checks to distinguish between JSON and non-JSON `output` types for accurate `functionResponse` construction.
2025-11-27 09:40:00 +08:00
Luis Pater
0bcae68c6c
**fix(translator): preserve raw JSON encoding in function call outputs**
...
- Updated handling of `output` in `gemini_openai-responses_request.go` to use `.Raw` instead of `.String` for preserving original JSON encoding.
- Ensured proper setting of raw JSON output when constructing `functionResponse`.
2025-11-27 08:26:53 +08:00
Luis Pater
c8cee547fd
**fix(translator): ensure partial content is retained while skipping encrypted thoughtSignature**
...
- Updated handling of `thoughtSignature` across all translator modules to retain other content payloads if present.
- Adjusted logic for `thought_signature` and `inline_data` keys for consistent processing.
2025-11-27 00:52:17 +08:00