fix: update TypeScript and enhance ANTHROPIC_API_KEY validation

paperclipai/paperclip·May 16, 2026·❌ Open

Unsetting API key in adapter config still inherited host env var through process.env merging, causing incorrect probe failures.

Paperclip orchestrates AI agents for zero-human companies, and the Claude Local adapter is responsible for executing Claude CLI commands and validating environment configuration. A subtle bug existed where explicitly unsetting ANTHROPIC_API_KEY in adapter config (e.g., { type: 'plain', value: '' }) would still inherit the host environment's API key through process.env merging, causing incorrect probe failures and misleading error messages.

This PR fixed the environment isolation bug by adding configExplicitlyHasAnthropicApiKey detection to prevent host ANTHROPIC_API_KEY leakage when config explicitly overrides it. It also added automatic subscription-auth fallback — extracting probe execution into a runSingleProbe helper and adding automatic retry without API key when the host-provided key fails, with successful fallback reporting as a warn-level pass instead of error. Better error diagnostics were added via a describeClaudeFailure helper that surfaces structured Claude error messages (Insufficient credits, Invalid API key) instead of raw stderr. TypeScript was also bumped from ^5.7.3 to ^5.9.3. The changes across 5 files included 578 additions and 68 deletions.

GitHub
LinkedIn
LeetCode