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(settings): make market failures retryable (#1697)
Lanb6e439437769
diff --git a/apps/desktop/src/components/settings/McpMarketPanel.tsx b/apps/desktop/src/components/settings/McpMarketPanel.tsxindex 9b5a15289..e9be68bcf 100644--- a/apps/desktop/src/components/settings/McpMarketPanel.tsx+++ b/apps/desktop/src/components/settings/McpMarketPanel.tsx@@ -115,6 +115,7 @@ export function McpMarketPanel({const [values, setValues] = useState<Record<string, string>>({});const [saving, setSaving] = useState(false);const [remote, setRemote] = useState<RemoteState>(REMOTE_IDLE);+ const [catalogRetry, setCatalogRetry] = useState(0);const [sources, setSources] = useState<MarketSource[]>(loadSources);// Whether a plaintext hop to a user-supplied source is allowed, from the// stored `networkPolicy`. The panel validates its persisted list with the same@@ -180,7 +181,11 @@ export function McpMarketPanel({cancelled = true;clearTimeout(timer);};- }, [search, sources]);+ }, [search, sources, catalogRetry]);+ const retryCatalog = () => {+ setRemote((current) => ({ ...current, status: "loading", loadingMore: false }));+ setCatalogRetry((current) => current + 1);+ };const loadMore = async () => {if (remote.loadingMore) return;const generation = requestGeneration.current;@@ -590,10 +595,30 @@ export function McpMarketPanel({</p>) : null}{remote.status === "error" ? (- <p className="mcpm-status is-error" role="status">- {t("settings.mcpMarket.remoteError")}- {remote.failed.length ? ` (${remote.failed.join(", ")})` : ""}- </p>+ <>+ <p className="mcpm-status is-error" role="status">+ {t("settings.mcpMarket.remoteError")}+ {remote.failed.length ? ` (${remote.failed.join(", ")})` : ""}+ </p>+ <button type="button" className="mcpm-install is-ghost" onClick={retryCatalog}>+ {t("settings.mcpMarket.retry")}+ </button>+ </>+ ) : null}+ {remote.status === "ready" && remote.failed.length ? (+ <>+ <p className="mcpm-status">+ {t("settings.mcpMarket.remotePartial", { names: remote.failed.join(", ") })}+ </p>+ <button+ type="button"+ className="mcpm-install is-ghost"+ disabled={remote.loadingMore}+ onClick={retryCatalog}+ >+ {t("settings.mcpMarket.retry")}+ </button>+ </>) : null}<div className="mcpm-list" role="list">diff --git a/apps/desktop/src/components/settings/SkillMarketPanel.tsx b/apps/desktop/src/components/settings/SkillMarketPanel.tsxindex b3c916b1b..a2059fd85 100644--- a/apps/desktop/src/components/settings/SkillMarketPanel.tsx+++ b/apps/desktop/src/components/settings/SkillMarketPanel.tsx@@ -177,6 +177,7 @@ export function SkillMarketPanel({url: "",});const [remote, setRemote] = useState<RemoteState>(REMOTE_IDLE);+ const [catalogRetry, setCatalogRetry] = useState(0);useEffect(() => {let cancelled = false;@@ -209,18 +210,7 @@ export function SkillMarketPanel({useEffect(() => {let cancelled = false;const timer = setTimeout(() => {- setRemote((current) =>- current.status === "idle" || current.status === "ready"- ? {- status: "loading",- entries: current.entries,- failed: current.failed,- failureKinds: current.failureKinds,- failureDetails: current.failureDetails,- queryError: current.queryError,- }- : current,- );+ setRemote((current) => ({ ...current, status: "loading" }));api.searchSkillMarket(search, [...DEFAULT_SKILL_SOURCES, ...sources]).then((result) => {@@ -254,7 +244,7 @@ export function SkillMarketPanel({cancelled = true;clearTimeout(timer);};- }, [search, sources]);+ }, [search, sources, catalogRetry]);const sourceName = (id?: string) =>id@@ -334,6 +324,11 @@ export function SkillMarketPanel({if (installFor) loadDocument(installFor);};+ const retryCatalog = () => {+ setRemote((current) => ({ ...current, status: "loading" }));+ setCatalogRetry((current) => current + 1);+ };+const install = async () => {if (!installFor || installing) return;setInstalling(true);@@ -690,6 +685,9 @@ export function SkillMarketPanel({{hasUnresolvedFailure(remote.failureKinds) ? (<p className="sklm-status">{t("settings.sklm.dnsHint")}</p>) : null}+ <button type="button" className="sklm-install is-ghost" onClick={retryCatalog}>+ {t("settings.sklm.retryCatalog")}+ </button></>) : null}{remote.status === "ready" && remote.failed.length ? (@@ -706,6 +704,9 @@ export function SkillMarketPanel({{hasUnresolvedFailure(remote.failureKinds) ? (<p className="sklm-status">{t("settings.sklm.dnsHint")}</p>) : null}+ <button type="button" className="sklm-install is-ghost" onClick={retryCatalog}>+ {t("settings.sklm.retryCatalog")}+ </button></>) : null}diff --git a/apps/desktop/test/mcp-market-panel.test.mjs b/apps/desktop/test/mcp-market-panel.test.mjsindex 1dce53609..2ae613319 100644--- a/apps/desktop/test/mcp-market-panel.test.mjs+++ b/apps/desktop/test/mcp-market-panel.test.mjs@@ -28,6 +28,15 @@ test("install sheet shows the exact command and collects required values", () =>assert.match(panel, /type="password"/);});+test("failed and partial MCP catalog searches can be retried", () => {+ assert.match(panel, /const \[catalogRetry, setCatalogRetry\] = useState\(0\)/);+ assert.match(panel, /\[search, sources, catalogRetry\]/);+ assert.match(panel, /const retryCatalog = \(\) => \{/);+ assert.match(panel, /settings\.mcpMarket\.retry/);+ assert.match(panel, /settings\.mcpMarket\.remotePartial/);+ assert.match(panel, /remote\.status === "ready" && remote\.failed\.length/);+});+test("installed state comes from matching server ids", () => {assert.match(panel, /installedIds\.includes\(entry\.id\)/);assert.match(page, /installedIds=\{\[\.\.\.globalServers, \.\.\.projectServers\]/);@@ -45,6 +54,17 @@ test("market strings exist in en and zh-CN", () => {assert.match(locale, /browse: "/);assert.match(locale, /installSuccess: "/);assert.match(locale, /"category\.devtools": "/);+ assert.match(locale, /remotePartial: "/);+ assert.match(locale, /retry: "/);+ }+});++test("every shipped locale carries the MCP market recovery strings", async () => {+ const ids = ["en", "zh-CN", "zh-TW", "de", "es", "fr", "ko", "tr", "pt-BR"];+ for (const id of ids) {+ const locale = await read(`../../../packages/i18n/src/locales/${id}/index.ts`);+ assert.match(locale, /remotePartial: "/, `${id} remotePartial`);+ assert.match(locale, /retry: "/, `${id} retry`);}});diff --git a/apps/desktop/test/skill-market-panel.test.mjs b/apps/desktop/test/skill-market-panel.test.mjsindex 72ce0cd6e..da04e4037 100644--- a/apps/desktop/test/skill-market-panel.test.mjs+++ b/apps/desktop/test/skill-market-panel.test.mjs@@ -112,6 +112,14 @@ test("the market list explains a policy refusal instead of a bare unreachable",assert.match(panel, /queryError: skillMarketFailureDetail\(error\)/);});+test("failed and partial skill catalog searches can be retried", () => {+ assert.match(panel, /const \[catalogRetry, setCatalogRetry\] = useState\(0\)/);+ assert.match(panel, /\[search, sources, catalogRetry\]/);+ assert.match(panel, /const retryCatalog = \(\) => \{/);+ assert.match(panel, /settings\.sklm\.retryCatalog/);+ assert.match(panel, /setRemote\(\(current\) => \(\{ \.\.\.current, status: "loading" \}\)\)/);+});+test("a resolver with no answer is explained as that, not as an address check", () => {// Issue #419, second round: one `policy` bucket meant a local resolver that// answered nothing produced the same sentence as an address the guard had@@ -138,7 +146,8 @@ test("a resolver with no answer is explained as that, not as an address check",assert.match(panel, /remote\.failureDetails\[name\]\?\.host/);// And the host reaches the state from the IPC result.assert.match(panel, /failureDetails: result\.failureDetails \?\? \{\}/);- assert.match(panel, /failureDetails: current\.failureDetails/);+ // The retry loading state preserves the last host details until the request resolves.+ assert.match(panel, /setRemote\(\(current\) => \(\{ \.\.\.current, status: "loading" \}\)\)/);});test("a proxy fake-IP gets its own copy and names the address it came from", () => {@@ -182,6 +191,7 @@ test("every shipped locale carries the new skill market strings", async () => {"fakeIpHintPlain","failureDetail","retryPreview",+ "retryCatalog","remoteErrorPolicy","remoteErrorUnresolved","remoteErrorFakeIp",diff --git a/docs/spec/04-ux/06-settings-ia.md b/docs/spec/04-ux/06-settings-ia.mdindex c9ba803b1..3e61a737f 100644--- a/docs/spec/04-ux/06-settings-ia.md+++ b/docs/spec/04-ux/06-settings-ia.md@@ -687,6 +687,9 @@ system while preserving their different data ownership:explanation — and a market whose sources were refused by the public-networkguard says so instead of calling every source unreachable, because a proxieduser sees that refusal while the same URL opens in their browser (ADR 0177).+ A failed catalog query offers Retry; the same action remains available when+ only some sources failed. It repeats the current search over the configured+ sources and announces loading while the request runs.Back reloads the skill list.- Skills also exposes **Scan other tools** in its toolbar. The explicit scanopens inline on the Skills page, and imported entries follow the current@@ -696,6 +699,9 @@ system while preserving their different data ownership:opens inline on the MCP page. Imported servers follow the current Global /Project filter and selected project; secrets and header values are nevershown in candidate rows.+- MCP Market offers Retry after a failed query or partial source failure. It+ repeats the current search through the existing market request path and+ announces loading while the request runs.- The Subagents create/edit sheet pins a model with a searchable, provider-grouped anchored menu — the same option-menu control the service picker uses— over the configured, runnable models the Composer offers, plus andiff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex d56a21457..4124df4cf 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -10027,6 +10027,7 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.| E — Tools & permissions (Skill residency) | E2E-254 || Quality (Skill residency and IME slash alias) | E2E-254, E2E-255 || C / E / F / Quality — Built-in skill activation | E2E-SKILL-builtin-activation |+| Quality — Market catalog retry recovery | E2E-MARKET-CATALOG-RETRY || C — Conversation & stream (plugin session import visibility) | E2E-257 || F — Persistence (plugin session import visibility) | E2E-257 || G — Plugins (session import visibility) | E2E-257 |@@ -16299,6 +16300,7 @@ plugin-form fixtures in an isolated temporary directory at runtime.| E2E-MCP-MARKET-INSTALL | Builtin catalog entry resolves through `resolveCatalogEntry` and installs via the host `mcp.upsert` RPC; record lands in `~/.agents/servers/` | real host binary, isolated temp HOME || E2E-MCP-MARKET-HEADER-SCOPE | Registry header-local `{token}` resolves only in its header; same-named URL path/query tokens remain literal through mapping, resolution, host upsert/list and persistence. URL templates retain only legacy `${NAME}` substitution. When `headerBindings` exists (even empty or partial), unbound tokens in every header stay literal and never consume another header's input or default | shared regressions plus real host binary with isolated temporary storage; remote entry disabled, no network call || E2E-MCP-MARKET-partial-header-bindings-stay-literal | Resolve a catalog with only Authorization bound and another header using the same `{token}` / `${token}`; an undeclared `${UNBOUND}` in a third header also remains literal through host upsert/list and disk persistence | real host binary, disabled remote entry, synthetic input and isolated temporary storage; no network call |+| E2E-MARKET-CATALOG-RETRY | In Skill Market and MCP Market, a failed query and then a partial source failure expose Retry; clicking it announces loading, refreshes the same query, and clears the failure when the source recovers | real React components in Electron with deterministic mocked market API responses; no live network |#### E2E-SKILL-MARKET-NET-BOUNDARY: A user-supplied source reaches the LAN, third-party content does not@@ -16348,6 +16350,25 @@ plugin-form fixtures in an isolated temporary directory at runtime.`apps/desktop/test/skill-market-policy-refusal.test.mjs`,`packages/shared/src/public-network.test.ts`)+#### E2E-MARKET-CATALOG-RETRY: Retry a failed or partially available market query++- **Preconditions**: Rendered Skill Market and MCP Market panels with the+ market APIs stubbed at the IPC boundary. Each API returns a total failure,+ then a result with one failed source, then a complete result.+- **Steps**: Open each market; click Retry after the total failure; confirm the+ loading announcement and recovered entry; click Retry again after the+ partial failure.+- **Expected**: Both markets repeat the current search, show loading while the+ request runs, retain a Retry action for partial failures, and clear the failed+ source after recovery. The test makes no live network request and does not+ change the main-process network policy.+- **Specs linked**: `04-ux/06-settings-ia.md`, ADR 0177, ADR 0272+- **Acceptance**: Quality+- **Milestone**: M6++- **Status**: Automated (`pnpm test:e2e:market-retry`,+ `apps/desktop/test/skill-market-panel.test.mjs`,+ `apps/desktop/test/mcp-market-panel.test.mjs`)+#### E2E-SKILL-MARKET-EXPANSION: Adjacent markdown resources inline before install- **Preconditions**: A jsDelivr skill document whose directory lists FORMS.mddiff --git a/docs/zh-CN/spec/04-ux/06-settings-ia.md b/docs/zh-CN/spec/04-ux/06-settings-ia.mdindex e77a1acde..985912332 100644--- a/docs/zh-CN/spec/04-ux/06-settings-ia.md+++ b/docs/zh-CN/spec/04-ux/06-settings-ia.md@@ -429,7 +429,8 @@ Token 用量**不是设置目的地**(D335 / ADR 0173)。已完成回合历20. 命令 Shell 选择保留平台有效的目录 ID,仅在状态有额外信息时公开默认、不可用、回退或无实际 Shell 文案,并且从不授权过时的 ID/dialect21. 信息页提供「问题反馈」,打开已预填版本和操作系统的 GitHub bug 表单;设置搜索可索引该行-22. 技能页的市场视图浏览公网 HTTPS 目录、预览组装后的文档,并只通过 `skills.create` 安装;超限展开文档拒绝写入,来源角标跟随 `sourceId`;预览失败时面板给出可读原因与重试入口(安装按钮可以禁用,但不得无解释地禁用);来源被公网策略守卫拒绝时明确说明,而不是笼统报「不可达」+22. 技能页的市场视图浏览公网 HTTPS 目录、预览组装后的文档,并只通过 `skills.create` 安装;超限展开文档拒绝写入,来源角标跟随 `sourceId`;预览失败时面板给出可读原因与重试入口(安装按钮可以禁用,但不得无解释地禁用);来源被公网策略守卫拒绝时明确说明,而不是笼统报「不可达」。目录查询全部失败或仅部分来源失败时都提供重试按钮;点击后按当前搜索和已配置来源重查,并在请求期间播报加载状态+23. MCP 市场查询全部失败或部分来源失败时提供重试按钮;点击后重跑当前搜索,并在请求期间播报加载状态## 5. Chrome 指标常规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 056513bd9..e9e213c88 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@@ -5729,6 +5729,7 @@ eleven-tool-round desktop paths are verified by| E——工具和权限(Skill 常驻) | E2E-254 || 品质(Skill 常驻与输入法斜杠别名) | E2E-254、E2E-255 || C / E / F / 品质——内置技能启用状态 | E2E-SKILL-builtin-activation |+| 品质——市场目录查询重试恢复 | E2E-MARKET-CATALOG-RETRY || C — 对话和直播(插件会话导入可见性) | E2E-257 || F——持久化(插件会话导入可见性) | E2E-257 || C — 对话和直播(聊天文件引用) | E2E-CHAT-shorthand-file-ref-opens-the-matching-file、E2E-CHAT-file-ref-opens-the-surface-that-owns-it |@@ -8590,6 +8591,7 @@ runner 会在运行时的隔离临时目录中生成六个插件形态 fixture| E2E-MCP-MARKET-INSTALL | 内置目录条目经 `resolveCatalogEntry` 解析并通过宿主 `mcp.upsert` RPC 安装;记录落盘 `~/.agents/servers/` | 真实宿主二进制,隔离临时 HOME || E2E-MCP-MARKET-HEADER-SCOPE | Registry header-local `{token}` resolves only in its header; same-named URL path/query tokens remain literal through mapping, resolution, host upsert/list and persistence. URL templates retain only legacy `${NAME}` substitution. When `headerBindings` exists (even empty or partial), unbound tokens in every header stay literal and never consume another header's input or default | shared regressions plus real host binary with isolated temporary storage; remote entry disabled, no network call || E2E-MCP-MARKET-partial-header-bindings-stay-literal | Resolve a catalog with only Authorization bound and another header using the same `{token}` / `${token}`; an undeclared `${UNBOUND}` in a third header also remains literal through host upsert/list and disk persistence | real host binary, disabled remote entry, synthetic input and isolated temporary storage; no network call |+| E2E-MARKET-CATALOG-RETRY | 技能市场和 MCP 市场查询全部失败后、以及部分来源失败时都显示重试;点击后播报加载、重跑当前查询,并在来源恢复后清除失败状态 | Electron 中的真实 React 组件使用确定性的模拟市场 API 响应;不访问公网 |#### E2E-SKILL-MARKET-NET-BOUNDARY:用户自填源可达局域网,第三方内容不行@@ -8602,6 +8604,16 @@ runner 会在运行时的隔离临时目录中生成六个插件形态 fixture- **里程碑**:M6+- **状态**:已自动化(`pnpm test:e2e:skill-market`、`apps/desktop/test/public-https-fetch.test.mjs`、`apps/desktop/test/public-https-fetch-route.test.mjs`、`apps/desktop/test/skill-market-scan.test.mjs`、`apps/desktop/test/skill-market-failure.test.mjs`、`apps/desktop/test/skill-market-policy-refusal.test.mjs`、`packages/shared/src/public-network.test.ts`)+#### E2E-MARKET-CATALOG-RETRY:重试失败或部分可用的市场查询++- **前提条件**:渲染技能市场和 MCP 市场面板,并在 IPC 边界模拟市场 API。每个 API 依次返回全部失败、一个来源失败的结果、完整成功结果。+- **步骤**:打开两个市场;全部失败后点击重试;确认加载播报和恢复的目录条目;部分失败后再次点击重试。+- **预期**:两个市场都按当前查询重新请求,期间显示加载状态;部分来源失败时仍有重试入口;来源恢复后失败项清除。测试不访问公网,也不改变主进程网络策略。+- **链接规格**:`04-ux/06-settings-ia.md`、ADR 0177、ADR 0272+- **验收**:Quality+- **里程碑**:M6++- **状态**:已自动化(`pnpm test:e2e:market-retry`、`apps/desktop/test/skill-market-panel.test.mjs`、`apps/desktop/test/mcp-market-panel.test.mjs`)+#### E2E-SKILL-MARKET-EXPANSION:相邻 markdown 资源在安装前内联- **前提条件**:技能目录列出 FORMS.md 与 REFERENCE.md。diff --git a/package.json b/package.jsonindex 18b92b401..2ed5e4a5d 100644--- a/package.json+++ b/package.json@@ -86,6 +86,7 @@"lint:biome": "biome lint","test:e2e:mcp-market": "node scripts/e2e-mcp-market.mjs","test:e2e:skill-market": "node scripts/e2e-skill-market.mjs",+ "test:e2e:market-retry": "node scripts/e2e-market-retry.mjs","test:e2e:capability-move": "node scripts/e2e-capability-move.mjs","test:e2e:plugin-fetch-redirect": "node --test apps/desktop/test/plugin-fetch-redirect.test.mjs","test:e2e:plugin-import-deps": "node scripts/e2e-plugin-import-deps.mjs",diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.tsindex 904e6ed78..cc748564b 100644--- a/packages/i18n/src/locales/de/index.ts+++ b/packages/i18n/src/locales/de/index.ts@@ -831,6 +831,7 @@ sklm: {proxyHint: "Diese Prüfung löst den Host lokal auf, der Download selbst würde über Ihren Proxy laufen. Bei Proxy oder VPN: Einstellungen → Allgemein → Netzwerk prüfen.",failureDetail: "Details: ",retryPreview: "Erneut versuchen",+ retryCatalog: "Erneut versuchen",remoteErrorPolicy: "Katalogquellen wurden von der Adressprüfung der App blockiert – integrierte Auswahl wird angezeigt",remoteErrorUnresolved:"Der lokale Resolver konnte die Katalogquellen nicht auflösen – integrierte Auswahl wird angezeigt",@@ -1233,6 +1234,8 @@ sklm: {remoteBadge: "Registry",remoteLoading: "Offizielle Registry wird geladen…",remoteError: "Registry nicht erreichbar – integrierte Auswahl wird angezeigt",+ remotePartial: "Einige Marktquellen sind nicht verfügbar ({{names}})",+ retry: "Erneut versuchen",manageSources: "Quellen",sourcesHint: "Mehrere Marktquellen gleichzeitig abfragen. Registry-Quellen sprechen das offizielle MCP-Registrierungsprotokoll; Katalogquellen sind statische JSON-Dateien im Markt-Schema.",addSource: "Quelle hinzufügen",diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.tsindex ba76cbc43..a5cc9ab40 100644--- a/packages/i18n/src/locales/en/index.ts+++ b/packages/i18n/src/locales/en/index.ts@@ -843,6 +843,7 @@ sklm: {proxyHint: "That check resolves the host locally, while the download itself would use your proxy. If you use a proxy or VPN, check Settings → General → Network.",failureDetail: "Details: ",retryPreview: "Retry",+ retryCatalog: "Retry",remoteErrorPolicy: "Catalog sources were blocked by the app's address check — showing built-in picks",remoteErrorUnresolved:"The local resolver could not answer for the catalog sources — showing built-in picks",@@ -1087,6 +1088,8 @@ sklm: {remoteBadge: "Registry",remoteLoading: "Loading the official registry…",remoteError: "Registry unreachable — showing built-in picks",+ remotePartial: "Some market sources are unavailable ({{names}})",+ retry: "Retry",manageSources: "Sources",sourcesHint: "Query several market sources at once. Registry sources speak the official MCP registry protocol; catalog sources are static JSON files in the market schema.",addSource: "Add source",diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.tsindex 9b315e6c3..022f03524 100644--- a/packages/i18n/src/locales/es/index.ts+++ b/packages/i18n/src/locales/es/index.ts@@ -831,6 +831,7 @@ sklm: {proxyHint: "Esa comprobación resuelve el host de forma local, mientras que la descarga usaría tu proxy. Si usas proxy o VPN, revisa Configuración → General → Red.",failureDetail: "Detalles: ",retryPreview: "Reintentar",+ retryCatalog: "Reintentar",remoteErrorPolicy: "La comprobación de direcciones de la aplicación bloqueó las fuentes del catálogo: se muestran las selecciones integradas",remoteErrorUnresolved:"El resolutor local no pudo resolver las fuentes del catálogo: se muestran las selecciones integradas",@@ -1233,6 +1234,8 @@ sklm: {remoteBadge: "Registro",remoteLoading: "Cargando el registro oficial…",remoteError: "Registro no disponible: se muestran las selecciones integradas",+ remotePartial: "Algunas fuentes del mercado no están disponibles ({{names}})",+ retry: "Reintentar",manageSources: "Fuentes",sourcesHint: "Consulta varias fuentes a la vez. Las fuentes de registro hablan el protocolo oficial MCP; las de catálogo son archivos JSON estáticos con el esquema del mercado.",addSource: "Añadir fuente",diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.tsindex 11ebadece..ad9241d88 100644--- a/packages/i18n/src/locales/fr/index.ts+++ b/packages/i18n/src/locales/fr/index.ts@@ -831,6 +831,7 @@ sklm: {proxyHint: "Ce contrôle résout l'hôte localement, alors que le téléchargement passerait par votre proxy. Si vous utilisez un proxy ou un VPN, vérifiez Paramètres → Général → Réseau.",failureDetail: "Détails : ",retryPreview: "Réessayer",+ retryCatalog: "Réessayer",remoteErrorPolicy: "Les sources du catalogue ont été bloquées par le contrôle d'adresse de l'application – sélection intégrée affichée",remoteErrorUnresolved:"Le résolveur local n'a pas pu résoudre les sources du catalogue – sélection intégrée affichée",@@ -1233,6 +1234,8 @@ sklm: {remoteBadge: "Registre",remoteLoading: "Chargement du registre officiel…",remoteError: "Registre inaccessible – sélection intégrée affichée",+ remotePartial: "Certaines sources du marché sont indisponibles ({{names}})",+ retry: "Réessayer",manageSources: "Sources",sourcesHint: "Interroge plusieurs sources à la fois. Les sources de registre parlent le protocole officiel MCP ; les sources de catalogue sont des fichiers JSON statiques au schéma du marché.",addSource: "Ajouter une source",diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.tsindex f03ba16a6..f0f708b50 100644--- a/packages/i18n/src/locales/ko/index.ts+++ b/packages/i18n/src/locales/ko/index.ts@@ -840,6 +840,7 @@ sklm: {proxyHint: "이 검사는 호스트를 로컬에서 조회하지만, 다운로드 자체는 프록시를 사용합니다. 프록시나 VPN을 사용한다면 설정 → 일반 → 네트워크를 확인하세요.",failureDetail: "세부 정보: ",retryPreview: "다시 시도",+ retryCatalog: "다시 시도",remoteErrorPolicy: "앱의 주소 검사가 카탈로그 소스를 차단했습니다. 내장 목록을 표시합니다",remoteErrorUnresolved:"로컬 리졸버가 카탈로그 소스를 확인하지 못했습니다. 내장 목록을 표시합니다",@@ -1243,6 +1244,8 @@ sklm: {remoteBadge: "레지스트리",remoteLoading: "공식 레지스트리에서 불러오는 중…",remoteError: "레지스트리에 연결할 수 없어 내장 목록을 표시합니다",+ remotePartial: "일부 마켓 소스를 사용할 수 없습니다 ({{names}})",+ retry: "다시 시도",manageSources: "마켓 소스",sourcesHint: "여러 마켓 소스를 동시에 조회합니다. 레지스트리 소스는 공식 MCP 레지스트리 프로토콜을, 카탈로그 소스는 마켓 스키마의 정적 JSON 파일을 사용합니다.",addSource: "소스 추가",diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.tsindex 111a0f54e..6cca45532 100644--- a/packages/i18n/src/locales/pt-BR/index.ts+++ b/packages/i18n/src/locales/pt-BR/index.ts@@ -826,6 +826,7 @@ export const ptBR = {proxyHint: "Esta verificação resolve o host localmente, enquanto o download usaria seu proxy. Se usar proxy ou VPN, revise Configurações → Geral → Rede.",failureDetail: "Detalhes: ",retryPreview: "Tentar novamente",+ retryCatalog: "Tentar novamente",remoteErrorPolicy: "A verificação de endereço do aplicativo bloqueou as fontes do catálogo: exibindo seleções integradas",remoteErrorUnresolved: "O resolvedor local não conseguiu resolver as fontes do catálogo: exibindo seleções integradas",previewResolveError: "A verificação de endereço do aplicativo não conseguiu resolver este host: nada foi instalado.",@@ -1056,6 +1057,8 @@ export const ptBR = {remoteBadge: "Registro",remoteLoading: "Carregando o registro oficial…",remoteError: "Registro inacessível — exibindo seleções integradas",+ remotePartial: "Algumas fontes do mercado estão indisponíveis ({{names}})",+ retry: "Tentar novamente",manageSources: "Fontes",sourcesHint: "Consulte várias fontes do marketplace de uma só vez. Fontes de registro usam o protocolo oficial do MCP; fontes de catálogo são arquivos JSON estáticos no formato do marketplace.",addSource: "Adicionar fonte",diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.tsindex d0391c202..c5d25f5cc 100644--- a/packages/i18n/src/locales/tr/index.ts+++ b/packages/i18n/src/locales/tr/index.ts@@ -840,6 +840,7 @@ sklm: {proxyHint: "Bu denetim ana makineyi yerel olarak çözer, indirme ise proxy üzerinden yapılır. Proxy veya VPN kullanıyorsanız Ayarlar → Genel → Ağ bölümüne bakın.",failureDetail: "Ayrıntılar: ",retryPreview: "Yeniden dene",+ retryCatalog: "Yeniden dene",remoteErrorPolicy: "Uygulamanın adres denetimi katalog kaynaklarını engelledi – yerleşik seçkiler gösteriliyor",remoteErrorUnresolved:"Yerel çözümleyici katalog kaynaklarını çözemedi – yerleşik seçkiler gösteriliyor",@@ -1237,6 +1238,8 @@ sklm: {remoteBadge: "Kayıt",remoteLoading: "Resmî kayıt yükleniyor…",remoteError: "Kayıt erişilemiyor – yerleşik seçkiler gösteriliyor",+ remotePartial: "Bazı market kaynakları kullanılamıyor ({{names}})",+ retry: "Yeniden dene",manageSources: "Kaynaklar",sourcesHint: "Birden fazla market kaynağını aynı anda sorgular. Kayıt kaynakları resmî MCP kayıt protokolünü; katalog kaynakları market şemasında statik JSON dosyalarını kullanır.",addSource: "Kaynak ekle",diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.tsindex dd7322590..338be1d8c 100644--- a/packages/i18n/src/locales/zh-CN/index.ts+++ b/packages/i18n/src/locales/zh-CN/index.ts@@ -835,6 +835,7 @@ sklm: {proxyHint: "该校验在本地解析域名,而下载本身会走你的代理。若使用代理或 VPN,请检查 设置 → 常规 → 网络。",failureDetail: "详情: ",retryPreview: "重试",+ retryCatalog: "重试",remoteErrorPolicy: "目录源被应用的地址校验阻止,已显示内置精选",remoteErrorUnresolved: "本机 DNS 无法解析目录源,已显示内置精选",previewResolveError: "应用的地址校验无法解析该主机,未安装任何内容。",@@ -1227,6 +1228,8 @@ sklm: {remoteBadge: "注册表",remoteLoading: "正在从官方注册表加载更多…",remoteError: "官方注册表暂不可达,已显示内置精选",+ remotePartial: "部分市场源暂不可用({{names}})",+ retry: "重试",manageSources: "市场源",sourcesHint: "同时查询多个市场源。Registry 型源走官方 MCP 注册表协议;目录型源是符合市场 schema 的静态 JSON 文件。",addSource: "添加源",diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.tsindex ae40e1656..3a1920d25 100644--- a/packages/i18n/src/locales/zh-TW/index.ts+++ b/packages/i18n/src/locales/zh-TW/index.ts@@ -835,6 +835,7 @@ sklm: {proxyHint: "該校驗在本機解析網域,而下載本身會走你的代理。若使用代理或 VPN,請檢查 設定 → 常規 → 網路。",failureDetail: "詳情: ",retryPreview: "重試",+ retryCatalog: "重試",remoteErrorPolicy: "目錄源被應用程式的地址校驗阻止,已顯示內建精選",remoteErrorUnresolved: "本機 DNS 無法解析目錄源,已顯示內建精選",previewResolveError: "應用程式的地址校驗無法解析該主機,未安裝任何內容。",@@ -1227,6 +1228,8 @@ sklm: {remoteBadge: "註冊表",remoteLoading: "正在從官方註冊表載入更多…",remoteError: "官方註冊表暫不可達,已顯示內建精選",+ remotePartial: "部分市集來源暫時無法使用({{names}})",+ retry: "重試",manageSources: "市場源",sourcesHint: "同時查詢多個市場源。Registry 型源走官方 MCP 註冊表協定;目錄型源是符合市集 schema 的靜態 JSON 檔案。",addSource: "新增源",diff --git a/scripts/e2e-market-retry.mjs b/scripts/e2e-market-retry.mjsnew file mode 100644index 000000000..59edcead3--- /dev/null+++ b/scripts/e2e-market-retry.mjs@@ -0,0 +1,89 @@+#!/usr/bin/env node+/** Real React/Chromium coverage for Skill and MCP market retry controls. */+import assert from "node:assert/strict";+import { spawn } from "node:child_process";+import { createRequire } from "node:module";+import { mkdtemp, rm, writeFile } from "node:fs/promises";+import { tmpdir } from "node:os";+import { dirname, join } from "node:path";+import { fileURLToPath } from "node:url";+import { resolveElectronBinary } from "./e2e/boot.mjs";++const root = join(dirname(fileURLToPath(import.meta.url)), "..");+const require = createRequire(join(root, "packages/agent-runtime/package.json"));+const { build } = require("esbuild");+const { electronBinary } = resolveElectronBinary(root);+const temp = await mkdtemp(join(tmpdir(), "pi-market-retry-"));+try {+ await build({+ entryPoints: [join(root, "scripts/e2e/market-retry.tsx")],+ outfile: join(temp, "renderer.js"),+ bundle: true,+ platform: "browser",+ format: "iife",+ jsx: "automatic",+ loader: { ".woff": "file", ".woff2": "file", ".ttf": "file" },+ define: { "process.env.NODE_ENV": '"production"' },+ alias: {+ "@pi-desktop/i18n": join(root, "packages/i18n/src/index.ts"),+ react: join(root, "apps/desktop/node_modules/react"),+ "react-dom": join(root, "apps/desktop/node_modules/react-dom"),+ },+ nodePaths: [join(root, "apps/desktop/node_modules")],+ });+ await writeFile(+ join(temp, "index.html"),+ '<!doctype html><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src \'self\'; style-src \'self\' \'unsafe-inline\'; img-src \'self\' data:"><link rel="stylesheet" href="renderer.css"><title>Market retry interactions</title><body><script src="renderer.js"></script>',+ );+ await writeFile(+ join(temp, "main.cjs"),+ [+ 'const { app, BrowserWindow } = require("electron");',+ 'const path = require("node:path");',+ 'app.setPath("userData", path.join(__dirname, "profile"));',+ 'app.whenReady().then(async () => {',+ ' const window = new BrowserWindow({ show: false, webPreferences: { sandbox: true, contextIsolation: true, nodeIntegration: false } });',+ ' window.webContents.on("console-message", (event) => console.error(event.message));',+ ' try {',+ ' await window.loadFile(path.join(__dirname, "index.html"));',+ ' const result = await window.webContents.executeJavaScript("globalThis.marketRetryProbe()");',+ ' console.log("MARKET_RETRY_PROBE " + JSON.stringify(result));',+ ' app.quit();',+ ' } catch (error) {',+ ' console.error("MARKET_RETRY_PROBE " + JSON.stringify({ ok: false, error: String(error) }));',+ ' app.exit(1);',+ ' }',+ '});',+ ].join("\n"),+ );+ const env = { ...process.env };+ delete env.ELECTRON_RUN_AS_NODE;+ const child = spawn(electronBinary, [join(temp, "main.cjs")], {+ env,+ stdio: ["ignore", "pipe", "pipe"],+ });+ let output = "";+ for (const stream of [child.stdout, child.stderr]) {+ stream.on("data", (data) => {+ output += data;+ });+ }+ const timeout = setTimeout(() => child.kill("SIGKILL"), 45_000);+ let code;+ try {+ code = await new Promise((resolve, reject) => {+ child.once("error", reject);+ child.once("close", resolve);+ });+ } finally {+ clearTimeout(timeout);+ }+ const line = output.split(/\r?\n/).find((entry) => entry.startsWith("MARKET_RETRY_PROBE "));+ assert(line, `renderer returned no probe result (exit=${code}): ${output.slice(-2000)}`);+ const result = JSON.parse(line.slice("MARKET_RETRY_PROBE ".length));+ console.log("MARKET_RETRY_PROBE " + JSON.stringify(result));+ assert.equal(code, 0, output.slice(-6000));+ assert.equal(result.ok, true);+} finally {+ await rm(temp, { recursive: true, force: true });+}diff --git a/scripts/e2e/market-retry.tsx b/scripts/e2e/market-retry.tsxnew file mode 100644index 000000000..e6f023ee6--- /dev/null+++ b/scripts/e2e/market-retry.tsx@@ -0,0 +1,126 @@+import { createRoot } from "react-dom/client";+import { flushSync } from "react-dom";+import { createInstance } from "i18next";+import { I18nextProvider } from "react-i18next";+import { catalogs } from "@pi-desktop/i18n";+import type { AppSettings, McpCatalogEntry, SkillCatalogEntry } from "@pi-desktop/shared";+import { McpMarketPanel } from "../../apps/desktop/src/components/settings/McpMarketPanel";+import { SkillMarketPanel } from "../../apps/desktop/src/components/settings/SkillMarketPanel";+import { api } from "../../apps/desktop/src/lib/api";+import "../../apps/desktop/src/styles/tokens.css";+import "../../apps/desktop/src/styles/settings.css";++declare global {+ var marketRetryProbe: () => Promise<unknown>;+}++const assert = (condition: unknown, message: string) => {+ if (!condition) throw new Error(message);+};+const painted = () => new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));+async function until(condition: () => boolean, message: string) {+ const deadline = performance.now() + 8_000;+ while (!condition() && performance.now() < deadline) await painted();+ assert(condition(), message);+}++const settings = {+ defaultMode: "agent",+ theme: "system",+ enterToSend: true,+} satisfies AppSettings;++const skillEntry: SkillCatalogEntry = {+ id: "retry-skill",+ name: "Recovered Skill",+ description: "A catalog entry returned after retry.",+ url: "https://example.com/skills/retry-skill/SKILL.md",+ categories: ["coding"],+};+const mcpEntry: McpCatalogEntry = {+ id: "retry-server",+ name: "Recovered Server",+ description: "A registry entry returned after retry.",+ transport: "stdio",+ command: "node",+ args: [],+ categories: ["devtools"],+};++globalThis.marketRetryProbe = async () => {+ const i18n = createInstance();+ await i18n.init({+ lng: "en",+ resources: { en: { translation: catalogs.en }, "zh-CN": { translation: catalogs["zh-CN"] } },+ });+ api.getSettings = async () => structuredClone(settings);+ const container = document.createElement("div");+ document.body.append(container);+ const root = createRoot(container);+ const render = (panel: "skill" | "mcp") =>+ flushSync(() =>+ root.render(+ <I18nextProvider i18n={i18n}>+ {panel === "skill" ? (+ <SkillMarketPanel installedIds={[]} onBack={() => {}} onInstalled={() => {}} />+ ) : (+ <McpMarketPanel installedIds={[]} onBack={() => {}} onInstalled={() => {}} />+ )}+ </I18nextProvider>,+ ),+ );+ const click = (element: HTMLElement | undefined | null) => {+ assert(element, "missing retry button");+ flushSync(() => element!.click());+ };+ const button = (label: string) =>+ [...container.querySelectorAll<HTMLButtonElement>("button")].find(+ (element) => element.textContent?.trim() === label,+ );+ const status = () => container.querySelector<HTMLElement>('[role="status"]')?.textContent ?? "";++ try {+ for (const locale of ["en", "zh-CN"]) {+ await i18n.changeLanguage(locale);+ let skillCalls = 0;+ api.searchSkillMarket = async () => {+ skillCalls += 1;+ if (skillCalls === 1) return { entries: [], failedSources: ["anthropics/skills"] };+ if (skillCalls === 2) return { entries: [skillEntry], failedSources: ["obra/superpowers"] };+ return { entries: [skillEntry], failedSources: [] };+ };+ render("skill");+ await until(+ () => status().includes(i18n.t("settings.sklm.remoteError")) || status().includes(i18n.t("settings.sklm.remoteErrorQuery")),+ `${locale}: skill market error status missing`,+ );+ click(button(i18n.t("settings.sklm.retryCatalog")));+ await until(() => status().includes(i18n.t("settings.sklm.remoteLoading")), `${locale}: skill retry did not announce loading`);+ await until(() => container.textContent?.includes("Recovered Skill") === true, `${locale}: skill did not load after retry`);+ await until(() => button(i18n.t("settings.sklm.retryCatalog")) !== undefined, `${locale}: partial skill failure has no retry`);+ click(button(i18n.t("settings.sklm.retryCatalog")));+ await until(() => skillCalls === 3 && !container.textContent?.includes("obra/superpowers"), `${locale}: second skill retry did not clear partial failure`);++ flushSync(() => root.render(<div />));+ let mcpCalls = 0;+ api.searchMcpMarketRegistry = async () => {+ mcpCalls += 1;+ if (mcpCalls === 1) return { entries: [], failedSources: ["official registry"] };+ if (mcpCalls === 2) return { entries: [mcpEntry], failedSources: ["community catalog"] };+ return { entries: [mcpEntry], failedSources: [] };+ };+ render("mcp");+ await until(() => status().includes(i18n.t("settings.mcpMarket.remoteError")), `${locale}: MCP market error status missing`);+ click(button(i18n.t("settings.mcpMarket.retry")));+ await until(() => status().includes(i18n.t("settings.mcpMarket.remoteLoading")), `${locale}: MCP retry did not announce loading`);+ await until(() => container.textContent?.includes("Recovered Server") === true, `${locale}: MCP entry did not load after retry`);+ await until(() => button(i18n.t("settings.mcpMarket.retry")) !== undefined, `${locale}: partial MCP failure has no retry`);+ click(button(i18n.t("settings.mcpMarket.retry")));+ await until(() => mcpCalls === 3 && !container.textContent?.includes("community catalog"), `${locale}: second MCP retry did not clear partial failure`);+ }+ return { ok: true };+ } finally {+ flushSync(() => root.unmount());+ container.remove();+ }+};