Commit Graph
85 Commits
Author SHA1 Message Date
RCDandCopilot 68b97075af chore: merge upstream CLIProxyAPI v6.10.8
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 08:10:59 +00:00
edlsh 95318ad46d fix(amp): preserve lowercase glob tool name 2026-04-25 17:46:44 -04:00
RCD 45dc09d487 chore: merge upstream CLIProxyAPI v6.9.22 2026-04-11 00:06:28 +07:00
hkfires d390b95b76 fix(tests): update test cases 2026-04-08 08:53:50 +08:00
Luis Pater 9eabdd09db Merge pull request #2522 from aikins01/fix/strip-tool-use-signature
fix(amp): strip signature from tool_use blocks before forwarding to Claude
2026-04-06 09:30:14 +08:00
Luis Pater c1818f197b Merge pull request #1940 from Blue-B/fix/claude-interleaved-thinking-amp-gzip-budget
fix(claude): enable interleaved-thinking beta, decode AMP error gzip, fix budget 400
2026-04-06 09:08:23 +08:00
Aikins Laryea b0653cec7b fix(amp): strip signature from tool_use blocks before forwarding to Claude
ensureAmpSignature injects signature:"" into tool_use blocks so the
Amp TUI does not crash on P.signature.length. when Amp sends the
conversation back, Claude rejects the extra field with 400:
  tool_use.signature: Extra inputs are not permitted

strip the proxy-injected signature from tool_use blocks in
SanitizeAmpRequestBody before forwarding to the upstream API.
2026-04-05 12:26:24 +00:00
RCD 3d853cb295 chore: merge upstream CLIProxyAPI v6.9.10 2026-04-03 13:13:41 +07:00
Luis Pater ab9ebea592 Merge PR #2474
# Conflicts:
#	internal/api/modules/amp/response_rewriter.go
#	internal/api/modules/amp/response_rewriter_test.go
2026-04-02 22:31:12 +08:00
Aikins Laryea ff7dbb5867 test(amp): update tests to expect thinking blocks to pass through during streaming 2026-04-01 20:21:39 +00:00
Aikins Laryea e34b2b4f1d fix(gemini): clean tool schemas and eager_input_streaming
delegate schema sanitization to util.CleanJSONSchemaForGemini and drop the top-level eager_input_streaming key to prevent validation errors when sending claude tools to the gemini api
2026-04-01 19:49:38 +00:00
RCD 8fc58e0806 chore: merge upstream CLIProxyAPI v6.9.7 2026-04-01 03:36:56 +07:00
CharTyr 279cbbbb8a fix(amp): don't suppress thinking blocks in streaming mode
Reverts the streaming thinking suppression introduced in b15453c.
rewriteStreamEvent should only inject signatures and rewrite model
names — suppressing thinking blocks in streaming mode breaks SSE
index alignment and causes the Amp TUI to render empty responses
on the second message onward (especially with model-mapped
non-Claude providers like GPT-5.4).

Non-streaming responses still suppress thinking when tool_use is
present via rewriteModelInResponse.
2026-03-30 20:09:32 +08:00
CharTyr b15453c369 fix(amp): address PR review - stream thinking suppression, SSE detection, test init
- Call suppressAmpThinking in rewriteStreamEvent for streaming path
- Handle nil return from suppressAmpThinking to skip suppressed events
- Narrow looksLikeSSEChunk to line-prefix detection (HasPrefix vs Contains)
- Initialize suppressedContentBlock map in test
2026-03-30 00:42:04 -04:00
CharTyr 04ba8c8bc3 feat(amp): sanitize signatures and handle stream suppression for Amp compatibility 2026-03-29 22:23:18 -04:00
Blue-B 07d6689d87 fix(claude): add interleaved-thinking beta header, AMP gzip error decoding, normalizeClaudeBudget max_tokens
1. Always include interleaved-thinking-2025-05-14 beta header so that
   thinking blocks are returned correctly for all Claude models.

