Commit Graph
1985 Commits
Author SHA1 Message Date
RCDandClaude 7cc4e9d8f5 refactor(middleware): split codex_prompt_budget.go into logical modules
Split the 2,762 line codex_prompt_budget.go into focused modules:
- codex_prompt_budget.go (1,272 lines): Main middleware, scaffold injection
- codex_budget_types.go (498 lines): Constants, package vars, config functions
- codex_budget_calculator.go (944 lines): Token analysis, trim functions

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 12:28:00 +07:00
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 8927e6b71d test(auth): add unit tests for claude, codex, gemini auth packages
Add comprehensive unit tests for authentication packages:
- claude_auth_test.go: AuthBundle parsing, token serialization, validation
- codex_auth_test.go: token storage, expiry edge cases, refresh thresholds
- gemini_auth_test.go: token storage with any type, JSON field verification

Also add translator package tests for format conversion edge cases.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 12:08:53 +07:00
RCDandClaude ef60b1cd7e refactor(auth): split conductor.go into logical modules
Split the 2,280-line conductor.go into three focused files:
- conductor.go (1,416 lines): Core types, Manager struct, execution
- conductor_oauth.go (383 lines): OAuth/API key model alias resolution
- conductor_token.go (501 lines): Token refresh and HTTP request handling

This is a pure refactor with no logic changes.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 12:02:14 +07:00
RCDandClaude 3986099409 refactor: remove unused loop index variable
Replace `for i, part := range` with `for _, part := range` since the
index variable was captured but never used (just discarded with `_ = i`).

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:57:03 +07:00
RCDandClaude b4fd299fce refactor(modules): remove deprecated RouteModule interface
Remove the V1 RouteModule interface which was marked as deprecated.
All modules now use RouteModuleV2 exclusively. The RegisterModule
function signature is simplified to accept RouteModuleV2 directly
instead of interface{}.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:55:57 +07:00
RCDandClaude b5077879d0 chore: clarify GetRequestMonitor stub comment
Remove TODO marker and update comment to indicate the stub is
intentional for API compatibility, not incomplete work.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:54:32 +07:00
RCDandClaude 861c4c29d9 chore: sync version strings to 0.3.0
Update FileVersion and ProductVersion in versioninfo.json files
from 0.1.6 to 0.3.0 for both proxypilot-tray and server commands.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:53:41 +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>
v0.3.0-dev-0.26
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 0801d1d101 fix(config): add codex instructions enabled change to config change details
Cherry-picked from upstream bb09708c

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:35:49 +07:00
RCDandClaude 993e6795c0 fix(misc): update opencode instructions
Cherry-picked from upstream 1150d972

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:35:26 +07:00
RCDandClaude 4ba0a04c37 feat(logging): make error-logs-max-files configurable
Cherry-picked from upstream 6db8d2a2

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:34:58 +07:00
RCDandClaude 006bd54c9a fix(misc): update user agent string for opencode
Cherry-picked from upstream 2854e04b

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:34:19 +07:00
RCDandClaude af48e0f37b fix(translator): handle stop_reason and MAX_TOKENS for Claude responses
Cherry-picked from upstream f99cddf9

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:33:36 +07:00
RCDandClaude 2f6fee08d4 fix(translator): include token usage in message_delta for Claude responses
Cherry-picked from upstream 550da0ce

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:33:20 +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 d9b3f07db3 feat(auth): add custom HTTP client with utls for Claude API authentication
Cherry-picked from upstream 6b6d030e

Adds uTLS-based HTTP transport to mimic browser TLS fingerprints for Claude API.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:32:40 +07:00
RCDandClaude 4a3996ca5c feat(translator): add code_execution and url_context tool passthrough
Cherry-picked from upstream 538039f5

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:31:18 +07:00
RCDandClaude 459997789e refactor(gemini): optimize removeExtensionFields with post-order traversal
Cherry-picked from upstream ca796510

