Commit Graph
349 Commits
Author SHA1 Message Date
RCDandClaude 75ca091a73 refactor(executor): split kiro_executor.go into logical modules
Split the 3,891 line kiro_executor.go into focused modules:
- kiro_executor.go (966 lines): Main executor, public interface
- kiro_auth.go (462 lines): Authentication/credential logic
- kiro_request.go (422 lines): Request transformation and retry logic
- kiro_response.go (1,765 lines): Response handling/streaming

Fix: Corrected isRetryableError to use errors.As for EventStreamError
type assertion instead of errors.Is on string constants.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 12:09:33 +07:00
RCDandClaude 0db83010aa feat(config): add payload filter rules to remove JSON paths
Cherry-picked from upstream 6d8609e4

Allows configuring rules to remove specific JSON paths from request/response payloads.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:36:39 +07:00
RCDandClaude 977c5c18ad fix: handle issues #1372 #1366
Cherry-picked from upstream d216adef

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:36:17 +07:00
RCDandClaude 35b033ae06 fix(caching): ensure prompt-caching beta is always appended
Cherry-picked from upstream 7ff3936e

Adds multi-turn cache control tests.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:33:02 +07:00
RCDandClaude 39796063c5 feat(caching): implement Claude prompt caching with multi-turn support
Cherry-picked from upstream 3a43ecb1

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:30:10 +07:00
RCDandClaude 8473211ad6 fix(codex): avoid empty prompt_cache_key
Cherry-picked from upstream 04b22909

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:29:21 +07:00
RCDandClaude 4527e5a7e5 fix(openai): drop stream for responses/compact
Cherry-picked from upstream 53920b03

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:29:03 +07:00
RCDandClaude acdf099442 feat(openai): add responses/compact support
Cherry-picked from upstream 95096bc3

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:28:45 +07:00
RCDandClaude 41b1ad654e feat(config): add oauth-model-alias migration support
Add migration logic for converting oauth-model-mappings to oauth-model-alias
with comprehensive test coverage.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:30:09 +07:00
RCD 1663148a32 feat: sync with upstream v6.7.25-26
Cherry-picked changes from CLIProxyAPI:
- fix(gemini): force type to string for enum fields (fixes Antigravity Gemini API error)
- feat(auth): add request_retry and disable_cooling per-auth overrides
- feat(auth): add skip persistence context key for file watcher events

Manually added RequestRetryOverride/DisableCoolingOverride methods to
types.go to preserve ProxyPilot's conductor.go compatibility while
gaining new functionality.
2026-01-27 22:08:43 +07:00
RCD 1d29f18172 feat: sync with upstream v6.7.22-24
- Antigravity retry logic with improved error handling and capacity management
- Added request_id to error logs for better debugging
- Export OAuth constants from auth packages (antigravity, claude, codex, gemini)
- Added Antigravity AuthService in internal/auth/antigravity
- Updated Claude executor test expectations for system message handling
- Skip built-in tools in OAuth tool prefix
- Preserve displayName and description in Gemini models list
- Added Embed stubs for ProviderExecutor interface compliance
2026-01-26 20:22:43 +07:00
RCD 5be8c90506 feat: sync with upstream v6.7.19-21
- Updated all executors with context cancellation handling
- Added payload rules using requested model
- Filter out Top_P when Temperature is set on Claude
- Remove empty system messages in translators
- Handle quota cooldown in retry logic
- Include requested model in executor metadata
- Normalize plan type filenames to lowercase
- Added Embed stubs for ProviderExecutor interface compliance
- Added payloadRequestedModel helper function
2026-01-24 11:17:03 +07:00
RCD 377697331b feat: sync with upstream v6.7.17-18
- Updated gemini_schema.go with improved schema cleaning
- Refined signature caching logic (kept 1h TTL for memory efficiency)
- Enhanced Claude/Gemini translator tests
- Fixed Gemini function-calling INVALID_ARGUMENT via relaxed tool validation
2026-01-23 19:26:02 +07:00
RCD e86d2b86d5 feat: sync with upstream v6.7.16
Major changes from upstream v6.7.16:
- Remove sessionID from signature caching API entirely
  - CacheSignature(modelName, text, sig) instead of 4 params
  - GetCachedSignature(modelName, text) instead of 3 params
  - HasValidSignature(modelName, sig) instead of 1 param
