ccproxy-api 0.1.6__tar.gz → 0.1.7__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.6 → ccproxy_api-0.1.7}/CHANGELOG.md +219 -1
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/PKG-INFO +1 -1
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/_version.py +2 -2
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/app.py +15 -3
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/dependencies.py +1 -8
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/middleware/errors.py +15 -7
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/routes/codex.py +42 -22
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/scheduler.py +4 -4
- ccproxy_api-0.1.7/ccproxy/data/claude_headers_fallback.json +37 -0
- ccproxy_api-0.1.7/ccproxy/data/codex_headers_fallback.json +14 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/scheduler/manager.py +2 -2
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/scheduler/tasks.py +105 -65
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/services/claude_detection_service.py +7 -33
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/services/codex_detection_service.py +7 -18
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/utils/startup_helpers.py +143 -12
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/utils/version_checker.py +6 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/pyproject.toml +3 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_codex_proxy.py +0 -1
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_scheduler_tasks.py +17 -9
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/utils/test_startup_helpers.py +13 -13
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/utils/test_version_checker.py +29 -1
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/.env.example +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/.github/workflows/backend.yml +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/.github/workflows/build.yml +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/.github/workflows/ci.yml +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/.github/workflows/docs.yml +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/.github/workflows/frontend.yml.disabled +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/.github/workflows/release.yml +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/.gitignore +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/.pre-commit-config.yaml +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/.python-version +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/CONTRIBUTING.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/CONVENTIONS.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/Dockerfile +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/LICENSE +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/Makefile +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/README.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/TESTING.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/__main__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/adapters/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/adapters/base.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/adapters/codex/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/adapters/openai/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/adapters/openai/adapter.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/adapters/openai/models.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/adapters/openai/response_adapter.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/adapters/openai/response_models.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/adapters/openai/streaming.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/middleware/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/middleware/auth.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/middleware/cors.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/middleware/headers.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/middleware/logging.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/middleware/request_content_logging.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/middleware/request_id.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/middleware/server_header.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/responses.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/routes/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/routes/claude.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/routes/health.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/routes/mcp.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/routes/metrics.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/routes/permissions.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/routes/proxy.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/services/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/services/permission_service.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/ui/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/ui/permission_handler_protocol.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/api/ui/terminal_permission_handler.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/bearer.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/conditional.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/credentials_adapter.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/dependencies.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/exceptions.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/manager.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/models.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/oauth/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/oauth/models.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/oauth/routes.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/oauth/storage.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/openai/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/openai/credentials.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/openai/oauth_client.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/openai/storage.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/storage/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/storage/base.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/storage/json_file.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/auth/storage/keyring.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/claude_sdk/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/claude_sdk/client.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/claude_sdk/converter.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/claude_sdk/exceptions.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/claude_sdk/manager.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/claude_sdk/message_queue.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/claude_sdk/options.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/claude_sdk/parser.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/claude_sdk/session_client.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/claude_sdk/session_pool.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/claude_sdk/stream_handle.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/claude_sdk/stream_worker.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/claude_sdk/streaming.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/commands/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/commands/auth.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/commands/config/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/commands/config/commands.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/commands/config/schema_commands.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/commands/permission_handler.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/commands/serve.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/docker/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/docker/adapter_factory.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/docker/params.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/helpers.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/main.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/options/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/options/claude_options.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/options/core_options.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/options/security_options.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/cli/options/server_options.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/auth.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/claude.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/codex.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/cors.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/discovery.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/docker_settings.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/observability.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/pricing.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/reverse_proxy.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/security.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/server.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/settings.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/config/validators.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/async_utils.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/codex_transformers.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/constants.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/errors.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/http.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/http_transformers.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/interfaces.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/logging.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/middleware.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/proxy.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/system.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/transformers.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/types.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/core/validators.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/docker/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/docker/adapter.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/docker/docker_path.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/docker/middleware.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/docker/models.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/docker/protocol.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/docker/stream_process.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/docker/validators.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/models/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/models/claude_sdk.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/models/detection.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/models/errors.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/models/messages.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/models/permissions.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/models/requests.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/models/responses.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/models/types.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/observability/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/observability/access_logger.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/observability/context.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/observability/metrics.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/observability/pushgateway.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/observability/sse_events.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/observability/stats_printer.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/observability/storage/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/observability/storage/duckdb_simple.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/observability/storage/models.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/observability/streaming_response.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/pricing/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/pricing/cache.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/pricing/loader.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/pricing/models.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/pricing/updater.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/scheduler/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/scheduler/core.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/scheduler/errors.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/scheduler/registry.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/services/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/services/claude_sdk_service.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/services/credentials/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/services/credentials/config.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/services/credentials/manager.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/services/credentials/oauth_client.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/services/proxy_service.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/static/.keep +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/testing/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/testing/config.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/testing/content_generation.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/testing/mock_responses.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/testing/response_handlers.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/testing/scenarios.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/utils/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/utils/cost_calculator.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/utils/disconnection_monitor.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/utils/id_generator.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/utils/model_mapping.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/utils/models_provider.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/utils/simple_request_logger.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/ccproxy/utils/streaming_metrics.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/data/metrics.db +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/devenv.lock +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/devenv.nix +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docker-compose.monitoring.yml +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docker-compose.yml +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/README.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/api-reference.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/assets/extra.css +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/assets/extra.js +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/contributing.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/development/debugging-with-proxy.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/examples.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/gen_ref_pages.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/getting-started/configuration.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/getting-started/installation.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/getting-started/quickstart.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/index.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/metrics-api.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/observability.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/systemd-setup.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/user-guide/api-usage.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/user-guide/authentication.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/user-guide/claude-code-options.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/user-guide/claude-sdk-compatibility.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/user-guide/codex-api.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/user-guide/mcp-integration.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/user-guide/pool-configuration.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/docs/user-guide/understanding-pool-logs.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/README.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/README_chat_agent.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/ai_code_discussion_demo.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/anthropic_streaming_demo.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/anthropic_tools_demo.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/client.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/common_utils.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/console_utils.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/debug_anthropic_streaming.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/openai_anthropic_conversation_demo.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/openai_claude_code_options_example.sh +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/openai_json_object_example.sh +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/openai_json_schema_example.sh +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/openai_streaming_demo.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/openai_structured_response_demo.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/openai_thinking_demo.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/openai_tools_demo.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/project_code_access_demo.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/simple_thinking_demo.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/examples/textual_chat_agent.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/mkdocs.yml +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/monitoring/grafana/dashboards/ccproxy-dashboard.json +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/monitoring/grafana/provisioning/dashboards/dashboard.yml +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/monitoring/grafana/provisioning/datasources/victoria-metrics.yml +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/scripts/act-run.sh +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/scripts/build-docs.sh +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/scripts/entrypoint.sh +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/scripts/format_version.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/scripts/serve-docs.sh +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/scripts/setup-systemd.sh +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/scripts/setup.sh +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/scripts/traffic_generator.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/systemd/ccproxy.service.template +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/.gitignore +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/conftest.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/factories/README.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/factories/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/factories/fastapi_factory.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/README.md +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/auth/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/auth/example_usage.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/claude_sdk/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/claude_sdk/client_mocks.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/claude_sdk/internal_mocks.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/claude_sdk/responses.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/credentials.json +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/external_apis/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/external_apis/anthropic_api.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/external_apis/openai_codex_api.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/proxy_service/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/proxy_service/oauth_mocks.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/fixtures/responses.json +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/helpers/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/helpers/assertions.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/helpers/test_data.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/integration/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/integration/test_access_logger_integration.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/integration/test_confirmation_integration.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/integration/test_duckdb_settings_integration.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/integration/test_streaming_access_logging.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/test_cache_control_limiter.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/api/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/api/test_api.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/api/test_confirmation_routes.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/api/test_mcp_route.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/api/test_metrics_api.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/api/test_reset_endpoint.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/auth/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/auth/test_auth.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/cli/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/cli/test_cli_auth_commands.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/cli/test_cli_config.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/cli/test_cli_confirmation_handler.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/cli/test_cli_serve.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/config/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/config/test_claude_sdk_options.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/config/test_claude_sdk_parser.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/config/test_terminal_handler.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/observability/test_streaming_response.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_adapters.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_claude_sdk_client.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_confirmation_service.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_docker.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_fastapi_factory.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_http_transformers.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_observability.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_pricing.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_pushgateway_error_handling.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_queue_duckdb_storage.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_scheduler.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_session_pool_race_condition.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_sse_events.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_sse_stream_filtering.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_stats_printer.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/services/test_streaming.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/utils/__init__.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/tests/unit/utils/test_duckdb_lifecycle.py +0 -0
- {ccproxy_api-0.1.6 → ccproxy_api-0.1.7}/uv.lock +0 -0
|
@@ -5,7 +5,225 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [0.1.
|
|
8
|
+
## [0.1.7] - 2025-08-13
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Enhanced Authentication Validation**: Implemented separate authentication validation for both Claude and Codex providers at startup
|
|
13
|
+
- Added `validate_claude_authentication_startup()` function with provider-specific logging messages
|
|
14
|
+
- Added `validate_codex_authentication_startup()` function for OpenAI/Codex token validation
|
|
15
|
+
- Updated startup lifecycle to validate both authentication systems independently
|
|
16
|
+
- Clear differentiation between Claude and Codex authentication status in logs
|
|
17
|
+
- **Package Data Fallback System**: Implemented robust fallback data system using package-embedded JSON files
|
|
18
|
+
- Added `ccproxy/data/claude_headers_fallback.json` with Claude CLI headers and system prompts
|
|
19
|
+
- Added `ccproxy/data/codex_headers_fallback.json` with Codex CLI headers and detection data
|
|
20
|
+
- Updated `pyproject.toml` to include data files in package builds via `[tool.hatch.build.targets.wheel]`
|
|
21
|
+
- Enhanced detection services to load fallback data from package files instead of hardcoded values
|
|
22
|
+
- Removed identifying UUIDs from fallback files for privacy protection
|
|
23
|
+
- **Version Update Checking System**: Comprehensive version monitoring with scheduled checks and caching
|
|
24
|
+
- Automatic version checking against GitHub releases with configurable intervals (default 12 hours)
|
|
25
|
+
- Startup version checks with graceful degradation when GitHub is unavailable
|
|
26
|
+
- Intelligent caching system to avoid rate limiting and reduce network requests
|
|
27
|
+
- Integration with scheduler for periodic background version monitoring
|
|
28
|
+
- Detailed logging of version check results, cache status, and update availability
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- **Authentication Error Logging**: Significantly improved error logging and reduced log noise for authentication failures
|
|
33
|
+
- HTTP 401 authentication errors now log as warnings instead of errors with stack traces
|
|
34
|
+
- Removed exception chaining (`from e`) for authentication failures to eliminate verbose stack traces
|
|
35
|
+
- Updated Codex route exception handling to use `from None` suppression for cleaner logs
|
|
36
|
+
- Enhanced HTTP exception middleware to treat 401 errors as expected events like 404s
|
|
37
|
+
- Updated metrics recording to properly categorize HTTP 401 errors as "http_401"
|
|
38
|
+
- **Codex CLI Detection**: Improved Codex header detection reliability and startup behavior
|
|
39
|
+
- Added CLI availability check before attempting Codex header detection to prevent warnings
|
|
40
|
+
- Enhanced `initialize_codex_detection_startup()` to skip detection when Codex CLI is unavailable
|
|
41
|
+
- Improved error handling and fallback behavior when Codex is not installed
|
|
42
|
+
- Better separation between Codex enabled/disabled states and CLI availability
|
|
43
|
+
- **Codex Streaming Response Handling**: Enhanced streaming behavior and format conversion for Codex endpoints
|
|
44
|
+
- Fixed streaming response management in `codex_chat_completions` endpoint
|
|
45
|
+
- Improved Response API to Chat Completions format conversion for both streaming and non-streaming requests
|
|
46
|
+
- Enhanced error handling for malformed responses and backend communication failures
|
|
47
|
+
- Better stream chunk processing with proper reasoning block handling and content type detection
|
|
48
|
+
- Improved non-streaming response collection and conversion from streaming backends
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
|
|
52
|
+
- **Startup Lifecycle Architecture**: Enhanced component-based startup system with better error handling
|
|
53
|
+
- Updated `LIFECYCLE_COMPONENTS` to include separate "Claude Authentication" and "Codex Authentication" components
|
|
54
|
+
- Improved startup component execution with graceful degradation when individual components fail
|
|
55
|
+
- Enhanced logging for component startup and shutdown phases with clear component identification
|
|
56
|
+
- Better separation of concerns between different startup validation tasks
|
|
57
|
+
- **Exception Handling Patterns**: Standardized exception handling across Codex routes
|
|
58
|
+
- Applied consistent `from None` pattern for all authentication and proxy error handling
|
|
59
|
+
- Improved error message clarity and reduced stack trace pollution
|
|
60
|
+
- Enhanced logging levels appropriate for different error types (debug for auth failures, error for unexpected issues)
|
|
61
|
+
- **Detection Service Architecture**: Improved fallback data loading and service initialization
|
|
62
|
+
- Enhanced `ClaudeDetectionService` and `CodexDetectionService` to use package data files
|
|
63
|
+
- Better error handling when package data files are missing or corrupted
|
|
64
|
+
- Improved service initialization with graceful fallback to embedded data
|
|
65
|
+
|
|
66
|
+
### Infrastructure
|
|
67
|
+
|
|
68
|
+
- **Package Data Management**: Added proper package data inclusion for distribution
|
|
69
|
+
- Updated build configuration to include `ccproxy/data/*.json` files in wheel packages
|
|
70
|
+
- Ensured fallback data is available in both development and packaged installations
|
|
71
|
+
- Improved data file loading with proper path resolution for packaged deployments
|
|
72
|
+
- **Code Quality**: Enhanced code organization and linting compliance
|
|
73
|
+
- Fixed all ruff linting issues with proper exception chaining patterns
|
|
74
|
+
- Improved type safety and eliminated linting warnings
|
|
75
|
+
- Enhanced code consistency across authentication and error handling modules
|
|
76
|
+
|
|
77
|
+
This release focuses on improving the reliability and maintainability of the authentication system while providing better user experience through cleaner logs and more robust startup behavior. The version checking system ensures users stay informed about updates, while the improved Codex integration provides a more stable experience when using OpenAI providers.
|
|
78
|
+
|
|
79
|
+
## [0.1.6] - 2025-08-13
|
|
80
|
+
|
|
81
|
+
## Added OpenAI Codex Provider with Full Proxy Support
|
|
82
|
+
|
|
83
|
+
### Overview
|
|
84
|
+
|
|
85
|
+
Implemented comprehensive support for OpenAI Codex CLI integration, enabling users to proxy requests through their OpenAI subscription via the ChatGPT backend API. This feature provides an alternative to the Claude provider while maintaining full compatibility with the existing proxy architecture. The implementation uses the OpenAI Responses API endpoint as documented at https://platform.openai.com/docs/api-reference/responses/get.
|
|
86
|
+
|
|
87
|
+
### Key Features
|
|
88
|
+
|
|
89
|
+
**Complete Codex API Proxy**
|
|
90
|
+
|
|
91
|
+
- Full reverse proxy to `https://chatgpt.com/backend-api/codex`
|
|
92
|
+
- Support for both `/codex/responses` and `/codex/{session_id}/responses` endpoints
|
|
93
|
+
- Compatible with Codex CLI 0.21.0 and authentication flow
|
|
94
|
+
- Implements OpenAI Responses API protocol
|
|
95
|
+
|
|
96
|
+
**OAuth PKCE Authentication Flow**
|
|
97
|
+
|
|
98
|
+
- Implements complete OpenAI OAuth 2.0 PKCE flow matching official Codex CLI
|
|
99
|
+
- Local callback server on port 1455 for authorization code exchange
|
|
100
|
+
- Token refresh and credential management with persistent storage
|
|
101
|
+
- Support for `~/.codex/auth.json` configuration file format
|
|
102
|
+
|
|
103
|
+
**Intelligent Request/Response Handling**
|
|
104
|
+
|
|
105
|
+
- Automatic detection and injection of Codex CLI instructions field
|
|
106
|
+
- Smart streaming behavior based on user's explicit `stream` parameter
|
|
107
|
+
- Session management with flexible session ID handling (auto-generated, persistent, header-forwarded)
|
|
108
|
+
- Request transformation preserving Codex CLI identity headers
|
|
109
|
+
|
|
110
|
+
**Advanced Configuration**
|
|
111
|
+
|
|
112
|
+
- Environment variable support: `CODEX__BASE_URL`
|
|
113
|
+
- Configurable via TOML: `[codex]` section in configuration files
|
|
114
|
+
- Debug logging with request/response capture capabilities
|
|
115
|
+
- Comprehensive error handling with proper HTTP status codes
|
|
116
|
+
- Enabled by default
|
|
117
|
+
|
|
118
|
+
### Technical Implementation
|
|
119
|
+
|
|
120
|
+
**New Components Added:**
|
|
121
|
+
|
|
122
|
+
- `ccproxy/auth/openai.py` - OAuth token management and credential storage
|
|
123
|
+
- `ccproxy/core/codex_transformers.py` - Request/response transformation for Codex format
|
|
124
|
+
- `ccproxy/api/routes/codex.py` - FastAPI routes for Codex endpoints
|
|
125
|
+
- `ccproxy/models/detection.py` - Codex CLI detection and header management
|
|
126
|
+
- `ccproxy/services/codex_detection_service.py` - Runtime detection of Codex CLI requests
|
|
127
|
+
|
|
128
|
+
**Enhanced Proxy Service:**
|
|
129
|
+
|
|
130
|
+
- Extended `ProxyService.handle_codex_request()` with full Codex support
|
|
131
|
+
- Intelligent streaming response conversion when user doesn't explicitly request streaming
|
|
132
|
+
- Comprehensive request/response logging for debugging
|
|
133
|
+
- Error handling with proper OpenAI-compatible error responses
|
|
134
|
+
|
|
135
|
+
### Streaming Behavior Fix
|
|
136
|
+
|
|
137
|
+
**Problem Resolved:** Fixed issue where requests without explicit `stream` field were incorrectly returning streaming responses.
|
|
138
|
+
|
|
139
|
+
**Solution Implemented:**
|
|
140
|
+
|
|
141
|
+
- When `"stream"` field is missing: Inject `"stream": true` for upstream (Codex requirement) but return JSON response to client
|
|
142
|
+
- When `"stream": true` explicitly set: Return streaming response to client
|
|
143
|
+
- When `"stream": false` explicitly set: Return JSON response to client
|
|
144
|
+
- Smart response conversion: collects streaming data and converts to single JSON response when user didn't request streaming
|
|
145
|
+
|
|
146
|
+
### Usage Examples
|
|
147
|
+
|
|
148
|
+
**Basic Request (JSON Response):**
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
curl -X POST "http://127.0.0.1:8000/codex/responses" \
|
|
152
|
+
-H "Content-Type: application/json" \
|
|
153
|
+
-d '{
|
|
154
|
+
"input": [{"type": "message", "role": "user", "content": [{"type": "input_text", "text": "Hello!"}]}],
|
|
155
|
+
"model": "gpt-5",
|
|
156
|
+
"store": false
|
|
157
|
+
}'
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Streaming Request:**
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
curl -X POST "http://127.0.0.1:8000/codex/responses" \
|
|
164
|
+
-H "Content-Type: application/json" \
|
|
165
|
+
-d '{
|
|
166
|
+
"input": [{"type": "message", "role": "user", "content": [{"type": "input_text", "text": "Hello!"}]}],
|
|
167
|
+
"model": "gpt-5",
|
|
168
|
+
"stream": true,
|
|
169
|
+
"store": false
|
|
170
|
+
}'
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Authentication Setup
|
|
174
|
+
|
|
175
|
+
**Environment Variables:**
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
export CODEX__BASE_URL="https://chatgpt.com/backend-api/codex"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Configuration File (`~/.ccproxy.toml`):**
|
|
182
|
+
|
|
183
|
+
```toml
|
|
184
|
+
[codex]
|
|
185
|
+
base_url = "https://chatgpt.com/backend-api/codex"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Compatibility
|
|
189
|
+
|
|
190
|
+
- Codex CLI: Full compatibility with `codex-cli 0.21.0`
|
|
191
|
+
- OpenAI OAuth: Complete PKCE flow implementation
|
|
192
|
+
- Session Management: Supports persistent and auto-generated sessions
|
|
193
|
+
- Model Support: All Codex-supported models (`gpt-5`, `gpt-4`, etc.)
|
|
194
|
+
- Streaming: Both streaming and non-streaming responses
|
|
195
|
+
- Error Handling: Proper HTTP status codes and OpenAI-compatible errors
|
|
196
|
+
- API Compliance: Follows OpenAI Responses API specification
|
|
197
|
+
|
|
198
|
+
### Files Modified/Added
|
|
199
|
+
|
|
200
|
+
**New Files:**
|
|
201
|
+
|
|
202
|
+
- `ccproxy/auth/openai.py` - OpenAI authentication management
|
|
203
|
+
- `ccproxy/core/codex_transformers.py` - Codex request/response transformation
|
|
204
|
+
- `ccproxy/api/routes/codex.py` - Codex API endpoints
|
|
205
|
+
- `ccproxy/models/detection.py` - Codex detection models
|
|
206
|
+
- `ccproxy/services/codex_detection_service.py` - Codex CLI detection service
|
|
207
|
+
|
|
208
|
+
**Modified Files:**
|
|
209
|
+
|
|
210
|
+
- `ccproxy/services/proxy_service.py` - Added `handle_codex_request()` method
|
|
211
|
+
- `ccproxy/config/settings.py` - Added Codex configuration section
|
|
212
|
+
- `ccproxy/api/app.py` - Integrated Codex routes
|
|
213
|
+
- `ccproxy/api/routes/health.py` - Added Codex health checks
|
|
214
|
+
|
|
215
|
+
### Breaking Changes
|
|
216
|
+
|
|
217
|
+
None. This is a purely additive feature that doesn't affect existing Claude provider functionality.
|
|
218
|
+
|
|
219
|
+
### Migration Notes
|
|
220
|
+
|
|
221
|
+
For users wanting to use Codex provider:
|
|
222
|
+
|
|
223
|
+
1. Authenticate: Use existing OpenAI credentials or run Codex CLI login
|
|
224
|
+
2. Update endpoints: Change from `/v1/messages` to `/codex/responses`
|
|
225
|
+
|
|
226
|
+
This implementation provides a complete, production-ready OpenAI Codex proxy solution that maintains the same standards as the existing Claude provider while offering users choice in their AI provider preferences.
|
|
9
227
|
|
|
10
228
|
## Added OpenAI Codex Provider with Full Proxy Support
|
|
11
229
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ccproxy-api
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
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
|
|
@@ -35,6 +35,7 @@ from ccproxy.utils.models_provider import get_models_list
|
|
|
35
35
|
from ccproxy.utils.startup_helpers import (
|
|
36
36
|
check_claude_cli_startup,
|
|
37
37
|
check_codex_cli_startup,
|
|
38
|
+
check_version_updates_startup,
|
|
38
39
|
flush_streaming_batches_shutdown,
|
|
39
40
|
initialize_claude_detection_startup,
|
|
40
41
|
initialize_claude_sdk_startup,
|
|
@@ -46,7 +47,8 @@ from ccproxy.utils.startup_helpers import (
|
|
|
46
47
|
setup_scheduler_shutdown,
|
|
47
48
|
setup_scheduler_startup,
|
|
48
49
|
setup_session_manager_shutdown,
|
|
49
|
-
|
|
50
|
+
validate_claude_authentication_startup,
|
|
51
|
+
validate_codex_authentication_startup,
|
|
50
52
|
)
|
|
51
53
|
|
|
52
54
|
|
|
@@ -72,10 +74,20 @@ class ShutdownComponent(TypedDict):
|
|
|
72
74
|
# Define lifecycle components for startup/shutdown organization
|
|
73
75
|
LIFECYCLE_COMPONENTS: list[LifecycleComponent] = [
|
|
74
76
|
{
|
|
75
|
-
"name": "Authentication",
|
|
76
|
-
"startup":
|
|
77
|
+
"name": "Claude Authentication",
|
|
78
|
+
"startup": validate_claude_authentication_startup,
|
|
77
79
|
"shutdown": None, # One-time validation, no cleanup needed
|
|
78
80
|
},
|
|
81
|
+
{
|
|
82
|
+
"name": "Codex Authentication",
|
|
83
|
+
"startup": validate_codex_authentication_startup,
|
|
84
|
+
"shutdown": None, # One-time validation, no cleanup needed
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "Version Check",
|
|
88
|
+
"startup": check_version_updates_startup,
|
|
89
|
+
"shutdown": None, # One-time check, no cleanup needed
|
|
90
|
+
},
|
|
79
91
|
{
|
|
80
92
|
"name": "Claude CLI",
|
|
81
93
|
"startup": check_claude_cli_startup,
|
|
@@ -7,7 +7,6 @@ from typing import Annotated
|
|
|
7
7
|
from fastapi import Depends, Request
|
|
8
8
|
from structlog import get_logger
|
|
9
9
|
|
|
10
|
-
from ccproxy.auth.dependencies import AuthManagerDep
|
|
11
10
|
from ccproxy.config.settings import Settings, get_settings
|
|
12
11
|
from ccproxy.core.http import BaseProxyClient
|
|
13
12
|
from ccproxy.observability import PrometheusMetrics, get_metrics
|
|
@@ -70,11 +69,8 @@ def get_cached_claude_service(request: Request) -> ClaudeSDKService:
|
|
|
70
69
|
)
|
|
71
70
|
# Get dependencies manually for fallback
|
|
72
71
|
settings = get_cached_settings(request)
|
|
73
|
-
# Create a simple auth manager for fallback
|
|
74
|
-
from ccproxy.auth.credentials_adapter import CredentialsAuthManager
|
|
75
72
|
|
|
76
|
-
|
|
77
|
-
claude_service = get_claude_service(settings, auth_manager)
|
|
73
|
+
claude_service = get_claude_service(settings)
|
|
78
74
|
return claude_service
|
|
79
75
|
|
|
80
76
|
|
|
@@ -84,13 +80,11 @@ SettingsDep = Annotated[Settings, Depends(get_cached_settings)]
|
|
|
84
80
|
|
|
85
81
|
def get_claude_service(
|
|
86
82
|
settings: SettingsDep,
|
|
87
|
-
auth_manager: AuthManagerDep,
|
|
88
83
|
) -> ClaudeSDKService:
|
|
89
84
|
"""Get Claude SDK service instance.
|
|
90
85
|
|
|
91
86
|
Args:
|
|
92
87
|
settings: Application settings dependency
|
|
93
|
-
auth_manager: Authentication manager dependency
|
|
94
88
|
|
|
95
89
|
Returns:
|
|
96
90
|
Claude SDK service instance
|
|
@@ -114,7 +108,6 @@ def get_claude_service(
|
|
|
114
108
|
# This dependency function should not create stateful resources
|
|
115
109
|
|
|
116
110
|
return ClaudeSDKService(
|
|
117
|
-
auth_manager=auth_manager,
|
|
118
111
|
metrics=metrics,
|
|
119
112
|
settings=settings,
|
|
120
113
|
session_manager=session_manager,
|
|
@@ -583,13 +583,16 @@ def setup_error_handlers(app: FastAPI) -> None:
|
|
|
583
583
|
):
|
|
584
584
|
request.state.context.metadata["status_code"] = exc.status_code
|
|
585
585
|
|
|
586
|
-
# Don't log stack trace for
|
|
587
|
-
if exc.status_code
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
586
|
+
# Don't log stack trace for expected errors (404, 401)
|
|
587
|
+
if exc.status_code in (404, 401):
|
|
588
|
+
log_level = "debug" if exc.status_code == 404 else "warning"
|
|
589
|
+
log_func = logger.debug if exc.status_code == 404 else logger.warning
|
|
590
|
+
|
|
591
|
+
log_func(
|
|
592
|
+
f"HTTP {exc.status_code} error",
|
|
593
|
+
error_type=f"http_{exc.status_code}",
|
|
591
594
|
error_message=exc.detail,
|
|
592
|
-
status_code=
|
|
595
|
+
status_code=exc.status_code,
|
|
593
596
|
request_method=request.method,
|
|
594
597
|
request_url=str(request.url.path),
|
|
595
598
|
)
|
|
@@ -613,7 +616,12 @@ def setup_error_handlers(app: FastAPI) -> None:
|
|
|
613
616
|
|
|
614
617
|
# Record error in metrics
|
|
615
618
|
if metrics:
|
|
616
|
-
|
|
619
|
+
if exc.status_code == 404:
|
|
620
|
+
error_type = "http_404"
|
|
621
|
+
elif exc.status_code == 401:
|
|
622
|
+
error_type = "http_401"
|
|
623
|
+
else:
|
|
624
|
+
error_type = "http_error"
|
|
617
625
|
metrics.record_error(
|
|
618
626
|
error_type=error_type,
|
|
619
627
|
endpoint=str(request.url.path),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""OpenAI Codex API routes."""
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
+
import time
|
|
4
5
|
import uuid
|
|
5
6
|
from collections.abc import AsyncIterator
|
|
6
7
|
|
|
@@ -74,11 +75,18 @@ async def codex_responses(
|
|
|
74
75
|
status_code=401,
|
|
75
76
|
detail="No valid OpenAI credentials found. Please authenticate first.",
|
|
76
77
|
)
|
|
78
|
+
except HTTPException:
|
|
79
|
+
# Re-raise HTTPExceptions without chaining to avoid stack traces
|
|
80
|
+
raise
|
|
77
81
|
except Exception as e:
|
|
78
|
-
logger.
|
|
82
|
+
logger.debug(
|
|
83
|
+
"Failed to get OpenAI access token",
|
|
84
|
+
error=str(e),
|
|
85
|
+
error_type=type(e).__name__,
|
|
86
|
+
)
|
|
79
87
|
raise HTTPException(
|
|
80
88
|
status_code=401, detail="Failed to retrieve valid credentials"
|
|
81
|
-
) from
|
|
89
|
+
) from None
|
|
82
90
|
|
|
83
91
|
try:
|
|
84
92
|
# Handle the Codex request
|
|
@@ -92,12 +100,12 @@ async def codex_responses(
|
|
|
92
100
|
)
|
|
93
101
|
return response
|
|
94
102
|
except AuthenticationError as e:
|
|
95
|
-
raise HTTPException(status_code=401, detail=str(e)) from
|
|
103
|
+
raise HTTPException(status_code=401, detail=str(e)) from None
|
|
96
104
|
except ProxyError as e:
|
|
97
|
-
raise HTTPException(status_code=502, detail=str(e)) from
|
|
105
|
+
raise HTTPException(status_code=502, detail=str(e)) from None
|
|
98
106
|
except Exception as e:
|
|
99
107
|
logger.error("Unexpected error in codex_responses", error=str(e))
|
|
100
|
-
raise HTTPException(status_code=500, detail="Internal server error") from
|
|
108
|
+
raise HTTPException(status_code=500, detail="Internal server error") from None
|
|
101
109
|
|
|
102
110
|
|
|
103
111
|
@router.post("/{session_id}/responses", response_model=None)
|
|
@@ -122,11 +130,18 @@ async def codex_responses_with_session(
|
|
|
122
130
|
status_code=401,
|
|
123
131
|
detail="No valid OpenAI credentials found. Please authenticate first.",
|
|
124
132
|
)
|
|
133
|
+
except HTTPException:
|
|
134
|
+
# Re-raise HTTPExceptions without chaining to avoid stack traces
|
|
135
|
+
raise
|
|
125
136
|
except Exception as e:
|
|
126
|
-
logger.
|
|
137
|
+
logger.debug(
|
|
138
|
+
"Failed to get OpenAI access token",
|
|
139
|
+
error=str(e),
|
|
140
|
+
error_type=type(e).__name__,
|
|
141
|
+
)
|
|
127
142
|
raise HTTPException(
|
|
128
143
|
status_code=401, detail="Failed to retrieve valid credentials"
|
|
129
|
-
) from
|
|
144
|
+
) from None
|
|
130
145
|
|
|
131
146
|
try:
|
|
132
147
|
# Handle the Codex request with specific session_id
|
|
@@ -140,12 +155,12 @@ async def codex_responses_with_session(
|
|
|
140
155
|
)
|
|
141
156
|
return response
|
|
142
157
|
except AuthenticationError as e:
|
|
143
|
-
raise HTTPException(status_code=401, detail=str(e)) from
|
|
158
|
+
raise HTTPException(status_code=401, detail=str(e)) from None
|
|
144
159
|
except ProxyError as e:
|
|
145
|
-
raise HTTPException(status_code=502, detail=str(e)) from
|
|
160
|
+
raise HTTPException(status_code=502, detail=str(e)) from None
|
|
146
161
|
except Exception as e:
|
|
147
162
|
logger.error("Unexpected error in codex_responses_with_session", error=str(e))
|
|
148
|
-
raise HTTPException(status_code=500, detail="Internal server error") from
|
|
163
|
+
raise HTTPException(status_code=500, detail="Internal server error") from None
|
|
149
164
|
|
|
150
165
|
|
|
151
166
|
@router.post("/chat/completions", response_model=None)
|
|
@@ -174,11 +189,18 @@ async def codex_chat_completions(
|
|
|
174
189
|
status_code=401,
|
|
175
190
|
detail="No valid OpenAI credentials found. Please authenticate first.",
|
|
176
191
|
)
|
|
192
|
+
except HTTPException:
|
|
193
|
+
# Re-raise HTTPExceptions without chaining to avoid stack traces
|
|
194
|
+
raise
|
|
177
195
|
except Exception as e:
|
|
178
|
-
logger.
|
|
196
|
+
logger.debug(
|
|
197
|
+
"Failed to get OpenAI access token",
|
|
198
|
+
error=str(e),
|
|
199
|
+
error_type=type(e).__name__,
|
|
200
|
+
)
|
|
179
201
|
raise HTTPException(
|
|
180
202
|
status_code=401, detail="Failed to retrieve valid credentials"
|
|
181
|
-
) from
|
|
203
|
+
) from None
|
|
182
204
|
|
|
183
205
|
try:
|
|
184
206
|
# Create adapter for format conversion
|
|
@@ -233,6 +255,9 @@ async def codex_chat_completions(
|
|
|
233
255
|
|
|
234
256
|
# Convert Response API SSE stream to Chat Completions format
|
|
235
257
|
response_headers = {}
|
|
258
|
+
# Generate stream_id and timestamp outside the nested function to avoid closure issues
|
|
259
|
+
stream_id = f"chatcmpl_{uuid.uuid4().hex[:29]}"
|
|
260
|
+
created = int(time.time())
|
|
236
261
|
|
|
237
262
|
async def stream_codex_response() -> AsyncIterator[bytes]:
|
|
238
263
|
"""Stream and convert Response API to Chat Completions format."""
|
|
@@ -317,8 +342,6 @@ async def codex_chat_completions(
|
|
|
317
342
|
|
|
318
343
|
chunk_count = 0
|
|
319
344
|
total_bytes = 0
|
|
320
|
-
stream_id = f"chatcmpl_{uuid.uuid4().hex[:29]}"
|
|
321
|
-
created = int(time.time())
|
|
322
345
|
|
|
323
346
|
# Process SSE events directly without buffering
|
|
324
347
|
line_count = 0
|
|
@@ -951,9 +974,6 @@ async def codex_chat_completions(
|
|
|
951
974
|
|
|
952
975
|
# Create a minimal request context if none exists
|
|
953
976
|
if request_context is None:
|
|
954
|
-
import time
|
|
955
|
-
import uuid
|
|
956
|
-
|
|
957
977
|
request_context = RequestContext(
|
|
958
978
|
request_id=str(uuid.uuid4()),
|
|
959
979
|
start_time=time.perf_counter(),
|
|
@@ -1159,12 +1179,12 @@ async def codex_chat_completions(
|
|
|
1159
1179
|
except HTTPException:
|
|
1160
1180
|
raise
|
|
1161
1181
|
except AuthenticationError as e:
|
|
1162
|
-
raise HTTPException(status_code=401, detail=str(e)) from
|
|
1182
|
+
raise HTTPException(status_code=401, detail=str(e)) from None
|
|
1163
1183
|
except ProxyError as e:
|
|
1164
|
-
raise HTTPException(status_code=502, detail=str(e)) from
|
|
1184
|
+
raise HTTPException(status_code=502, detail=str(e)) from None
|
|
1165
1185
|
except Exception as e:
|
|
1166
1186
|
logger.error("Unexpected error in codex_chat_completions", error=str(e))
|
|
1167
|
-
raise HTTPException(status_code=500, detail="Internal server error") from
|
|
1187
|
+
raise HTTPException(status_code=500, detail="Internal server error") from None
|
|
1168
1188
|
|
|
1169
1189
|
|
|
1170
1190
|
# NOTE: Test endpoint commented out after exploration
|
|
@@ -1222,10 +1242,10 @@ async def codex_chat_completions(
|
|
|
1222
1242
|
# return response
|
|
1223
1243
|
# except AuthenticationError as e:
|
|
1224
1244
|
# logger.warning(f"Auth error for path /{path}: {str(e)}")
|
|
1225
|
-
# raise HTTPException(status_code=401, detail=str(e)) from e
|
|
1245
|
+
# raise HTTPException(status_code=401, detail=str(e)) from None from e
|
|
1226
1246
|
# except ProxyError as e:
|
|
1227
1247
|
# logger.warning(f"Proxy error for path /{path}: {str(e)}")
|
|
1228
|
-
# raise HTTPException(status_code=502, detail=str(e)) from e
|
|
1248
|
+
# raise HTTPException(status_code=502, detail=str(e)) from None from e
|
|
1229
1249
|
# except Exception as e:
|
|
1230
1250
|
# logger.error(f"Unexpected error testing path /{path}", error=str(e))
|
|
1231
1251
|
# raise HTTPException(status_code=500, detail=f"Error testing path: {str(e)}") from e
|
|
@@ -89,17 +89,17 @@ class SchedulerSettings(BaseSettings):
|
|
|
89
89
|
)
|
|
90
90
|
|
|
91
91
|
version_check_interval_hours: int = Field(
|
|
92
|
-
default=
|
|
92
|
+
default=6,
|
|
93
93
|
ge=1,
|
|
94
94
|
le=168, # Max 1 week
|
|
95
95
|
description="Interval in hours between version checks",
|
|
96
96
|
)
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
default=
|
|
98
|
+
version_check_cache_ttl_hours: float = Field(
|
|
99
|
+
default=6,
|
|
100
100
|
ge=0.1,
|
|
101
101
|
le=24.0,
|
|
102
|
-
description="Maximum age in hours since last check
|
|
102
|
+
description="Maximum age in hours since last check version check",
|
|
103
103
|
)
|
|
104
104
|
|
|
105
105
|
model_config = SettingsConfigDict(
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"claude_version": "1.0.77",
|
|
3
|
+
"headers": {
|
|
4
|
+
"anthropic_beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14",
|
|
5
|
+
"anthropic_version": "2023-06-01",
|
|
6
|
+
"anthropic_dangerous_direct_browser_access": "true",
|
|
7
|
+
"x_app": "cli",
|
|
8
|
+
"user_agent": "claude-cli/1.0.77 (external, cli)",
|
|
9
|
+
"x_stainless_lang": "js",
|
|
10
|
+
"x_stainless_retry_count": "0",
|
|
11
|
+
"x_stainless_timeout": "60",
|
|
12
|
+
"x_stainless_package_version": "0.55.1",
|
|
13
|
+
"x_stainless_os": "Linux",
|
|
14
|
+
"x_stainless_arch": "x64",
|
|
15
|
+
"x_stainless_runtime": "node",
|
|
16
|
+
"x_stainless_runtime_version": "v22.17.0"
|
|
17
|
+
},
|
|
18
|
+
"system_prompt": {
|
|
19
|
+
"system_field": [
|
|
20
|
+
{
|
|
21
|
+
"type": "text",
|
|
22
|
+
"text": "You are Claude Code, Anthropic's official CLI for Claude.",
|
|
23
|
+
"cache_control": {
|
|
24
|
+
"type": "ephemeral"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"type": "text",
|
|
29
|
+
"text": "\nYou are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\n\nIMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\nIMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.\n\nIf the user asks for help or wants to give feedback inform them of the following: \n- /help: Get help with using Claude Code\n- To give feedback, users should report the issue at https://github.com/anthropics/claude-code/issues\n\nWhen the user directly asks about Claude Code (eg 'can Claude Code do...', 'does Claude Code have...') or asks in second person (eg 'are you able...', 'can you do...'), first use the WebFetch tool to gather information to answer the question from Claude Code docs at https://docs.anthropic.com/en/docs/claude-code.\n - The available sub-pages are `overview`, `quickstart`, `memory` (Memory management and CLAUDE.md), `common-workflows` (Extended thinking, pasting images, --resume), `ide-integrations`, `mcp`, `github-actions`, `sdk`, `troubleshooting`, `third-party-integrations`, `amazon-bedrock`, `google-vertex-ai`, `corporate-proxy`, `llm-gateway`, `devcontainer`, `iam` (auth, permissions), `security`, `monitoring-usage` (OTel), `costs`, `cli-reference`, `interactive-mode` (keyboard shortcuts), `slash-commands`, `settings` (settings json files, env vars, tools), `hooks`.\n - Example: https://docs.anthropic.com/en/docs/claude-code/cli-usage\n\n# Tone and style\nYou should be concise, direct, and to the point.\nYou MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail.\nIMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.\nIMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.\nDo not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did.\nAnswer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as \"The answer is <answer>.\", \"Here is the content of the file...\" or \"Based on the information provided, the answer is...\" or \"Here is what I will do next...\". Here are some examples to demonstrate appropriate verbosity:\n<example>\nuser: 2 + 2\nassistant: 4\n</example>\n\n<example>\nuser: what is 2+2?\nassistant: 4\n</example>\n\n<example>\nuser: is 11 a prime number?\nassistant: Yes\n</example>\n\n<example>\nuser: what command should I run to list files in the current directory?\nassistant: ls\n</example>\n\n<example>\nuser: what command should I run to watch files in the current directory?\nassistant: [runs ls to list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files]\nnpm run dev\n</example>\n\n<example>\nuser: How many golf balls fit inside a jetta?\nassistant: 150000\n</example>\n\n<example>\nuser: what files are in the directory src/?\nassistant: [runs ls and sees foo.c, bar.c, baz.c]\nuser: which file contains the implementation of foo?\nassistant: src/foo.c\n</example>\nWhen you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).\nRemember that your output will be displayed on a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.\nOutput text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.\nIf you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.\nOnly use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.\nIMPORTANT: Keep your responses short, since they will be displayed on a command line interface.\n\n# Proactiveness\nYou are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:\n- Doing the right thing when asked, including taking actions and follow-up actions\n- Not surprising the user with actions you take without asking\nFor example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.\n\n# Following conventions\nWhen making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.\n- NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language).\n- When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.\n- When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.\n- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.\n\n# Code style\n- IMPORTANT: DO NOT ADD ***ANY*** COMMENTS unless asked\n\n\n# Task Management\nYou have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.\nThese tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.\n\nIt is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.\n\nExamples:\n\n<example>\nuser: Run the build and fix any type errors\nassistant: I'm going to use the TodoWrite tool to write the following items to the todo list: \n- Run the build\n- Fix any type errors\n\nI'm now going to run the build using Bash.\n\nLooks like I found 10 type errors. I'm going to use the TodoWrite tool to write 10 items to the todo list.\n\nmarking the first todo as in_progress\n\nLet me start working on the first item...\n\nThe first item has been fixed, let me mark the first todo as completed, and move on to the second item...\n..\n..\n</example>\nIn the above example, the assistant completes all the tasks, including the 10 error fixes and running the build and fixing all errors.\n\n<example>\nuser: Help me write a new feature that allows users to track their usage metrics and export them to various formats\n\nassistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the TodoWrite tool to plan this task.\nAdding the following todos to the todo list:\n1. Research existing metrics tracking in the codebase\n2. Design the metrics collection system\n3. Implement core metrics tracking functionality\n4. Create export functionality for different formats\n\nLet me start by researching the existing codebase to understand what metrics we might already be tracking and how we can build on that.\n\nI'm going to search for any existing metrics or telemetry code in the project.\n\nI've found some existing telemetry code. Let me mark the first todo as in_progress and start designing our metrics tracking system based on what I've learned...\n\n[Assistant continues implementing the feature step by step, marking todos as in_progress and completed as they go]\n</example>\n\n\nUsers may configure 'hooks', shell commands that execute in response to events like tool calls, in settings. Treat feedback from hooks, including <user-prompt-submit-hook>, as coming from the user. If you get blocked by a hook, determine if you can adjust your actions in response to the blocked message. If not, ask the user to check their hooks configuration.\n\n# Doing tasks\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n- Use the TodoWrite tool to plan the task if required\n- Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.\n- Implement the solution using all tools available to you\n- Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach.\n- VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) with Bash if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to CLAUDE.md so that you will know to run it next time.\nNEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.\n\n- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.\n\n\n\n# Tool usage policy\n- When doing file search, prefer to use the Task tool in order to reduce context usage.\n- You should proactively use the Task tool with specialized agents when the task at hand matches the agent's description.\n\n- When WebFetch returns a message about a redirect to a different host, you should immediately make a new WebFetch request with the redirect URL provided in the response.\n- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run \"git status\" and \"git diff\", send a single message with two tool calls to run the calls in parallel.\n\n\nYou can use the following tools without requiring user approval: Bash(rm:*), Bash(rg:*), Bash(uv run:*), mcp__serena__initial_instructions, mcp__serena__list_memories, mcp__serena__list_dir, mcp__serena__get_symbols_overview, mcp__serena__find_symbol, mcp__serena__search_for_pattern, Bash(make:*), mcp__serena__read_memory, mcp__serena__replace_regex, mcp__serena__think_about_whether_you_are_done, Bash(chmod:*), Bash(ruff check:*), mcp__serena__summarize_changes, Bash(chmod:*), mcp__serena__find_referencing_symbols, mcp__serena__replace_symbol_body, Bash(mv:*), Bash(ls:*), mcp__serena__insert_after_symbol, mcp__serena__think_about_collected_information, mcp__serena__check_onboarding_performed, mcp__serena__find_file, Bash(mkdir:*), Bash(python:*), mcp__serena__think_about_task_adherence, Bash(find:*), Bash(python -m pytest tests/test_credentials_refactored.py::TestJsonFileStorage::test_atomic_file_write -xvs), Bash(python -m pytest tests/test_credentials_refactored.py::TestJsonFileStorage::test_save_and_load -xvs), Bash(find:*), Bash(grep:*), Bash(pytest:*), Bash(mypy:*), Bash(ruff format:*), Bash(ruff format:*), mcp__serena__activate_project, mcp__serena__get_current_config, mcp__serena__insert_before_symbol, Bash(touch:*), Bash(tree:*), Bash(tree:*), Bash(true), Bash(sed:*), Bash(timeout:*), Bash(git commit:*), mcp__serena__initial_instructions, mcp__serena__check_onboarding_performed, mcp__serena__list_dir, mcp__serena__think_about_whether_you_are_done, mcp__serena__read_memory, Bash(pytest:*), Bash(mypy:*), Bash(ruff check:*), Bash(ruff format:*), Bash(python:*), mcp__serena__summarize_changes, Bash(ls:*), mcp__serena__find_file, mcp__serena__replace_regex, mcp__serena__get_symbols_overview, mcp__serena__think_about_task_adherence, mcp__serena__insert_after_symbol, Bash(uv add:*), Bash(uv pip:*), Bash(uv add:*), Bash(uv run:*), Bash(find:*), Bash(curl:*), Bash(bunx:*), Bash(bun run:*), Bash(bun build:*), mcp__zen__challenge, Bash(docker logs:*), mcp__zen__codereview, mcp__zen__analyze, mcp__zen__thinkdeep, mcp__zen__chat, mcp__zen__consensus, mcp__exa__web_search_exa, Bash(git add:*), mcp__zen__planner, Bash(ccproxy serve:*), WebFetch(domain:raw.githubusercontent.com), mcp__context7__resolve-library-id, mcp__serena__onboarding, mcp__serena__write_memory, Bash(git tag:*), Bash(git rebase:*), Bash(git checkout:*)\n\n\n\nHere is useful information about the environment you are running in:\n<env>\nWorking directory: /home/rick/projects-caddy/ccproxy-api\nIs directory a git repo: Yes\nPlatform: linux\nOS Version: Linux 6.12.36\nToday's date: 2025-08-13\n</env>\nYou are powered by the model named Sonnet 4. The exact model ID is claude-sonnet-4-20250514.\n\nAssistant knowledge cutoff is January 2025.\n\n\nIMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\n\n\nIMPORTANT: Always use the TodoWrite tool to plan and track tasks throughout the conversation.\n\n# Code References\n\nWhen referencing specific functions or pieces of code include the pattern `file_path:line_number` to allow the user to easily navigate to the source code location.\n\n<example>\nuser: Where are errors from the client handled?\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.ts:712.\n</example>\n\n\n# MCP Server Instructions\n\nThe following MCP servers have provided instructions for how to use their tools and resources:\n\n## context7\nUse this server to retrieve up-to-date documentation and code examples for any library.\n\n## serena\nYou are a professional coding agent concerned with one particular codebase. You have \naccess to semantic coding tools on which you rely heavily for all your work, as well as collection of memory \nfiles containing general information about the codebase. You operate in a resource-efficient and intelligent manner, always\nkeeping in mind to not read or generate content that is not needed for the task at hand.\n\nWhen reading code in order to answer a user question or task, you should try reading only the necessary code. \nSome tasks may require you to understand the architecture of large parts of the codebase, while for others,\nit may be enough to read a small set of symbols or a single file.\nGenerally, you should avoid reading entire files unless it is absolutely necessary, instead relying on\nintelligent step-by-step acquisition of information. However, if you already read a file, it does not make\nsense to further analyse it with the symbolic tools (except for the `find_referencing_symbols` tool), \nas you already have the information.\n\nI WILL BE SERIOUSLY UPSET IF YOU READ ENTIRE FILES WITHOUT NEED!\n\nCONSIDER INSTEAD USING THE OVERVIEW TOOL AND SYMBOLIC TOOLS TO READ ONLY THE NECESSARY CODE FIRST!\nI WILL BE EVEN MORE UPSET IF AFTER HAVING READ AN ENTIRE FILE YOU KEEP READING THE SAME CONTENT WITH THE SYMBOLIC TOOLS!\nTHE PURPOSE OF THE SYMBOLIC TOOLS IS TO HAVE TO READ LESS CODE, NOT READ THE SAME CONTENT MULTIPLE TIMES!\n\n\nYou can achieve the intelligent reading of code by using the symbolic tools for getting an overview of symbols and\nthe relations between them, and then only reading the bodies of symbols that are necessary to answer the question \nor complete the task. \nYou can use the standard tools like list_dir, find_file and search_for_pattern if you need to.\nWhen tools allow it, you pass the `relative_path` parameter to restrict the search to a specific file or directory.\nFor some tools, `relative_path` can only be a file path, so make sure to properly read the tool descriptions.\n\nIf you are unsure about a symbol's name or location (to the extent that substring_matching for the symbol name is not enough), you can use the `search_for_pattern` tool, which allows fast\nand flexible search for patterns in the codebase.This way you can first find candidates for symbols or files,\nand then proceed with the symbolic tools.\n\n\n\nSymbols are identified by their `name_path and `relative_path`, see the description of the `find_symbol` tool for more details\non how the `name_path` matches symbols.\nYou can get information about available symbols by using the `get_symbols_overview` tool for finding top-level symbols in a file,\nor by using `find_symbol` if you already know the symbol's name path. You generally try to read as little code as possible\nwhile still solving your task, meaning you only read the bodies when you need to, and after you have found the symbol you want to edit.\nFor example, if you are working with python code and already know that you need to read the body of the constructor of the class Foo, you can directly\nuse `find_symbol` with the name path `Foo/__init__` and `include_body=True`. If you don't know yet which methods in `Foo` you need to read or edit,\nyou can use `find_symbol` with the name path `Foo`, `include_body=False` and `depth=1` to get all (top-level) methods of `Foo` before proceeding\nto read the desired methods with `include_body=True`\nYou can understand relationships between symbols by using the `find_referencing_symbols` tool.\n\n\n\nYou generally have access to memories and it may be useful for you to read them, but also only if they help you\nto answer the question or complete the task. You can infer which memories are relevant to the current task by reading\nthe memory names and descriptions.\n\n\nThe context and modes of operation are described below. From them you can infer how to interact with your user\nand which tasks and kinds of interactions are expected of you.\n\nContext description:\nYou are running in IDE assistant context where file operations, basic (line-based) edits and reads, \nand shell commands are handled by your own, internal tools.\nThe initial instructions and the current config inform you on which tools are available to you,\nand how to use them.\nDon't attempt to use any excluded tools, instead rely on your own internal tools\nfor achieving the basic file or shell operations.\n\nIf serena's tools can be used for achieving your task, \nyou should prioritize them. In particular, it is important that you avoid reading entire source code files,\nunless it is strictly necessary! Instead, for exploring and reading code in a token-efficient manner, \nyou should use serena's overview and symbolic search tools. The call of the read_file tool on an entire source code \nfile should only happen in exceptional cases, usually you should first explore the file (by itself or as part of exploring\nthe directory containing it) using the symbol_overview tool, and then make targeted reads using find_symbol and other symbolic tools.\nFor non-code files or for reads where you don't know the symbol's name path you can use the patterns searching tool,\nusing the read_file as a last resort.\n\nModes descriptions:\n\n- You are operating in interactive mode. You should engage with the user throughout the task, asking for clarification\nwhenever anything is unclear, insufficiently specified, or ambiguous.\n\nBreak down complex tasks into smaller steps and explain your thinking at each stage. When you're uncertain about\na decision, present options to the user and ask for guidance rather than making assumptions.\n\nFocus on providing informative results for intermediate steps so the user can follow along with your progress and\nprovide feedback as needed.\n\n- You are operating in editing mode. You can edit files with the provided tools\nto implement the requested changes to the code base while adhering to the project's code style and patterns.\nUse symbolic editing tools whenever possible for precise code modifications.\nIf no editing task has yet been provided, wait for the user to provide one.\n\nWhen writing new code, think about where it belongs best. Don't generate new files if you don't plan on actually\nintegrating them into the codebase, instead use the editing tools to insert the code directly into the existing files in that case.\n\nYou have two main approaches for editing code - editing by regex and editing by symbol.\nThe symbol-based approach is appropriate if you need to adjust an entire symbol, e.g. a method, a class, a function, etc.\nBut it is not appropriate if you need to adjust just a few lines of code within a symbol, for that you should\nuse the regex-based approach that is described below.\n\nLet us first discuss the symbol-based approach.\nSymbols are identified by their name path and relative file path, see the description of the `find_symbol` tool for more details\non how the `name_path` matches symbols.\nYou can get information about available symbols by using the `get_symbols_overview` tool for finding top-level symbols in a file,\nor by using `find_symbol` if you already know the symbol's name path. You generally try to read as little code as possible\nwhile still solving your task, meaning you only read the bodies when you need to, and after you have found the symbol you want to edit.\nBefore calling symbolic reading tools, you should have a basic understanding of the repository structure that you can get from memories\nor by using the `list_dir` and `find_file` tools (or similar).\nFor example, if you are working with python code and already know that you need to read the body of the constructor of the class Foo, you can directly\nuse `find_symbol` with the name path `Foo/__init__` and `include_body=True`. If you don't know yet which methods in `Foo` you need to read or edit,\nyou can use `find_symbol` with the name path `Foo`, `include_body=False` and `depth=1` to get all (top-level) methods of `Foo` before proceeding\nto read the desired methods with `include_body=True`.\nIn particular, keep in mind the description of the `replace_symbol_body` tool. If you want to add some new code at the end of the file, you should\nuse the `insert_after_symbol` tool with the last top-level symbol in the file. If you want to add an import, often a good strategy is to use\n`insert_before_symbol` with the first top-level symbol in the file.\nYou can understand relationships between symbols by using the `find_referencing_symbols` tool. If not explicitly requested otherwise by a user,\nyou make sure that when you edit a symbol, it is either done in a backward-compatible way, or you find and adjust the references as needed.\nThe `find_referencing_symbols` tool will give you code snippets around the references, as well as symbolic information.\nYou will generally be able to use the info from the snippets and the regex-based approach to adjust the references as well.\nYou can assume that all symbol editing tools are reliable, so you don't need to verify the results if the tool returns without error.\n\n\nLet us discuss the regex-based approach.\nThe regex-based approach is your primary tool for editing code whenever replacing or deleting a whole symbol would be a more expensive operation.\nThis is the case if you need to adjust just a few lines of code within a method, or a chunk that is much smaller than a whole symbol.\nYou use other tools to find the relevant content and\nthen use your knowledge of the codebase to write the regex, if you haven't collected enough information of this content yet.\nYou are extremely good at regex, so you never need to check whether the replacement produced the correct result.\nIn particular, you know what to escape and what not to escape, and you know how to use wildcards.\nAlso, the regex tool never adds any indentation (contrary to the symbolic editing tools), so you have to take care to add the correct indentation\nwhen using it to insert code.\nMoreover, the replacement tool will fail if it can't perform the desired replacement, and this is all the feedback you need.\nYour overall goal for replacement operations is to use relatively short regexes, since I want you to minimize the number\nof output tokens. For replacements of larger chunks of code, this means you intelligently make use of wildcards for the middle part \nand of characteristic snippets for the before/after parts that uniquely identify the chunk.\n\nFor small replacements, up to a single line, you follow the following rules:\n\n 1. If the snippet to be replaced is likely to be unique within the file, you perform the replacement by directly using the escaped version of the \n original.\n 2. If the snippet is probably not unique, and you want to replace all occurrences, you use the `allow_multiple_occurrences` flag.\n 3. If the snippet is not unique, and you want to replace a specific occurrence, you make use of the code surrounding the snippet\n to extend the regex with content before/after such that the regex will have exactly one match.\n 4. You generally assume that a snippet is unique, knowing that the tool will return an error on multiple matches. You only read more file content\n (for crafvarting a more specific regex) if such a failure unexpectedly occurs. \n\nExamples:\n\n1 Small replacement\nYou have read code like\n \n ```python\n ...\n x = linear(x)\n x = relu(x)\n return x\n ...\n ```\n\nand you want to replace `x = relu(x)` with `x = gelu(x)`.\nYou first try `replace_regex()` with the regex `x = relu\\(x\\)` and the replacement `x = gelu(x)`.\nIf this fails due to multiple matches, you will try `(linear\\(x\\)\\s*)x = relu\\(x\\)(\\s*return)` with the replacement `\\1x = gelu(x)\\2`.\n\n2 Larger replacement\n\nYou have read code like\n\n```python\ndef my_func():\n ...\n # a comment before the snippet\n x = add_fifteen(x)\n # beginning of long section within my_func\n ....\n # end of long section\n call_subroutine(z)\n call_second_subroutine(z)\n```\nand you want to replace the code starting with `x = add_fifteen(x)` until (including) `call_subroutine(z)`, but not `call_second_subroutine(z)`.\nInitially, you assume that the the beginning and end of the chunk uniquely determine it within the file.\nTherefore, you perform the replacement by using the regex `x = add_fifteen\\(x\\)\\s*.*?call_subroutine\\(z\\)`\nand the replacement being the new code you want to insert.\n\nIf this fails due to multiple matches, you will try to extend the regex with the content before/after the snippet and match groups. \nThe matching regex becomes:\n`(before the snippet\\s*)x = add_fifteen\\(x\\)\\s*.*?call_subroutine\\(z\\)` \nand the replacement includes the group as (schematically):\n`\\1<new_code>`\n\nGenerally, I remind you that you rely on the regex tool with providing you the correct feedback, no need for more verification!\n\nIMPORTANT: REMEMBER TO USE WILDCARDS WHEN APPROPRIATE! I WILL BE VERY UNHAPPY IF YOU WRITE LONG REGEXES WITHOUT USING WILDCARDS INSTEAD!\n\n\n\ngitStatus: This is the git status at the start of the conversation. Note that this status is a snapshot in time, and will not update during the conversation.\nCurrent branch: feature/codex\n\nMain branch (you will usually use this for PRs): main\n\nStatus:\nM tests/conftest.py\n M tests/helpers/assertions.py\n M tests/helpers/test_data.py\n M tests/unit/api/test_api.py\n M tests/unit/auth/test_auth.py\n?? CHANGELOG-codex.md\n?? docs/codex-implementation-plan.md\n?? out.json\n?? req-hel.json\n?? req-min.json\n?? req.json\n?? test.sh\n?? tests/fixtures/external_apis/openai_codex_api.py\n?? tests/unit/services/test_codex_proxy.py\n\nRecent commits:\nf8991df feat: add codex support\n366f807 feat: implement cache_control block limiting for Anthropic API compliance\nf44b400 feat: enable pricing and version checking by default, add version logging\nc3ef714 feat: v0.1.5 release\n7c1d441 feat: add configurable builtin_permissions flag for MCP and SSE control",
|
|
30
|
+
"cache_control": {
|
|
31
|
+
"type": "ephemeral"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"cached_at": "2025-08-13 06:55:26.881133+00:00"
|
|
37
|
+
}
|