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(composer): display configured model context limits
zszz39e51902490db
diff --git a/apps/desktop/src/lib/composer-models.ts b/apps/desktop/src/lib/composer-models.tsindex 9db299e6f..f64785c1d 100644--- a/apps/desktop/src/lib/composer-models.ts+++ b/apps/desktop/src/lib/composer-models.ts@@ -1,5 +1,6 @@import {bindingSupportsImages,+ effectiveContextWindow,isImageGenerationModel,type ImageGenerationBindings,modelMatchesFilter,@@ -43,13 +44,21 @@ export function composerModelsForProvider(const metadata = (discovered ?? []).find((model) =>sameComposerModelId(model.modelId, modelId),);+ const binding = composerModelBinding(provider, modelId);+ const contextWindow = effectiveContextWindow(+ metadata?.contextWindow,+ binding?.contextWindow,+ binding?.contextWindowSource,+ );+ const contextLimit = contextWindow === undefined ? {} : { contextWindow };const displayName = modelId;return metadata- ? { ...metadata, modelId, displayName, providerId: provider.id }+ ? { ...metadata, ...contextLimit, modelId, displayName, providerId: provider.id }: {modelId,displayName,providerId: provider.id,+ ...contextLimit,capabilities: ["text"],source: "user" as const,};diff --git a/docs/spec/03-runtime/13-model-catalog-and-selection.md b/docs/spec/03-runtime/13-model-catalog-and-selection.mdindex 5fae83faf..2e6fd2cf0 100644--- a/docs/spec/03-runtime/13-model-catalog-and-selection.md+++ b/docs/spec/03-runtime/13-model-catalog-and-selection.md@@ -442,6 +442,8 @@ retain the existing session configuration and permission boundaries.Warnings are non-blocking unless execution is impossible.+Composer context-window labels resolve the exact binding with `effectiveContextWindow`: explicit user limits override discovery, catalog-owned limits follow discovery, and legacy bindings preserve their saved limits. A binding with a valid saved limit still displays it when discovery is unavailable. This display resolution does not modify the discovered catalog or runtime safety budgets.+### 11.1 Reasoning capability resolution1. Resolve published Pi thinking metadata for the exact physical model.diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 41345470d..7e80261a4 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -17097,3 +17097,9 @@ host-created files. The full app's file-preview viewer is covered separately.Playwright can be supplied through `PI_TEST_PLAYWRIGHT`). Only the model serveris simulated in the Electron flow. The fixture profile and screenshots stayunder `.artifacts/` for inspection; no user profile or paid model is used.++### E2E-COMPOSER-configured-context-window++- **Steps:** Save a 500K user context limit for a model whose catalog publishes 1M. Open the Composer model list, then send a short message and inspect context usage. Repeat with a catalog-owned limit and with discovery unavailable.+- **Expected:** The user-configured row and context inspector show 500K; a catalog-owned row follows the published limit; a configured model without discovery retains its saved context label. Model selection remains unchanged.+- **Status:** Manual validation scenario; no new automated regression test.diff --git a/docs/zh-CN/spec/03-runtime/13-model-catalog-and-selection.md b/docs/zh-CN/spec/03-runtime/13-model-catalog-and-selection.mdindex 98a3d2418..2a073f373 100644--- a/docs/zh-CN/spec/03-runtime/13-model-catalog-and-selection.md+++ b/docs/zh-CN/spec/03-runtime/13-model-catalog-and-selection.md@@ -280,6 +280,8 @@ type ModelCatalogItem = {除非不可能执行,否则警告是非阻塞的。+Composer context-window labels resolve the exact binding with `effectiveContextWindow`: explicit user limits override discovery, catalog-owned limits follow discovery, and legacy bindings preserve their saved limits. A binding with a valid saved limit still displays it when discovery is unavailable. This display resolution does not modify the discovered catalog or runtime safety budgets.+### 11.1 Reasoning capability resolution1. Resolve published Pi thinking metadata for the exact physical model.diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex 0650fd415..6d28c828d 100644--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md@@ -9447,3 +9447,9 @@ preload, API normalization, store events, ToolRow, and Markdown renderer.No provider credentials or paid model calls are required. The fixture ends atwork-panel file-request routing; artifact bytes are verified from the realhost-created files. The full app's file-preview viewer is covered separately.++### E2E-COMPOSER-configured-context-window++- **Steps:** Save a 500K user context limit for a model whose catalog publishes 1M. Open the Composer model list, then send a short message and inspect context usage. Repeat with a catalog-owned limit and with discovery unavailable.+- **Expected:** The user-configured row and context inspector show 500K; a catalog-owned row follows the published limit; a configured model without discovery retains its saved context label. Model selection remains unchanged.+- **Status:** Manual validation scenario; no new automated regression test.