惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
InfoQ
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
D
DataBreaches.Net
Recent Announcements
Recent Announcements
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog RSS Feed
Y
Y Combinator Blog
博客园 - 【当耐特】
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
量子位
C
Check Point Blog
F
Fortinet All Blogs
罗磊的独立博客
Last Week in AI
Last Week in AI
GbyAI
GbyAI
L
LangChain Blog
博客园 - 司徒正美

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
refactor(anthropic): share Foundry bearer auth policy · o...
vincentkoc · 2026-06-23 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -21,6 +21,10 @@ import type {

2121

ThinkingLevel,

2222

} from "../llm/types.js";

2323

import { parseStreamingJson } from "../llm/utils/json-parse.js";

24+

import {

25+

omitFoundryBearerCredentialHeaders,

26+

usesFoundryBearerAuth,

27+

} from "../shared/anthropic-auth-headers.js";

2428

import {

2529

resolveClaudeNativeThinkingLevelMap,

2630

requiresClaudeAdaptiveThinking,

@@ -256,39 +260,6 @@ function isAnthropicOAuthToken(apiKey: string): boolean {

256260

return apiKey.includes("sk-ant-oat");

257261

}

258262
259-

function hasBearerAuthorizationHeader(headers?: Record<string, string>): boolean {

260-

if (!headers) {

261-

return false;

262-

}

263-

return Object.entries(headers).some(

264-

([key, value]) => key.toLowerCase() === "authorization" && /^bearer\s+\S+/i.test(value.trim()),

265-

);

266-

}

267-
268-

function usesFoundryBearerAuth(model: AnthropicTransportModel): boolean {

269-

return (

270-

model.provider === "microsoft-foundry" &&

271-

(model.authHeader === true || hasBearerAuthorizationHeader(model.headers))

272-

);

273-

}

274-
275-

function omitFoundryBearerCredentialHeaders(

276-

headers?: Record<string, string>,

277-

): Record<string, string> | undefined {

278-

if (!headers) {

279-

return undefined;

280-

}

281-

const next: Record<string, string> = {};

282-

for (const [key, value] of Object.entries(headers)) {

283-

const lower = key.toLowerCase();

284-

if (lower === "authorization" || lower === "x-api-key" || lower === "api-key") {

285-

continue;

286-

}

287-

next[key] = value;

288-

}

289-

return Object.keys(next).length > 0 ? next : undefined;

290-

}

291-
292263

function isDirectAnthropicModel(model: Pick<AnthropicTransportModel, "provider" | "baseUrl">) {

293264

if (normalizeLowercaseStringOrEmpty(model.provider) !== "anthropic") {

294265

return false;

Original file line numberDiff line numberDiff line change

@@ -19,6 +19,10 @@ import {

1919

splitSystemPromptCacheBoundary,

2020

stripSystemPromptCacheBoundary,

2121

} from "../../agents/system-prompt-cache-boundary.js";

22+

import {

23+

omitFoundryBearerCredentialHeaders,

24+

usesFoundryBearerAuth,

25+

} from "../../shared/anthropic-auth-headers.js";

2226

import {

2327

resolveClaudeNativeThinkingLevelMap,

2428

requiresClaudeAdaptiveThinking,

@@ -246,39 +250,6 @@ function mergeHeaders(

246250

return merged;

247251

}

248252
249-

function hasBearerAuthorizationHeader(headers?: Record<string, string>): boolean {

250-

if (!headers) {

251-

return false;

252-

}

253-

return Object.entries(headers).some(

254-

([key, value]) => key.toLowerCase() === "authorization" && /^bearer\s+\S+/i.test(value.trim()),

255-

);

256-

}

257-
258-

function usesFoundryBearerAuth(model: Model<"anthropic-messages">): boolean {

259-

return (

260-

model.provider === "microsoft-foundry" &&

261-

(model.authHeader === true || hasBearerAuthorizationHeader(model.headers))

262-

);

263-

}

264-
265-

function omitFoundryBearerCredentialHeaders(

266-

headers?: Record<string, string>,

267-

): Record<string, string> | undefined {

268-

if (!headers) {

269-

return undefined;

270-

}

271-

const next: Record<string, string> = {};

272-

for (const [key, value] of Object.entries(headers)) {

273-

const lower = key.toLowerCase();

274-

if (lower === "authorization" || lower === "x-api-key" || lower === "api-key") {

275-

continue;

276-

}

277-

next[key] = value;

278-

}

279-

return Object.keys(next).length > 0 ? next : undefined;

280-

}

281-
282253

interface ServerSentEvent {

283254

event: string | null;

284255

data: string;

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,38 @@

1+

type AnthropicAuthModel = {

2+

provider?: string;

3+

authHeader?: boolean;

4+

headers?: Record<string, string>;

5+

};

6+
7+

export function usesFoundryBearerAuth(model: AnthropicAuthModel): boolean {

8+

return (

9+

model.provider === "microsoft-foundry" &&

10+

(model.authHeader === true || hasBearerAuthorizationHeader(model.headers))

11+

);

12+

}

13+
14+

function hasBearerAuthorizationHeader(headers?: Record<string, string>): boolean {

15+

if (!headers) {

16+

return false;

17+

}

18+

return Object.entries(headers).some(

19+

([key, value]) => key.toLowerCase() === "authorization" && /^bearer\s+\S+/i.test(value.trim()),

20+

);

21+

}

22+
23+

export function omitFoundryBearerCredentialHeaders(

24+

headers?: Record<string, string>,

25+

): Record<string, string> | undefined {

26+

if (!headers) {

27+

return undefined;

28+

}

29+

const next: Record<string, string> = {};

30+

for (const [key, value] of Object.entries(headers)) {

31+

const lower = key.toLowerCase();

32+

if (lower === "authorization" || lower === "x-api-key" || lower === "api-key") {

33+

continue;

34+

}

35+

next[key] = value;

36+

}

37+

return Object.keys(next).length > 0 ? next : undefined;

38+

}