Uses post-order traversal and DeleteBytes for better performance.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:30:57 +07:00
RCDandClaude 29f0da4942 fix(gemini): remove unsupported extension fields
Cherry-picked from upstream d0d66cdc

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:30:35 +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 a7fa518584 fix: skip empty text parts and messages for Gemini API
Cherry-picked from upstream 2666708c

When Claude API sends an assistant message with empty text content,
the translator was creating an empty part, causing Gemini API to return
"required oneof field 'data' must have one initialized field" error.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:29:47 +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 1c9ade20f8 fix: change HTTP status code from 400 to 502 when no provider available
Cherry-picked from upstream 6da7ed53

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:28:20 +07:00
RCDandClaude 787af1fb12 fix(antigravity): preserve finish_reason tool_calls across streaming chunks
Cherry-picked from upstream fe6043ae

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:28:03 +07:00
RCDandClaude 070ddb0ff5 fix: prevent race condition in objectstore auth sync
Cherry-picked from upstream bc32096e

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-02-01 11:27:40 +07:00
RCDandClaude ae7946402a fix(translator): validate complete JSON before using SetRaw for tool output
Tool outputs like "[1,2,3]\n\n[Process exited with code 0]" were being
partially parsed by gjson.Parse() which would extract just "[1,2,3]" and
lose the trailing text. This caused invalid JSON in the Gemini request.

Fix: Use gjson.Valid() to verify the ENTIRE string is valid JSON before
treating it as raw JSON. If validation fails, treat as a string with
proper escaping via sjson.Set().

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
v0.3.0-dev-0.25
2026-01-30 17:19:56 +07:00
RCDandClaude a7b7856135 fix(tests): register test models in global registry for auth lookup
Tests were failing with "auth_not_found: no auth available" because the
conductor.pickNextMixed() function checks ClientSupportsModel() against
the global registry. Test auths weren't registered with their models.

Changes:
- sdk/cliproxy/auth/conductor_test.go: Add registry.RegisterClient calls
- internal/translator/gemini/.../gemini_openai-responses_request.go:
  Skip empty text parts to avoid invalid Gemini content

Note: Some pre-existing flaky tests remain in test/integration and
internal/translator/gemini (NonJSON tool output test).

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
v0.3.0-dev-0.24
2026-01-30 16:07:03 +07:00
RCDandClaude c73b709a98 feat(registry): sync model definitions from plus remote
- Add SupportedEndpoints field to ModelInfo
- Add GetMiniMaxModels, GetZhipuModels stub functions
- Add GetGitHubCopilotModels, GetKiroModels, GetAmazonQModels
- Update model registry with new providers

Cherry-picked and merged from plus remote.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
v0.3.0-dev-0.23
2026-01-30 15:44:20 +07:00
RCDandClaude 63e54f2ca4 chore(registry): disable gemini 2.5 flash image preview model
Cherry-picked from plus: 88a0f095

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:41:28 +07:00
RCDandClaude ac2d6df45e chore(registry): comment out rev19-uic3-1p model config
Cherry-picked from plus: c65f64dc

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:41:06 +07:00
RCDandClaude 6756600812 feat(api): add management model definitions endpoint
Cherry-picked from plus: d18cd217

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:40:44 +07:00
RCDandClaude 3a00e35a5a feat(auth): add support for request_retry and disable_cooling overrides
Cherry-picked from plus: 70897247

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:39:42 +07:00
RCDandClaude cb25c754ea feat(auth): add skip persistence context key for file watcher events
Cherry-picked from plus: 9c341f5a

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:39:20 +07:00
RCDandClaude a8592c8410 fix(claude): default Claude tool input schema
Cherry-picked from plus: e3e741d0

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:38:36 +07:00
RCDandClaude 9e53fc4540 fix(kiro): fix Kiro tool schema defaults
Cherry-picked from plus: 7c7c5fd9

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:38:17 +07:00
RCDandClaude e17990c2f8 fix(config): ensure empty mapping persists for oauth-model-alias deletions
When all oauth-model-alias entries are deleted, ensure an empty map
is persisted to config file rather than being omitted entirely.

