@oh-my-pi/pi-coding-agent 6.7.67 → 6.7.670

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-coding-agent",
3
- "version": "6.7.67",
3
+ "version": "6.7.670",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "ompConfig": {
@@ -40,10 +40,10 @@
40
40
  "prepublishOnly": "bun run generate-template && bun run clean && bun run build"
41
41
  },
42
42
  "dependencies": {
43
- "@oh-my-pi/pi-agent-core": "6.7.67",
44
- "@oh-my-pi/pi-ai": "6.7.67",
45
- "@oh-my-pi/pi-git-tool": "6.7.67",
46
- "@oh-my-pi/pi-tui": "6.7.67",
43
+ "@oh-my-pi/pi-agent-core": "6.7.670",
44
+ "@oh-my-pi/pi-ai": "6.7.670",
45
+ "@oh-my-pi/pi-git-tool": "6.7.670",
46
+ "@oh-my-pi/pi-tui": "6.7.670",
47
47
  "@openai/agents": "^0.3.7",
48
48
  "@sinclair/typebox": "^0.34.46",
49
49
  "ajv": "^8.17.1",
@@ -10,7 +10,7 @@
10
10
 
11
11
  import * as os from "node:os";
12
12
  import * as path from "node:path";
13
- import { buildBetaHeader, claudeCodeHeaders, claudeCodeVersion } from "@oh-my-pi/pi-ai";
13
+ import { buildAnthropicHeaders as buildProviderAnthropicHeaders } from "@oh-my-pi/pi-ai";
14
14
  import { getAgentDbPath, getConfigDirPaths } from "../../../config";
15
15
  import { AgentStorage } from "../../agent-storage";
16
16
  import type { AuthCredential, AuthCredentialEntry, AuthStorageData } from "../../auth-storage";
@@ -242,55 +242,19 @@ export async function findAnthropicAuth(): Promise<AnthropicAuthConfig | null> {
242
242
  return null;
243
243
  }
244
244
 
245
- /**
246
- * Checks if a base URL points to the official Anthropic API.
247
- * @param baseUrl - The base URL to check
248
- * @returns True if the URL is for api.anthropic.com over HTTPS
249
- */
250
- function isAnthropicBaseUrl(baseUrl: string): boolean {
251
- try {
252
- const url = new URL(baseUrl);
253
- return url.protocol === "https:" && url.hostname === "api.anthropic.com";
254
- } catch {
255
- return false;
256
- }
257
- }
258
-
259
245
  /**
260
246
  * Builds HTTP headers for Anthropic API requests.
261
247
  * @param auth - The authentication configuration
262
248
  * @returns Headers object ready for use in fetch requests
263
249
  */
264
250
  export function buildAnthropicHeaders(auth: AnthropicAuthConfig): Record<string, string> {
265
- const baseBetas = auth.isOAuth
266
- ? [
267
- "claude-code-20250219",
268
- "oauth-2025-04-20",
269
- "interleaved-thinking-2025-05-14",
270
- "fine-grained-tool-streaming-2025-05-14",
271
- ]
272
- : ["fine-grained-tool-streaming-2025-05-14"];
273
- const betaHeader = buildBetaHeader(baseBetas, ["web-search-2025-03-05"]);
274
-
275
- const headers: Record<string, string> = {
276
- accept: "application/json",
277
- "content-type": "application/json",
278
- "anthropic-dangerous-direct-browser-access": "true",
279
- "anthropic-beta": betaHeader,
280
- "user-agent": `claude-cli/${claudeCodeVersion} (external, cli)`,
281
- "x-app": "cli",
282
- "accept-encoding": "gzip, deflate, br, zstd",
283
- connection: "keep-alive",
284
- ...claudeCodeHeaders,
285
- };
286
-
287
- if (auth.isOAuth || !isAnthropicBaseUrl(auth.baseUrl)) {
288
- headers.authorization = `Bearer ${auth.apiKey}`;
289
- } else {
290
- headers["x-api-key"] = auth.apiKey;
291
- }
292
-
293
- return headers;
251
+ return buildProviderAnthropicHeaders({
252
+ apiKey: auth.apiKey,
253
+ baseUrl: auth.baseUrl,
254
+ isOAuth: auth.isOAuth,
255
+ extraBetas: ["web-search-2025-03-05"],
256
+ stream: false,
257
+ });
294
258
  }
295
259
 
296
260
  /**