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

推荐订阅源

罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
爱范儿
爱范儿
小众软件
小众软件
MyScale Blog
MyScale Blog
美团技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
V
V2EX
量子位
云风的 BLOG
云风的 BLOG
A
About on SuperTechFans
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
C
Check Point 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
fix: prune retired model catalog entries · openclaw/openc...
steipete · 2026-05-23 · via Recent Commits to openclaw:main

@@ -4,6 +4,7 @@ import { CLAUDE_CLI_BACKEND_ID, CLAUDE_CLI_MODEL_ALIASES } from "./cli-constants

44

const DEFAULT_CLAUDE_MODEL_BY_FAMILY: Record<string, string> = {

55

opus: "claude-opus-4-7",

66

sonnet: "claude-sonnet-4-6",

7+

haiku: "claude-sonnet-4-6",

78

};

89910

export type ClaudeCliAnthropicModelRefs = {

@@ -12,6 +13,47 @@ export type ClaudeCliAnthropicModelRefs = {

1213

rewriteRef?: string;

1314

};

141516+

function splitTrailingModelAuthProfile(raw: string): { model: string; profile?: string } {

17+

const trimmed = raw.trim();

18+

if (!trimmed) {

19+

return { model: "" };

20+

}

21+

const lastSlash = trimmed.lastIndexOf("/");

22+

let delimiter = trimmed.indexOf("@", lastSlash + 1);

23+

if (delimiter <= 0) {

24+

return { model: trimmed };

25+

}

26+

if (/^\d{8}(?:@|$)/.test(trimmed.slice(delimiter + 1))) {

27+

const nextDelimiter = trimmed.indexOf("@", delimiter + 9);

28+

if (nextDelimiter < 0) {

29+

return { model: trimmed };

30+

}

31+

delimiter = nextDelimiter;

32+

}

33+

const model = trimmed.slice(0, delimiter).trim();

34+

const profile = trimmed.slice(delimiter + 1).trim();

35+

return model && profile ? { model, profile } : { model: trimmed };

36+

}

37+38+

function attachModelAuthProfile(model: string, profile?: string): string {

39+

return profile ? `${model}@${profile}` : model;

40+

}

41+42+

function hasRetiredVersionPrefix(normalized: string, prefix: string): boolean {

43+

if (normalized === prefix) {

44+

return true;

45+

}

46+

if (!normalized.startsWith(prefix)) {

47+

return false;

48+

}

49+

const next = normalized[prefix.length];

50+

return next === "-" || next === "." || next === ":" || next === "@";

51+

}

52+53+

function hasAnyRetiredVersionPrefix(normalized: string, prefixes: readonly string[]): boolean {

54+

return prefixes.some((prefix) => hasRetiredVersionPrefix(normalized, prefix));

55+

}

56+1557

function parseProviderModelRef(

1658

raw: string,

1759

defaultProvider: string,

@@ -37,17 +79,22 @@ function parseProviderModelRef(

3779

}

38803981

function canonicalizeKnownClaudeCliModelId(modelId: string): string | null {

40-

const trimmed = modelId.trim();

82+

const split = splitTrailingModelAuthProfile(modelId);

83+

const trimmed = split.model.trim();

4184

const normalized = normalizeLowercaseStringOrEmpty(trimmed);

4285

if (!normalized) {

4386

return null;

4487

}

88+

const upgraded = upgradeOldClaudeModelId(normalized);

89+

if (upgraded) {

90+

return attachModelAuthProfile(upgraded, split.profile);

91+

}

4592

if (normalized.startsWith("claude-")) {

46-

return trimmed;

93+

return attachModelAuthProfile(trimmed, split.profile);

4794

}

4895

const defaultModel = DEFAULT_CLAUDE_MODEL_BY_FAMILY[normalized];

4996

if (defaultModel) {

50-

return defaultModel;

97+

return attachModelAuthProfile(defaultModel, split.profile);

5198

}

5299

const family = CLAUDE_CLI_MODEL_ALIASES[normalized];

53100

if (!family) {

@@ -57,7 +104,81 @@ function canonicalizeKnownClaudeCliModelId(modelId: string): string | null {

57104

if (!version || version === normalized) {

58105

return null;

59106

}

60-

return `claude-${family}-${version.replaceAll(".", "-")}`;

107+

return attachModelAuthProfile(`claude-${family}-${version.replaceAll(".", "-")}`, split.profile);

108+

}

109+110+

function upgradeOldClaudeModelId(normalized: string): string | null {

111+

if (normalized.startsWith("claude-opus-4-7") || normalized.startsWith("claude-opus-4.7")) {

112+

return null;

113+

}

114+

if (normalized.startsWith("claude-opus-4-6") || normalized.startsWith("claude-opus-4.6")) {

115+

return null;

116+

}

117+

if (normalized.startsWith("claude-sonnet-4-6") || normalized.startsWith("claude-sonnet-4.6")) {

118+

return null;

119+

}

120+

if (

121+

normalized === "claude-opus-4" ||

122+

hasAnyRetiredVersionPrefix(normalized, [

123+

"claude-opus-4-5",

124+

"claude-opus-4.5",

125+

"claude-opus-4-1",

126+

"claude-opus-4.1",

127+

"claude-opus-4-0",

128+

"claude-opus-4.0",

129+

]) ||

130+

/^claude-opus-4-20\d{6}/.test(normalized)

131+

) {

132+

return "claude-opus-4-7";

133+

}

134+

if (

135+

normalized === "claude-sonnet-4" ||

136+

hasAnyRetiredVersionPrefix(normalized, [

137+

"claude-sonnet-4-5",

138+

"claude-sonnet-4.5",

139+

"claude-sonnet-4-1",

140+

"claude-sonnet-4.1",

141+

"claude-sonnet-4-0",

142+

"claude-sonnet-4.0",

143+

"claude-haiku-4-5",

144+

"claude-haiku-4.5",

145+

]) ||

146+

/^claude-sonnet-4-20\d{6}/.test(normalized)

147+

) {

148+

return "claude-sonnet-4-6";

149+

}

150+

if (normalized.startsWith("claude-3") && normalized.includes("opus")) {

151+

return "claude-opus-4-7";

152+

}

153+

if (

154+

normalized.startsWith("claude-3") &&

155+

(normalized.includes("sonnet") || normalized.includes("haiku"))

156+

) {

157+

return "claude-sonnet-4-6";

158+

}

159+

if (

160+

normalized === "opus-4.5" ||

161+

normalized === "opus-4.1" ||

162+

normalized === "opus-4" ||

163+

normalized === "opus-3"

164+

) {

165+

return "claude-opus-4-7";

166+

}

167+

if (

168+

normalized === "sonnet-4.5" ||

169+

normalized === "sonnet-4.1" ||

170+

normalized === "sonnet-4.0" ||

171+

normalized === "sonnet-4" ||

172+

normalized === "sonnet-3.7" ||

173+

normalized === "sonnet-3.5" ||

174+

normalized === "sonnet-3" ||

175+

normalized === "haiku-4.5" ||

176+

normalized === "haiku-3.5" ||

177+

normalized === "haiku-3"

178+

) {

179+

return "claude-sonnet-4-6";

180+

}

181+

return null;

61182

}

6218363184

export function resolveClaudeCliAnthropicModelRefs(