Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

feat(models): 补登记 Claude Haiku 5.5 与 Sonnet 5.5,恢复思考强度选择 (#5751)

Dash9bdd979e9a72
diff --git a/apps/desktop/src/main/__tests__/claudeLocalSessions.test.ts b/apps/desktop/src/main/__tests__/claudeLocalSessions.test.ts
index b43ed848ab..3d4fdb8012 100644
--- a/apps/desktop/src/main/__tests__/claudeLocalSessions.test.ts
+++ b/apps/desktop/src/main/__tests__/claudeLocalSessions.test.ts
@@ -358,6 +358,32 @@ describe('parseClaudeCodeMessageLine', () => {
expect(rows[0].agentMeta).not.toHaveProperty('parentUuid');
});
+ it.each([
+ ['claude-haiku-5-5', 'claude-haiku-5-5'],
+ ['claude-haiku-5-5[1m]', 'claude-haiku-5-5'],
+ ['claude-sonnet-5-5', 'claude-sonnet-5-5'],
+ ['claude-sonnet-5-5[1m]', 'claude-sonnet-5-5'],
+ ])('keeps the 5.5 generation for %s instead of folding it into an older model', (model, expected) => {
+ const rows = parseClaudeCodeMessageLine(
+ line({
+ type: 'assistant',
+ uuid: `assistant-${model}`,
+ message: {
+ id: `msg-${model}`,
+ model,
+ stop_reason: 'end_turn',
+ usage: { input_tokens: 1, output_tokens: 1 },
+ content: [{ type: 'text', text: 'ok' }],
+ },
+ }),
+ 10,
+ sdkSessionId,
+ 'claude-sonnet-4-6',
+ );
+
+ expect(rows[0].agentMeta).toMatchObject({ model: expected });
+ });
+
it('normalizes opus-4-8 full model id to short form', () => {
const rows = parseClaudeCodeMessageLine(
line({
diff --git a/apps/desktop/src/main/maker-host/__tests__/anthropicModelDiscovery.test.ts b/apps/desktop/src/main/maker-host/__tests__/anthropicModelDiscovery.test.ts
index 059c389a90..67bb99e89e 100644
--- a/apps/desktop/src/main/maker-host/__tests__/anthropicModelDiscovery.test.ts
+++ b/apps/desktop/src/main/maker-host/__tests__/anthropicModelDiscovery.test.ts
@@ -163,12 +163,15 @@ describe('mapAnthropicSdkModels', () => {
const out = mapAnthropicSdkModels([
{ value: 'claude-sonnet-9-unknown', displayName: 'Sonnet 9' },
{ value: 'claude-haiku-9-unknown', displayName: 'Haiku 9' },
+ { value: 'claude-haiku-4-9-unknown', displayName: 'Haiku 4.9' },
]);
// 目录没有该模型、也没有旧缓存明示窗口 → 1M / 200k 是猜的,只能展示。
expect(out[0].model.contextWindow).toBe(1_000_000);
expect(out[0].model.contextWindowVerified).toBeUndefined();
- expect(out[1].model.contextWindow).toBe(200_000);
+ expect(out[1].model.contextWindow).toBe(1_000_000);
expect(out[1].model.contextWindowVerified).toBeUndefined();
+ expect(out[2].model.contextWindow).toBe(200_000);
+ expect(out[2].model.contextWindowVerified).toBeUndefined();
});
it('active registry 快照提供窗口和 effort 基线', () => {
@@ -242,17 +245,22 @@ describe('mapAnthropicSdkModels', () => {
});
});
- it('目录未知且能力缺席时,非 Haiku 新模型先开放 5 档,Haiku 仍保持 0 档', () => {
+ it('目录未知且能力缺席时,新模型(含 Haiku 5 起)先开放 5 档,Haiku 4 及更早仍保持 0 档', () => {
const out = mapAnthropicSdkModels([
{ value: 'claude-opus-6', displayName: 'Opus 6' },
{ value: 'claude-haiku-5', displayName: 'Haiku 5' },
+ { value: 'claude-haiku-4-6', displayName: 'Haiku 4.6' },
]);
expect(out[0]).toMatchObject({ hasEffortInfo: false });
- expect(out[0].model).toMatchObject({
- efforts: ['low', 'medium', 'high', 'xhigh', 'max'],
- defaultEffort: 'high',
- });
- expect(out[1].model).toMatchObject({
+ for (const entry of out.slice(0, 2)) {
+ expect(entry.model).toMatchObject({
+ contextWindow: 1_000_000,
+ efforts: ['low', 'medium', 'high', 'xhigh', 'max'],
+ defaultEffort: 'high',
+ });
+ }
+ expect(out[2].model).toMatchObject({
+ contextWindow: 200_000,
efforts: [],
defaultEffort: null,
});
@@ -1094,3 +1102,20 @@ describe('noteAnthropicSdkSupportedModels(登录态门控 + 合并纪律)', () =
});
});
});
+
+describe('Claude 5.5 目录基线', () => {
+ it('Haiku 5.5 / Sonnet 5.5 能力缺席时取目录五档(默认 medium)', () => {
+ setActiveCatalog(BUNDLED_CATALOG);
+ const out = mapAnthropicSdkModels([
+ { value: 'claude-haiku-5-5', displayName: 'Haiku 5.5' },
+ { value: 'claude-sonnet-5-5', displayName: 'Sonnet 5.5' },
+ ]);
+ for (const entry of out) {
+ expect(entry.model).toMatchObject({
+ efforts: ['low', 'medium', 'high', 'xhigh', 'max'],
+ defaultEffort: 'medium',
+ contextWindow: 1_000_000,
+ });
+ }
+ });
+});
diff --git a/apps/desktop/src/main/maker-host/claude-local-sessions.ts b/apps/desktop/src/main/maker-host/claude-local-sessions.ts
index 39be2edcf6..59369cff05 100644
--- a/apps/desktop/src/main/maker-host/claude-local-sessions.ts
+++ b/apps/desktop/src/main/maker-host/claude-local-sessions.ts
@@ -1039,7 +1039,9 @@ function normalizeClaudeModel(raw: string): string {
if (model.includes('opus-4-7')) return 'claude-opus-4-7';
if (model.includes('opus-4-6')) return 'claude-opus-4-6';
if (model.includes('fable-5')) return 'claude-fable-5';
+ if (model.includes('haiku-5-5')) return 'claude-haiku-5-5';
if (model.includes('haiku-4-5')) return 'claude-haiku-4-5';
+ if (model.includes('sonnet-5-5')) return 'claude-sonnet-5-5';
if (model.includes('sonnet-5')) return 'claude-sonnet-5';
if (model.includes('sonnet-4-6')) return 'claude-sonnet-4-6';
// 历史会话里的裸 'sonnet' 别名(修复前 toSdkModelString 的产物)实际命中的是 4.6。
diff --git a/apps/desktop/src/main/maker-host/model-discovery/anthropic.ts b/apps/desktop/src/main/maker-host/model-discovery/anthropic.ts
index 27e16f65b4..cff2a29cbe 100644
--- a/apps/desktop/src/main/maker-host/model-discovery/anthropic.ts
+++ b/apps/desktop/src/main/maker-host/model-discovery/anthropic.ts
@@ -34,8 +34,8 @@ import { pickModelMetadata } from '@cindy/model-providers';
*
* contextWindow 规则:
* 旧缓存恢复的精确窗口用之;否则读取当前 modelRegistry 的已知窗口;
- * 目录未知时默认 1M,仅 id 含 "haiku" 例外 200k。这样已知旧模型不会被错误提升到
- * 1M,未来新模型仍可在目录更新前按当代默认工作。
+ * 目录未知时默认 1M,仅 Haiku 4 及更早型号例外 200k。这样已知旧模型不会被错误提升到
+ * 1M,未来新模型(含 Haiku 5 起)仍可在目录更新前按当代默认工作。
*
* 磁盘缓存:`<userData>/model-discovery/anthropic-models.json`
* ({ fetchedAt, models, explicitEffortModelIds, explicitFastModeModelIds });只缓存动态获取的
@@ -183,6 +183,15 @@ function labelFromClaudeModelId(id: string): string | null {
return `${parsed.family[0]!.toUpperCase()}${parsed.family.slice(1)} ${parsed.version}`;
}
+/**
+ * Haiku 4 及更早:200K 窗口、不收 effort。Haiku 5 起(如 Haiku 5.5)与当代模型一致:1M、五档 effort,
+ * 不能再按名称里的 haiku 一律判成不可调。
+ */
+function isLegacyHaiku(id: string): boolean {
+ const match = /haiku-(\d+)/.exec(id);
+ return /haiku/.test(id) && !(match && Number(match[1]) >= 5);
+}
+
/**
* contextWindow 规则:缓存恢复的精确值 > 目录已知值 > 未知模型启发式(默认 1M,Haiku 200k)。
*
@@ -201,7 +210,7 @@ function contextWindowFor(
if (catalogWindow !== null) {
return { contextWindow: catalogWindow, contextWindowVerified: true };
}
- return { contextWindow: /haiku/.test(id) ? 200_000 : 1_000_000 };
+ return { contextWindow: isLegacyHaiku(id) ? 200_000 : 1_000_000 };
}
function pickDefaultEffort(efforts: Effort[]): Effort | null {
@@ -237,14 +246,14 @@ export interface SdkMappedModel {
}
/**
- * 动态通道无能力信息时:产品目录基线优先;未知非 Haiku 模型按当代旗舰能力合成
- * 5 档,让新 Opus / Sonnet 上线后无需等客户端目录更新即可使用 xhigh / max。
- * Haiku 保持 0 档;上游后续明确返回能力时仍会逐字段覆盖此临时基线。
+ * 动态通道无能力信息时:产品目录基线优先;未知模型按当代旗舰能力合成 5 档,让新 Opus /
+ * Sonnet / Haiku 上线后无需等客户端目录更新即可使用 xhigh / max。
+ * Haiku 4 及更早保持 0 档;上游后续明确返回能力时仍会逐字段覆盖此临时基线。
*/
function fallbackEffortBaseline(id: string): { efforts: Effort[]; defaultEffort: Effort | null } {
const catalogBaseline = getCindyModelEffortBaseline(id);
if (catalogBaseline) return catalogBaseline;
- const efforts: Effort[] = /haiku/.test(id) ? [] : ['low', 'medium', 'high', 'xhigh', 'max'];
+ const efforts: Effort[] = isLegacyHaiku(id) ? [] : ['low', 'medium', 'high', 'xhigh', 'max'];
return { efforts, defaultEffort: pickDefaultEffort(efforts) };
}
diff --git a/docs/model-catalog-history.md b/docs/model-catalog-history.md
index b3e43db79d..33c3252ceb 100644
--- a/docs/model-catalog-history.md
+++ b/docs/model-catalog-history.md
@@ -3,6 +3,20 @@
> 参考记录,不是当前配置或部署状态。当前维护规则见 [模型配置与下发](dev-rules/model-catalog-maintenance.md)。
> 下列文字记录各批次当时的事实,不能相互当作后续状态的证明。引用时须带日期、来源和验证范围。
+## Claude Haiku 5.5 与 Sonnet 5.5(2026-10-10)
+
+XD Gateway 已上架 `anthropic/claude-haiku-5-5`、`anthropic/claude-sonnet-5-5`,但 Registry 没有这两个型号;
+上游未实报 `reasoning` 时 `/models` 无档位可回落,客户端因而不显示思考强度。本批在 Server 正本与客户端
+离线 Registry 同步新增两者的公共资料与 Claude Code / Codex 官方路由(与 Opus 5.5 相同形态):adaptive 思考、
+图片输入、1M 上下文、128K 输出、low / medium / high / xhigh / max,默认 medium(官方 API 默认 Haiku 5.5 为
+medium、Sonnet 5.5 为 high,此处沿用 Cindy 的 medium 优先)。排序紧接在 Haiku 4.5 / Sonnet 5 之前。
+参考价、Pi 显式成员与默认显示设置本批未改。revision 为 `2026-10-10T16:00:00.000Z`,与 Server 正本同内容。
+
+同批修正两处按名称猜型号的旧逻辑:Anthropic 动态发现在目录缺失时只把 Haiku 4 及更早当作 200K、
+不可调档(Haiku 5 起按当代模型处理);导入本机 Claude Code 会话时不再把 Haiku 5.5 归为 Haiku 4.5、
+Sonnet 5.5 归为 Sonnet 5。依据:[模型总览](https://platform.claude.com/docs/en/about-claude/models/overview)、
+[Effort](https://platform.claude.com/docs/en/build-with-claude/effort),核验日 2026-10-10。
+
## 第三方预设与服务端对齐(2026-09-26)
依据各厂商官方文档(2026-09-26 核对)处理下线、别名与不存在的型号,并以线上服务端推荐清单为基础
diff --git a/packages/model-providers/catalog/model-registry.json b/packages/model-providers/catalog/model-registry.json
index 1c6696cb4b..3cb2f6f7ea 100644
--- a/packages/model-providers/catalog/model-registry.json
+++ b/packages/model-providers/catalog/model-registry.json
@@ -1,6 +1,6 @@
{
"schemaVersion": 5,
- "updatedAt": "2026-10-09T06:00:00.000Z",
+ "updatedAt": "2026-10-10T16:00:00.000Z",
"models": [
{
"id": "openai/gpt-6.1-sol",
@@ -117,6 +117,36 @@
"nativeApi": "anthropic-messages",
"modelRef": "anthropic/claude-opus-5-5"
},
+ {
+ "id": "anthropic/claude-sonnet-5-5",
+ "name": "Sonnet 5.5",
+ "status": "active",
+ "sortOrder": 6,
+ "routes": [
+ {
+ "providerId": "anthropic",
+ "modelId": "claude-sonnet-5-5",
+ "agents": ["claude-code", "codex"]
+ }
+ ],
+ "nativeApi": "anthropic-messages",
+ "modelRef": "anthropic/claude-sonnet-5-5"
+ },
+ {
+ "id": "anthropic/claude-haiku-5-5",
+ "name": "Haiku 5.5",
+ "status": "active",
+ "sortOrder": 9,
+ "routes": [
+ {
+ "providerId": "anthropic",
+ "modelId": "claude-haiku-5-5",
+ "agents": ["claude-code", "codex"]
+ }
+ ],
+ "nativeApi": "anthropic-messages",
+ "modelRef": "anthropic/claude-haiku-5-5"
+ },
{
"id": "openai/gpt-5.6-sol",
"name": "GPT-5.6-Sol",
@@ -3325,6 +3355,33 @@
}
]
},
+ {
+ "id": "anthropic/claude-sonnet-5-5",
+ "aliases": ["claude-sonnet-5-5"],
+ "defaults": {
+ "name": "Sonnet 5.5",
+ "group": "anthropic",
+ "contextWindow": 1000000,
+ "maxOutputTokens": 128000,
+ "efforts": ["low", "medium", "high", "xhigh", "max"],
+ "defaultEffort": "medium",
+ "supportsImageInput": true
+ }
+ },
+ {
+ "id": "anthropic/claude-haiku-5-5",
+ "aliases": ["claude-haiku-5-5"],
+ "defaults": {
+ "name": "Haiku 5.5",
+ "description": "Fastest for quick answers",
+ "group": "anthropic",
+ "contextWindow": 1000000,
+ "maxOutputTokens": 128000,
+ "efforts": ["low", "medium", "high", "xhigh", "max"],
+ "defaultEffort": "medium",
+ "supportsImageInput": true
+ }
+ },
{
"id": "openai/gpt-5.6-sol",
"aliases": [