2. Remove status-code guard in AMP reverse proxy ModifyResponse so that
   error responses (4xx/5xx) with hidden gzip encoding are decoded
   properly — prevents garbled error messages reaching the client.

3. In normalizeClaudeBudget, when the adjusted budget falls below the
   model minimum, set max_tokens = budgetTokens+1 instead of leaving
   the request unchanged (which causes a 400 from the API).
2026-03-07 21:31:10 +09:00
RCD 960422f715 Merge upstream CLIProxyAPI v6.8.38–v6.8.39
Upstream changes:
- Antigravity v1.19.5→1.19.6: Claude 4-6 migration, new models, image_gen payload
- Comprehensive browser fingerprint and proxy tracing header scrubbing
- Whitelist-based header filtering (replaces blacklist approach)
- Singleton HTTP transport to prevent OOM from connection pool leaks
- Disable HTTP/2 ALPN in Antigravity client (fixes connection resets)
- Gemini: route gemini-3.1-flash-image, custom generationConfig passthrough
- GeminiCLI versioning and User-Agent streamlining
- Model registry: input/output modalities, token limits, generation methods
- Removed oauth-model-alias migration logic

Fork resolution:
- Keep both SupportedEndpoints (fork) and modality fields (upstream) in ModelInfo
- Keep our README, delete README_CN.md
2026-03-02 19:51:13 +07:00
maplelove fc0257d6d9 refactor: consolidate duplicate UA and header scrubbing into shared misc functions 2026-02-27 10:57:13 +08:00
RCD cf558dd166 Merge upstream CLIProxyAPI v6.8.18–v6.8.26
Upstream changes:
- Codex WebSocket executor and Codex response handlers
- Header passthrough (upstream response headers forwarded to clients)
- ExecuteStream returns *StreamResult (wraps channel + headers)
- Embeddings handler with synthetic fallback
- User ID cache for executors
- Gemini schema/request fixes
- New test coverage for bootstrap retries, error responses

Fork resolution:
- Delete upstream's modular TUI files (app.go, styles.go, dashboard.go,
  auth_tab.go, config_tab.go, keys_tab.go, logs_tab.go, oauth_tab.go,
  usage_tab.go, i18n.go, loghook.go) — keep fork's Flight Deck tui.go
- Add PassthroughHeaders field to SDKConfig
- Fix embeddings handler to capture 3-value ExecuteWithAuthManager return
- Update test mocks (conductor_test, auth_flow_test, multi_provider_test,
  gemini_executor_test) for new ExecuteStream signature
- Fix tuiMode → launchTUI flag variable reference
- Remove unused "io" import from main.go
2026-02-23 11:58:54 +07:00
maplelove 2a4d3e60f3 Merge remote-tracking branch 'upstream/dev' into dev 2026-02-23 00:01:47 +08:00
Luis Pater e6c7af0fa9 Merge pull request #1522 from soilSpoon/feature/canceled
feature(proxy): Adds special handling for client cancellations in proxy error handler
2026-02-22 22:02:59 +08:00
maplelove 5dc1848466 feat(scrub): add comprehensive browser fingerprint and client identity header scrubbing 2026-02-22 20:51:00 +08:00
maplelove 9370b5bd04 fix(executor): completely scrub all proxy tracing headers in executor 2026-02-22 19:43:10 +08:00
maplelove c8d809131b fix(executor): improve antigravity reverse proxy emulation
- force http/1.1 instead of http/2

- explicit connection close

- strip proxy headers X-Forwarded-For and X-Real-IP

- add project id to fetch models payload
2026-02-22 18:41:58 +08:00
RCD 4cf25c05ce Merge upstream CLIProxyAPI v6.8.15–v6.8.17
Upstream changes:
- feat: add Google One login and improve Gemini CLI auto-discovery
- feat: add gpt-5.3-codex-spark model definition
- feat: add 'kimi' channel support in model definitions
- feat: pass cache usage from codex to openai chat completions
- fix: normalize Gemini credential file prefix for consistency
- refactor: replace manual pointer assignments with new()
- chore: update Go to 1.26, update Codex client version

