13 Commits

Author SHA1 Message Date
Kristian Vastveit
75a3f71200 feat(v1.1.1): auto-mirror macOS Keychain credentials in install.sh
On macOS, Claude Code stores OAuth credentials in Keychain but
hermes-agent reads them from ~/.claude/.credentials.json. The oneliner
would install the patch successfully but auth still failed until users
manually ran DrQbz's Python mirror snippet (README troubleshooting).

install.sh now detects Darwin via 'uname -s' and mirrors the 'Claude
Code-credentials' Keychain entry into ~/.claude/.credentials.json on
every run (with content-compare to skip no-op writes). No-op on Linux
where Claude Code writes the file directly.

- install.sh: Darwin branch reads Keychain via 'security' and mirrors
  to file with 0600 perms; warns if neither Keychain entry nor file
  exist so the user knows to run 'claude auth login --claudeai'
- README.md: troubleshooting section updated to note the auto-mirror,
  keeps the manual Python snippet as a fallback for edge cases
- anthropic_billing_bypass.py: version bump to 1.1.1 (module unchanged,
  tracks the installer release)
- tests/test_install.sh: 3 new tests via PATH-shimmed 'uname' and
  'security' fakes — fresh mirror, idempotent re-run, missing Keychain

Closes the last gap on issue #5 (@DrQbz, macOS Keychain auth).
2026-04-22 12:15:40 +02:00
Kristian Vastveit
b430a8a78f feat(v1.1.0): PascalCase mcp_ tools + Claude Code 2.1.112 fingerprint
Anthropic tightened OAuth validation between 2026-04-14 and 2026-04-22.
Requests are now classified as third-party and routed to extra-usage
credits (or rejected with 'Third-party apps now draw from your extra
usage, not your plan limits') unless the fingerprint matches real
Claude Code. Ports the two upstream opencode-claude-auth fixes that
address this:

- PR #191 (merged, v1.4.10): PascalCase `mcp_` tool names. Hermes
  prefixes tools with lowercase `mcp_bash`; the validator now flags
  that as non-Claude-Code. Real CC uses `mcp_Bash` / `mcp_Read` /
  `mcp_Background_output`. Adds a request-side rewrite hook plus a
  response-side unhook that lowercases the first char after hermes
  strips the prefix, so the tool dispatcher continues to receive the
  original lowercase names.

- PR #207 (open, attempted fix for Claude Code 2.1.112): updates the
  billing fingerprint. Changes the `cc_entrypoint` in the signed
  billing header from `cli` to `sdk-cli`, adds the
  `advisor-tool-2026-03-01` beta flag, injects the Stainless SDK
  headers that real CC sends (`x-stainless-*`) plus
  `anthropic-dangerous-direct-browser-access: true`, and appends
  `?beta=true` to the /v1/messages query string. All non-body signals
  ride the Anthropic Python SDK's per-request `extra_headers` and
  `extra_query` kwargs so we don't need to rewrap the HTTP client.

Other changes:
- Bump __version__ to 1.1.0 and document the rationale above in the
  module docstring.
- Extend `_EXTRA_OAUTH_BETAS` so both prompt-caching and advisor-tool
  betas are appended to hermes's `_OAUTH_ONLY_BETAS` list.
- 10 new unit tests covering PascalCase rewrite (request + response),
  sdk-cli entrypoint, Stainless headers, extra_query=beta:true, and
  preservation of pre-existing extra_headers.

Smoke-tested on Linux with hermes-agent v0.10.0 against claude-sonnet-4-6,
claude-opus-4-6, and claude-opus-4-7 \u2014 all return 200 and complete
responses with the new patch loaded. Billing-tier routing (plan vs
extra-usage) cannot be verified from the client side; this tracks the
best-known upstream bypass as of 2026-04-22 but Anthropic may tighten
validation again at any time.

Refs: #6
Upstream: https://github.com/griffinmartin/opencode-claude-auth/pull/191
Upstream: https://github.com/griffinmartin/opencode-claude-auth/pull/207
2026-04-22 11:56:25 +02:00
Kristian Vastveit
6857168c19 docs: add macOS Keychain auth troubleshooting, credit @DrQbz
Merges the working macOS setup from issue #5 into the Troubleshooting
section. Adds an 'Auth issues' subsection covering the common 401
'authentication failed' / 'No Anthropic credentials found' symptoms and
the Keychain-to-~/.claude/.credentials.json mirror step that fixes them.

The billing/routing section is separated out to keep auth failures
distinct from the 'third-party apps draw from extra usage' bug (#6),
which is a billing-classification issue, not an auth issue.

Closes #5.
2026-04-22 11:56:01 +02:00
Kristian Vastveit
22868d3b69 fix: correct GitHub username in one-liner and README 2026-04-19 11:52:44 +02:00
Kristian Vastveit
9ed27fe1d6 add one-line remote installer 2026-04-13 12:12:32 +02:00
Kristian Vastveit
a1920e2d4b docs: add README 2026-04-12 15:01:51 +02:00
Kristian Vastveit
3bd9378f07 test: add install/uninstall integration test 2026-04-12 15:01:47 +02:00
Kristian Vastveit
047094759d test: add unit tests for signing, bypass, and hook 2026-04-12 15:01:43 +02:00
Kristian Vastveit
cd790313e1 feat: add uninstall script 2026-04-12 15:01:37 +02:00
Kristian Vastveit
3d0ce9f357 feat: add install script with venv detection 2026-04-12 15:01:33 +02:00
Kristian Vastveit
436104b944 feat: add sitecustomize import hook 2026-04-12 15:01:30 +02:00
Kristian Vastveit
a342e3fcec feat: add anthropic billing bypass patch module 2026-04-12 15:01:25 +02:00
Kristian Vastveit
f61d2b80eb init: repo structure, license, gitignore 2026-04-12 15:01:21 +02:00