Fixes #1305

Cherry-picked from upstream: a709e5a1

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
v0.3.0-dev-0.22
2026-01-30 15:31:58 +07:00
RCDandClaude 71a502075e fix(logging): capture streaming TTFB on first chunk and make timestamps required
- Add firstChunkTimestamp field to ResponseWriterWrapper for sync capture
- Capture TTFB in Write() and WriteString() before async channel send
- Add SetFirstChunkTimestamp() to StreamingLogWriter interface
- Make requestTimestamp/apiResponseTimestamp required in LogRequest()
- Remove timestamp capture from WriteAPIResponse() (now via setter)
- Fix Gemini handler to set API_RESPONSE_TIMESTAMP before writing response

This ensures accurate TTFB measurement for all streaming API formats
(OpenAI, Gemini, Claude) by capturing timestamp synchronously when
the first response chunk arrives, not when the stream finalizes.

Cherry-picked from upstream: 295f34d7

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:31:30 +07:00
RCDandClaude bcd735b2a8 fix(logging): add API response timestamp and fix request timestamp timing
Previously:
- REQUEST INFO timestamp was captured at log write time (not request arrival)
- API RESPONSE had NO timestamp at all

This fix:
- Captures REQUEST INFO timestamp when request first arrives
- Adds API RESPONSE timestamp when upstream response arrives
- Add Timestamp field to RequestInfo, set at middleware initialization
- Set API_RESPONSE_TIMESTAMP in appendAPIResponse() and gemini handler
- Pass timestamps through logging chain to writeNonStreamingLog()
- Add timestamp output to API RESPONSE section

Cherry-picked from upstream: c41ce77e

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:30:56 +07:00
RCDandClaude 584648416a fix(translator): restore usageMetadata in Gemini responses from Antigravity
When using Gemini API format with Antigravity backend, the executor
renames usageMetadata to cpaUsageMetadata in non-terminal chunks.
The Gemini translator was returning this internal field name directly
to clients instead of the standard usageMetadata field.

Add restoreUsageMetadata() to rename cpaUsageMetadata back to
usageMetadata before returning responses to clients.

Cherry-picked from upstream: 9dc0e6d0

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-30 15:29:30 +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>
v0.3.0-dev-0.21
2026-01-29 21:30:09 +07:00
RCDandClaude 7d1dc22657 feat(config): add AmpCode config and incognito browser option
- Add AmpCode configuration structure for Amp CLI proxy
- Add IncognitoBrowser option for OAuth flows
- Update SDK config mappings

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:29:39 +07:00
RCDandClaude 6b85dadce7 feat(interfaces): extend client models and types
Update interfaces with new fields for extended provider support.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:29:29 +07:00
RCDandClaude 24626d061d feat(constant): add Kiro and iFlow provider constants
Add new provider constants for Kiro and iFlow authentication.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:29:20 +07:00
RCDandClaude 3fc5b5a3b3 feat(auth): add empty token provider for unauthenticated requests
Add empty auth provider for handling requests that don't require authentication.

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:23:46 +07:00
RCDandClaude 357eed3ec6 feat(auth): enhance Kiro authentication with rate limiting and metrics
Extend Kiro auth module with:
- Background token refresh
- Cooldown mechanism for failed requests
- Browser fingerprint generation
- Jitter utilities for request timing
- Metrics collection and reporting
- Rate limiter with singleton pattern
- Refresh manager for token lifecycle
- Token repository for persistent storage
- Usage checker for quota monitoring
- Web-based OAuth flow templates
- Updated AWS auth and SSO OIDC flows

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:23:31 +07:00
RCDandClaude d6104a0fca feat(auth): add iFlow authentication provider
Add iFlow auth module for cookie-based authentication:
- Cookie helper utilities
- iFlow auth client implementation
- Token management
- Local OAuth server for browser flow
- SDK auth integration

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:23:10 +07:00