ccproxy-api 0.1.4__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccproxy_api-0.1.5/CHANGELOG.md +255 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/PKG-INFO +29 -2
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/README.md +27 -0
- ccproxy_api-0.1.5/SESSION_POOL_FIX_PLAN.md +118 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/TESTING.md +93 -29
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/_version.py +2 -2
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/adapters/openai/adapter.py +1 -1
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/adapters/openai/streaming.py +1 -0
- ccproxy_api-0.1.5/ccproxy/api/app.py +338 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/dependencies.py +22 -2
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/middleware/errors.py +27 -3
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/middleware/logging.py +4 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/responses.py +6 -1
- ccproxy_api-0.1.5/ccproxy/api/routes/claude.py +371 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/routes/proxy.py +25 -6
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/services/permission_service.py +2 -2
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/claude_sdk/__init__.py +4 -8
- ccproxy_api-0.1.5/ccproxy/claude_sdk/client.py +782 -0
- ccproxy_api-0.1.5/ccproxy/claude_sdk/exceptions.py +16 -0
- ccproxy_api-0.1.5/ccproxy/claude_sdk/manager.py +219 -0
- ccproxy_api-0.1.5/ccproxy/claude_sdk/message_queue.py +342 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/claude_sdk/options.py +5 -0
- ccproxy_api-0.1.5/ccproxy/claude_sdk/session_client.py +546 -0
- ccproxy_api-0.1.5/ccproxy/claude_sdk/session_pool.py +550 -0
- ccproxy_api-0.1.5/ccproxy/claude_sdk/stream_handle.py +538 -0
- ccproxy_api-0.1.5/ccproxy/claude_sdk/stream_worker.py +392 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/claude_sdk/streaming.py +53 -11
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/commands/serve.py +96 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/options/claude_options.py +47 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/config/__init__.py +0 -3
- ccproxy_api-0.1.5/ccproxy/config/claude.py +348 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/config/discovery.py +10 -1
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/config/scheduler.py +4 -4
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/config/settings.py +19 -1
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/http_transformers.py +305 -73
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/logging.py +108 -12
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/transformers.py +5 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/models/claude_sdk.py +57 -0
- ccproxy_api-0.1.5/ccproxy/models/detection.py +126 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/observability/access_logger.py +72 -14
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/observability/metrics.py +151 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/observability/storage/duckdb_simple.py +12 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/observability/storage/models.py +16 -0
- ccproxy_api-0.1.5/ccproxy/observability/streaming_response.py +107 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/scheduler/manager.py +31 -6
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/scheduler/tasks.py +122 -0
- ccproxy_api-0.1.5/ccproxy/services/claude_detection_service.py +269 -0
- ccproxy_api-0.1.5/ccproxy/services/claude_sdk_service.py +713 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/services/proxy_service.py +91 -200
- ccproxy_api-0.1.5/ccproxy/utils/__init__.py +14 -0
- ccproxy_api-0.1.5/ccproxy/utils/disconnection_monitor.py +83 -0
- ccproxy_api-0.1.5/ccproxy/utils/id_generator.py +12 -0
- ccproxy_api-0.1.5/ccproxy/utils/startup_helpers.py +408 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/getting-started/configuration.md +44 -1
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/systemd-setup.md +9 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/pyproject.toml +3 -3
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/scripts/act-run.sh +2 -2
- ccproxy_api-0.1.5/tests/.gitignore +7 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/conftest.py +98 -335
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/factories/README.md +12 -45
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/factories/fastapi_factory.py +51 -19
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/fixtures/README.md +3 -33
- ccproxy_api-0.1.5/tests/fixtures/claude_sdk/client_mocks.py +142 -0
- ccproxy_api-0.1.5/tests/integration/__init__.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/integration}/test_duckdb_settings_integration.py +1 -1
- ccproxy_api-0.1.5/tests/integration/test_streaming_access_logging.py +488 -0
- ccproxy_api-0.1.5/tests/unit/__init__.py +0 -0
- ccproxy_api-0.1.5/tests/unit/api/__init__.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/api}/test_api.py +0 -9
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/api}/test_confirmation_routes.py +36 -21
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/api}/test_mcp_route.py +1 -2
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/api}/test_reset_endpoint.py +47 -31
- ccproxy_api-0.1.5/tests/unit/auth/__init__.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/auth}/test_auth.py +18 -11
- ccproxy_api-0.1.5/tests/unit/cli/__init__.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/cli}/test_cli_confirmation_handler.py +29 -19
- ccproxy_api-0.1.5/tests/unit/config/__init__.py +0 -0
- ccproxy_api-0.1.5/tests/unit/observability/test_streaming_response.py +274 -0
- ccproxy_api-0.1.5/tests/unit/services/__init__.py +0 -0
- ccproxy_api-0.1.5/tests/unit/services/test_claude_sdk_client.py +491 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_fastapi_factory.py +13 -26
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_http_transformers.py +210 -13
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_observability.py +7 -1
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_scheduler.py +2 -2
- ccproxy_api-0.1.5/tests/unit/services/test_session_pool_race_condition.py +208 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_streaming.py +22 -9
- ccproxy_api-0.1.5/tests/unit/utils/__init__.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/utils}/test_duckdb_lifecycle.py +1 -1
- ccproxy_api-0.1.5/tests/unit/utils/test_startup_helpers.py +917 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/uv.lock +253 -243
- ccproxy_api-0.1.4/CHANGELOG.md +0 -136
- ccproxy_api-0.1.4/ccproxy/api/app.py +0 -428
- ccproxy_api-0.1.4/ccproxy/api/routes/claude.py +0 -166
- ccproxy_api-0.1.4/ccproxy/claude_sdk/client.py +0 -252
- ccproxy_api-0.1.4/ccproxy/config/claude.py +0 -200
- ccproxy_api-0.1.4/ccproxy/config/loader.py +0 -105
- ccproxy_api-0.1.4/ccproxy/services/claude_sdk_service.py +0 -510
- ccproxy_api-0.1.4/ccproxy/utils/__init__.py +0 -6
- ccproxy_api-0.1.4/scripts/benchmark_startup_node.py +0 -392
- ccproxy_api-0.1.4/test_config/test-config.toml +0 -5
- ccproxy_api-0.1.4/test_logging.py +0 -132
- ccproxy_api-0.1.4/tests/factories/MIGRATION_GUIDE.md +0 -252
- ccproxy_api-0.1.4/tests/fixtures/MIGRATION_GUIDE.md +0 -206
- ccproxy_api-0.1.4/tests/fixtures/auth/MIGRATION_GUIDE.md +0 -216
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/.env.example +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/.github/workflows/backend.yml +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/.github/workflows/build.yml +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/.github/workflows/ci.yml +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/.github/workflows/docs.yml +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/.github/workflows/frontend.yml.disabled +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/.github/workflows/release.yml +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/.gitignore +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/.pre-commit-config.yaml +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/.python-version +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/CONTRIBUTING.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/CONVENTIONS.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/Dockerfile +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/LICENSE +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/Makefile +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/__main__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/adapters/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/adapters/base.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/adapters/openai/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/adapters/openai/models.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/middleware/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/middleware/auth.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/middleware/cors.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/middleware/headers.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/middleware/request_content_logging.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/middleware/request_id.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/middleware/server_header.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/routes/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/routes/health.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/routes/mcp.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/routes/metrics.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/routes/permissions.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/services/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/ui/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/ui/permission_handler_protocol.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/api/ui/terminal_permission_handler.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/bearer.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/conditional.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/credentials_adapter.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/dependencies.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/exceptions.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/manager.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/models.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/oauth/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/oauth/models.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/oauth/routes.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/oauth/storage.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/storage/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/storage/base.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/storage/json_file.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/auth/storage/keyring.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/claude_sdk/converter.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/claude_sdk/parser.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/commands/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/commands/auth.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/commands/config/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/commands/config/commands.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/commands/config/schema_commands.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/commands/permission_handler.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/docker/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/docker/adapter_factory.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/docker/params.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/helpers.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/main.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/options/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/options/core_options.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/options/security_options.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/cli/options/server_options.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/config/auth.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/config/cors.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/config/docker_settings.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/config/observability.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/config/pricing.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/config/reverse_proxy.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/config/security.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/config/server.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/config/validators.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/async_utils.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/constants.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/errors.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/http.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/interfaces.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/middleware.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/proxy.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/system.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/types.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/core/validators.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/docker/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/docker/adapter.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/docker/docker_path.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/docker/middleware.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/docker/models.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/docker/protocol.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/docker/stream_process.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/docker/validators.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/models/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/models/errors.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/models/messages.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/models/permissions.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/models/requests.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/models/responses.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/models/types.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/observability/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/observability/context.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/observability/pushgateway.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/observability/sse_events.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/observability/stats_printer.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/observability/storage/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/pricing/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/pricing/cache.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/pricing/loader.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/pricing/models.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/pricing/updater.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/scheduler/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/scheduler/core.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/scheduler/errors.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/scheduler/registry.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/services/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/services/credentials/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/services/credentials/config.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/services/credentials/manager.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/services/credentials/oauth_client.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/static/.keep +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/testing/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/testing/config.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/testing/content_generation.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/testing/mock_responses.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/testing/response_handlers.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/testing/scenarios.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/utils/cost_calculator.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/utils/model_mapping.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/utils/models_provider.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/utils/simple_request_logger.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/utils/streaming_metrics.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/ccproxy/utils/version_checker.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/cleanup.sh +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/data/metrics.db +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/debug_stream.sh +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/debug_stream_openai.sh +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/devenv.lock +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/devenv.nix +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docker-compose.monitoring.yml +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docker-compose.yml +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/README.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/api-reference.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/assets/extra.css +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/assets/extra.js +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/contributing.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/development/debugging-with-proxy.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/examples.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/gen_ref_pages.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/getting-started/installation.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/getting-started/quickstart.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/index.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/metrics-api.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/observability.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/user-guide/api-usage.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/user-guide/authentication.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/user-guide/claude-code-options.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/user-guide/claude-sdk-compatibility.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/user-guide/mcp-integration.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/user-guide/pool-configuration.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/docs/user-guide/understanding-pool-logs.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/README.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/README_chat_agent.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/ai_code_discussion_demo.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/anthropic_streaming_demo.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/anthropic_tools_demo.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/client.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/common_utils.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/console_utils.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/debug_anthropic_streaming.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/openai_anthropic_conversation_demo.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/openai_claude_code_options_example.sh +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/openai_json_object_example.sh +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/openai_json_schema_example.sh +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/openai_streaming_demo.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/openai_structured_response_demo.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/openai_thinking_demo.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/openai_tools_demo.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/project_code_access_demo.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/simple_thinking_demo.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/examples/textual_chat_agent.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/mkdocs.yml +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/monitoring/grafana/dashboards/ccproxy-dashboard.json +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/monitoring/grafana/provisioning/dashboards/dashboard.yml +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/monitoring/grafana/provisioning/datasources/victoria-metrics.yml +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/reddit.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/reddit_soft.md +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/scripts/build-docs.sh +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/scripts/entrypoint.sh +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/scripts/format_version.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/scripts/serve-docs.sh +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/scripts/setup-systemd.sh +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/scripts/setup.sh +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/scripts/traffic_generator.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/systemd/ccproxy.service.template +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/factories/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/fixtures/auth/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/fixtures/auth/example_usage.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/fixtures/claude_sdk/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/fixtures/claude_sdk/internal_mocks.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/fixtures/claude_sdk/responses.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/fixtures/credentials.json +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/fixtures/external_apis/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/fixtures/external_apis/anthropic_api.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/fixtures/proxy_service/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/fixtures/proxy_service/oauth_mocks.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/fixtures/responses.json +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/helpers/__init__.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/helpers/assertions.py +0 -0
- {ccproxy_api-0.1.4 → ccproxy_api-0.1.5}/tests/helpers/test_data.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/integration}/test_access_logger_integration.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/integration}/test_confirmation_integration.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/api}/test_metrics_api.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/cli}/test_cli_auth_commands.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/cli}/test_cli_config.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/cli}/test_cli_serve.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/config}/test_claude_sdk_options.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/config}/test_claude_sdk_parser.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/config}/test_terminal_handler.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_adapters.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_confirmation_service.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_docker.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_pricing.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_pushgateway_error_handling.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_queue_duckdb_storage.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_scheduler_tasks.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_sse_events.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_sse_stream_filtering.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/services}/test_stats_printer.py +0 -0
- {ccproxy_api-0.1.4/tests → ccproxy_api-0.1.5/tests/unit/utils}/test_version_checker.py +0 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Advanced Session and Pool Management**:
|
|
13
|
+
- Implemented a robust session-aware pool for persistent Claude SDK connections, significantly improving performance and maintaining conversation continuity.
|
|
14
|
+
- Introduced a hybrid pooling system that automatically transfers clients from a general pool to the session pool upon receiving a session ID.
|
|
15
|
+
- Developed a queue-based streaming architecture to efficiently handle and broadcast messages to multiple listeners, improving session management and disconnection handling.
|
|
16
|
+
- **Enhanced Observability and Logging**:
|
|
17
|
+
- Upgraded logging capabilities to include detailed session metadata, providing deeper insights into session lifecycle and reuse.
|
|
18
|
+
- Implemented a pool monitoring system to track the health and performance of both general and session-based connection pools.
|
|
19
|
+
- Reduced logging noise by adjusting log levels for operational SDK messages, focusing on essential access logs, warnings, and errors.
|
|
20
|
+
- **Improved Configuration and Control**:
|
|
21
|
+
- Introduced a `builtin_permissions` flag to provide granular control over the built-in permission handling infrastructure (MCP and SSE).
|
|
22
|
+
- Implemented configurable system prompt injection modes (`minimal` and `full`) to customize how the Claude Code identity is presented in requests.
|
|
23
|
+
- **Robust Streaming and Header Management**:
|
|
24
|
+
- Implemented `StreamingResponseWithLogging` for unified and consistent access logging across all streaming endpoints.
|
|
25
|
+
- Ensured critical upstream headers (e.g., `cf-ray`, `anthropic-ratelimit-*`) are correctly forwarded in SSE streaming responses.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- **Default Behavior**:
|
|
30
|
+
- The Claude SDK connection pool is now disabled by default, requiring an explicit opt-in for safer and more predictable behavior.
|
|
31
|
+
- **Architectural Improvements**:
|
|
32
|
+
- Refactored the application's startup and shutdown logic into a modular, component-based architecture for better maintainability and testability.
|
|
33
|
+
- Renamed `SessionContext` to `SessionClient` for improved clarity and consistency in the session pooling implementation.
|
|
34
|
+
- **Testing Infrastructure**:
|
|
35
|
+
- Reorganized the entire test suite into a hierarchical structure (`unit` and `integration`) to improve navigation and maintainability.
|
|
36
|
+
- Migrated from legacy test fixtures to a more flexible and maintainable factory pattern for creating test clients and application instances.
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
40
|
+
- **Session and Streaming Stability**:
|
|
41
|
+
- Eliminated critical race conditions and `AttributeError` exceptions in the session pool and stream handling logic.
|
|
42
|
+
- Replaced fragile `asyncio.sleep` calls with a robust, event-based synchronization mechanism to prevent timing-related failures.
|
|
43
|
+
- Implemented a more accurate message-based stale detection mechanism to prevent the incorrect termination of active sessions.
|
|
44
|
+
- **Resource Management**:
|
|
45
|
+
- Corrected several resource leak issues by improving stream interruption handling, ensuring that hanging sessions are properly cleaned up.
|
|
46
|
+
- **Header and Content Formatting**:
|
|
47
|
+
- Resolved an issue that prevented the forwarding of upstream headers in SSE streaming responses.
|
|
48
|
+
- Fixed a formatting bug in the OpenAI adapter that caused message content to be improperly concatenated.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
|
|
53
|
+
- **Configurable Permission Infrastructure**: Added `builtin_permissions` configuration flag to control built-in permission handling infrastructure:
|
|
54
|
+
- New `builtin_permissions` flag (default: true) in ClaudeSettings for granular control
|
|
55
|
+
- CLI support with `--builtin-permissions/--no-builtin-permissions` options
|
|
56
|
+
- When disabled: No MCP server setup, no SSE permission endpoints, no permission service initialization
|
|
57
|
+
- When enabled: Full built-in permission infrastructure with smart MCP server merging
|
|
58
|
+
- Users can configure custom MCP servers independently when built-in infrastructure is disabled
|
|
59
|
+
- Maintains full backward compatibility with existing configurations
|
|
60
|
+
- **Claude SDK Pool Mode**: Implemented connection pooling for Claude Code SDK clients to improve request performance:
|
|
61
|
+
- Maintains a pool of pre-initialized Claude Code instances to eliminate startup overhead
|
|
62
|
+
- Reduces request latency by reusing established connections
|
|
63
|
+
- Pool mode is disabled by default and can be enabled via configuration
|
|
64
|
+
- **Limitations**: Pool mode does not support dynamic Claude options (max_tokens, model changes, etc.)
|
|
65
|
+
- Pool instances are shared across requests with identical configurations
|
|
66
|
+
- **Session-Aware Connection Pooling**: Added advanced session-based pooling for persistent conversation context:
|
|
67
|
+
- Session pools maintain dedicated Claude SDK clients per session ID for conversation continuity
|
|
68
|
+
- Configurable session TTL (time-to-live) with automatic cleanup of idle sessions
|
|
69
|
+
- Session pool settings include max sessions, idle threshold, and cleanup intervals
|
|
70
|
+
- Automatic connection recovery for unhealthy sessions when enabled
|
|
71
|
+
- Session interruption support for graceful handling of canceled requests
|
|
72
|
+
- Separate from the general connection pool - can be used independently or together
|
|
73
|
+
- Configuration via `claude.session_pool` settings with sensible defaults
|
|
74
|
+
- **Claude Detection Service**: Implemented automatic Claude CLI header and system prompt detection at startup:
|
|
75
|
+
- Automatically detects current Claude CLI version and extracts real headers/system prompt
|
|
76
|
+
- Caches detection results per version to avoid repeated startup delays
|
|
77
|
+
- Falls back to hardcoded values when detection fails
|
|
78
|
+
- **Detection Models**: Added Pydantic models for Claude detection data:
|
|
79
|
+
- `ClaudeCodeHeaders` - Structured header extraction with field aliases
|
|
80
|
+
- `SystemPromptData` - System prompt content with cache control
|
|
81
|
+
- `ClaudeCacheData` - Complete cached detection data with version tracking
|
|
82
|
+
|
|
83
|
+
### Changed
|
|
84
|
+
|
|
85
|
+
- **Configuration Updates**: Enhanced Claude settings with new pool configuration options:
|
|
86
|
+
- Added `use_client_pool` boolean flag to enable general connection pooling
|
|
87
|
+
- Added `pool_settings` for configuring general pool behavior (size, timeouts, health checks)
|
|
88
|
+
- Added `session_pool` settings for session-aware pooling configuration
|
|
89
|
+
- Session pool enabled by default with 1-hour TTL and automatic cleanup
|
|
90
|
+
- **HTTP Request Transformation**: Enhanced request transformers to use detected Claude CLI headers and system prompt:
|
|
91
|
+
- Dynamically uses detected headers when available, falls back to hardcoded when not
|
|
92
|
+
- System prompt injection now uses detected Claude Code system prompt
|
|
93
|
+
- Added app_state parameter propagation for detection data access
|
|
94
|
+
- **Request Transformer Architecture**: Refactored transformers to support dynamic header and prompt injection:
|
|
95
|
+
- Added proxy_mode parameter to RequestTransformer base class
|
|
96
|
+
- Enhanced transform methods to accept app_state for detection data access
|
|
97
|
+
- Improved header creation logic to distinguish between detected and fallback headers
|
|
98
|
+
- **Test Organization Cleanup**: Finalized test suite migration and removed obsolete migration documentation:
|
|
99
|
+
- Removed obsolete `MIGRATION_GUIDE.md` files from factories, fixtures, and auth directories
|
|
100
|
+
- Cleaned up `conftest.py` by removing backward compatibility aliases for fixture names
|
|
101
|
+
- Updated fixture references to use direct imports from fixture modules
|
|
102
|
+
- Simplified FastAPI factory test organization by removing legacy compatibility layer
|
|
103
|
+
- Modernized fixture naming convention throughout test files (internal_claude_sdk_service vs claude_service)
|
|
104
|
+
- Removed unused factory fixtures and consolidated client creation patterns
|
|
105
|
+
- **Test Organization**: Migrated test suite from flat structure to organized hierarchy:
|
|
106
|
+
- Tests now organized under `tests/unit/` and `tests/integration/` directories
|
|
107
|
+
- Unit tests categorized by component: `api/`, `services/`, `auth/`, `config/`, `utils/`, `cli/`
|
|
108
|
+
- Integration tests moved to dedicated `tests/integration/` directory
|
|
109
|
+
- Enhanced factory pattern with `FastAPIAppFactory` for flexible test app creation
|
|
110
|
+
- Improved fixture organization with dedicated `tests/fixtures/` structure
|
|
111
|
+
- **Configuration Cleanup**: Removed unused `ConfigLoader` class and simplified configuration management
|
|
112
|
+
- **Logging Optimization**: Reduced permission service log verbosity from INFO to DEBUG level for cleaner production logs
|
|
113
|
+
|
|
114
|
+
### Infrastructure
|
|
115
|
+
|
|
116
|
+
- **Test Structure**: Added `.gitignore` for test artifacts and coverage reports
|
|
117
|
+
- **Documentation**: Updated `TESTING.md` with new test organization and examples
|
|
118
|
+
- **Cache Directory**: Added automatic creation of `~/.cache/ccproxy/` for detection data persistence
|
|
119
|
+
- **Session Pool Components**: Added new modules for session management:
|
|
120
|
+
- `ccproxy/claude_sdk/session_pool.py` - Core session pool implementation
|
|
121
|
+
- `ccproxy/claude_sdk/session_client.py` - Session-aware client wrapper
|
|
122
|
+
- `ccproxy/claude_sdk/manager.py` - Unified pool management with metrics integration
|
|
123
|
+
- **Test Coverage**: Added comprehensive tests for session pool functionality:
|
|
124
|
+
- Unit tests for session lifecycle, cleanup, and recovery
|
|
125
|
+
- Integration tests for end-to-end session pooling behavior
|
|
126
|
+
|
|
127
|
+
## [0.1.4] - 2025-05-28
|
|
128
|
+
|
|
129
|
+
### Fixed
|
|
130
|
+
|
|
131
|
+
- **Pydantic Compatibility**: Fixed TypeError in model_dump_json() call by removing invalid separators parameter (issue #5)
|
|
132
|
+
|
|
133
|
+
## [0.1.3] - 2025-07-25
|
|
134
|
+
|
|
135
|
+
### Added
|
|
136
|
+
|
|
137
|
+
- **Version Update Checking**: Automatic version checking against GitHub releases with configurable intervals (default 12 hours) and startup checks
|
|
138
|
+
- **MCP Server Integration**: Added Model Context Protocol (MCP) server functionality with permission checking tools for Claude Code integration
|
|
139
|
+
- **Permission System**: Implemented comprehensive permission management with REST API endpoints and Server-Sent Events (SSE) streaming for real-time permission requests
|
|
140
|
+
- **Request/Response Logging**: Added comprehensive logging middleware with configurable verbosity levels (`CCPROXY_VERBOSE_API`, `CCPROXY_REQUEST_LOG_DIR`)
|
|
141
|
+
- **Claude SDK Custom Content Blocks**: Added support for `system_message`, `tool_use_sdk`, and `tool_result_sdk` content blocks with full metadata preservation
|
|
142
|
+
- **Model Mapping Utilities**: Centralized model provider abstraction with unified mapping logic in `ccproxy/utils/models_provider.py`
|
|
143
|
+
- **Terminal Permission Handler**: Interactive permission workflow handler for CLI-based permission management
|
|
144
|
+
- **Claude SDK Field Rendering**: Added flexible content handling with `forward`, `formatted`, and `ignore` rendering options for Claude SDK fields
|
|
145
|
+
|
|
146
|
+
### Changed
|
|
147
|
+
|
|
148
|
+
- **Claude SDK Integration**: Refactored to use native ThinkingBlock models from Claude Code SDK
|
|
149
|
+
- **Models Endpoint**: Centralized `/v1/models` endpoint implementation to eliminate code duplication across routes
|
|
150
|
+
- **OpenAI Adapter**: Enhanced with improved modularization and streaming architecture
|
|
151
|
+
- **Logging System**: Migrated to canonical structlog pattern for structured, consistent logging
|
|
152
|
+
- **SSE Streaming**: Improved Server-Sent Events format with comprehensive examples and better error handling
|
|
153
|
+
|
|
154
|
+
### Fixed
|
|
155
|
+
|
|
156
|
+
- **SDK Double Content**: Resolved duplicate content issue in Claude SDK message processing
|
|
157
|
+
- **Error Handling**: Enhanced error handling throughout Claude SDK message processing pipeline
|
|
158
|
+
- **Type Safety**: Improved type checking across permission system components
|
|
159
|
+
- **Permission Handler**: Fixed lazy initialization issues in terminal permission handler
|
|
160
|
+
|
|
161
|
+
## [0.1.2] - 2025-07-22
|
|
162
|
+
|
|
163
|
+
### Added
|
|
164
|
+
|
|
165
|
+
- **Permission Mode Support**: Restored `--permission-mode` option supporting default, acceptEdits, and bypassPermissions modes
|
|
166
|
+
- **Custom Permission Tool**: Restored `--permission-prompt-tool-name` option to specify custom permission tool names
|
|
167
|
+
- **Permission Response Models**: Added `PermissionToolAllowResponse` and `PermissionToolDenyResponse` models with proper JSON serialization
|
|
168
|
+
|
|
169
|
+
### Changed
|
|
170
|
+
|
|
171
|
+
- **Message Formatting**: Modified `MessageConverter.combine_text_parts()` to join text parts with newlines instead of spaces, preserving formatting in multi-line content
|
|
172
|
+
- **Settings Integration**: Enhanced OptionsHandler to apply default Claude options from settings before API parameters
|
|
173
|
+
- **Configuration**: Extended settings to persist permission_mode and permission_prompt_tool_name
|
|
174
|
+
|
|
175
|
+
### Fixed
|
|
176
|
+
|
|
177
|
+
- **Claude SDK Options**: Integrated Settings dependency into ClaudeSDKService to support configuration-based options
|
|
178
|
+
|
|
179
|
+
## [0.1.1] - 2025-07-22
|
|
180
|
+
|
|
181
|
+
### Added
|
|
182
|
+
|
|
183
|
+
- **Conditional Authentication**: API endpoints now support optional authentication - when `SECURITY__AUTH_TOKEN` is configured, authentication is enforced; when not configured, the proxy runs in open mode.
|
|
184
|
+
- **Startup Validation**: Added comprehensive validation checks during application startup:
|
|
185
|
+
- Validates OAuth credentials and warns about expired tokens
|
|
186
|
+
- Checks for Claude CLI binary availability with installation instructions
|
|
187
|
+
- Logs token expiration time and subscription type when valid
|
|
188
|
+
- **Default Command**: The `serve` command is now the default - running `ccproxy` without subcommands automatically starts the server.
|
|
189
|
+
- **Alternative Entry Point**: Added `ccproxy-api` as an alternative command-line entry point.
|
|
190
|
+
|
|
191
|
+
### Changed
|
|
192
|
+
|
|
193
|
+
- **Authentication Variable**: Renamed environment variable from `AUTH_TOKEN` to `SECURITY__AUTH_TOKEN` for better namespace organization and clarity.
|
|
194
|
+
- **Credential Priority**: Reordered credential search paths to prioritize ccproxy-specific credentials before Claude CLI paths.
|
|
195
|
+
- **CLI Syntax**: Migrated all CLI parameters to modern Annotated syntax for better type safety and IDE support.
|
|
196
|
+
- **Pydantic v2**: Updated all models to use Pydantic v2 configuration syntax (`model_config` instead of `Config` class).
|
|
197
|
+
- **Documentation**: Improved Aider integration docs with correct API endpoint URLs and added installation options (uv, pipx).
|
|
198
|
+
|
|
199
|
+
### Fixed
|
|
200
|
+
|
|
201
|
+
- **Authentication Separation**: Fixed critical issue where auth token was incorrectly used for both client and upstream authentication - now client auth token is separate from OAuth credentials.
|
|
202
|
+
- **URL Paths**: Fixed documentation to use `/api` endpoints for Aider compatibility instead of SDK mode paths.
|
|
203
|
+
- **Default Values**: Fixed default values for list parameters in CLI (docker_env, docker_volume, docker_arg).
|
|
204
|
+
|
|
205
|
+
### Removed
|
|
206
|
+
|
|
207
|
+
- **Status Endpoints**: Removed redundant `/status` endpoints from both Claude SDK and proxy routes.
|
|
208
|
+
- **Permission Tool**: Removed Claude permission tool functionality and related CLI options (`--permission-mode`, `--permission-prompt-tool-name`) that are no longer needed.
|
|
209
|
+
- **Deprecated Options**: Removed references to deprecated permission_mode and permission_prompt_tool_name from documentation.
|
|
210
|
+
|
|
211
|
+
## [0.1.0] - 2025-07-21
|
|
212
|
+
|
|
213
|
+
This is the initial public release of the CCProxy API.
|
|
214
|
+
|
|
215
|
+
### Added
|
|
216
|
+
|
|
217
|
+
#### Core Functionality
|
|
218
|
+
|
|
219
|
+
- **Personal Claude Access**: Enables using a personal Claude Pro, Team, or Enterprise subscription as an API endpoint, without needing separate API keys.
|
|
220
|
+
- **OAuth2 Authentication**: Implements the official Claude OAuth2 flow for secure, local authentication.
|
|
221
|
+
- **Local Proxy Server**: Runs a lightweight FastAPI server on your local machine.
|
|
222
|
+
- **HTTP/HTTPS Proxy Support**: Full support for routing requests through an upstream HTTP or HTTPS proxy.
|
|
223
|
+
|
|
224
|
+
#### API & Compatibility
|
|
225
|
+
|
|
226
|
+
- **Dual API Support**: Provides full compatibility with both Anthropic and OpenAI API specifications.
|
|
227
|
+
- **Anthropic Messages API**: Native support for the Anthropic Messages API at `/v1/chat/completions`.
|
|
228
|
+
- **OpenAI Chat Completions API**: Compatibility layer for the OpenAI Chat Completions API at `/openai/v1/chat/completions`.
|
|
229
|
+
- **Request/Response Translation**: Seamlessly translates requests and responses between OpenAI and Anthropic formats.
|
|
230
|
+
- **Streaming Support**: Real-time streaming for both Anthropic and OpenAI-compatible endpoints.
|
|
231
|
+
- **Model Endpoints**: Lists available models via `/v1/models` and `/openai/v1/models`.
|
|
232
|
+
- **Health Check**: A `/health` endpoint for monitoring the proxy's status.
|
|
233
|
+
|
|
234
|
+
#### Configuration & CLI
|
|
235
|
+
|
|
236
|
+
- **Unified `ccproxy` CLI**: A single, user-friendly command-line interface for managing the proxy.
|
|
237
|
+
- **TOML Configuration**: Configure the server using a `config.toml` file with JSON Schema validation.
|
|
238
|
+
- **Keyring Integration**: Securely stores and manages OAuth credentials in the system's native keyring.
|
|
239
|
+
- **`generate-token` Command**: A CLI command to manually generate and manage API tokens.
|
|
240
|
+
- **Systemd Integration**: Includes a setup script and service template for running the proxy as a systemd service in production environments.
|
|
241
|
+
- **Docker Support**: A `Dockerfile` and `docker-compose.yml` for running the proxy in an isolated containerized environment.
|
|
242
|
+
|
|
243
|
+
#### Security
|
|
244
|
+
|
|
245
|
+
- **Local-First Design**: All processing and authentication happens locally; no conversation data is stored or transmitted to third parties.
|
|
246
|
+
- **Credential Security**: OAuth tokens are stored securely in the system keyring, not in plaintext files.
|
|
247
|
+
- **Header Stripping**: Automatically removes client-side `Authorization` headers to prevent accidental key leakage.
|
|
248
|
+
|
|
249
|
+
#### Developer Experience
|
|
250
|
+
|
|
251
|
+
- **Comprehensive Documentation**: Includes a quick start guide, API reference, and setup instructions.
|
|
252
|
+
- **Pre-commit Hooks**: Configured for automated code formatting and linting to ensure code quality.
|
|
253
|
+
- **Modern Tooling**: Uses `uv` for package management and `devenv` for a reproducible development environment.
|
|
254
|
+
- **Extensive Test Suite**: Includes unit, integration, and benchmark tests to ensure reliability.
|
|
255
|
+
- **Rich Logging**: Structured and colorized logging for improved readability during development and debugging.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ccproxy-api
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: API server that provides an Anthropic and OpenAI compatible interface over Claude Code, allowing to use your Claude OAuth account or over the API.
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Requires-Python: >=3.11
|
|
7
7
|
Requires-Dist: aiofiles>=24.1.0
|
|
8
8
|
Requires-Dist: aiosqlite>=0.21.0
|
|
9
|
-
Requires-Dist: claude-code-sdk>=0.0.
|
|
9
|
+
Requires-Dist: claude-code-sdk>=0.0.19
|
|
10
10
|
Requires-Dist: duckdb-engine>=0.17.0
|
|
11
11
|
Requires-Dist: duckdb>=1.1.0
|
|
12
12
|
Requires-Dist: fastapi-mcp
|
|
@@ -182,6 +182,33 @@ CLAUDE__SDK_MESSAGE_MODE=formatted ccproxy
|
|
|
182
182
|
CLAUDE__PRETTY_FORMAT=false ccproxy
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
+
## Claude SDK Pool Mode
|
|
186
|
+
|
|
187
|
+
CCProxy supports connection pooling for Claude Code SDK clients to improve request performance by maintaining a pool of pre-initialized Claude instances.
|
|
188
|
+
|
|
189
|
+
### Benefits
|
|
190
|
+
- **Reduced Latency**: Eliminates Claude Code startup overhead on each request
|
|
191
|
+
- **Improved Performance**: Reuses established connections for faster response times
|
|
192
|
+
- **Resource Efficiency**: Maintains a configurable pool size to balance performance and resource usage
|
|
193
|
+
|
|
194
|
+
### Usage
|
|
195
|
+
Pool mode is disabled by default and can be enabled using the CLI flag:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Enable pool mode with default settings
|
|
199
|
+
ccproxy --sdk-enable-pool
|
|
200
|
+
|
|
201
|
+
# Configure pool size (default: 3)
|
|
202
|
+
ccproxy --sdk-enable-pool --sdk-pool-size 5
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Limitations
|
|
206
|
+
- **No Dynamic Options**: Pool instances cannot change Claude options (max_tokens, model, etc.) after initialization
|
|
207
|
+
- **Shared Configuration**: All requests using the pool must use identical Claude configuration
|
|
208
|
+
- **Memory Usage**: Each pool instance consumes additional memory
|
|
209
|
+
|
|
210
|
+
Pool mode is most effective for high-frequency requests with consistent configuration requirements.
|
|
211
|
+
|
|
185
212
|
## Using with Aider
|
|
186
213
|
|
|
187
214
|
CCProxy works seamlessly with Aider and other AI coding assistants:
|
|
@@ -150,6 +150,33 @@ CLAUDE__SDK_MESSAGE_MODE=formatted ccproxy
|
|
|
150
150
|
CLAUDE__PRETTY_FORMAT=false ccproxy
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
+
## Claude SDK Pool Mode
|
|
154
|
+
|
|
155
|
+
CCProxy supports connection pooling for Claude Code SDK clients to improve request performance by maintaining a pool of pre-initialized Claude instances.
|
|
156
|
+
|
|
157
|
+
### Benefits
|
|
158
|
+
- **Reduced Latency**: Eliminates Claude Code startup overhead on each request
|
|
159
|
+
- **Improved Performance**: Reuses established connections for faster response times
|
|
160
|
+
- **Resource Efficiency**: Maintains a configurable pool size to balance performance and resource usage
|
|
161
|
+
|
|
162
|
+
### Usage
|
|
163
|
+
Pool mode is disabled by default and can be enabled using the CLI flag:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Enable pool mode with default settings
|
|
167
|
+
ccproxy --sdk-enable-pool
|
|
168
|
+
|
|
169
|
+
# Configure pool size (default: 3)
|
|
170
|
+
ccproxy --sdk-enable-pool --sdk-pool-size 5
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Limitations
|
|
174
|
+
- **No Dynamic Options**: Pool instances cannot change Claude options (max_tokens, model, etc.) after initialization
|
|
175
|
+
- **Shared Configuration**: All requests using the pool must use identical Claude configuration
|
|
176
|
+
- **Memory Usage**: Each pool instance consumes additional memory
|
|
177
|
+
|
|
178
|
+
Pool mode is most effective for high-frequency requests with consistent configuration requirements.
|
|
179
|
+
|
|
153
180
|
## Using with Aider
|
|
154
181
|
|
|
155
182
|
CCProxy works seamlessly with Aider and other AI coding assistants:
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Session Pool Stale Detection Fix Plan
|
|
2
|
+
|
|
3
|
+
## Issue Analysis
|
|
4
|
+
|
|
5
|
+
The session pool incorrectly marks completed streams as "stale" using a fixed 10-second threshold (`idle_seconds > 10.0` in session_pool.py:184). This causes unnecessary interruptions of already-completed streams.
|
|
6
|
+
|
|
7
|
+
## Root Cause
|
|
8
|
+
|
|
9
|
+
1. **Incorrect stale detection logic**: Uses 10s timeout instead of proper message-based lifecycle tracking
|
|
10
|
+
2. **No stream completion detection**: Pool doesn't detect when streams finish with ResultMessage
|
|
11
|
+
3. **Missing first chunk timing**: No distinction between waiting-for-first-chunk vs ongoing streams
|
|
12
|
+
|
|
13
|
+
## Solution: Message-Based Stream Lifecycle Tracking
|
|
14
|
+
|
|
15
|
+
### Step 1: Enhance Stream Handle with Message Tracking
|
|
16
|
+
- Add message type tracking in `StreamHandle` class
|
|
17
|
+
- Track `SystemMessage(init)` reception (first chunk received)
|
|
18
|
+
- Track `ResultMessage` reception (stream completed)
|
|
19
|
+
- Track timestamps for timeout calculations
|
|
20
|
+
|
|
21
|
+
### Step 2: Update Session Pool Stale Detection Logic
|
|
22
|
+
Replace current logic in `session_pool.py:182-184` with:
|
|
23
|
+
```python
|
|
24
|
+
# Stream is stale if:
|
|
25
|
+
# - No SystemMessage received within 3 seconds (first chunk timeout)
|
|
26
|
+
# - SystemMessage received but no activity for 60 seconds (ongoing timeout)
|
|
27
|
+
# - Never check stale for completed streams (ResultMessage received)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Step 3: Implementation Details
|
|
31
|
+
|
|
32
|
+
**In `stream_handle.py`:**
|
|
33
|
+
- Add fields: `first_chunk_received_at`, `completed_at`, `has_result_message`
|
|
34
|
+
- Track message types in stream worker message processing
|
|
35
|
+
- Expose completion status to session pool
|
|
36
|
+
|
|
37
|
+
**In `session_pool.py`:**
|
|
38
|
+
- Update stale detection in `get_session_client()` method (lines 182-184)
|
|
39
|
+
- Implement proper timeout logic:
|
|
40
|
+
- 3s timeout if no first chunk
|
|
41
|
+
- 60s timeout if first chunk received but not completed
|
|
42
|
+
- Skip timeout check for completed streams
|
|
43
|
+
|
|
44
|
+
### Step 4: Message Flow Integration
|
|
45
|
+
- Hook into existing message processing in `stream_worker.py`
|
|
46
|
+
- Update handle when `SystemMessage(subtype=init)` received
|
|
47
|
+
- Update handle when `ResultMessage` received
|
|
48
|
+
- No special handling for slash commands (generic solution)
|
|
49
|
+
|
|
50
|
+
## Files to Modify
|
|
51
|
+
|
|
52
|
+
1. `ccproxy/claude_sdk/stream_handle.py` - Add message lifecycle tracking
|
|
53
|
+
2. `ccproxy/claude_sdk/session_pool.py` - Fix stale detection logic
|
|
54
|
+
3. `ccproxy/claude_sdk/stream_worker.py` - Update message tracking in worker
|
|
55
|
+
|
|
56
|
+
## Testing
|
|
57
|
+
|
|
58
|
+
- Unit tests for new timeout logic
|
|
59
|
+
- Integration tests with slash commands and regular messages
|
|
60
|
+
- Verify 3s/60s timeout behavior
|
|
61
|
+
|
|
62
|
+
## Implementation Order
|
|
63
|
+
|
|
64
|
+
1. ✅ Write plan to file
|
|
65
|
+
2. ✅ Update StreamHandle with message tracking
|
|
66
|
+
3. ✅ Update StreamWorker to notify handle of message types
|
|
67
|
+
4. ✅ Update SessionPool stale detection logic
|
|
68
|
+
5. ✅ Test the fix
|
|
69
|
+
6. ✅ Fix Claude SDK client timeout conflict
|
|
70
|
+
7. ✅ Fix unhandled StreamTimeoutError exception
|
|
71
|
+
|
|
72
|
+
## Implementation Summary
|
|
73
|
+
|
|
74
|
+
The fix has been successfully implemented with the following changes:
|
|
75
|
+
|
|
76
|
+
### StreamHandle (`ccproxy/claude_sdk/stream_handle.py`)
|
|
77
|
+
- Added message lifecycle tracking fields: `_first_chunk_received_at`, `_completed_at`, `_has_result_message`, `_last_activity_at`
|
|
78
|
+
- Added methods: `on_first_chunk_received()`, `on_message_received()`, `on_completion()`
|
|
79
|
+
- Added properties: `is_completed`, `has_first_chunk`, `idle_seconds`
|
|
80
|
+
- Added `is_stale()` method with proper timeout logic:
|
|
81
|
+
- 3s timeout if no SystemMessage received
|
|
82
|
+
- 60s timeout if SystemMessage received but no ResultMessage
|
|
83
|
+
- Never stale for completed streams
|
|
84
|
+
|
|
85
|
+
### StreamWorker (`ccproxy/claude_sdk/stream_worker.py`)
|
|
86
|
+
- Added `stream_handle` parameter to constructor
|
|
87
|
+
- Added message tracking logic to notify handle of:
|
|
88
|
+
- All message activity (updates last activity time)
|
|
89
|
+
- SystemMessage with init subtype (first chunk received)
|
|
90
|
+
- ResultMessage (stream completion)
|
|
91
|
+
|
|
92
|
+
### SessionPool (`ccproxy/claude_sdk/session_pool.py`)
|
|
93
|
+
- Replaced fixed 10-second stale detection with message-based timeout logic:
|
|
94
|
+
- First chunk timeout (3s): Terminate session client
|
|
95
|
+
- Ongoing timeout (60s): Interrupt stream but keep session
|
|
96
|
+
- Added differentiated timeout handling with proper logging
|
|
97
|
+
|
|
98
|
+
### ClaudeClient (`ccproxy/claude_sdk/client.py`)
|
|
99
|
+
- Modified first chunk timeout handling to check if session pool is enabled
|
|
100
|
+
- When session pool is enabled, logs timeout but lets session pool handle cleanup
|
|
101
|
+
- When session pool is disabled, maintains original interrupt behavior
|
|
102
|
+
- Prevents conflicting timeout handling between client and session pool
|
|
103
|
+
|
|
104
|
+
### Testing
|
|
105
|
+
- All existing unit tests pass
|
|
106
|
+
- Type checking passes with mypy
|
|
107
|
+
- Linting passes with ruff
|
|
108
|
+
- Custom validation tests confirm proper timeout behavior
|
|
109
|
+
- Session pool integration tests pass
|
|
110
|
+
|
|
111
|
+
## Message Flow
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Stream Start → StreamWorker processes SystemMessage(init) → StreamHandle.on_first_chunk()
|
|
115
|
+
Stream Processing → StreamWorker processes content messages → Continue
|
|
116
|
+
Stream End → StreamWorker processes ResultMessage → StreamHandle.on_completion()
|
|
117
|
+
Session Pool → Check handle.is_completed() before stale detection
|
|
118
|
+
```
|