Fork fixes:
- Bump mise Go pin to 1.26.0
- Remove stale .syso resource files (incompatible with Go 1.26 linker)
2026-02-16 08:01:38 +07:00
Luis Pater 46a6782065 refactor(all): replace manual pointer assignments with new to enhance code readability and maintainability 2026-02-15 14:10:10 +08:00
이대희 93147dddeb Improves error handling for canceled requests
Adds explicit handling for context.Canceled errors in the reverse proxy error handler to return 499 status code without logging, which is more appropriate for client-side cancellations during polling.

Also adds a test case to verify this behavior.
2026-02-12 10:39:45 +09:00
이대희andgemini-code-assist[bot] 6f2fbdcbae Update internal/api/modules/amp/proxy.go
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-02-12 10:30:05 +09:00
RCD a987b9fb83 Merge upstream CLIProxyAPI v6.8.11 into ProxyPilot
Upstream changes (v6.8.0–v6.8.11):
- feat: add Kimi (Moonshot AI) provider support with OAuth
- feat: add iFlow provider with OAuth and cookie auth
- feat: support Claude thinking type adaptive
- feat: capture cached token count in usage metadata
- fix: correct max completion tokens for opus 4.6 thinking
- fix: improve content handling for system and user messages
- fix: rewrite model name in response.model for Responses API SSE
- refactor: simplify provider lifecycle and registration logic
- refactor: migrate config-access to internal package

Fork integration:
- Migrate configaccess from sdk/access/config to internal/access/config_access
- Update reconcile.go to use internalconfig types directly
- Add Kimi and iFlow login flags to ProxyPilot CLI
- Integrate managementasset auto-updater
- Keep all ProxyPilot fork features (TUI, agent setup, service, etc.)
2026-02-11 19:03:07 +07:00
이대희andCopilot ce0c6aa82b Update internal/api/modules/amp/proxy.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-10 19:07:49 +09:00
이대희 3c85d2a4d7 feature(proxy): Adds special handling for client cancellations in proxy error handler
Silences logging for client cancellations during polling to reduce noise in logs.
Client-side cancellations are common during long-running operations and should not be treated as errors.
2026-02-10 18:02:08 +09:00
Muhammad Zahid Masruri 918b6955e4 fix(amp): rewrite model name in response.model for Responses API SSE events
The ResponseRewriter's modelFieldPaths was missing 'response.model',
causing the mapped model name to leak through SSE streaming events
(response.created, response.in_progress, response.completed) in the
OpenAI Responses API (/v1/responses).

This caused Amp CLI to report 'Unknown OpenAI model' errors when
model mapping was active (e.g., gpt-5.2-codex -> gpt-5.3-codex),
because the mapped name reached Amp's backend via telemetry.

Also sorted modelFieldPaths alphabetically per review feedback
and added regression tests for all rewrite paths.

Fixes #1463
2026-02-09 23:52:59 +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 92bf72d8c5 feat(amp): add Amp CLI proxy module
Add complete Amp module for routing requests through the Amp CLI:
- Core module with lifecycle management
- Gemini bridge for model translation
- Model mapping configuration
- Proxy handler for request forwarding
- Response rewriter for format conversion
- Secret management for API keys
- Route definitions and fallback handlers
- Comprehensive test coverage

Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) <noreply@anthropic.com>
2026-01-29 21:22:19 +07:00
hkfires 0b06d637e7 refactor: improve thinking logic 2026-01-15 13:06:39 +08:00
Luis Pater ed28b71e87 refactor(amp): remove duplicate comments in response rewriter 2026-01-09 08:21: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
hkfires 225e2c6797 feat(amp): add per-client upstream API key mapping support 2025-12-29 12:26:25 +08:00
hkfires 26fbb77901 refactor(sdk/auth): rename manager.go to conductor.go 2025-12-24 15:21:03 +08:00
altamash 0c0aae1eac Robust change detection: replaced string concat with struct-based compare in hasModelMappingsChanged; removed boolTo01.
•  Performance: pre-allocate map and regex slice capacities in UpdateMappings.
   •  Verified with amp module tests (all passing)
