diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md index cf9d21ff6..70bc57648 100644 --- a/packages/ai/CHANGELOG.md +++ b/packages/ai/CHANGELOG.md @@ -1,6 +1,23 @@ # Changelog ## [Unreleased] +### Added + +- Added prompt-caching-scope-2026-01-05 beta feature support + +### Changed + +- Updated Claude Code version header to 2.1.39 +- Updated runtime version header to v24.13.1 and package version to 0.73.0 +- Increased request timeout from 60s to 600s +- Reordered Accept-Encoding header values for compression preference +- Updated OAuth authorization and token endpoints to use platform.claude.com +- Expanded OAuth scopes to include user:sessions:claude_code and user:mcp_servers + +### Removed + +- Removed claude-code-20250219 beta feature from default models +- Removed fine-grained-tool-streaming-2025-05-14 beta feature ## [11.13.1] - 2026-02-12 ### Added diff --git a/packages/ai/src/providers/anthropic.ts b/packages/ai/src/providers/anthropic.ts index 72596173a..4dff665a1 100644 --- a/packages/ai/src/providers/anthropic.ts +++ b/packages/ai/src/providers/anthropic.ts @@ -59,19 +59,19 @@ function getCacheControl( } // Stealth mode: Mimic Claude Code headers and tool prefixing. -export const claudeCodeVersion = "1.0.83"; +export const claudeCodeVersion = "2.1.39"; export const claudeToolPrefix = "proxy_"; export const claudeCodeSystemInstruction = "You are Claude Code, Anthropic's official CLI for Claude."; export const claudeCodeHeaders = { "X-Stainless-Helper-Method": "stream", "X-Stainless-Retry-Count": "0", - "X-Stainless-Runtime-Version": "v24.3.0", - "X-Stainless-Package-Version": "0.55.1", + "X-Stainless-Runtime-Version": "v24.13.1", + "X-Stainless-Package-Version": "0.73.0", "X-Stainless-Runtime": "node", "X-Stainless-Lang": "js", "X-Stainless-Arch": "arm64", "X-Stainless-Os": "MacOS", - "X-Stainless-Timeout": "60", + "X-Stainless-Timeout": "600", } as const; export const applyClaudeToolPrefix = (name: string) => { @@ -89,10 +89,9 @@ export const stripClaudeToolPrefix = (name: string) => { }; const claudeCodeBetaDefaults = [ - "claude-code-20250219", "oauth-2025-04-20", "interleaved-thinking-2025-05-14", - "fine-grained-tool-streaming-2025-05-14", + "prompt-caching-scope-2026-01-05", ]; // Prefix tool names for OAuth traffic. @@ -465,7 +464,7 @@ export function buildAnthropicHeaders(options: AnthropicHeaderOptions): Record atob(s); const CLIENT_ID = decode("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl"); -const AUTHORIZE_URL = "https://claude.ai/oauth/authorize"; -const TOKEN_URL = "https://console.anthropic.com/v1/oauth/token"; +const AUTHORIZE_URL = "https://platform.claude.com/oauth/authorize"; +const TOKEN_URL = "https://platform.claude.com/v1/oauth/token"; const CALLBACK_PORT = 54545; const CALLBACK_PATH = "/callback"; -const SCOPES = "org:create_api_key user:profile user:inference"; +const SCOPES = "org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers"; class AnthropicOAuthFlow extends OAuthCallbackFlow { #verifier: string = ""; diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index db40247ac..3f50b84e2 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -1,6 +1,15 @@ # Changelog ## [Unreleased] +### Changed + +- Improved Bun binary detection to check `Bun.env.PI_COMPILED` environment variable +- Enhanced Bun package manager update to install specific version instead of latest +- Added post-update verification for Bun installations to warn if expected version was not installed + +### Fixed + +- Fixed Bun update process to properly handle version pinning and report installation mismatches ## [11.14.0] - 2026-02-12 ### Added diff --git a/packages/coding-agent/src/cli/update-cli.ts b/packages/coding-agent/src/cli/update-cli.ts index f875d0818..288f29186 100644 --- a/packages/coding-agent/src/cli/update-cli.ts +++ b/packages/coding-agent/src/cli/update-cli.ts @@ -17,7 +17,10 @@ import { theme } from "../modes/theme/theme"; * Detect if we're running as a Bun compiled binary. */ const isBunBinary = - import.meta.url.includes("$bunfs") || import.meta.url.includes("~BUN") || import.meta.url.includes("%7EBUN"); + Bun.env.PI_COMPILED || + import.meta.url.includes("$bunfs") || + import.meta.url.includes("~BUN") || + import.meta.url.includes("%7EBUN"); const REPO = "can1357/oh-my-pi"; const PACKAGE = "@oh-my-pi/pi-coding-agent"; @@ -155,15 +158,33 @@ function getNativeAddonName(): string { /** * Update via bun package manager. */ -async function updateViaBun(): Promise { +async function updateViaBun(expectedVersion: string): Promise { console.log(chalk.dim("Updating via bun...")); - try { - execSync(`bun update --latest -g ${PACKAGE}`, { stdio: "inherit" }); - console.log(chalk.green(`\n${theme.status.success} Update complete`)); + execSync(`bun install -g ${PACKAGE}@${expectedVersion}`, { stdio: "inherit" }); } catch (error) { - throw new Error("bun update failed", { cause: error }); + throw new Error("bun install failed", { cause: error }); } + + // Verify the update actually took effect + try { + const result = spawnSync("bun", ["pm", "ls", "-g"], { encoding: "utf-8", stdio: "pipe" }); + const output = result.stdout || ""; + const match = output.match(new RegExp(`${PACKAGE.replace("/", "\\/")}@(\\S+)`)); + if (match) { + const installedVersion = match[1]; + if (compareVersions(installedVersion, expectedVersion) < 0) { + console.log( + chalk.yellow(`\nWarning: bun reports ${installedVersion} installed, expected ${expectedVersion}`), + ); + console.log(chalk.yellow(`Try: bun install -g ${PACKAGE}@latest`)); + return; + } + } + } catch { + // Verification is best-effort, don't fail the update + } + console.log(chalk.green(`\n${theme.status.success} Update complete`)); } /** @@ -280,7 +301,7 @@ export async function runUpdateCommand(opts: { force: boolean; check: boolean }) // Choose update method try { if (!isBunBinary && hasBun()) { - await updateViaBun(); + await updateViaBun(release.version); } else { await updateViaBinary(release); } diff --git a/packages/natives/src/native.ts b/packages/natives/src/native.ts index 89c41515f..451bdbcf3 100644 --- a/packages/natives/src/native.ts +++ b/packages/natives/src/native.ts @@ -45,7 +45,10 @@ const legacyUserDataDir = : path.join(os.homedir(), ".local", "bin"); const downloadUrl = `https://github.com/can1357/oh-my-pi/releases/latest/download/${addonFilename}`; const isCompiledBinary = - import.meta.url.includes("$bunfs") || import.meta.url.includes("~BUN") || import.meta.url.includes("%7EBUN"); + Bun.env.PI_COMPILED || + import.meta.url.includes("$bunfs") || + import.meta.url.includes("~BUN") || + import.meta.url.includes("%7EBUN"); const SUPPORTED_PLATFORMS = ["linux-x64", "linux-arm64", "darwin-x64", "darwin-arm64", "win32-x64"];