- Add Gemini fallback: returns "skip_thought_signature_validator" on cache miss
- Add sliding expiration (TTL refresh on cache access)
- Add GetModelGroup() for grouping cache keys by model family
- Simplify antigravity executor by removing project switch logic
- Fix OpenAI Responses request handler to skip empty assistant text
- Fix OpenAI Responses request to validate full JSON before parsing

Local fixes for compatibility:
- Add Embed stub method to AntigravityExecutor for interface compliance
- Update test to clear cache for isolation (ThinkingBlockWithoutSignature)
- Update Gemini test to expect thinking blocks to be annotated not removed
- Fix gjson.Valid check before treating tool output as raw JSON
2026-01-21 15:05:05 +07:00
RCD e0fa10b669 feat: sync with upstream v6.7.13
Features ported from upstream:
- feat(claude): add native request cloaking support
- feat(translator): add candidate count (n param) support for Gemini
- fix(translator): consolidate multiple system messages into single message (#1064)
- feat(codex): add config toggle for codex instructions injection
- feat(auth): add hashed account ID to credential filenames for team plans
- feat(config): add support for raw JSON payload rules (default-raw, override-raw)
- feat(codex): add OpenCode instructions based on user agent

Also includes minor whitespace cleanup and code organization.
2026-01-20 14:08:05 +07:00
RCD 4a0f8232d5 refactor(claude): remove redundant system instructions check
The checkSystemInstructions was being called on every request but the
cloaking/system prompt handling is now done elsewhere. This removes
redundant processing.

Cherry-picked from CLIProxyAPI: 7831cba9
2026-01-20 11:49:21 +07:00
RCD 02b0714e3a feat(vertex): add Imagen image generation model support
Add support for Imagen 3.0 and 4.0 image generation models in Vertex AI:

- Add 5 Imagen model definitions (4.0, 4.0-ultra, 4.0-fast, 3.0, 3.0-fast)
- Implement :predict action routing for Imagen models
- Convert Imagen request/response format to match Gemini structure
- Transform prompts to Imagen's instances/parameters format
- Convert base64 image responses to Gemini-compatible inline data

Cherry-picked from CLIProxyAPI: 8734d4cb
2026-01-20 11:31:07 +07:00
RCD e6e7e6db30 feat(registry): support provider-specific model info lookup
Add InfoByProvider map to ModelRegistration to store provider-specific
ModelInfo, enabling different capabilities for the same model across
providers (e.g., direct API vs OpenRouter).

Changes:
- Add InfoByProvider field to ModelRegistration struct
- Update GetModelInfo to accept provider parameter for provider-specific lookup
- Update LookupModelInfo to accept variadic provider parameter
- Add LookupStaticModelInfo for fallback to static model definitions
- Update ApplyThinking to pass providerKey for registry lookups
- Update all GetModelInfo callers to use new signature
- Remove ensureMaxTokensForThinking test (function moved to thinking package)

Ported from CLIProxyAPI e641fde2
2026-01-20 11:15:39 +07:00
RCD 5dd078ffb3 refactor(claude): move max_tokens constraint enforcement to Apply method
Move ensureMaxTokensForThinking logic from claude_executor to
thinking/provider/claude/apply.go. This centralizes Claude-specific
thinking budget constraints in the thinking package.

Cherry-picked from c421d653.
2026-01-20 10:53:37 +07:00
RCD 8d8a010577 feat(executor): enhance payload translation with original request context
Add 6th parameter 'original' to applyPayloadConfigWithRoot to support
checking defaults against the original payload. This enables proper
default rule validation when translating between formats.

Based on upstream 2a663d5c.
2026-01-20 10:49:30 +07:00
RCD 5a38b6bc04 fix(executor): stop rewriting thinkingLevel for gemini
Remove automatic thinkingLevel -> thinkingBudget:-1 conversion
for non-gemini-3 models in antigravity executor.

Cherry-picked from 1d2fe553.
2026-01-20 10:40:07 +07:00
RCD f1d05cc027 feat(registry): expand antigravity model config
- Remove static Name mapping from AntigravityModelConfig
- Add new model entries: claude-sonnet-4-5, gpt-oss-120b-medium, tab_flash_lite_preview
- Add model skip list for unlisted models
- Update thinking limits (Max: 128000, ZeroAllowed: true)

Cherry-picked from c175821c.
2026-01-20 10:39:00 +07:00
RCD f2eabe57c5 fix(codex): ensure instructions field exists in request body
Add check to ensure 'instructions' field exists in Execute, ExecuteStream,
and CountTokens functions before sending request to Codex API.

Cherry-picked from:
- CLIProxyAPI v6.7.4 (902bea2)
2026-01-16 15:25:50 +07:00
RCD a2d701b205 fix(executor): update gemini-3-pro model name check to use internal name
Change conditional check from gemini-3-pro-preview (alias) to
gemini-3-pro-high (internal name) for system instruction injection.

Cherry-picked from:
- CLIProxyAPI v6.7.3 (c3ef46f)
2026-01-16 15:25:50 +07:00
RCD 7b22c4fd4d feat(auth): cherry-pick CLIProxyAPI v6.6.108-109 core updates
- Add ensureAntigravityProjectID to fetch project_id during token refresh
- Simplify filestore Save() to use os.O_TRUNC instead of temp file rename
- Auto-fetch project_id for antigravity provider in readAuthFile()
- Add metadataEqualIgnoringTimestamps to prevent refresh loops
- Use reflect.DeepEqual for cleaner metadata comparison

Cherry-picked from:
- CLIProxyAPI v6.6.108 (086eb3d)
- CLIProxyAPI v6.6.109-dev (7248f65)
2026-01-16 15:25:49 +07:00
Finessse 9f5eb93f64 sync(upstream): add HttpRequest support across executors
Cherry-picked from e8e3bc86. Adds HttpRequest method to ProviderExecutor
interface for injecting credentials into arbitrary HTTP requests.

- Added HttpRequest to conductor.go interface
- Added HttpRequest stubs to kiro, minimax, zhipu executors
- Added http-request example
- Updated mock executors in tests

Also kept our Embed method and CountTokens implementations.
2026-01-11 06:32:53 +07:00
Finessse 01e1d5aed2 sync(upstream): auth rotation atomic fix + memory leak fixes
- fix(auth): make provider rotation atomic (keep shouldKeepProviderOrder)
- fix(server): resolve memory leaks in failed attempts and codex cache
  - Add background cleanup goroutine for stale IP entries
  - Add cache expiry cleanup for codex prompt cache
- Update provider rotation tests for atomic rotation

Cherry-picked: 8be06255, 47dacce6
Merged with ProxyPilot's shouldKeepProviderOrder for gemini-3 fallback
2026-01-11 06:11:37 +07:00
Finessse 19bf935a2e sync(upstream): Gemini 3 Pro and Antigravity executor improvements
- feat(executor): enhance Antigravity payload with user role and dynamic system instructions
- feat(executor): add model-specific support for "gemini-3-pro" in execution
- feat(executor): update system instruction handling for Claude and Gemini-3-Pro models
- fix(executor): update gemini model identifier to gemini-3-pro-preview
- feat(executor): centralize systemInstruction handling

Cherry-picked: 67985d82, bda04eed, 1b2f9076, b6a0f7a0, 59a448b6
2026-01-11 06:03:27 +07:00
Finessse fd9d097b8e sync(upstream): management API and executor improvements
- feat(management): add generic API call handler
- Fix: disable thinking when tool_choice forces tool use
- feat(api): add ManagementTokenRequester interface (sans iflow)
- fix(management): refresh antigravity token for api-call $TOKEN$
- fix(auth): error when antigravity refresh token missing during refresh

Cherry-picked: ade71947, aca2ef63, ee171bc5, b01619b4, 5e5d8142
Adapted: removed iflow references (not in ProxyPilot)
2026-01-11 06:00:37 +07:00
Finessse cddccdd5cb feat(executor): add project and model fallback on 429 for gemini-cli 2026-01-10 06:02:48 +07:00
Finessse 06c41e1a00 test(executor): add antigravity project switch integration test 2026-01-10 06:02:35 +07:00
Finessse 092cef6fa3 feat(executor): add project and model fallback on 429 for antigravity 2026-01-10 06:02:20 +07:00
Finessse 7806419df5 test(executor): add quota fallback unit tests 2026-01-10 06:02:06 +07:00
Finessse ff5a078229 feat(executor): add quota fallback helpers for project and model switching 2026-01-10 06:01:52 +07:00
Finessse 123fd00c0a feat(executor): add kiro thinking model variants mapping 2026-01-09 23:41:25 +07:00
Finessse b87fe4580d fix(executor): update antigravity user-agent and add required headers 2026-01-09 23:41:11 +07:00
Finessse 33be41ba03 feat(cache): wire cache initialization and add docs
Initialize response/prompt caches in Service.Run from config.
Add cache lookup to executor payload helpers.
Document cache config and management API in README.
2026-01-06 06:24:01 +07:00
Finessse 36621166c8 feat(antigravity): capture tier metadata and retry delays 2026-01-01 00:51:28 +07:00
Finessse c720fad57b feat(executor): add embeddings support to Kiro executor
Handle embedding requests in Kiro runtime executor.
2025-12-31 02:07:48 +07:00
Finessse a20c4cefdc feat(executor): add Zhipu AI executor
Add OpenAI-compatible executor for Zhipu AI (GLM models).

- Base URL: https://open.bigmodel.cn/api/paas/v4/
- Auth: Bearer token (API key)
- Supports streaming and non-streaming requests
- Token usage tracking
2025-12-28 20:51:10 +07:00
Finessse 833a560ae1 feat(executor): add MiniMax executor
Add OpenAI-compatible executor for MiniMax API.

- Base URL: https://api.minimax.io/v1
- Auth: Bearer token (API key)
- Supports streaming and non-streaming requests
- Token usage tracking
2025-12-28 20:50:45 +07:00
Finessse ffc608b7fe refactor(executor): remove iFlow executor
Remove the iFlow request executor implementation.

Deleted: internal/runtime/executor/iflow_executor.go
2025-12-28 20:47:36 +07:00
Finessse 352095c54c test(runtime): add unit tests for model registry, executors, and pricing
Covers model registration, quota tracking, concurrent access,
Claude/Gemini executor request prep, and pricing calculations.
2025-12-28 10:46:38 +07:00
Finessse b127b674e9 sync: squash merge upstream CLIProxyAPI v6.6.62
Synced with upstream v6.6.61-v6.6.62 changes:
- Added usage export/import endpoints
- Added normalizeCodexKey function
- Updated BootstrapRetries type
- Enhanced model definitions and antigravity config

Preserved ProxyPilot customizations:
- Kept CompressionConfig for long-context sessions
- Kept Kiro, GitHub Copilot, Amazon Q model definitions
- Kept shouldKeepProviderOrder for Gemini-3 provider stability
- Kept advanceProviderCursor pattern (separate cursor advancement)
- Removed AmpCode integration (not used)

Version: 0.1.4
2025-12-28 08:32:11 +07:00
FinessseandClaude Opus 4.5 ca06786892 feat(executor): add token counting helper functions
Add utilities for estimating token counts using tiktoken
to support token-aware compression decisions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 05:07:52 +07:00
FinessseandClaude Opus 4.5 221a386040 feat: sync with CLIProxyAPIPlus (excludes Amp, GitHub Copilot)
Synced all changes from router-for-me/CLIProxyAPIPlus including:

Executor updates:
- claude_executor: response decompression, beta extraction, model resolution
- gemini_executor/codex_executor: usage reporting
- antigravity_executor: fallback URLs, thinking metadata, token refresh
- kiro_executor: token refresh, profile ARN handling, quota fallback

Translator updates:
- Updated all translators for improved request/response handling
- Enhanced tool result formatting and streaming support

Configuration:
- Added IncognitoBrowser option for OAuth
- Updated KiroKey configuration
- Enhanced PayloadConfig options

SDK updates:
- Auth refresh registry improvements
- Cliproxy service enhancements
- Added ErrNotImplemented for executor interface

Excluded features (not synced):
- Amp CLI Integration module
- GitHub Copilot executor

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 02:10:20 +07:00
FinessseandClaude Opus 4.5 f52840b10e Merge remote-tracking branch 'origin/main'
Resolve conflicts:
- Keep Kiro executor (was deleted in remote)
- Merge antigravity executor changes (0.7 safety factor, new model names)
- Keep Kiro management API, remove broken Copilot function
- Fix Kiro translator imports

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 01:02:29 +07:00
FinessseandClaude Opus 4.5 036beb061a refactor(executor): update antigravity executor
Minor updates to antigravity executor.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 00:54:37 +07:00
FinessseandClaude Opus 4.5 4b44ab8328 feat(executor): add Kiro executor
Add KiroExecutor for AWS CodeWhisperer API:
- AWS Event Stream binary format parsing
- Kiro payload building with origin field
- Token refresh with mutex protection
- Quota fallback: AI_EDITOR -> CLI on 429
- Auto-refresh on 401/403 errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 00:53:32 +07:00
Finessse 8c14135f97 chore: final cleanup of legacy model references and placeholder updates 2025-12-25 05:59:31 +07:00