2025-12-23 18:52:28 +05:30
altamash 5dcf7cb846 feat: regex support for model-mappings 2025-12-23 18:41:58 +05:30
hkfires 3fc410a253 fix(amp): add /settings routes to proxy 2025-12-21 12:51:35 +08:00
Luis Pater ed5ec5b55c feat(amp): enhance model mapping and Gemini thinking configuration
This commit introduces several improvements to the AMP (Advanced Model Proxy) module:

- **Model Mapping Logic:** The `FallbackHandler` now uses a more robust approach for model mapping. It includes the extraction and preservation of dynamic "thinking suffixes" (e.g., `(xhigh)`) during mapping, ensuring that these configurations are correctly applied to the mapped model. A new `resolveMappedModel` function centralizes this logic for cleaner code.
- **ModelMapper Verification:** The `ModelMapper` in `model_mapping.go` now verifies that the target model of a mapping has available providers *after* normalizing it. This prevents mappings to non-existent or unresolvable models.
- **Gemini Thinking Configuration Cleanup:** In `gemini_thinking.go`, unnecessary `generationConfig.thinkingConfig.include_thoughts` and `generationConfig.thinkingConfig.thinkingBudget` fields are now deleted from the request body when applying Gemini thinking levels. This prevents potential conflicts or redundant configurations.
- **Testing:** A new test case `TestModelMapper_MapModel_TargetWithThinkingSuffix` has been added to `model_mapping_test.go` to specifically cover the preservation of thinking suffixes during model mapping.
2025-12-20 22:19:35 +08:00
hkfires c84ff42bcd fix(amp): add /docs routes to proxy 2025-12-20 10:15:25 +08:00
hkfires 9d9b9e7a0d fix(amp): add management auth skipper 2025-12-19 13:57:47 +08:00
이대희 31bd90c748 feature: Improves Amp client compatibility
Ensures compatibility with the Amp client by suppressing
"thinking" blocks when "tool_use" blocks are also present in
the response.

The Amp client has issues rendering both types of blocks
simultaneously. This change filters out "thinking" blocks in
such cases, preventing rendering problems.
2025-12-19 08:18:27 +09:00
Finessse 13d1ba7137 remove amp support 2025-12-17 16:15:10 +07:00
Luis Pater 26a5f67df2 Merge branch 'dev' into watcher 2025-12-17 01:48:11 +08:00
Luis Pater 670685139a fix(api): update route patterns to support wildcards for Gemini actions
Normalize action handling by accommodating wildcard patterns in route definitions for Gemini endpoints. Adjust `request.Action` parsing logic to correctly process routes with prefixed actions.
2025-12-17 01:17:02 +08:00
hkfires 8f1dd69e72 feat(amp): require API key authentication for management routes
All Amp management endpoints (e.g., /api/user, /threads) are now protected by the standard API key authentication middleware. This ensures that all management operations require a valid API key, significantly improving security.

As a result of this change:
- The `restrict-management-to-localhost` setting now defaults to `false`. API key authentication provides a stronger and more flexible security control than IP-based restrictions, improving usability in containerized environments.
- The reverse proxy logic now strips the client's `Authorization` header after authenticating the initial request. It then injects the configured `upstream-api-key` for the request to the upstream Amp service.

BREAKING CHANGE: Amp management endpoints now require a valid API key for authentication. Requests without a valid API key in the `Authorization` header will be rejected with a 401 Unauthorized error.
2025-12-15 13:24:53 +08:00