Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(agent-runtime): keep OAuth Claude fallback unchanged
vastsa91e72b9dcf41
diff --git a/docs/spec/03-runtime/11-provider-model-system.md b/docs/spec/03-runtime/11-provider-model-system.mdindex fa5881ff0..37ab8db4b 100644--- a/docs/spec/03-runtime/11-provider-model-system.md+++ b/docs/spec/03-runtime/11-provider-model-system.md@@ -125,10 +125,11 @@ models.dev record publishes a reasoning `effort` option and noreject `thinking.type=enabled` with HTTP 400, and the model's publishedreasoning options determine that wire shape.Models that still publish `budget_tokens`, including those that also publish-`effort`, keep budget thinking by default. A reasoning-enabled generic model-config with no `thinkingProtocol` or reasoning options also defaults to-adaptive thinking when its id contains `claude` and the wire API is Anthropic-Messages; this covers unpublished Claude relay ids whose metadata is missing.+`effort`, keep budget thinking by default. A reasoning-enabled non-OAuth+generic model config with no `thinkingProtocol` or reasoning options+also defaults to adaptive thinking when its id contains `claude` and the wire+API is Anthropic Messages; this covers unpublished Claude relay ids whose+metadata is missing. Live-only OAuth vendor rows keep their existing fallback.An explicit `ModelBinding.thinkingProtocol` selection (`legacy` or `adaptive`)takes priority, followed by an explicit per-model`compat.forceAdaptiveThinking` value, then catalog metadata or the Claude-iddiff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 9b7f34d19..c56f2e9fa 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -498,8 +498,8 @@### E2E-PROVIDER-adaptive-thinking-protocol-- **Preconditions:** Isolated provider settings fixture with an Anthropic- Messages provider, `claude-opus-5-5`, a legacy Claude model, and a+- **Preconditions:** Isolated provider settings fixture with a non-OAuth+ Anthropic Messages provider, `claude-opus-5-5`, a legacy Claude model, and aClaude-named relay id whose generic model config has no protocol orreasoning-options metadata;no live credentials.diff --git a/docs/zh-CN/spec/03-runtime/11-provider-model-system.md b/docs/zh-CN/spec/03-runtime/11-provider-model-system.mdindex 299b84913..59a9c65ae 100644--- a/docs/zh-CN/spec/03-runtime/11-provider-model-system.md+++ b/docs/zh-CN/spec/03-runtime/11-provider-model-system.md@@ -119,8 +119,9 @@ OpenAI 风格的 Copilot 线路 API 仍将令牌作为请求密钥签名;所`thinking.type=enabled`,而 Pi catalog 不携带 pi-ai 的 compat 记录,缺少该标志时pi-ai 会回落到 budget 思考。仍发布 `budget_tokens` 的模型保持 budget 思考,显式的目录 `compat` 记录会被保留。对于已启用推理、但没有 `thinkingProtocol` 或推理选项的-通用模型配置,如果模型 ID 含有 `claude` 且 wire API 为 Anthropic Messages,也默认使用-adaptive 思考;这覆盖缺少元数据的未发布 Claude 中继模型 ID。显式的+非 OAuth 通用模型配置,如果模型 ID 含有 `claude` 且 wire API 为 Anthropic Messages,也默认使用+adaptive 思考;这覆盖缺少元数据的未发布 Claude 中继模型 ID。仅实时提供的 OAuth 厂商模型+保留原有回退行为。显式的`ModelBinding.thinkingProtocol`(`legacy` 或 `adaptive`)优先级最高,其次是显式的模型级 `compat.forceAdaptiveThinking`,再之后才根据目录元数据或 Claude ID 回退规则判断。对于目录中已发布的模型,模型设置会根据相同的 effort/budget 元数据推导并显示协议。diff --git a/packages/agent-runtime/src/provider-binding.test.ts b/packages/agent-runtime/src/provider-binding.test.tsindex ecc82d845..00bbe1116 100644--- a/packages/agent-runtime/src/provider-binding.test.ts+++ b/packages/agent-runtime/src/provider-binding.test.ts@@ -523,6 +523,16 @@ describe("Anthropic adaptive thinking from models.dev reasoning options", () =>expect(request?.thinking).toHaveProperty("budget_tokens");});+ it("keeps the legacy default for live-only OAuth Claude ids", async () => {+ const provider = genericAnthropicProvider("claude-sonnet-99");+ provider.authKind = "oauth";+ provider.vendorKey = "github-copilot";+ const request = await thinkingRequest(provider);++ expect(request?.thinking).toMatchObject({ type: "enabled" });+ expect(request?.thinking).toHaveProperty("budget_tokens");+ });+it("honors an explicit legacy protocol on a generic Claude model", async () => {const request = await thinkingRequest(genericAnthropicProvider("claude-relay-model", {diff --git a/packages/agent-runtime/src/provider-binding.ts b/packages/agent-runtime/src/provider-binding.tsindex bc3079ef5..0618a651f 100644--- a/packages/agent-runtime/src/provider-binding.ts+++ b/packages/agent-runtime/src/provider-binding.ts@@ -350,10 +350,11 @@ export function buildProviderModel(const autoAdaptiveThinking =catalogModel.thinkingProtocol === undefined && requiresAdaptiveThinking(catalogModel);// A generic model projection can still be present when the catalog misses a- // model (#926). With no protocol or reasoning options, a Claude id on the- // Anthropic wire is the remaining signal for adaptive thinking.+ // model (#926). OAuth vendor rows may expose live-only Claude ids, so only+ // use the id heuristic for non-OAuth rows without protocol or options.const customClaudeId =catalog?.source === "generic" &&+ provider.authKind !== "oauth" &&catalogModel.reasoning === true &&catalogModel.thinkingProtocol === undefined &&(catalogModel.reasoningOptions?.length ?? 0) === 0 &&