Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: anthropics/claude-agent-sdk-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: frograms/claude-agent-sdk-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: oauth
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 8 commits
  • 11 files changed
  • 2 contributors

Commits on Mar 30, 2026

  1. 기능: OAuth 토큰 기반 인증 추가

    Claude Max 사용자가 API 키 없이 로그인된 토큰으로 SDK를 사용할 수 있도록
    OAuth 인증 시스템을 구현했습니다.
    
    주요 기능:
    - AuthProvider 추상화로 확장 가능한 인증 아키텍처
    - OAuth 인증 (macOS Keychain + 파일 기반)
    - API 키 인증 (ANTHROPIC_API_KEY fallback)
    - 자동 감지 및 우선순위 적용 (OAuth → API 키)
    - logging 모듈 사용으로 일관된 출력 관리
    - 의존성 주입으로 테스트 가능성 확보
    
    구현 세부사항:
    - _errors.py: AuthenticationError 에러 타입 추가
    - _internal/auth/: 인증 모듈 생성
      - provider.py: AuthProvider 추상 클래스
      - oauth.py: OAuthProvider 구현 (Keychain/파일 지원)
      - apikey.py: APIKeyProvider 구현
      - __init__.py: create_auth_provider 팩토리 + get_oauth_status 헬퍼
    - _internal/client.py: InternalClient에 AuthProvider 통합
    - __init__.py: AuthenticationError, get_oauth_status export 추가
    - tests/test_auth_provider.py: 12개 단위 테스트 추가
    
    테스트 결과:
    - 12개 새 테스트 모두 통과 ✅
    - 114개 기존 테스트 모두 통과 ✅
    - 총 126개 테스트 성공 ✅
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <[email protected]>
    tim-watcha and claude committed Mar 30, 2026
    Configuration menu
    Copy the full SHA
    b605fc2 View commit details
    Browse the repository at this point in the history
  2. 개선: OAuth 사용 시 ANTHROPIC_API_KEY 자동 제거

    Claude CLI의 인증 우선순위에서 ANTHROPIC_API_KEY가 OAuth보다
    우선하므로, OAuth를 사용할 때는 API 키를 환경변수에서 제거하여
    OAuth 인증이 확실히 사용되도록 개선했습니다.
    
    변경사항:
    - OAuthProvider.prepare()에 API 키 제거 로직 추가
    - 제거 시 debug 로그 출력
    - docstring 업데이트
    
    테스트 결과:
    - API 키 있는 상태에서도 OAuth 우선 사용 확인 ✅
    - 실제 쿼리 정상 동작 확인 ✅
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <[email protected]>
    tim-watcha and claude committed Mar 30, 2026
    Configuration menu
    Copy the full SHA
    8a89d3a View commit details
    Browse the repository at this point in the history
  3. 수정: ClaudeSDKClient에 OAuth 인증 통합

    ClaudeSDKClient는 InternalClient를 사용하지 않고 직접 Transport를
    생성하기 때문에, connect() 메서드에 별도로 인증 로직을 추가했습니다.
    
    변경사항:
    - ClaudeSDKClient.connect()에 create_auth_provider() 추가
    - auth_provider.prepare() 호출로 OAuth 우선 사용
    - API 키 자동 제거 로직 적용
    
    테스트 결과:
    - ClaudeSDKClient도 OAuth 우선 사용 확인 ✅
    - 126개 전체 테스트 통과 ✅
    - query()와 ClaudeSDKClient 모두 OAuth 작동 ✅
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <[email protected]>
    tim-watcha and claude committed Mar 30, 2026
    Configuration menu
    Copy the full SHA
    932ac81 View commit details
    Browse the repository at this point in the history
  4. 문서: README에 OAuth 브랜치 사용 방법 추가

    다른 프로젝트에서 OAuth 브랜치를 사용하는 방법을 한국어로 안내:
    - pyproject.toml 설정 예시 (git branch 지정)
    - uv sync로 설치하는 방법
    - uv sync --upgrade로 업데이트하는 방법
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <[email protected]>
    tim-watcha and claude committed Mar 30, 2026
    Configuration menu
    Copy the full SHA
    ac63061 View commit details
    Browse the repository at this point in the history
  5. 수정: OAuth 모듈 타입 힌트 추가 및 의존성 업데이트

    - oauth.py에 dict[str, Any] 타입 명시로 mypy 에러 수정
    - uv.lock 버전 동기화 (0.1.18)
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Opus 4.5 <[email protected]>
    tim-watcha and claude committed Mar 30, 2026
    Configuration menu
    Copy the full SHA
    cde3ec0 View commit details
    Browse the repository at this point in the history
  6. 수정: OAuth 모듈 lint 에러 수정

    - open() → Path.open() 변경
    - IOError → OSError 변경
    - 중첩 with문을 단일 with문으로 통합
    
    Co-Authored-By: Claude Opus 4.5 <[email protected]>
    tim-watcha and claude committed Mar 30, 2026
    Configuration menu
    Copy the full SHA
    8a36b4f View commit details
    Browse the repository at this point in the history
  7. 기능: CLAUDE_CODE_OAUTH_TOKEN 환경변수 지원 (long-lived token)

    `claude setup-token`으로 발급한 장기 토큰을 CLAUDE_CODE_OAUTH_TOKEN
    환경변수로 설정하면 SDK가 인식하여 CLI에 전달합니다.
    raw 문자열(sk-ant-oat01-...)과 JSON 형식 모두 지원합니다.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
    tim-watcha and claude committed Mar 30, 2026
    Configuration menu
    Copy the full SHA
    4ae270f View commit details
    Browse the repository at this point in the history
  8. 문서: README에 long-lived token 인증 방법 추가

    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
    tim-watcha and claude committed Mar 30, 2026
    Configuration menu
    Copy the full SHA
    9c7ae7f View commit details
    Browse the repository at this point in the history
Loading