Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(plugins): keep marketplace installs responsive (#1488)

Lan55e330d6f0ec
diff --git a/apps/desktop/electron/main/bootstrap/window.ts b/apps/desktop/electron/main/bootstrap/window.ts
index 9a6e2e6e3..19c76c339 100644
--- a/apps/desktop/electron/main/bootstrap/window.ts
+++ b/apps/desktop/electron/main/bootstrap/window.ts
@@ -1908,27 +1908,13 @@ export async function createWindow({
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));
`);
await new Promise((r) => setTimeout(r, 200));
- // Plugins marketplace: the source picker lives beside the catalog,
- // including the custom URL row that only appears for that source.
+ // Plugins marketplace uses the fixed official catalog.
await setPage("plugins");
await windowState.mainWindow!.webContents.executeJavaScript(
`document.querySelector('#plugins-tab-market')?.dispatchEvent(new MouseEvent('click',{bubbles:true}))`,
);
await new Promise((r) => setTimeout(r, 350));
await shot("pi-settings-extensions");
- await windowState.mainWindow!.webContents.executeJavaScript(`
- (() => {
- const select = document.querySelector('.plugins-market-settings select');
- if (!select) return;
- const setter = Object.getOwnPropertyDescriptor(
- window.HTMLSelectElement.prototype, 'value',
- )?.set;
- setter?.call(select, 'custom');
- select.dispatchEvent(new Event('change', { bubbles: true }));
- })()
- `);
- await new Promise((r) => setTimeout(r, 350));
- await shot("pi-settings-extensions-custom");
await setPage("chat");
await setTheme("light");
await new Promise((r) => setTimeout(r, 250));
diff --git a/apps/desktop/src/components/plugins/MarketplaceSourceSettings.tsx b/apps/desktop/src/components/plugins/MarketplaceSourceSettings.tsx
deleted file mode 100644
index 28354d3dc..000000000
--- a/apps/desktop/src/components/plugins/MarketplaceSourceSettings.tsx
+++ /dev/null
@@ -1,112 +0,0 @@
-import { useEffect, useState } from "react";
-import { useTranslation } from "react-i18next";
-import type { AppSettings, PluginMarketSource } from "@pi-desktop/shared";
-import { api } from "../../lib/api";
-import { useAppStore } from "../../stores/app-store";
-import { HelpIcon, Input } from "../ui";
-import { SettingsMenuSelect } from "../settings/SettingsMenuSelect";
-
-type MarketplaceSourceSettingsProps = {
- settings: AppSettings;
- onSourceRefreshed: (source: string) => void;
-};
-
-export function MarketplaceSourceSettings({
- settings,
- onSourceRefreshed,
-}: MarketplaceSourceSettingsProps) {
- const { t } = useTranslation();
- const showToast = useAppStore((s) => s.showToast);
- const source: PluginMarketSource = settings.pluginMarketSource ?? "official";
- const [customUrl, setCustomUrl] = useState(settings.pluginMarketCustomUrl ?? "");
-
- useEffect(() => {
- setCustomUrl(settings.pluginMarketCustomUrl ?? "");
- }, [settings.pluginMarketCustomUrl]);
-
- const applySource = async (patch: Partial<AppSettings>) => {
- try {
- const nextSettings = { ...settings, ...patch };
- await api.setSettings(nextSettings);
- useAppStore.setState({ settings: nextSettings });
-
- // Keep settings.set free of network waits; refreshing after persistence
- // also makes the marketplace list reflect the newly selected source.
- const meta = await api.marketRefresh(true);
- onSourceRefreshed(meta.sourceUrl ?? "");
- showToast(
- t("plugins.marketRefreshed", {
- count: meta.pluginCount,
- defaultValue: `Marketplace refreshed (${meta.pluginCount} plugins)`,
- }),
- { variant: "success" },
- );
- } catch (error) {
- showToast(error instanceof Error ? error.message : String(error), {
- variant: "error",
- });
- }
- };
-
- const commitCustomUrl = () => {
- const next = customUrl.trim();
- if (next === (settings.pluginMarketCustomUrl ?? "")) return;
- void applySource({ pluginMarketCustomUrl: next });
- };
-
- return (
- <section
- className="plugins-market-settings"
- aria-labelledby="plugins-market-settings-title"
- >
- <div className="plugins-market-settings-head">
- <div className="plugins-market-settings-copy">
- <h2 id="plugins-market-settings-title" className="settings-card-heading">
- {t("settings.marketProviderTitle")}
- </h2>
- </div>
- <div className="plugins-market-settings-control">
- <SettingsMenuSelect
- label={t("settings.marketProvider")}
- value={source}
- onChange={(id) =>
- void applySource({
- pluginMarketSource: id as PluginMarketSource,
- })
- }
- options={[
- { id: "official", label: t("settings.marketProviderOfficial") },
- { id: "github", label: t("settings.marketProviderGithub") },
- { id: "mirror", label: t("settings.marketProviderMirror") },
- { id: "custom", label: t("settings.marketProviderCustom") },
- ]}
- />
- </div>
- </div>
-
- {source === "custom" ? (
- <div className="plugins-market-settings-row">
- <div className="plugins-market-settings-copy">
- <div className="settings-row-title">
- {t("settings.marketCustomUrl")}
- <HelpIcon label={t("settings.marketCustomUrlDesc")} />
- </div>
- </div>
- <div className="plugins-market-settings-control">
- <Input
- type="url"
- value={customUrl}
- placeholder={t("settings.marketCustomUrlPlaceholder")}
- aria-label={t("settings.marketCustomUrl")}
- onChange={(event) => setCustomUrl(event.target.value)}
- onBlur={commitCustomUrl}
- onKeyDown={(event) => {
- if (event.key === "Enter") commitCustomUrl();
- }}
- />
- </div>
- </div>
- ) : null}
- </section>
- );
-}
diff --git a/apps/desktop/src/features/plugins/MarketplacePanel.tsx b/apps/desktop/src/features/plugins/MarketplacePanel.tsx
index 74431b79b..1029f171f 100644
--- a/apps/desktop/src/features/plugins/MarketplacePanel.tsx
+++ b/apps/desktop/src/features/plugins/MarketplacePanel.tsx
@@ -1,6 +1,5 @@
import { Button, cx } from "../../components/ui";
import { IconCheck, IconSearch, IconShield } from "../../components/icons";
-import { MarketplaceSourceSettings } from "../../components/plugins/MarketplaceSourceSettings";
import { PermissionChips } from "./presentation";
import {
formatDate,
@@ -12,11 +11,9 @@ import type { PluginsPageModel } from "./usePluginsPage";
export function MarketplacePanel({
t,
locale,
- settings,
query,
setQuery,
refreshMarket,
- setMarketSource,
categories,
category,
setCategory,
@@ -36,16 +33,6 @@ export function MarketplacePanel({
aria-labelledby="plugins-tab-market"
className="plugins-panel"
>
- {settings ? (
- <MarketplaceSourceSettings
- settings={settings}
- onSourceRefreshed={(source) => {
- setMarketSource(source);
- void refreshMarket(query);
- }}
- />
- ) : null}
-
{categories.length > 1 ? (
<div
className="plugins-filters"
diff --git a/apps/desktop/src/features/plugins/usePluginsPage.ts b/apps/desktop/src/features/plugins/usePluginsPage.ts
index 426048116..77a36458c 100644
--- a/apps/desktop/src/features/plugins/usePluginsPage.ts
+++ b/apps/desktop/src/features/plugins/usePluginsPage.ts
@@ -38,7 +38,6 @@ export function usePluginsPage() {
const { t, i18n } = useTranslation();
const locale = i18n.language;
const plugins = useAppStore((s) => s.plugins);
- const settings = useAppStore((s) => s.settings);
const refreshPlugins = useAppStore((s) => s.refreshPlugins);
const showToast = useAppStore((s) => s.showToast);
const activateProject = useAppStore((s) => s.activateProject);
@@ -78,7 +77,6 @@ export function usePluginsPage() {
const [autoUpdate, setAutoUpdate] = useState(true);
const [templatePick, setTemplatePick] = useState<TemplateId | null>(null);
const [creating, setCreating] = useState(false);
- const [marketSource, setMarketSource] = useState("");
const [headerMenu, setHeaderMenu] = useState(false);
const [rowMenu, setRowMenu] = useState<string | null>(null);
const [selectedId, setSelectedId] = useState<string | null>(null);
@@ -115,7 +113,6 @@ export function usePluginsPage() {
try {
if (opts?.refreshRemote) {
const meta = await api.marketRefresh(true);
- setMarketSource(meta.sourceUrl || meta.homepage || "");
showToast(
t("plugins.marketRefreshed", {
count: meta.pluginCount,
@@ -126,11 +123,6 @@ export function usePluginsPage() {
}
const res = await api.marketSearch(q);
setMarket((res.plugins ?? []).filter(isClientVisibleMarketPlugin));
- if (!marketSource) {
- // The host reports the catalog URL actually in effect, so a mirror or
- // custom source shows up here instead of the official repo.
- setMarketSource(res.sourceUrl || res.providerId || "");
- }
} catch (e) {
showToast(e instanceof Error ? e.message : String(e), { variant: "error" });
} finally {
@@ -662,7 +654,6 @@ export function usePluginsPage() {
t,
locale,
plugins,
- settings,
refreshPlugins,
showToast,
activateProject,
@@ -687,8 +678,6 @@ export function usePluginsPage() {
templatePick,
setTemplatePick,
creating,
- marketSource,
- setMarketSource,
headerMenu,
setHeaderMenu,
rowMenu,
diff --git a/apps/desktop/src/styles/plugins.css b/apps/desktop/src/styles/plugins.css
index 0f99cfcc4..01cba17ef 100644
--- a/apps/desktop/src/styles/plugins.css
+++ b/apps/desktop/src/styles/plugins.css
@@ -1122,74 +1122,6 @@
font-weight: var(--font-weight-medium);
}
-/* Marketplace source: a single tile; the custom-URL row hangs below the head
- with spacing alone marking the step. */
-.plugins-market-settings {
- display: flex;
- flex-direction: column;
- gap: 0;
- margin-bottom: 0;
- border-radius: var(--radius-lg);
- background: var(--plugins-tile);
-}
-
-.plugins-market-settings-head,
-.plugins-market-settings-row {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 24px;
- padding: 14px 16px;
-}
-
-.plugins-market-settings-row {
- padding-top: 0;
-}
-
-.plugins-market-settings-copy {
- min-width: 0;
- flex: 1;
-}
-
-.plugins-market-settings-copy .settings-card-heading {
- margin-bottom: 3px;
-}
-
-.plugins-market-settings-control {
- display: flex;
- flex: 0 0 auto;
- min-width: 0;
- max-width: min(240px, 100%);
- justify-content: flex-end;
-}
-
-.plugins-market-settings-control .field-select,
-.plugins-market-settings-control .field-input {
- width: 100%;
- min-width: 0;
-}
-
-/* Same list, same right column: the provider dropdown sits directly above the
- custom-URL input row, so it takes the shared field metric rather than the
- compact Settings-row pill size. */
-.plugins-market-settings-control .settings-menu-select-trigger {
- height: var(--ds-field-height);
-}
-
-@media (max-width: 720px) {
- .plugins-market-settings-head,
- .plugins-market-settings-row {
- align-items: stretch;
- flex-direction: column;
- gap: 10px;
- }
-
- .plugins-market-settings-control {
- flex-basis: auto;
- width: 100%;
- }
-}
-
/* Loading placeholders keep the grid from collapsing on the first search. */
.plugins-card.is-skeleton {
gap: 10px;
diff --git a/apps/desktop/test/extensions-page.test.mjs b/apps/desktop/test/extensions-page.test.mjs
index 9ba1758ad..fd7d59f58 100644
--- a/apps/desktop/test/extensions-page.test.mjs
+++ b/apps/desktop/test/extensions-page.test.mjs
@@ -26,8 +26,8 @@ const settingsComponents = new Map(
.map((name) => [name, readFileSync(join(settingsDir, name), "utf8")]),
);
const pageSrc = readPluginsSourceSync();
-const marketSettingsSrc = readFileSync(
- join(here, "../src/components/plugins/MarketplaceSourceSettings.tsx"),
+const marketPanelSrc = readFileSync(
+ join(here, "../src/features/plugins/MarketplacePanel.tsx"),
"utf8",
);
const settingsPageSrc = readSettingsSourceSync();
@@ -112,13 +112,14 @@ test("the extensions page uses tabs instead of the removed capability overview",
assert.match(pageSrc, /className="plugins-segment"/);
});
-test("marketplace source settings omit redundant explanatory copy", () => {
- assert.match(marketSettingsSrc, /marketProviderTitle/);
+test("marketplace keeps refresh and install actions without source switching", () => {
+ const source = `${pageSrc}\n${marketPanelSrc}`;
assert.doesNotMatch(
- marketSettingsSrc,
- /marketProviderDesc|marketProviderMirrorHint|marketActiveSource|plugins-market-settings-active/,
+ source,
+ /MarketplaceSourceSettings|pluginMarketSource|pluginMarketCustomUrl|marketProvider|marketCustomUrl|marketSource/,
);
- assert.match(marketSettingsSrc, /marketCustomUrlDesc/);
+ assert.match(marketPanelSrc, /refreshMarket\(query, \{ refreshRemote: true \}\)/);
+ assert.match(marketPanelSrc, /queueInstall/);
});
test("installed plugin rows keep secondary detail behind a disclosure", () => {
diff --git a/apps/desktop/test/field-control-height.test.mjs b/apps/desktop/test/field-control-height.test.mjs
index 709687a70..b1a927799 100644
--- a/apps/desktop/test/field-control-height.test.mjs
+++ b/apps/desktop/test/field-control-height.test.mjs
@@ -76,7 +76,6 @@ test("a stretched trigger takes the field metric without outranking a denser sur
test("dropdowns that act as form fields take the field metric", () => {
for (const [css, selector] of [
[pluginsCss, ".plugins-setting-control .settings-menu-select-trigger"],
- [pluginsCss, ".plugins-market-settings-control .settings-menu-select-trigger"],
[scheduledCss, ".scheduled-fields .settings-menu-select-trigger"],
]) {
assert.equal(
diff --git a/apps/desktop/test/plugin-runtime-risk.test.mjs b/apps/desktop/test/plugin-runtime-risk.test.mjs
index 4bb7d127a..a516b6c0b 100644
--- a/apps/desktop/test/plugin-runtime-risk.test.mjs
+++ b/apps/desktop/test/plugin-runtime-risk.test.mjs
@@ -169,7 +169,7 @@ test("shared protocol declares marketplace and package install IPC", () => {
test("plugins page can refresh the official marketplace repository", () => {
assert.match(pageSrc, /marketRefresh|refreshMarket|refreshRemote/);
- assert.match(pageSrc, /pi-desktop-plugins|marketSource/);
+ assert.doesNotMatch(pageSrc, /MarketplaceSourceSettings|marketSource/);
});
diff --git a/apps/desktop/test/plugins-page-style.test.mjs b/apps/desktop/test/plugins-page-style.test.mjs
index 3d02566cc..1100f0487 100644
--- a/apps/desktop/test/plugins-page-style.test.mjs
+++ b/apps/desktop/test/plugins-page-style.test.mjs
@@ -111,7 +111,7 @@ test("extensions page draws no in-flow dividers", async () => {
assert.match(pluginsCss, /\.plugins-card-foot\s*\{[^}]*padding:\s*2px 14px 12px/);
assert.doesNotMatch(pluginsCss, /\.plugins-card-foot\s*\{[^}]*border/);
assert.match(pluginsCss, /\.plugins-empty\s*\{[^}]*background:\s*var\(--plugins-tile\)/);
- assert.match(pluginsCss, /\.plugins-market-settings\s*\{[^}]*background:\s*var\(--plugins-tile\)/);
+ assert.doesNotMatch(pluginsCss, /\.plugins-market-settings/);
});
test("installed rows default to a calm summary with accessible details", () => {
diff --git a/apps/desktop/test/settings-general.test.mjs b/apps/desktop/test/settings-general.test.mjs
index 203283a42..a160aab55 100644
--- a/apps/desktop/test/settings-general.test.mjs
+++ b/apps/desktop/test/settings-general.test.mjs
@@ -31,13 +31,6 @@ const scheduledFormatSource = await readFile(
"utf8",
);
const pluginsPageSource = await readPluginsSource();
-const marketplaceSettingsSource = await readFile(
- new URL(
- "../src/components/plugins/MarketplaceSourceSettings.tsx",
- import.meta.url,
- ),
- "utf8",
-);
// API services and vendor accounts share one list (D625).
const serviceListSource = await readFile(
new URL("../src/components/settings/ServiceList.tsx", import.meta.url),
@@ -487,12 +480,13 @@ test("settings rail uses short parallel labels and descriptive page titles", ()
assert.match(settingsPageSource, /titleKey: entry\.titleKey/);
});
-test("marketplace source settings live inside the Plugins marketplace surface", () => {
- assert.match(pluginsPageSource, /<MarketplaceSourceSettings/);
- assert.match(marketplaceSettingsSource, /api\.marketRefresh\(true\)/);
- assert.match(marketplaceSettingsSource, /settings\.marketProvider/);
- assert.match(marketplaceSettingsSource, /<SettingsMenuSelect/);
- assert.doesNotMatch(marketplaceSettingsSource, /<Select/);
+test("Plugins marketplace keeps official refresh without source settings", () => {
+ assert.doesNotMatch(
+ pluginsPageSource,
+ /MarketplaceSourceSettings|pluginMarketSource|pluginMarketCustomUrl|marketProvider|marketCustomUrl|marketSource/,
+ );
+ assert.match(pluginsPageSource, /api\.marketRefresh\(true\)/);
+ assert.match(pluginsPageSource, /refreshMarket\(query, \{ refreshRemote: true \}\)/);
assert.doesNotMatch(settingsPageSource, /ExtensionMarketSection/);
assert.doesNotMatch(settingsPageSource, /tab === "extensions"/);
});
diff --git a/crates/host-core/src/plugins.rs b/crates/host-core/src/plugins.rs
index a0dadc555..2158e2ef4 100644
--- a/crates/host-core/src/plugins.rs
+++ b/crates/host-core/src/plugins.rs
@@ -32,10 +32,7 @@ mod resolve;
mod validation;
pub use manifest::PluginManifest;
-pub use marketplace::{
- market_channel_from_settings, MarketChannel, GITHUB_BACKUP_CHANNEL_CATALOG_URL,
- MIRROR_MARKET_CATALOG_URL, OFFICIAL_CHANNEL_CATALOG_URL,
-};
+pub use marketplace::{market_channel_from_settings, MarketChannel, OFFICIAL_CHANNEL_CATALOG_URL};
pub use model::{
InstallOptions, InstallResult, MarketDownloadInfo, MarketPluginDetail, MarketPluginSummary,
MarketProvenance, MarketReview, MarketVersion, PluginDisplayI18n, PluginI18nMap,
diff --git a/crates/host-core/src/plugins/install.rs b/crates/host-core/src/plugins/install.rs
index 8ec766dc0..711f1e33d 100644
--- a/crates/host-core/src/plugins/install.rs
+++ b/crates/host-core/src/plugins/install.rs
@@ -299,10 +299,10 @@ impl PluginManager {
report.phase(InstallPhase::Resolve);
match self.download_market_package_via_resolve(info, report, &mut tried) {
Ok(fetched) => return Ok(fetched),
- // A refusal is an answer, and so is a cancellation: install
- // nothing, fall back to nothing, and say why.
+ // Publication refusals and cancellations are authoritative:
+ // never install through the catalog URL after either one.
Err(error)
- if !super::resolve::is_recoverable(&error)
+ if !super::resolve::allows_catalog_fallback(&error)
|| super::progress::is_cancelled(&error) =>
{
return Err(report.failed(tried, error))
@@ -311,12 +311,13 @@ impl PluginManager {
plugin = %info.plugin_id,
version = %info.version,
%error,
- "the plugin center did not answer; using the catalog url"
+ "the plugin center resolve path is unavailable; using the catalog url"
),
}
}
- // The catalog's own URL, which is also the documented fallback for a
- // platform that cannot be reached.
+ // The catalog's own URL avoids waiting for a slow resolve endpoint and
+ // remains safe because download_market_package verifies its digest.
+ report.phase(InstallPhase::Download);
report.mirror(None, 0, 0);
match self.download_market_package(info, &info.url, &info.shasum, info.size_bytes, report) {
Ok(path) => Ok((path, info.shasum.clone())),
diff --git a/crates/host-core/src/plugins/marketplace.rs b/crates/host-core/src/plugins/marketplace.rs
index 25c24004a..15ec80d9f 100644
--- a/crates/host-core/src/plugins/marketplace.rs
+++ b/crates/host-core/src/plugins/marketplace.rs
@@ -10,68 +10,24 @@ pub(crate) use catalog::{built_in_catalog_at, bundled_package_bytes};
/// a relative package URL against a git host.
pub const OFFICIAL_CHANNEL_CATALOG_URL: &str = "https://plugins.aiuo.net/catalog.json";
-/// Backup channel: the GitHub copy of the distribution repository.
+/// The catalog source used by the plugin manager.
///
-/// Catalog and packages live in one tree, so a relative package URL resolves
-/// against whichever host served the catalog and a switch can never cross
-/// providers.
-pub const GITHUB_BACKUP_CHANNEL_CATALOG_URL: &str =
- "https://raw.githubusercontent.com/AIUO-Net/pi-desktop-plugins/main/catalog.json";
-
-/// Backup channel: the CNB copy, for networks that cannot reach GitHub.
-pub const MIRROR_MARKET_CATALOG_URL: &str =
- "https://cnb.cool/aixk/pi-desktop-plugins/-/git/raw/main/catalog.json";
-
-/// The catalog source a user chose.
-///
-/// `official` keeps its meaning — "the official one" — and the official one is
-/// now the plugin center. That is why a settings row written before this change
-/// keeps meaning what its author picked, and why no migration is needed.
+/// Application settings are pinned to `Official`.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MarketChannel {
/// The plugin center (the default).
Official,
- /// The GitHub backup.
- Github,
- /// The CNB backup.
- Mirror,
- /// A catalog URL the user typed.
- Custom,
}
impl MarketChannel {
/// Persisted value, and the `providerId` an install records.
pub fn as_str(self) -> &'static str {
- match self {
- MarketChannel::Official => "official",
- MarketChannel::Github => "github",
- MarketChannel::Mirror => "mirror",
- MarketChannel::Custom => "custom",
- }
- }
-
- /// Channel named by a persisted `pluginMarketSource` value.
- ///
- /// An absent value, the legacy `official`, and anything unrecognised all
- /// mean the official channel: the old resolution fell back to its default
- /// for exactly those three cases, and the default is now the center.
- pub fn from_setting(value: Option<&str>) -> Self {
- match value.map(str::trim) {
- Some("github") => MarketChannel::Github,
- Some("mirror") => MarketChannel::Mirror,
- Some("custom") => MarketChannel::Custom,
- _ => MarketChannel::Official,
- }
+ "official"
}
- /// Catalog URL, for every channel that has a fixed one.
+ /// Catalog URL for the fixed application channel.
pub fn catalog_url(self) -> Option<&'static str> {
- match self {
- MarketChannel::Official => Some(OFFICIAL_CHANNEL_CATALOG_URL),
- MarketChannel::Github => Some(GITHUB_BACKUP_CHANNEL_CATALOG_URL),
- MarketChannel::Mirror => Some(MIRROR_MARKET_CATALOG_URL),
- MarketChannel::Custom => None,
- }
+ Some(OFFICIAL_CHANNEL_CATALOG_URL)
}
}
@@ -86,20 +42,12 @@ pub(crate) fn market_source_env_override() -> Option<String> {
.filter(|url| !url.is_empty())
}
-/// Channel and custom URL pinned by persisted app settings.
-pub fn market_channel_from_settings(settings: Option<&Value>) -> (MarketChannel, Option<String>) {
- let Some(settings) = settings else {
- return (MarketChannel::Official, None);
- };
- let channel =
- MarketChannel::from_setting(settings.get("pluginMarketSource").and_then(Value::as_str));
- let custom_url = settings
- .get("pluginMarketCustomUrl")
- .and_then(Value::as_str)
- .map(str::trim)
- .filter(|url| !url.is_empty())
- .map(str::to_string);
- (channel, custom_url)
+/// Application settings always use the official marketplace.
+///
+/// The legacy fields remain in persisted settings for compatibility, but no
+/// longer select a catalog or a custom URL.
+pub fn market_channel_from_settings(_settings: Option<&Value>) -> (MarketChannel, Option<String>) {
+ (MarketChannel::Official, None)
}
impl PluginManager {
@@ -111,33 +59,28 @@ impl PluginManager {
if let Some(url) = market_source_env_override() {
return url;
}
- match self.market_channel {
- // A custom channel with no URL keeps the official default, which is
- // what an empty setting meant before the channel existed.
- MarketChannel::Custom => self
- .market_custom_url
- .clone()
- .unwrap_or_else(|| OFFICIAL_CHANNEL_CATALOG_URL.to_string()),
- channel => channel
- .catalog_url()
- .unwrap_or(OFFICIAL_CHANNEL_CATALOG_URL)
- .to_string(),
- }
+ self.market_channel
+ .catalog_url()
+ .unwrap_or(OFFICIAL_CHANNEL_CATALOG_URL)
+ .to_string()
}
- /// Channel the user selected.
+ /// Channel this manager currently uses.
pub fn channel(&self) -> MarketChannel {
self.market_channel
}
- /// Re-pin the catalog channel after the user switches sources.
+ /// Update the in-memory channel after a settings write.
///
/// Cached snapshots are left on disk: they are keyed back to their source
/// through `cache-meta.json`, so a snapshot from another channel is ignored
- /// rather than deleted and switching back keeps working offline.
- pub fn set_market_channel(&mut self, channel: MarketChannel, custom_url: Option<String>) {
+ /// rather than deleted if an internal caller changes the channel.
+ pub fn set_market_channel(
+ &mut self,
+ channel: MarketChannel,
+ _legacy_custom_url: Option<String>,
+ ) {
self.market_channel = channel;
- self.market_custom_url = custom_url;
}
/// Whether an install asks the plugin center where the package is.
@@ -268,9 +211,8 @@ impl PluginManager {
/// Whether the snapshot on disk came from the source currently in effect.
///
- /// Package URLs are rewritten to absolute form against the catalog they
- /// arrived with, so a snapshot from another provider would keep installs
- /// pointed at the source the user just switched away from.
+ /// Package URLs are rewritten to absolute form against their catalog, so a
+ /// snapshot left by an older source must not drive current installs.
pub(crate) fn cached_catalog_matches_source(&self, catalog_url: &str) -> bool {
match self.cached_catalog_source() {
Some(cached) => cached == catalog_url,
@@ -354,8 +296,8 @@ impl PluginManager {
/// refresh remains responsible for fetching the latest catalog.
///
/// A snapshot left by a different source is skipped rather than deleted,
- /// so switching back to a previously used provider recovers its catalog
- /// without a round trip.
+ /// so its package URLs and checksums cannot be paired with the official
+ /// catalog.
fn load_cached_catalog(&self) -> Result<MarketCatalogFile> {
if self.cached_catalog_matches_source(&self.market_source_url()) {
if let Ok(raw) = fs::read_to_string(self.catalog_path()) {
@@ -680,18 +622,13 @@ impl PluginManager {
}
}
- /// Whether the catalog in effect is one this project issues.
+ /// Whether the catalog in effect is the official catalog.
///
- /// The three channels are the project's own catalogs; a URL somebody typed
- /// into `custom` may describe its own plugins but cannot assert a tier. The
- /// comparison stays on the effective URL rather than on the setting, so a
- /// catalog reached through `PI_DESKTOP_PLUGIN_MARKET_URL` counts only when
- /// it actually names one of them.
+ /// The comparison stays on the effective URL, so a catalog reached through
+ /// `PI_DESKTOP_PLUGIN_MARKET_URL` is trusted only when it names the official
+ /// source.
fn is_trusted_channel(&self) -> bool {
- let url = self.market_source_url();
- url == OFFICIAL_CHANNEL_CATALOG_URL
- || url == GITHUB_BACKUP_CHANNEL_CATALOG_URL
- || url == MIRROR_MARKET_CATALOG_URL
+ self.market_source_url() == OFFICIAL_CHANNEL_CATALOG_URL
}
}
diff --git a/crates/host-core/src/plugins/registry.rs b/crates/host-core/src/plugins/registry.rs
index 75c057e36..6e9e7598a 100644
--- a/crates/host-core/src/plugins/registry.rs
+++ b/crates/host-core/src/plugins/registry.rs
@@ -23,9 +23,8 @@ pub struct PluginManager {
/// build stops shipping must stop being protected immediately, whatever the
/// row that survives it looks like.
pub(crate) bundled_ids: BTreeSet<String>,
- /// Catalog channel pinned by app settings, and the URL for `custom`.
+ /// Catalog channel pinned by app settings.
pub(crate) market_channel: MarketChannel,
- pub(crate) market_custom_url: Option<String>,
/// Cancel token of the install currently running, when one is.
///
/// The renderer's cancel action flips it and the download loop reads it.
@@ -41,22 +40,19 @@ pub struct PluginManager {
}
impl PluginManager {
- /// Build a manager against a specific catalog channel.
+ /// Build a manager against the official catalog channel.
///
- /// The channel is applied before the first catalog fetch so a non-default
- /// source configured in settings is honoured on the very first launch, not
- /// only after an explicit refresh.
+ /// The legacy custom URL argument is accepted and ignored for compatibility.
pub fn new(
data_dir: &Path,
market_channel: MarketChannel,
- market_custom_url: Option<String>,
+ _legacy_custom_url: Option<String>,
) -> Self {
let mut mgr = Self {
data_dir: data_dir.to_path_buf(),
runtime: Vec::new(),
bundled_ids: BTreeSet::new(),
market_channel,
- market_custom_url,
install_cancel: None,
locale: "en".into(),
};
diff --git a/crates/host-core/src/plugins/resolve.rs b/crates/host-core/src/plugins/resolve.rs
index 98eb6109d..5faf6c9b1 100644
--- a/crates/host-core/src/plugins/resolve.rs
+++ b/crates/host-core/src/plugins/resolve.rs
@@ -4,15 +4,17 @@
//! answers with the digest and every mirror that can serve the package; the
//! client picks one and verifies what it got.
//!
-//! Two kinds of failure are worth telling apart, because the caller answers
-//! them differently: a platform that could not be *reached* is covered by the
-//! catalog's own URL (the platform's contract says so explicitly), while a
-//! platform that *answered* has an opinion — not published, archived, unknown,
-//! rate limited — and papering over it would install something it is not
-//! offering.
+//! The resolve request is bounded so a slow platform cannot hold an install
+//! open for a long time. Network failures, rate limits, and missing platform
+//! mirrors use the freshly loaded catalog URL instead. Publication refusals
+//! remain authoritative and are never bypassed.
use super::*;
+/// The resolve endpoint answers only with metadata; keep it from blocking an
+/// install longer than the catalog-backed download path needs to start.
+const RESOLVE_TIMEOUT_SECONDS: &str = "3";
+
/// One place a package can be fetched from.
#[derive(Debug, Clone, Deserialize)]
pub(crate) struct ResolvedMirror {
@@ -67,86 +69,46 @@ pub(crate) fn request(
"version": version,
})
.to_string();
- match resolve_once(&endpoint, &body) {
- Ok(resolved) => Ok(resolved),
- Err(Attempt::Failed(error)) => Err(error),
- // The platform answers a caller that asks too often with the interval
- // to wait. One retry is what its contract describes, and a longer loop
- // would be the broken client the limit exists to catch.
- Err(Attempt::RateLimited { wait, .. }) => {
- std::thread::sleep(wait);
- match resolve_once(&endpoint, &body) {
- Ok(resolved) => Ok(resolved),
- Err(Attempt::Failed(error)) | Err(Attempt::RateLimited { error, .. }) => Err(error),
- }
- }
- }
-}
-
-/// What one resolve attempt produced.
-enum Attempt {
- /// The platform could not answer, or answered something unusable.
- Failed(anyhow::Error),
- /// It answered `429` and named how long to wait.
- RateLimited {
- error: anyhow::Error,
- wait: Duration,
- },
+ resolve_once(&endpoint, &body)
}
/// One resolve request.
-fn resolve_once(endpoint: &str, body: &str) -> std::result::Result<ResolvedDownload, Attempt> {
- let (status, payload, headers) = post_json(endpoint, body).map_err(Attempt::Failed)?;
+fn resolve_once(endpoint: &str, body: &str) -> Result<ResolvedDownload> {
+ let (status, payload) = post_json(endpoint, body)?;
if status != 200 {
let error = refusal(status, &payload);
- if status == 429 {
- return Err(Attempt::RateLimited {
- error,
- wait: retry_after(&headers).unwrap_or(Duration::from_secs(1)),
- });
- }
- return Err(Attempt::Failed(error));
+ return Err(error);
}
let resolved: ResolvedDownload = serde_json::from_slice(&payload).map_err(|error| {
- Attempt::Failed(anyhow!(
- "PLUGIN_MARKET_INVALID: the plugin center's answer is not readable: {error}"
- ))
+ anyhow!("PLUGIN_MARKET_INVALID: the plugin center's answer is not readable: {error}")
})?;
if resolved.sha256.trim().is_empty() {
- return Err(Attempt::Failed(anyhow!(
+ return Err(anyhow!(
"PLUGIN_MARKET_INVALID: the plugin center named no digest"
- )));
+ ));
}
if resolved.downloads.is_empty() {
- return Err(Attempt::Failed(anyhow!(
+ return Err(anyhow!(
"PLUGIN_MARKET_INVALID: the plugin center listed no download"
- )));
+ ));
}
Ok(resolved)
}
-/// Seconds the platform asked the caller to wait, when it said so.
+/// Whether the catalog's package URL may safely answer a resolve failure.
///
-/// Clamped: a deployment may name a longer interval than an install should
-/// block on, and the platform's own default is sixty seconds.
-fn retry_after(headers: &str) -> Option<Duration> {
- let value = headers.lines().find_map(|line| {
- let (name, value) = line.split_once(':')?;
- name.trim()
- .eq_ignore_ascii_case("retry-after")
- .then(|| value.trim())
- })?;
- let seconds: u64 = value.parse().ok()?;
- Some(Duration::from_secs(seconds.clamp(1, 60)))
-}
-
-/// Whether a resolve failure is one the catalog's own URL may answer.
-///
-/// Only a transport failure or an unavailable deployment: those are the cases
-/// the platform's contract covers with "install from the catalog's URL". Every
-/// refusal keeps its own error so the surface can say what happened.
-pub(crate) fn is_recoverable(error: &anyhow::Error) -> bool {
- error.to_string().starts_with("PLUGIN_NETWORK")
+/// A rate limit or missing platform mirror affects distribution metadata, not
+/// the publication decision; the catalog package remains checksum-verified.
+/// Explicit publication refusals and malformed responses stay authoritative.
+pub(crate) fn allows_catalog_fallback(error: &anyhow::Error) -> bool {
+ let message = error.to_string();
+ [
+ "PLUGIN_NETWORK",
+ "PLUGIN_MARKET_RATE_LIMITED",
+ "PLUGIN_MARKET_NO_SOURCE",
+ ]
+ .iter()
+ .any(|prefix| message.starts_with(prefix))
}
/// The error a non-2xx answer becomes.
@@ -179,15 +141,12 @@ fn refusal(status: u16, payload: &[u8]) -> anyhow::Error {
/// POST a JSON body with curl.
///
-/// Answers with the status, the response body and the response headers: the
-/// body carries the platform's error envelope, and the headers carry the
-/// interval a rate-limited caller is asked to wait. The body is written to a
-/// scratch file and the status is read from `--write-out`, so an error answer
-/// still yields the envelope instead of a curl diagnostic.
-fn post_json(url: &str, body: &str) -> Result<(u16, Vec<u8>, String)> {
+/// Answers with the status and response body. The body is written to a scratch
+/// file and the status is read from `--write-out`, so an error answer still
+/// yields the platform's error envelope instead of a curl diagnostic.
+fn post_json(url: &str, body: &str) -> Result<(u16, Vec<u8>)> {
let body_path = super::install::download_scratch_path();
let response_path = super::install::download_scratch_path();
- let headers_path = super::install::download_scratch_path();
fs::write(&body_path, body).with_context(|| format!("write resolve body for {url}"))?;
let mut args: Vec<String> = vec![
@@ -203,13 +162,10 @@ fn post_json(url: &str, body: &str) -> Result<(u16, Vec<u8>, String)> {
format!("@{}", body_path.to_string_lossy()),
"--output".into(),
response_path.to_string_lossy().into_owned(),
- // The retry interval arrives in a header, so the headers are kept.
- "--dump-header".into(),
- headers_path.to_string_lossy().into_owned(),
"--write-out".into(),
"%{http_code}".into(),
"--max-time".into(),
- "30".into(),
+ RESOLVE_TIMEOUT_SECONDS.into(),
"--max-redirs".into(),
"3".into(),
"--location".into(),
@@ -238,8 +194,7 @@ fn post_json(url: &str, body: &str) -> Result<(u16, Vec<u8>, String)> {
.parse::<u16>()
.unwrap_or(0);
let payload = fs::read(&response_path).unwrap_or_default();
- let headers = fs::read_to_string(&headers_path).unwrap_or_default();
- Ok((status, payload, headers))
+ Ok((status, payload))
}
Ok(output) => {
let err = decode_curl_output(&output.stderr);
@@ -253,7 +208,6 @@ fn post_json(url: &str, body: &str) -> Result<(u16, Vec<u8>, String)> {
};
let _ = fs::remove_file(&body_path);
let _ = fs::remove_file(&response_path);
- let _ = fs::remove_file(&headers_path);
result
}
@@ -281,53 +235,46 @@ mod tests {
}
#[test]
- fn a_refusal_is_not_recoverable_and_a_dead_deployment_is() {
+ fn publication_refusals_stay_authoritative_but_unavailable_resolve_uses_catalog() {
let refused = refusal(
403,
br#"{"error":{"code":"NOT_PUBLISHED","message":"not yet"}}"#,
);
let text = refused.to_string();
assert!(text.starts_with("PLUGIN_MARKET_NOT_PUBLISHED"), "{text}");
- assert!(!is_recoverable(&refused));
+ assert!(!allows_catalog_fallback(&refused));
let archived = refusal(403, br#"{"error":{"code":"PLUGIN_ARCHIVED"}}"#);
assert!(archived.to_string().starts_with("PLUGIN_MARKET_ARCHIVED"));
+ assert!(!allows_catalog_fallback(&archived));
+
+ let missing = refusal(404, br#"{"error":{"code":"NOT_FOUND"}}"#);
+ assert!(missing.to_string().starts_with("PLUGIN_MARKET_NOT_FOUND"));
+ assert!(!allows_catalog_fallback(&missing));
let limited = refusal(429, br#"{"error":{"code":"TOO_MANY_REQUESTS"}}"#);
assert!(limited
.to_string()
.starts_with("PLUGIN_MARKET_RATE_LIMITED"));
+ assert!(allows_catalog_fallback(&limited));
let no_source = refusal(503, br#"{"error":{"code":"NO_DOWNLOAD_SOURCE"}}"#);
assert!(no_source.to_string().starts_with("PLUGIN_MARKET_NO_SOURCE"));
+ assert!(allows_catalog_fallback(&no_source));
let down = refusal(502, b"<html>bad gateway</html>");
assert!(down.to_string().starts_with("PLUGIN_NETWORK"), "{down}");
- assert!(is_recoverable(&down));
+ assert!(allows_catalog_fallback(&down));
// A body this client mangled is its own defect: falling back to the
// catalog would install something the platform was never asked for.
let mangled = refusal(400, br#"{"error":{"code":"BAD_BODY"}}"#);
assert!(mangled.to_string().starts_with("PLUGIN_MARKET_INVALID"));
- assert!(!is_recoverable(&mangled));
+ assert!(!allows_catalog_fallback(&mangled));
}
#[test]
- fn a_rate_limit_waits_what_the_platform_asked_for() {
- let headers = "HTTP/1.1 429 Too Many Requests\r\nRetry-After: 12\r\n\r\n";
- assert_eq!(retry_after(headers), Some(Duration::from_secs(12)));
- // The header name is case-insensitive and the value may carry spaces.
- assert_eq!(
- retry_after("retry-after: 7 \r\n"),
- Some(Duration::from_secs(7))
- );
- // A deployment may ask for longer than an install should block on.
- assert_eq!(
- retry_after("Retry-After: 600\r\n"),
- Some(Duration::from_secs(60))
- );
- // No header, or one that is not a number of seconds: wait the minimum.
- assert_eq!(retry_after("HTTP/1.1 429\r\n\r\n"), None);
- assert_eq!(retry_after("Retry-After: soon\r\n"), None);
+ fn resolve_metadata_request_has_a_three_second_deadline() {
+ assert_eq!(RESOLVE_TIMEOUT_SECONDS, "3");
}
}
diff --git a/crates/host-core/src/plugins/tests.rs b/crates/host-core/src/plugins/tests.rs
index b3ee7e39c..ca252b9c5 100644
--- a/crates/host-core/src/plugins/tests.rs
+++ b/crates/host-core/src/plugins/tests.rs
@@ -464,62 +464,29 @@ fn high_risk_permissions_roundtrip_on_notes_plugin() {
#[test]
fn resolve_relative_package_urls_against_catalog() {
let resolved = PluginManager::resolve_package_url(
- GITHUB_BACKUP_CHANNEL_CATALOG_URL,
+ OFFICIAL_CHANNEL_CATALOG_URL,
None,
"packages/demo.hello-0.2.0.piplug",
);
assert_eq!(
resolved,
- "https://raw.githubusercontent.com/AIUO-Net/pi-desktop-plugins/main/packages/demo.hello-0.2.0.piplug"
+ "https://plugins.aiuo.net/packages/demo.hello-0.2.0.piplug"
);
}
-#[test]
-fn refresh_catalog_from_the_github_backup_when_network_available() {
- let _guard = lock_market_env();
- // Skip cleanly if offline / rate-limited.
- let url = GITHUB_BACKUP_CHANNEL_CATALOG_URL;
- if download_url(url).is_err() {
- return;
- }
- let dir = tempdir().unwrap();
- unsafe {
- std::env::set_var("PI_DESKTOP_DATA_DIR", dir.path());
- std::env::set_var("PI_DESKTOP_PLUGIN_MARKET_URL", url);
- }
- let mgr = PluginManager::new(dir.path(), MarketChannel::Official, None);
- let Ok(meta) = mgr.refresh_market(true) else {
- // The repository answered the probe above and then rate limited or
- // dropped the real refresh: a network hiccup is not a client defect.
- return;
- };
- assert_eq!(meta["providerId"], "official");
- assert!(meta["pluginCount"].as_u64().unwrap_or(0) >= 1);
- assert!(meta["sourceUrl"]
- .as_str()
- .unwrap_or("")
- .contains("pi-desktop-plugins"));
- // Which plugins the repository publishes is the publisher's business; that
- // the catalog is readable and reaches the search path is the client's.
- let search = mgr.market_search(None, None).unwrap();
- assert!(
- !search.is_empty(),
- "a published catalog lists at least one installable plugin"
- );
- unsafe {
- std::env::remove_var("PI_DESKTOP_DATA_DIR");
- std::env::remove_var("PI_DESKTOP_PLUGIN_MARKET_URL");
- }
-}
-
-/// The official channel's install path, against the deployment that serves it.
+/// The official channel's install path, against the live deployment.
///
-/// Everything the test needs comes from the published catalog, so it does not
-/// pin a version a later release removes. It skips when the platform or the
-/// catalog cannot be reached, like the refresh above: the unit suite has to stay
-/// green on a machine with no route to either.
+/// This test is ignored by default because it contacts the plugin center. It
+/// requires both explicit test opt-in and user authorization.
#[test]
+#[ignore = "requires explicit live plugin marketplace authorization"]
fn the_plugin_center_resolves_a_published_package() {
+ if std::env::var("PI_DESKTOP_RUN_LIVE_PLUGIN_MARKET_TESTS").as_deref() != Ok("1") {
+ eprintln!(
+ "Set PI_DESKTOP_RUN_LIVE_PLUGIN_MARKET_TESTS=1 after authorization to run this live test."
+ );
+ return;
+ }
let _guard = lock_market_env();
let Ok(bytes) = download_url(OFFICIAL_CHANNEL_CATALOG_URL) else {
return;
@@ -568,10 +535,7 @@ fn the_plugin_center_resolves_a_published_package() {
}
#[test]
-fn market_channel_from_settings_selects_the_configured_channel() {
- // Nothing saved, and the legacy `official`, both mean the official channel:
- // it is the default, so a later default change reaches a user who never
- // switched away.
+fn market_channel_from_settings_ignores_legacy_source_values() {
assert_eq!(
market_channel_from_settings(None).0,
MarketChannel::Official
@@ -584,36 +548,14 @@ fn market_channel_from_settings_selects_the_configured_channel() {
market_channel_from_settings(Some(&json!({"pluginMarketSource": "official"}))).0,
MarketChannel::Official
);
- // An unrecognised value falls back to the official channel rather than
- // stranding the marketplace on an empty endpoint.
- assert_eq!(
- market_channel_from_settings(Some(&json!({"pluginMarketSource": "nonsense"}))).0,
- MarketChannel::Official
- );
- assert_eq!(
- market_channel_from_settings(Some(&json!({"pluginMarketSource": "github"}))).0,
- MarketChannel::Github
- );
- assert_eq!(
- market_channel_from_settings(Some(&json!({"pluginMarketSource": "mirror"}))).0,
- MarketChannel::Mirror
- );
- let (channel, url) = market_channel_from_settings(Some(&json!({
- "pluginMarketSource": "custom",
- "pluginMarketCustomUrl": " https://example.test/catalog.json ",
- })));
- assert_eq!(channel, MarketChannel::Custom);
- assert_eq!(url.as_deref(), Some("https://example.test/catalog.json"));
- // A custom channel with no URL must not strand the marketplace on an
- // empty endpoint.
- assert_eq!(
- market_channel_from_settings(Some(&json!({
- "pluginMarketSource": "custom",
- "pluginMarketCustomUrl": " ",
- })))
- .1,
- None
- );
+ for source in ["official", "github", "mirror", "custom", "nonsense"] {
+ let (channel, custom_url) = market_channel_from_settings(Some(&json!({
+ "pluginMarketSource": source,
+ "pluginMarketCustomUrl": "https://example.test/catalog.json",
+ })));
+ assert_eq!(channel, MarketChannel::Official, "source {source}");
+ assert_eq!(custom_url, None, "source {source}");
+ }
}
#[test]
@@ -624,25 +566,28 @@ fn cached_catalog_is_scoped_to_the_source_that_fetched_it() {
std::env::set_var("PI_DESKTOP_DATA_DIR", dir.path());
}
let mgr = PluginManager::new(dir.path(), MarketChannel::Official, None);
- // A bundled offline snapshot records no source and stays usable
- // whichever provider is selected.
+ // A bundled offline snapshot records no source and stays usable until
+ // an official remote snapshot has been fetched.
let _ = fs::remove_file(mgr.market_cache_meta_path());
+ let previous_source = "https://legacy.example.test/catalog.json";
+ // Without cache metadata, the bundled offline catalog has no
+ // provider-specific URLs and remains usable for any active source.
assert!(mgr.cached_catalog_matches_source(OFFICIAL_CHANNEL_CATALOG_URL));
- assert!(mgr.cached_catalog_matches_source(MIRROR_MARKET_CATALOG_URL));
+ assert!(mgr.cached_catalog_matches_source(previous_source));
fs::create_dir_all(dir.path().join("plugins/market")).unwrap();
fs::write(
mgr.market_cache_meta_path(),
- serde_json::to_string(&json!({"sourceUrl": MIRROR_MARKET_CATALOG_URL})).unwrap(),
+ serde_json::to_string(&json!({"sourceUrl": previous_source})).unwrap(),
)
.unwrap();
- assert!(mgr.cached_catalog_matches_source(MIRROR_MARKET_CATALOG_URL));
+ assert!(mgr.cached_catalog_matches_source(previous_source));
assert!(!mgr.cached_catalog_matches_source(OFFICIAL_CHANNEL_CATALOG_URL));
});
}
#[test]
-fn switching_source_ignores_the_previous_providers_snapshot() {
+fn catalog_cache_ignores_a_snapshot_from_another_source() {
with_local_market(|| {
let local_source = std::env::var("PI_DESKTOP_PLUGIN_MARKET_URL").unwrap();
let dir = tempdir().unwrap();
@@ -652,24 +597,27 @@ fn switching_source_ignores_the_previous_providers_snapshot() {
let mgr = PluginManager::new(dir.path(), MarketChannel::Official, None);
// A snapshot carrying a plugin the built-in catalog does not have,
- // written while a different provider was selected.
+ // left by an older catalog source.
let mut foreign = built_in_catalog_at(dir.path());
- foreign.provider_id = "mirror".into();
+ foreign.provider_id = "official".into();
foreign.plugins.truncate(1);
- foreign.plugins[0].id = "mirror.only".into();
- foreign.plugins[0].name = "Mirror Only".into();
+ foreign.plugins[0].id = "legacy.only".into();
+ foreign.plugins[0].name = "Legacy Only".into();
fs::create_dir_all(dir.path().join("plugins/market")).unwrap();
fs::write(mgr.catalog_path(), serde_json::to_string(&foreign).unwrap()).unwrap();
fs::write(
mgr.market_cache_meta_path(),
- serde_json::to_string(&json!({"sourceUrl": MIRROR_MARKET_CATALOG_URL})).unwrap(),
+ serde_json::to_string(&json!({
+ "sourceUrl": "https://legacy.example.test/catalog.json"
+ }))
+ .unwrap(),
)
.unwrap();
- // Package URLs in that snapshot resolve against the provider that
- // served it, so search must fall back to the built-in catalog.
+ // The old source no longer matches the active catalog, so search must
+ // fall back to the built-in catalog.
let results = mgr.market_search(None, None).unwrap();
- assert!(!results.iter().any(|p| p.id == "mirror.only"));
+ assert!(!results.iter().any(|p| p.id == "legacy.only"));
assert!(results.iter().any(|p| p.id == "demo.hello"));
// Re-record the snapshot against the active source and it is used.
@@ -679,7 +627,7 @@ fn switching_source_ignores_the_previous_providers_snapshot() {
)
.unwrap();
let results = mgr.market_search(None, None).unwrap();
- assert!(results.iter().any(|p| p.id == "mirror.only"));
+ assert!(results.iter().any(|p| p.id == "legacy.only"));
});
}
@@ -1786,31 +1734,35 @@ fn relative_package_urls_resolve_against_the_declared_artifact_base() {
);
}
-/// The backup channels serve `catalog.json` from their tree root and packages
-/// from `packages/`, so a relative URL needs no declared base. The official
-/// channel does not use this path at all: an install asks the plugin center
-/// where the package is.
+/// The official platform can return package URLs on approved GitHub and CNB
+/// hosts. The catalog's declared base keeps each package on its own host.
#[test]
-fn backup_channels_each_resolve_their_own_packages() {
+fn official_catalog_package_bases_resolve_to_approved_mirror_hosts() {
let relative = "packages/acme.todo-1.0.0.piplug";
- let github =
- PluginManager::resolve_package_url(GITHUB_BACKUP_CHANNEL_CATALOG_URL, None, relative);
+ let github = PluginManager::resolve_package_url(
+ OFFICIAL_CHANNEL_CATALOG_URL,
+ Some("https://raw.githubusercontent.com/AIUO-Net/pi-desktop-plugins/main"),
+ relative,
+ );
assert_eq!(
github,
"https://raw.githubusercontent.com/AIUO-Net/pi-desktop-plugins/main/packages/acme.todo-1.0.0.piplug"
);
- let mirror = PluginManager::resolve_package_url(MIRROR_MARKET_CATALOG_URL, None, relative);
+ let mirror = PluginManager::resolve_package_url(
+ OFFICIAL_CHANNEL_CATALOG_URL,
+ Some("https://cnb.cool/aixk/pi-desktop-plugins/-/git/raw/main"),
+ relative,
+ );
assert_eq!(
mirror,
"https://cnb.cool/aixk/pi-desktop-plugins/-/git/raw/main/packages/acme.todo-1.0.0.piplug"
);
- // Neither resolution leaves the source the user picked, and both hosts
- // are ones the download boundary already accepts.
- package_host_allowed(&github, GITHUB_BACKUP_CHANNEL_CATALOG_URL).unwrap();
- package_host_allowed(&mirror, MIRROR_MARKET_CATALOG_URL).unwrap();
+ // Both package hosts are accepted while the catalog stays official.
+ package_host_allowed(&github, OFFICIAL_CHANNEL_CATALOG_URL).unwrap();
+ package_host_allowed(&mirror, OFFICIAL_CHANNEL_CATALOG_URL).unwrap();
assert!(github.starts_with("https://raw.githubusercontent.com/AIUO-Net/"));
assert!(mirror.starts_with("https://cnb.cool/"));
}
@@ -1901,8 +1853,7 @@ fn verified_trust_is_honoured_only_from_the_official_source() {
let official = offline_manager(dir.path());
assert_eq!(official.resolve_trust(&v2_entry()), "verified");
- // The same claim from a source the user pointed at themselves cannot
- // promote itself past community.
+ // A non-official development override cannot promote itself past community.
unsafe {
std::env::set_var(
"PI_DESKTOP_PLUGIN_MARKET_URL",
diff --git a/crates/host-core/src/rpc/mod.rs b/crates/host-core/src/rpc/mod.rs
index 09dbcc30f..d76fd54b8 100644
--- a/crates/host-core/src/rpc/mod.rs
+++ b/crates/host-core/src/rpc/mod.rs
@@ -2230,9 +2230,9 @@ async fn handle_request(
st.db
.set_setting("app", &settings)
.map_err(|e| rpc_err(1000, e.to_string(), "INTERNAL"))?;
- // Re-pin the marketplace channel in memory. Fetching here would hold
- // the state lock behind a remote timeout, so the renderer triggers
- // `market.refresh` after switching channels.
+ // Keep the marketplace channel in memory aligned with settings.
+ // Legacy source values are ignored, so this remains the official
+ // channel; the renderer owns remote refresh timing.
let (channel, custom_url) =
crate::plugins::market_channel_from_settings(Some(&settings));
st.plugins.set_market_channel(channel, custom_url);
diff --git a/docs/adr/0096-flat-settings-directory-and-marketplace-context.md b/docs/adr/0096-flat-settings-directory-and-marketplace-context.md
index 55fe570c9..709b824b8 100644
--- a/docs/adr/0096-flat-settings-directory-and-marketplace-context.md
+++ b/docs/adr/0096-flat-settings-directory-and-marketplace-context.md
@@ -1,6 +1,10 @@
# ADR 0096: Flatten the Settings directory and colocate marketplace source configuration
-- Status: Accepted
+> Superseded 2026-10-08 for marketplace-source controls: Plugins → Marketplace
+> now uses only the official catalog and has no source selector. See the
+> amendment to [ADR 0276](0276-official-plugin-channel-and-backup-channels.md).
+
+- Status: Accepted for Settings IA; marketplace-source placement superseded
- Date: 2026-08-18
- Deciders: PI-Desktop core
- Related: D166, D168, D238, ADR 0036, ADR 0058
@@ -33,11 +37,12 @@ this exact order:
8. Info
Remove navigation group headings and the Settings `Extensions` destination.
-Move the official/mirror/custom marketplace source selector, including the
-custom catalog URL field and active-source status, into the app-shell
-`Extensions → Marketplace` surface. The shared Settings search index contains
-only the eight Settings destinations; plugin marketplace search and controls
-remain owned by the Extensions page.
+At the time of this decision, move the official/mirror/custom marketplace
+source selector, including the custom catalog URL field and active-source
+status, into the app-shell `Extensions → Marketplace` surface. That selector
+has since been retired: the page now uses the official catalog only, and
+host-core ignores legacy source values. The shared Settings search index still
+contains only the eight Settings destinations.
No IPC, host protocol, storage, provider, plugin permission, or project
ownership contract changes.
@@ -47,12 +52,10 @@ ownership contract changes.
- Settings has one visual hierarchy and fewer competing labels.
- The rail matches the frozen eight-destination IA and no longer duplicates
the Extensions page name.
-- Marketplace source changes remain available in the context where users browse
- and install packages, with the same persistence and refresh behavior.
-- Settings search no longer deep-links marketplace-source rows; the Extensions
- page is the owner of that surface.
-- Screenshot capture scenes and marketplace E2E steps must open the source
- selector from Extensions → Marketplace.
+- The marketplace-source selector described by this ADR is no longer present;
+ source selection is not a Settings destination or an Extensions control.
+- Screenshot capture scenes and marketplace E2E steps use the fixed official
+ catalog.
## Alternatives
@@ -68,8 +71,10 @@ split marketplace browsing from marketplace configuration.
### Remove marketplace source configuration
-Rejected because mirror and custom catalog sources are required for networks
-that cannot reach the official source and for development/private catalogs.
+Rejected at the time because mirror and custom catalog sources were considered
+necessary for some networks and development catalogs. The later official-only
+decision retains the catalog URL fallback and a development environment
+override; see ADR 0276.
## References
diff --git a/docs/adr/0276-official-plugin-channel-and-backup-channels.md b/docs/adr/0276-official-plugin-channel-and-backup-channels.md
index 96c92a237..a6ee663e6 100644
--- a/docs/adr/0276-official-plugin-channel-and-backup-channels.md
+++ b/docs/adr/0276-official-plugin-channel-and-backup-channels.md
@@ -1,5 +1,11 @@
# ADR 0276: Official plugin channel and backup channels
+> Amended 2026-10-08: the marketplace UI and persisted settings now use only
+> the official channel; legacy source values are ignored. The resolve request
+> is capped at three seconds and falls back to the official catalog URL after
+> a timeout, rate limit, or `NO_DOWNLOAD_SOURCE`. Publication refusals remain
+> authoritative.
+
- Status: Accepted for implementation
- Date: 2026-09-17
- Deciders: PI-Desktop plugin and distribution maintainers
@@ -47,57 +53,61 @@ client's download allowlist; the CNB mirror still served an older distribution
92951 bytes). A version string may contain `+` (for example `0.3.0+0.2.0`), so
the platform's byte route cannot be assumed to carry every published version.
-The client's source model therefore has to become "the center first, the two Git
-hosts as backups", and the install path has to follow the platform's contract.
+The original implementation decision made the center primary and offered the
+two Git hosts as catalog backups. The 2026-10-08 amendment retires those
+user-selectable catalog sources while keeping package mirrors returned by the
+official platform.
## Decision
-### 1. Four channels, and `official` keeps its meaning
+### 1. The product uses the official channel
+
+The product always reads `https://plugins.aiuo.net/catalog.json`; the Plugins
+page has no source selector. `pluginMarketSource` and `pluginMarketCustomUrl`
+remain in persisted settings so older settings can be read without migration,
+but host-core ignores them. The development-only
+`PI_DESKTOP_PLUGIN_MARKET_URL` override remains available to tests and local
+development.
-| # | Channel | Value | Catalog URL | Install path |
-| --- | --- | --- | --- | --- |
-| 1 | Official channel | `official` (default) | `https://plugins.aiuo.net/catalog.json` | Platform resolve |
-| 2 | GitHub backup | `github` (new) | `https://raw.githubusercontent.com/AIUO-Net/pi-desktop-plugins/main/catalog.json` | Static relative URL |
-| 3 | CNB backup | `mirror` (unchanged) | `https://cnb.cool/aixk/pi-desktop-plugins/-/git/raw/main/catalog.json` | Static relative URL |
-| 4 | Custom | `custom` (unchanged) | user-provided | Static relative URL |
+| Channel | Value | Catalog URL | Install path |
+| --- | --- | --- | --- |
+| Official channel | `official` | `https://plugins.aiuo.net/catalog.json` | Platform resolve |
-`official` keeps meaning "the project's own first-party channel" and now points
-at the center, so an unset value and an unrecognized value resolve to it and no
-persisted setting is migrated. `mirror` keeps meaning CNB; `github` is new
-because the GitHub backup no longer is the default. Display names are
-localized — Official channel / GitHub backup / CNB backup / Custom in English.
-A package URL never crosses providers: whichever channel served the catalog also
-serves the package.
+`official` means the project's first-party plugin center. A package URL never
+crosses providers: the official catalog supplies its package URL, and fallback
+downloads remain inside the official channel.
### 2. The official channel resolves through the platform
1. Refresh the catalog, then `POST {center origin}/api/v1/download/resolve` with
- `{ deviceId, pluginId, version }` — once per install or update. POST rather
- than GET, because the platform documents that a device id in a query string
- ends up in access logs.
+ `{ deviceId, pluginId, version }` — once per install or update. The client
+ gives this metadata request a three-second total deadline. POST rather than
+ GET, because the platform documents that a device id in a query string ends
+ up in access logs.
2. Try the returned `downloads` entries in order. Every attempt is downloaded to
a temporary file, checked against the returned `sha256` and the announced
`sizeBytes`, and extracted only when both agree. A mirror that fails —
network error, HTTP error, digest mismatch, size mismatch — is abandoned and
the next one is tried. Requests stay on the download allowlist.
-3. Only when the platform could not be reached, or when no mirror in the list
- could serve the version, the client falls back to the catalog's own package
- URL (`artifactBaseUrl` plus the relative `url`). That is the fallback the
- platform defines, and that install is not counted.
+3. When the request times out or fails at the transport boundary, the platform
+ rate-limits the device, or it answers `503 NO_DOWNLOAD_SOURCE`, the client
+ immediately falls back to the catalog's own package URL (`artifactBaseUrl`
+ plus the relative `url`). The catalog digest and size are still verified,
+ and that install is not counted. If every usable returned mirror fails at
+ the transport boundary, use the same fallback. A malformed resolve response
+ or integrity failure does not use this fallback.
4. The answer is never cached (`Cache-Control: no-store` is the platform's
confirmation of this), so two installs of the same version are two calls.
5. The resolve digest is authoritative on the resolve path; the catalog's
- `shasum` stays authoritative on the fallback and on the backup channels.
- `sizeBytes` is a sanity check on both.
-6. Refusals are reported, not papered over: `403 NOT_PUBLISHED` (no retry),
+ `shasum` stays authoritative on the catalog fallback. `sizeBytes` is a
+ sanity check on both paths.
+6. Publication refusals are reported, not papered over: `403 NOT_PUBLISHED`,
`403 PLUGIN_ARCHIVED` (hide the plugin from install and update selection),
- `404` (the platform has no such version — including a `+`-suffixed version
- the byte route cannot carry), `429` (wait the `Retry-After` interval, retry
- once, then report), `503` (report the deployment problem; `NO_DOWNLOAD_SOURCE`
- means no mirror can serve the version).
-7. Nothing switches the channel automatically. An unreachable platform is
- reported after the fallback, and the user switches through the existing
- selector.
+ and `404` (the platform has no such version — including a `+`-suffixed
+ version the byte route cannot carry). A rate limit or no-source deployment
+ answer uses the checked catalog URL without waiting or retrying.
+7. A resolve fallback does not change the selected channel. The product always
+ remains on the official channel and has no user-facing channel selector.
### 3. A stable device identifier, sent as a digest
@@ -121,22 +131,19 @@ read once per process, is stable for an installation across restarts, is never
shown in the UI, and is not a setting. It is a counting and rate-limit key, not
an account.
-### 4. The backup channels and `custom` are unchanged
+### 4. Legacy catalog-source settings are ignored
-`github`, `mirror`, and `custom` keep the static relative-URL resolution,
-including `artifactBaseUrl` precedence, the download allowlist, redirect
-re-validation, and shasum verification, byte for byte. The persisted source
-keeps working for existing users, the cache stays keyed by `sourceUrl` so a
-switch ignores rather than deletes another channel's snapshot, and an installed
-record's `providerId` now names the channel it actually came from — already
-installed records are not rewritten.
+The legacy `github`, `mirror`, and `custom` settings no longer select a catalog.
+The platform may still return GitHub or CNB package mirrors for the official
+catalog; these use the platform's digest and the same download allowlist. The
+cache stays keyed by `sourceUrl`, so an older snapshot from another catalog is
+ignored rather than deleted; installed records are not rewritten.
-### 5. Trust tiers follow the trusted channels
+### 5. Trust follows the official catalog
-`verified` renders as written only from the three project channels (official,
-GitHub backup, CNB backup). `custom` still degrades to `community`, and a v1
-catalog's boolean `verified` mapping is unchanged. The predicate changes from
-"is this the official source" to "is this a trusted channel".
+`verified` renders as written only from the official catalog. A v1 catalog's
+boolean `verified` mapping is unchanged. Package mirrors returned by the
+official platform do not change the catalog's trust source.
### 6. The download allowlist does not change
@@ -187,26 +194,28 @@ action.
- The official channel gains per-mirror fallback, withdrawal and archive
signals, and download counting, and it acquires a dependency: an install asks
- the platform. The documented catalog-URL fallback and the two backup channels
- are the mitigation.
+ the platform. The catalog-URL fallback is the mitigation; users cannot select
+ another channel from the marketplace page.
- Per-mirror digest verification becomes the reason a divergent mirror cannot
break an install. The measured CNB divergence (`pi.todo-0.6.5` at 92487 bytes
versus 92951) is exactly the case this absorbs.
- A first third-party service now receives an installation-level identifier.
Only a digest is sent, the platform stores counts rather than identities, and
the privacy policy and the decisions log state it.
-- `429` costs at most one `Retry-After` wait per install; a batch update makes
- one call per plugin, not one per mirror.
+- A resolve timeout is capped at three seconds. `429` no longer waits for
+ `Retry-After`; timeout, rate-limit, and no-source responses use the checked
+ catalog package URL. A batch update still makes one resolve call per plugin,
+ not one per mirror.
- An install is no longer opaque: the interface sees the phase, the mirror being
tried, and the byte count, and a user can stop a download without leaving a
half-installed plugin. The cost is progress notifications on the RPC channel,
bounded by the 200 ms throttle and the per-phase reports.
- No `.piplug` or manifest change, no catalog v1/v2 parsing change, no
- permission-review change, no storage schema change, no migration of persisted
- source values, and no change to the two backup install paths.
-- Still open, deliberately: signature verification (optional as before), any
- automatic channel switching, and the center's own byte route, which stays the
- marketplace page and console path.
+ permission-review change, and no storage schema change. Legacy persisted
+ source values are retained but ignored; approved package mirror hosts and
+ integrity checks remain unchanged.
+- Still open, deliberately: signature verification (optional as before) and the
+ center's own byte route, which stays the marketplace page and console path.
## Rejected alternatives
diff --git a/docs/spec/04-ux/01-ui-ia.md b/docs/spec/04-ux/01-ui-ia.md
index 940958419..8a96b622e 100644
--- a/docs/spec/04-ux/01-ui-ia.md
+++ b/docs/spec/04-ux/01-ui-ia.md
@@ -322,12 +322,10 @@ The Extensions destination is a focused plugin surface with a compact header and
only two tabs: **Installed** and **Marketplace**. Installed groups plugin rows
by state — Needs attention / Updates available / Active / Turned off — as soft
tiles stacked under a group label (D296). Marketplace remains the browse/install
-card grid. The page draws no dividers: header, toolbar, rows, source settings,
-cards and the detail sheet's sections are set apart by tone and spacing, and
-hairlines are reserved for floating layers (menus, sheet, dialogs). The
-marketplace source settings show the source selector without a redundant
-provider explanation or active-source status line. MCP, Skills, and Subagents
-are not tabs or sections of Extensions.
+card grid and always uses the official catalog. The page draws no dividers:
+header, toolbar, rows, cards and the detail sheet's sections are set apart by
+tone and spacing, and hairlines are reserved for floating layers (menus, sheet,
+dialogs). MCP, Skills, and Subagents are not tabs or sections of Extensions.
### 3.5 Settings (full-page takeover)
### 3.5 Settings (full-page takeover)
diff --git a/docs/spec/04-ux/06-settings-ia.md b/docs/spec/04-ux/06-settings-ia.md
index 99dd161c8..25190cda3 100644
--- a/docs/spec/04-ux/06-settings-ia.md
+++ b/docs/spec/04-ux/06-settings-ia.md
@@ -189,7 +189,7 @@ Settings is a **full-window page** that replaces the app sidebar + main chrome (
- **Relaxed network mode**: one switch persisting as
`AppSettings.networkPolicy.mode` (`relaxed` | `strict`), **on by default**.
When it is on, an endpoint the user typed themselves — a model base URL, an
- MCP server, a market source, a git remote — may be a loopback or LAN address,
+ MCP server, a git remote — may be a loopback or LAN address,
may use plain `http`, and a transparent proxy's fake-IP answers are
tolerated. Off returns those endpoints to the public-HTTPS-only boundary.
The first plaintext hop to such an endpoint shows one informational notice.
@@ -858,8 +858,6 @@ system while preserving their different data ownership:
- Plugin management remains available from the app shell's independent
**Plugins** destination, including load, enable, disable, and uninstall; it is
not duplicated in Settings
-- The marketplace source selector lives inside **Plugins → Marketplace**, next
- to the catalog controls; it is not a separate Settings destination.
- Project archive is indexed by Settings search and is not duplicated as a home
sidebar destination or standalone global-search page
- Back to app returns to chat shell from the rail's pinned footer action
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index e51a2c0b3..5206f925d 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -3210,20 +3210,20 @@ identify the platform validation still needed.
- **Focus regression**: In light and dark themes, open a marketplace card and press Escape. Like pointer dismissal, Escape leaves no line or focus ring on the card. Then use Tab and Shift+Tab: the detail button shows a complete, unclipped ring, and Install remains separately focusable. Automated focus-state regression: `node scripts/e2e-plugin-detail-focus.mjs`; verify the rendered ring visually.
-#### E2E-024F: Refresh official remote marketplace repository
+#### E2E-024F: Refresh the official marketplace catalog
-- **Preconditions**: Network available to GitHub raw content.
-- **Steps**: 1) Open Extensions → Marketplace. 2) Use the header Refresh marketplace action. 3) Confirm the source line names the official channel (`plugins.aiuo.net`) and that the GitHub and CNB backups are selectable.
-- **Expected**: Catalog refreshes from the selected channel; card grid updates; offline fallback still works if fetch fails.
+- **Preconditions**: Network available to `plugins.aiuo.net`.
+- **Steps**: 1) Open Extensions → Marketplace. 2) Use the header Refresh marketplace action. 3) Confirm the official catalog refreshes and the card grid updates.
+- **Expected**: The marketplace uses `plugins.aiuo.net/catalog.json`; the page has no source selector; the cached official catalog remains available if refresh fails.
- **Specs linked**: `07-plugins/07-plugin-marketplace.md`
- **Acceptance**: G (remote marketplace source)
- **Status**: Documented / host-core unit covered
-#### E2E-024P: Switch the marketplace catalog source
+#### E2E-024P: The marketplace ignores legacy source settings
-- **Preconditions**: Network available to `plugins.aiuo.net`, `raw.githubusercontent.com`, and `cnb.cool`.
-- **Steps**: 1) Open Extensions → Marketplace on a clean profile and confirm the source line reads Official channel. 2) Switch to GitHub backup, then CNB backup, then Custom with a URL, then back to Official channel. 3) After each switch, confirm the catalog refreshes in the same surface. 4) Install a plugin from the official channel, then one from the CNB backup. 5) Choose Custom URL with an empty value.
-- **Expected**: A fresh profile opens on the official channel, whose catalog comes from `plugins.aiuo.net/catalog.json`; the four choices are labelled Official channel / GitHub backup / CNB backup / Custom in that order; switching triggers a refresh and reports the new plugin count; the source selector remains the only source-status control, with no redundant provider explanation or active-source status line; the official install resolves through the platform while the CNB install downloads from the mirror and passes the same shasum verification as before, so the two backup paths are unchanged; switching back to a source reuses its cached snapshot instead of deleting it and never rounds trips; the installed record names the channel the plugin came from; choosing Custom URL with an empty value falls back to the official default rather than an empty endpoint.
+- **Preconditions**: Profiles can be seeded with legacy `pluginMarketSource` values `github`, `mirror`, and `custom`, including a custom URL. Network or a local request stub is available for the official catalog.
+- **Steps**: 1) Start the app with each seeded profile. 2) Open Extensions → Marketplace and refresh. 3) Inspect the catalog request. 4) Install a published plugin from the marketplace.
+- **Expected**: The page has no source controls; every profile requests `https://plugins.aiuo.net/catalog.json` and ignores the persisted source and custom URL; install uses the official platform resolve path, with the official catalog URL as the verified fallback; legacy settings remain readable and require no migration.
- **Specs linked**: `07-plugins/07-plugin-marketplace.md` §2
- **Acceptance**: G (remote marketplace source)
- **Status**: Documented / host-core unit covered
@@ -3233,12 +3233,11 @@ identify the platform validation still needed.
- **Preconditions**: Windows x64 host. The official catalog request is forced
to fail with a localized, non-UTF-8 curl/Schannel diagnostic (a deterministic
fake curl in the test PATH may emit GBK stderr and exit 35).
-- **Steps**: 1) Select Extensions → Marketplace with GitHub (official) as the
- source. 2) Refresh the marketplace. 3) Inspect the error toast. 4) Switch to
- the CNB mirror and refresh again.
+- **Steps**: 1) Open Extensions → Marketplace. 2) Refresh the marketplace.
+ 3) Inspect the error toast.
- **Expected**: The failed request remains a `PLUGIN_NETWORK` failure and
retains the readable localized diagnostic without Unicode replacement
- characters; switching to the mirror can refresh the catalog normally.
+ characters; the marketplace remains on the official source.
- **Specs linked**: `07-plugins/07-plugin-marketplace.md`,
`03-runtime/07-process-model.md`
- **Acceptance**: G (remote marketplace source)
@@ -3253,19 +3252,19 @@ identify the platform validation still needed.
- **Acceptance**: G (marketplace install + permission review)
- **Status**: Documented / host-core covered by unit tests + protocol methods
-#### E2E-024R: Install a center-published plugin from the unchanged distribution source
+#### E2E-024R: Install a center-published plugin from the official marketplace
- **Preconditions**: A `schemaVersion: 2` catalog served from the distribution repository, with one plugin carrying provenance and an approved review verdict, its package under `packages/`. A second fixture declares `artifactBaseUrl` for the mirror/enterprise case.
-- **Steps**: 1) Keep the marketplace source at its default. 2) Open a plugin's detail sheet. 3) Read the Source section. 4) Install the selected version. 5) Switch to the CNB mirror and repeat the install. 6) Repeat against the fixture that declares a base.
-- **Expected**: No settings change or client update is needed to see center-published plugins, because the catalog URL is unchanged; the relative package URL resolves against the catalog directory, so GitHub serves it from `raw.githubusercontent.com` and the mirror from `cnb.cool` with an identical checksum; a declared `artifactBaseUrl` takes precedence when present; the detail sheet shows the source repository, commit, and builder before install; the installed record keeps publisher, trust tier, and source pin.
+- **Steps**: 1) Open a plugin's detail sheet. 2) Read the Source section. 3) Install the selected version through the official resolve path. 4) Repeat with a local resolve stub that returns no source, exercising the official catalog URL fallback and an `artifactBaseUrl` fixture.
+- **Expected**: Center-published plugins appear in the fixed official catalog; the detail sheet shows the source repository, commit, and builder before install; resolve mirror bytes match the platform digest, while catalog fallback bytes match the catalog digest; the installed record keeps publisher, trust tier, and source pin.
- **Specs linked**: `07-plugins/07-plugin-marketplace.md`, `07-plugins/15-plugin-center.md`
- **Acceptance**: G (publisher-owned source distribution)
- **Status**: Documented / host-core covered by unit tests
#### E2E-024S: Package host allowlist refuses an untrusted download
-- **Preconditions**: A catalog fixture whose version URL points at a host outside the allowlist, plus one with embedded credentials and one on plain HTTP.
-- **Steps**: 1) Refresh the marketplace. 2) Inspect the plugin card and detail sheet. 3) Attempt an install. 4) Repeat with a private catalog whose packages sit on its own host.
+- **Preconditions**: An isolated host-core test uses `PI_DESKTOP_PLUGIN_MARKET_URL` to load a catalog fixture whose version URL points at a host outside the allowlist, plus fixtures with embedded credentials and plain HTTP.
+- **Steps**: 1) Refresh the fixture catalog. 2) Inspect the plugin card and detail sheet. 3) Attempt an install. 4) Repeat with a private catalog whose packages sit on its own host.
- **Expected**: The row does not offer an install action for an off-allowlist URL; an attempted install fails with `PLUGIN_MARKET_UNTRUSTED_HOST` naming the rejected host before any request leaves the machine; a credentialed URL and non-loopback plain HTTP are refused the same way; a private catalog can still serve packages from the host that served it, without widening the allowlist for third-party hosts.
- **Specs linked**: `07-plugins/07-plugin-marketplace.md`, `07-plugins/04-plugin-security.md`
- **Acceptance**: G (marketplace download boundary)
@@ -3282,8 +3281,8 @@ identify the platform validation still needed.
#### E2E-024U: Trust tier and host version bound are enforced by the client
-- **Preconditions**: A custom-source catalog claiming `trust: "verified"`, a catalog with an unrecognised tier, and a version whose `minPiDesktop` exceeds the running host.
-- **Steps**: 1) Point the marketplace at the custom source. 2) Inspect the card and detail sheet badges. 3) Attempt to install the version pinned to a newer host. 4) Repeat with a `minPiDesktop` that is a range expression rather than a version.
+- **Preconditions**: Test runs use `PI_DESKTOP_PLUGIN_MARKET_URL` for a catalog claiming `trust: "verified"`, a catalog with an unrecognised tier, and a version whose `minPiDesktop` exceeds the running host.
+- **Steps**: 1) Load the fixture catalog. 2) Inspect the card and detail sheet badges. 3) Attempt to install the version pinned to a newer host. 4) Repeat with a `minPiDesktop` that is a range expression rather than a version.
- **Expected**: A `verified` claim from a non-official source renders as community with no shield; an unrecognised tier renders as unknown; the version requiring a newer host is not offered and an explicit install fails with `PLUGIN_HOST_TOO_OLD` naming both versions; an unparseable bound is ignored rather than making the plugin uninstallable.
- **Specs linked**: `07-plugins/07-plugin-marketplace.md`, `07-plugins/15-plugin-center.md`
- **Acceptance**: G (trust presentation)
@@ -10040,9 +10039,8 @@ This test plan spec is accepted when:
an outside press, or scrolling the trigger out of view closes it while focus
returns to Change.
- Plugin load/enable/disable/uninstall remains available from the app shell's
- independent Extensions destination; its Marketplace tab also owns the
- official/mirror/custom catalog source picker, so Settings has no duplicate
- Extensions destination.
+ independent Extensions destination; its Marketplace tab always uses the
+ official catalog, so Settings has no duplicate Extensions destination.
- Dark: rail `#000`, main `#181818`, cards elevated `#212121`.
### US-UI-38 Composer workspace context omitted
@@ -16106,11 +16104,11 @@ plugin-form fixtures in an isolated temporary directory at runtime.
marked); `packages/shared/src/model-catalog.test.ts` covers the four source rules;
`crates/host-core/src/providers/catalog.rs` covers the config round trip, the
unmarked record, and the dropped unknown marker. The end-to-end settings journey
-#### E2E-PLUGIN-official-channel-resolves-through-the-platform: An official-channel install resolves through the platform and installs from the first working mirror
+#### E2E-PLUGIN-official-channel-resolves-through-the-platform: An official-channel install uses platform mirrors when resolve answers promptly
- **Preconditions**: A clean profile on the official channel, a plugin present in `plugins.aiuo.net/catalog.json`, and a request log for the platform and both mirror hosts (a local stub may stand in for each).
-- **Steps**: 1) Open Extensions → Marketplace and confirm the source line reads Official channel and that the catalog came from `plugins.aiuo.net`. 2) Install the plugin. 3) Capture the request the platform received. 4) Inspect which mirror served the package. 5) Install a second plugin, then install the same version of the first one again.
-- **Expected**: Exactly one `POST /api/v1/download/resolve` is sent per install or update, with a JSON body carrying `deviceId`, `pluginId`, and the version when one was picked; the package comes from the first entry in `downloads` that answers, and its bytes match the returned `sha256` and `sizeBytes` before anything is extracted; a mirror that is unreachable or fails is abandoned and the next one is used without user interaction; reinstalling the same version issues a fresh resolve call rather than reusing the earlier answer, because the response is never cached; the installed plugin passes the ordinary permission review and its record names the official channel as its provider.
+- **Steps**: 1) Open Extensions → Marketplace and confirm the catalog loads. 2) Capture the catalog request and verify it used `plugins.aiuo.net`. 3) Install the plugin. 4) Capture the request the platform received. 5) Inspect which mirror served the package. 6) Install a second plugin, then install the same version of the first one again.
+- **Expected**: The marketplace UI has no source selector; exactly one `POST /api/v1/download/resolve` is sent per install or update, with a JSON body carrying `deviceId`, `pluginId`, and the version when one was picked; when resolve answers within three seconds, the package comes from the first entry in `downloads` that answers, and its bytes match the returned `sha256` and `sizeBytes` before anything is extracted; a mirror that is unreachable or fails is abandoned and the next one is used without user interaction; if resolve exceeds its deadline, the install switches to the catalog URL and verifies its catalog digest; reinstalling the same version issues a fresh resolve call rather than reusing the earlier answer, because the response is never cached; the installed plugin passes the ordinary permission review and its record names the official channel as its provider.
- **Specs linked**: `07-plugins/07-plugin-marketplace.md` §2, `07-plugins/15-plugin-center.md` §10
- **Acceptance**: G (remote marketplace source)
- **Milestone**: M6+
@@ -16120,17 +16118,17 @@ plugin-form fixtures in an isolated temporary directory at runtime.
- **Preconditions**: An official-channel install whose `downloads` list has at least two entries, with the first mirror serving bytes that do not match the returned `sha256` (a stale distribution, or a stub that serves the CNB-era bytes for `pi.todo-0.6.5`), plus a view of the install cache and the plugin directory.
- **Steps**: 1) Start the install. 2) Watch the first mirror's download and the digest check. 3) Inspect the install cache and the plugin directory before the install finishes. 4) Let the install continue. 5) Repeat with a stub whose first mirror fails only the announced `sizeBytes`.
-- **Expected**: The mismatching bytes are discarded without being extracted or handed to the installer, nothing lands in the plugin directory, and the rejection is reported in the install progress instead of being swallowed; the next mirror's bytes are verified against the same digest and the install completes from there; the size-mismatch case behaves identically; when every entry fails, the install ends as a reported failure rather than a partially installed plugin.
+- **Expected**: The mismatching bytes are discarded without being extracted or handed to the installer, nothing lands in the plugin directory, and the rejection is reported in the install progress instead of being swallowed; the next mirror's bytes are verified against the same digest and the install completes from there; the size-mismatch case behaves identically; when every returned mirror fails digest or size validation, the install ends as a reported failure rather than falling back to different bytes or leaving a partial plugin.
- **Specs linked**: `07-plugins/07-plugin-marketplace.md` §2
- **Acceptance**: G (remote marketplace source) + Security
- **Milestone**: M6+
- **Status**: Draft
-#### E2E-PLUGIN-platform-unreachable-install-falls-back-to-the-catalog-url: An install falls back to the catalog URL when the platform cannot be reached
+#### E2E-PLUGIN-platform-unreachable-install-falls-back-to-the-catalog-url: A slow or unavailable platform resolve falls back quickly to the catalog URL
-- **Preconditions**: The official catalog is already cached from a successful refresh, and `plugins.aiuo.net` becomes unreachable for the install (a blocked stub, or a refused DNS/proxy route).
-- **Steps**: 1) Refresh the catalog while the platform is reachable, then make it unreachable. 2) Install a plugin whose catalog entry carries a relative `url`. 3) Confirm which host served the package and whether the platform received a resolve request. 4) Restore reachability and install a version the platform refuses in turn with `403 NOT_PUBLISHED`, `403 PLUGIN_ARCHIVED`, `404`, `429`, and `503`.
-- **Expected**: The install resolves the package from the catalog's own URL — `artifactBaseUrl` plus the relative `url` — and completes after the same shasum verification; no resolve request reaches the platform for that install and the fallback install is not counted; the failed resolve call is visible in the install log instead of being hidden; once the platform answers again each refusal produces its own message — not-published with no retry, archived hiding the plugin from install and update selection, not-found, one `Retry-After` wait for the rate limit, and a deployment error for `503` — and no refusal silently switches to another channel or another version.
+- **Preconditions**: The official catalog has been refreshed. A local stub can delay `POST /api/v1/download/resolve` beyond three seconds or return `429`, `503 NO_DOWNLOAD_SOURCE`, and the publication refusals.
+- **Steps**: 1) Install a plugin while the resolve stub delays its response beyond three seconds. 2) Confirm the UI leaves Resolve and begins downloading from the catalog URL. 3) Repeat with a `429` and `503 NO_DOWNLOAD_SOURCE`. 4) Return `403 NOT_PUBLISHED`, `403 PLUGIN_ARCHIVED`, and `404` for a selected version.
+- **Expected**: A slow resolve call is abandoned after three seconds; timeout, `429`, and `503 NO_DOWNLOAD_SOURCE` proceed through the catalog's `artifactBaseUrl` plus relative `url`, and bytes still pass the catalog digest check before installation; rate limiting is not retried or waited out; `403 NOT_PUBLISHED`, `403 PLUGIN_ARCHIVED`, and `404` remain explicit failures and never install the fallback package; archived plugins remain hidden from install and update selection; the selected channel does not change.
- **Specs linked**: `07-plugins/07-plugin-marketplace.md` §2
- **Acceptance**: G (remote marketplace source)
- **Milestone**: M6+
diff --git a/docs/spec/07-plugins/07-plugin-marketplace.md b/docs/spec/07-plugins/07-plugin-marketplace.md
index ce9611c74..a501fb9f1 100644
--- a/docs/spec/07-plugins/07-plugin-marketplace.md
+++ b/docs/spec/07-plugins/07-plugin-marketplace.md
@@ -30,7 +30,7 @@ The host is responsible for:
### Phase B ✅
- Browse/search + download install are implemented against the official provider
-- Official provider: the plugin center, `plugins.aiuo.net` (Phase B originally pointed at the GitHub repository `vastsa/pi-desktop-plugins`; see "Catalog source selection" below and [ADR 0276](../../adr/0276-official-plugin-channel-and-backup-channels.md))
+- Official provider: the plugin center, `plugins.aiuo.net` (Phase B originally pointed at the GitHub repository `vastsa/pi-desktop-plugins`; see "Catalog source" below and [ADR 0276](../../adr/0276-official-plugin-channel-and-backup-channels.md))
- Default catalog URL: `https://plugins.aiuo.net/catalog.json`
- Package URLs may be absolute `https://` / `http://` / `file://`, or a relative path resolved against the catalog's `artifactBaseUrl` when it declares one, and otherwise against the catalog URL
- HTTPS fetch uses `curl` in host-core
@@ -38,24 +38,14 @@ The host is responsible for:
code page when needed; a network failure remains `PLUGIN_NETWORK`, but its
localized message must not cross the RPC boundary as replacement characters
-### Catalog source selection
+### Catalog source
-Plugins → Marketplace picks where the catalog comes from. There are four
-channels, and the user can switch between them at any time:
-
-| # | Channel | `pluginMarketSource` | Catalog URL | Package resolution |
-| --- | --- | --- | --- | --- |
-| 1 | Official channel | `"official"` (default) | `https://plugins.aiuo.net/catalog.json` | Platform resolve (below) |
-| 2 | GitHub backup | `"github"` | `https://raw.githubusercontent.com/AIUO-Net/pi-desktop-plugins/main/catalog.json` | Relative URL against the catalog |
-| 3 | CNB backup | `"mirror"` | `https://cnb.cool/aixk/pi-desktop-plugins/-/git/raw/main/catalog.json` | Relative URL against the catalog |
-| 4 | Custom | `"custom"` | `pluginMarketCustomUrl` | Relative URL against the catalog |
-
-The selector labels are localized; the English locale uses exactly these four
-strings: Official channel, GitHub backup, CNB backup, Custom. An unset value
-and an unrecognized value both resolve to the official channel, and `mirror`
-still means CNB, so no persisted setting is migrated. The environment override
-`PI_DESKTOP_PLUGIN_MARKET_URL` stays above every channel so dev builds and
-tests can point at a local catalog without touching persisted settings.
+Plugins → Marketplace always uses the official plugin center catalog at
+`https://plugins.aiuo.net/catalog.json`. The page has no source selector.
+Persisted `pluginMarketSource` and `pluginMarketCustomUrl` values from older
+versions are retained for settings compatibility but ignored; no data migration
+is needed. `PI_DESKTOP_PLUGIN_MARKET_URL` remains available to development and
+test runs without making the catalog configurable in the shipped interface.
Marketplace catalog and package downloads follow Settings → General → Network.
System mode sends host-core `curl` through Electron's authenticated loopback
@@ -64,27 +54,21 @@ configuration. Direct mode forces the marketplace request direct; Custom uses
the configured proxy and bypass list. The relay credential is runtime-only and
is not inherited by workspace shell commands.
-The official channel is the plugin center: its catalog is the generated
-`catalog.json` the center publishes, and a package installed from it is
-resolved through the platform's download API instead of by joining a relative
-path onto a base URL. The two backup channels and `custom` keep the static v1
-and v2 behavior: a relative package URL resolves against the catalog that
-carried it (`artifactBaseUrl` first, then the catalog directory), so a package
-URL never crosses providers and a source switch cannot change the checksum
-being verified. The GitHub and CNB backups exist for networks that cannot reach
-`plugins.aiuo.net` or each other. The CNB mirror is expected to replicate the
-distribution repository, but it can lag — a measured catalog there was older
-(22 plugins, and different bytes for a version the other mirror serves) — which
-is why the official channel verifies each mirror's bytes instead of trusting
-one URL.
+The official catalog is the generated `catalog.json` the center publishes, and
+an install asks the platform where the package is instead of joining a relative
+path onto a base URL. If resolve is slow or unavailable, the client downloads
+from the official catalog's own package URL and verifies its catalog digest.
+Packages on the official resolve path can still come from approved GitHub and
+CNB mirrors returned by the platform. These are package mirrors inside the
+official channel; they do not change the catalog source. Each mirror's bytes
+are checked against its announced digest.
Cached catalogs are keyed to their source in `plugins/market/cache-meta.json`.
-A snapshot fetched from a different source is ignored rather than deleted —
-its package URLs point at the provider the user just switched away from — so
-switching back recovers that catalog without a round trip. `settings.set` only
-re-pins the source in memory; fetching there would hold the host RPC state lock
-behind a marketplace timeout, so the renderer triggers `market.refresh` after
-the switch.
+The official catalog cache remains the marketplace snapshot. Any cache left by
+an older selected source is ignored and not deleted. `settings.set` keeps the
+host's marketplace selection pinned to official; remote fetching remains an
+explicit `market.refresh` operation so a settings write never holds the host
+RPC state lock behind a marketplace timeout.
### Device identifier
@@ -114,21 +98,26 @@ the platform after the catalog has been refreshed:
official catalog — with a JSON body of `{ deviceId, pluginId, version }`,
where `version` is present when the user picked one. POST is used rather than
GET because the platform's own contract notes that a device id in a query
- string lands in access logs.
+ string lands in access logs. The metadata request has a three-second total
+ deadline and is made once; a slow endpoint cannot hold the install on
+ `resolve` for the download timeout or a `Retry-After` interval.
3. Try every entry of the returned `downloads` array in order: download, verify
the returned `sha256` and the announced `sizeBytes`, then hand the bytes to
the installer. A mirror that fails — network error, HTTP error, digest
mismatch, size mismatch — is abandoned and the next one is tried. Requests
stay on the allowlisted hosts below.
-4. If the list is exhausted, or the resolve call itself failed, fall back to the
- catalog's own package URL (`artifactBaseUrl` plus the relative `url`). That
- is the fallback the platform documents, and the install is not counted.
+4. If the resolve request times out or fails at the transport boundary, or
+ returns `429` / `503 NO_DOWNLOAD_SOURCE`, use the catalog's own package URL
+ (`artifactBaseUrl` plus the relative `url`) immediately. The catalog digest
+ and size are still checked, and the install is not counted. If all usable
+ returned mirrors fail at the transport boundary, use the same fallback. A
+ malformed resolve response or an integrity failure does not take this path.
5. One resolve call per install or update. The answer is never cached, which is
why the platform sends `Cache-Control: no-store`; `counted: false` is a
normal reply and never an error.
-A `200` response always carries a non-empty `downloads` array. Refusals are
-reported, never papered over:
+A `200` response always carries a non-empty `downloads` array. Publication
+refusals are reported, never papered over:
- `403 NOT_PUBLISHED` — the version is not published. Report it and do not
retry.
@@ -138,14 +127,16 @@ reported, never papered over:
byte route cannot carry (a `+` build-metadata suffix, for example) is a
missing version, not a URL to guess at.
- `429` — the platform rate-limits per device id (600 requests per minute by
- default). Wait the `Retry-After` interval, retry once, then report.
-- `503` — a deployment problem (`NO_DOWNLOAD_SOURCE` when no mirror can serve
- the version). Report it without a retry loop.
+ default). Do not wait or retry; use the catalog URL, whose package is checked
+ against the catalog digest.
+- `503 NO_DOWNLOAD_SOURCE` — use the catalog URL because no platform mirror can
+ serve the version. Other `503` deployment failures use the same fast fallback.
-The resolve digest is authoritative on this path; the catalog's `shasum` stays
-authoritative on the two backup channels and on the step-4 fallback. Nothing
-here switches the channel automatically: an unreachable platform is reported
-after the fallback, and the user changes channels through the existing selector.
+The resolve digest is authoritative when mirrors are used; the catalog's
+`shasum` stays authoritative on the fallback. An explicit `403` or `404`
+publication refusal never falls through to a different package source. Nothing
+here switches the catalog source: the fallback stays inside the official
+channel.
### Install progress and cancellation
@@ -221,10 +212,9 @@ interface MarketProvider {
}
```
-Supports multiple providers:
-- `official`
-- `custom` (enterprise private source)
-- `local-mock` (development)
+The shipped client currently exposes the `official` provider only. The
+development-only `PI_DESKTOP_PLUGIN_MARKET_URL` override supports local test
+catalogs without adding a source control to the product UI.
## 4. Data model
@@ -573,25 +563,12 @@ the catalog says so. A v1 catalog's boolean `verified` maps to `verified` /
`community` unchanged, because a v1 catalog is only writable by marketplace
maintainers.
-## 9. Private sources (enterprise-facing)
-
-Supports configuration:
+## 9. Private sources (future enterprise support)
-```json
-{
- "marketProviders": [
- {
- "id": "official",
- "url": "https://market.example.com"
- },
- {
- "id": "corp",
- "url": "https://plugins.company.local",
- "tokenEnv": "PI_DESKTOP_MARKET_TOKEN"
- }
- ]
-}
-```
+The shipped client does not expose or persist a private catalog source. The
+`PI_DESKTOP_PLUGIN_MARKET_URL` override is limited to local development and
+tests; it is not a product setting. Enterprise source support requires a
+future product decision and explicit security and authorization design.
## 10. Remote API draft (HTTP)
@@ -641,7 +618,7 @@ The distribution repository
([vastsa/pi-desktop-plugins](https://github.com/vastsa/pi-desktop-plugins)) holds the published
`catalog.json` and the `packages/*.piplug` artifacts it references. Plugin sources are neither
hosted nor reviewed there: the center packs, audits, records the SHA-256 and publishes from each
-publisher's own repository, then mirrors the catalog and packages for the GitHub backup channel
+publisher's own repository, then publishes the official catalog and package references
([15-plugin-center.md](15-plugin-center.md),
[ADR 0276](../../adr/0276-official-plugin-channel-and-backup-channels.md)).
diff --git a/docs/spec/07-plugins/15-plugin-center.md b/docs/spec/07-plugins/15-plugin-center.md
index a5931a86c..9c35c64e1 100644
--- a/docs/spec/07-plugins/15-plugin-center.md
+++ b/docs/spec/07-plugins/15-plugin-center.md
@@ -80,10 +80,10 @@ CNB mirror cnb.cool/aixk/pi-desktop-plugins/-/git/raw/main/…
```
Because the mirror is a Git mirror, packages and catalog move together and stay
-byte-identical, so a source switch mid-session cannot cross providers or invalidate
-a checksum. Declaring `artifactBaseUrl` is what keeps that true when the catalog is
-served from a host that does not itself host the packages; a catalog without it
-falls back to its own directory and can route a download at the wrong host.
+byte-identical. Declaring `artifactBaseUrl` keeps package URLs on the intended
+host when a catalog is served from a host that does not itself host the
+packages; a catalog without it falls back to its own directory and can route a
+download at the wrong host.
### 3.3 What replaces WORM
@@ -362,9 +362,11 @@ user picked one, and a stable device identifier (`deviceId`), so the platform ca
de-duplicate a download and rate-limit per device instead of per source address.
The byte sibling of that route, `GET /download/{id}/{version}`, is the
marketplace page and console path, not the client's. Browse and update checking
-still need nothing but static files, and an install whose resolve call cannot
-reach the platform falls back to the catalog's own package URL, so the API can
-be unavailable without making published plugins unreachable. The client-side
+still need nothing but static files. The client gives the resolve request three
+seconds; a timeout, rate limit, or `NO_DOWNLOAD_SOURCE` answer falls back to the
+catalog's own package URL, with the catalog digest still verified. This keeps a
+slow API from holding installation open while preserving the publication
+refusals for unpublished, archived, or missing versions. The client-side
contract — channels, mirrors, digest verification, and how the identifier is
derived — is in [07-plugin-marketplace.md](07-plugin-marketplace.md).
diff --git a/docs/zh-CN/spec/04-ux/01-ui-ia.md b/docs/zh-CN/spec/04-ux/01-ui-ia.md
index 688441c0e..acf539e48 100644
--- a/docs/zh-CN/spec/04-ux/01-ui-ia.md
+++ b/docs/zh-CN/spec/04-ux/01-ui-ia.md
@@ -235,9 +235,9 @@ schedule. Renaming an Hourly task does not restart its interval.
扩展目标是专注于插件的页面,使用紧凑标头并且只保留两个选项卡:
**已安装**和**市场**。已安装页按需要注意/可用更新/活动/关闭分组,每组标签
下以柔和色块行堆叠显示插件(D296);市场页继续使用浏览和安装卡片网格。
-整页不画分割线:标头、工具栏、行、来源设置、卡片以及详情抽屉的各节都靠色调
-与间距区分,细线只保留给浮层(菜单、抽屉、对话框)。市场来源设置只显示来源选择器,
-不再显示重复的提供商说明或当前来源状态行。MCP、技能和子代理不再是扩展页的选项卡或区块。
+市场页使用官方目录,页面不提供来源选择器。整页不画分割线:标头、工具栏、行、卡片
+以及详情抽屉的各节都靠色调与间距区分,细线只保留给浮层(菜单、抽屉、对话框)。
+MCP、技能和子代理不再是扩展页的选项卡或区块。
### 3. 5 设置(全页接管)
### 3. 5 设置(全页接管)
diff --git a/docs/zh-CN/spec/04-ux/06-settings-ia.md b/docs/zh-CN/spec/04-ux/06-settings-ia.md
index f8634cb40..ffff6518d 100644
--- a/docs/zh-CN/spec/04-ux/06-settings-ia.md
+++ b/docs/zh-CN/spec/04-ux/06-settings-ia.md
@@ -93,7 +93,7 @@
- **网络**卡:
- **代理**:分段控件 — 系统 / 直连 / 自定义。默认是系统(Chromium 跟随操作系统代理)。直连禁用代理。自定义将一个 HTTP、HTTPS 或 SOCKS5 URL 应用到应用自有出站请求(模型调用、扩展市场、更新、模型目录、插件 `net.fetch`、内置浏览器)。工作区 Bash 和 OAuth 用的系统浏览器不会被改写。
- 自定义显示代理 URL(含 `user:pass@`)、默认 `localhost,127.0.0.1,::1,<local>,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,169.254.0.0/16` 的绕过列表(本机、本地模型与所有局域网服务直连,不被代理吞掉),以及一次走该代理的测试。带认证的 URL 通过回环 SOCKS5 中继交给 Chromium(issue #490)。选择持久化为可选 `AppSettings.networkProxy`。无协议/存储版本升级(D340 / ADR 0177)。
- - **网络宽松模式**:一个开关,持久化为 `AppSettings.networkPolicy.mode`(`relaxed` | `strict`),**默认开启**。开启时,你自己填写的端点(模型服务、MCP 服务器、市场源、git 远端)可以是回环或局域网地址、可以使用明文 `http`,并容忍透明代理的 fake-IP 答案;关闭则回到"只允许公网 https"。首次用明文访问这类端点时会弹一次告知。它取代的三个旧确认开关(`networkProxy.allowFakeIp`、`configSync.allowInsecureHttp`、以及自填明文开关)都已删除(ADR 0304)。
+ - **网络宽松模式**:一个开关,持久化为 `AppSettings.networkPolicy.mode`(`relaxed` | `strict`),**默认开启**。开启时,你自己填写的端点(模型服务、MCP 服务器、git 远端)可以是回环或局域网地址、可以使用明文 `http`,并容忍透明代理的 fake-IP 答案;关闭则回到"只允许公网 https"。首次用明文访问这类端点时会弹一次告知。它取代的三个旧确认开关(`networkProxy.allowFakeIp`、`configSync.allowInsecureHttp`、以及自填明文开关)都已删除(ADR 0304)。
- 平台支持的**关闭行为**仍保留在常规中,因为它改变的是
应用程序窗口行为,而不是智能体行为。
- 文件打开目标、菜单栏行为和底部面板行为不是
@@ -363,8 +363,6 @@ Token 用量**不是设置目的地**(D335 / ADR 0173)。已完成回合历
- 插件管理仍然可以从独立的应用程序外壳中获得
**插件**目的地,包括加载、启用、禁用和卸载;是的
设置中不重复
-- 市场来源选择器位于 **扩展 → 市场**,与目录操作放在同一上下文中,
- 不再作为单独的设置目的地。
- 项目档案由设置搜索索引,不会复制为主页
侧边栏目标或独立的全局搜索页面
- 返回应用程序从导轨固定的底部操作返回聊天外壳
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.md
index 71f4826ac..3824bc621 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
@@ -1462,20 +1462,20 @@ task-candidate E2E 从请求工作树运行,但使用主工作区已经准备
- **接受**:G(插件剪贴板历史)+ 安全
- **状态**:单元覆盖(`clipboard-history.test.mjs`);Electron 剪贴板捕获仍需手动验证
-#### E2E-024F:刷新官方远程市场存储库
+#### E2E-024F:刷新官方市场目录
-- **先决条件**:网络可用于 GitHub 原始内容。
-- **步骤**:1) 打开扩展 → 市场。 2) 使用标题刷新市场操作。 3) 确认来源行显示官方通道(`plugins.aiuo.net`),且 GitHub 备份与 CNB 备份可选。
-- **预期**:目录从所选通道刷新;卡片网格更新;如果获取失败,离线回退仍然有效。
+- **先决条件**:网络可访问 `plugins.aiuo.net`。
+- **步骤**:1) 打开扩展 → 市场。 2) 使用标题栏的刷新市场操作。 3) 确认官方目录刷新且卡片网格更新。
+- **预期**:市场使用 `plugins.aiuo.net/catalog.json`;页面没有来源选择器;刷新失败时仍可使用缓存的官方目录。
- **链接规格**:`07-plugins/07-plugin-marketplace.md`
- **接受**:G(远程市场来源)
- **状态**:已记录/涵盖 host-core 单元
-#### E2E-024P:切换市场目录来源
+#### E2E-024P:市场忽略旧版来源设置
-- **先决条件**:网络可访问 `plugins.aiuo.net`、`raw.githubusercontent.com` 与 `cnb.cool`。
-- **步骤**:1) 在全新配置下打开扩展 → 市场,确认来源行显示官方渠道。 2) 依次切换到海外备份、国内备份、填写地址的自定义,再切回官方渠道。 3) 每次切换后确认同一页面完成目录刷新。 4) 先从官方渠道安装一个插件,再从国内备份安装一个。 5) 选择自定义地址但留空。
-- **预期**:全新配置默认停在官方渠道,其目录来自 `plugins.aiuo.net/catalog.json`;四个选项按官方渠道 / 海外备份 / 国内备份 / 自定义的顺序显示;切换后自动触发刷新并报告新的插件数量;来源选择器仍是唯一的来源状态控件,不显示重复的提供商说明或当前来源状态行;官方渠道的安装通过平台 resolve,国内备份的安装仍从镜像下载并通过与以前相同的 shasum 校验,因此两条备份路径逐字节不变;切回某个来源时直接复用其缓存快照而不是删除,也不产生额外往返;已安装记录标明插件来自哪个渠道;选择自定义地址但留空时回退到官方默认地址,而不是空端点。
+- **先决条件**:配置文件可预置旧版 `pluginMarketSource` 值 `github`、`mirror`、`custom`,其中包括一个自定义 URL;官方目录网络可用,或可使用本地请求存根。
+- **步骤**:1) 分别使用每种预置配置启动应用。 2) 打开扩展 → 市场并刷新。 3) 检查目录请求。 4) 从市场安装一个已发布插件。
+- **预期**:页面没有来源控制;所有配置都请求 `https://plugins.aiuo.net/catalog.json`,并忽略持久化来源与自定义 URL;安装使用官方平台 resolve,必要时从官方目录 URL 回退并校验摘要;旧版设置仍可读取,无需迁移。
- **链接规格**:`07-plugins/07-plugin-marketplace.md` §2
- **接受**:G(远程市场来源)
- **状态**:已记录 / 涵盖 host-core 单元
@@ -8654,11 +8654,11 @@ runner 会在运行时的隔离临时目录中生成六个插件形态 fixture
目录、继承值保持 `catalog` 标记);`packages/shared/src/model-catalog.test.ts` 覆盖
四条来源规则;`crates/host-core/src/providers/catalog.rs` 覆盖配置往返、无标记记录与
被丢弃的未知标记。端到端的设置旅程与实际启动窗口断言为草稿。
-#### E2E-PLUGIN-official-channel-resolves-through-the-platform:官方渠道的安装通过平台解析,并从第一个可用镜像安装
+#### E2E-PLUGIN-official-channel-resolves-through-the-platform:resolve 及时应答时官方渠道安装使用平台镜像
-- **先决条件**:全新配置停留在官方渠道;`plugins.aiuo.net/catalog.json` 中存在一个插件;平台与两个镜像主机各有请求日志(可用本地存根代替)。
-- **步骤**:1) 打开扩展 → 市场,确认来源行显示官方渠道,且目录来自 `plugins.aiuo.net`。 2) 安装该插件。 3) 抓取平台收到的请求。 4) 检查是哪个镜像提供了安装包。 5) 再安装第二个插件,然后重新安装第一个插件的同一版本。
-- **预期**:每次安装或更新只发出一次 `POST /api/v1/download/resolve`,JSON body 含 `deviceId`、`pluginId`,用户选定版本时含版本号;安装包来自 `downloads` 中第一个可应答的条目,且在解压之前其字节与返回的 `sha256` 和 `sizeBytes` 一致;不可达或失败的镜像被放弃并自动尝试下一个,无需用户操作;重新安装同一版本会发出新的 resolve 调用,而不是复用上一次的应答,因为响应从不缓存;插件通过常规权限审查安装,其记录标明来源为官方渠道。
+- **先决条件**:全新配置,目录中存在一个插件,并可记录平台与两个镜像主机的请求(各项都可由本地存根代替)。
+- **步骤**:1) 打开扩展 → 市场并确认目录已加载。 2) 捕获目录请求,确认使用 `plugins.aiuo.net`。 3) 安装插件。 4) 捕获平台收到的请求。 5) 检查哪个镜像提供了安装包。 6) 再安装第二个插件,然后重新安装第一个插件的同一版本。
+- **预期**:市场页面没有来源选择器;每次安装或更新只发出一次带 `deviceId`、`pluginId` 以及可选版本的 `POST /api/v1/download/resolve`;resolve 在三秒内应答时,按顺序尝试 `downloads` 并在解压前校验平台返回的 `sha256` 与 `sizeBytes`;某个镜像不可达或失败时无需用户操作即可尝试下一个;resolve 超时后从目录 URL 下载并校验目录摘要;重新安装同一版本会发起新的 resolve 请求,因为响应从不缓存;插件通过常规权限审查,安装记录标明官方渠道。
- **链接规格**:`07-plugins/07-plugin-marketplace.md` §2、`07-plugins/15-plugin-center.md` §10
- **验收**:G(远程市场来源)
- **里程碑**:M6+
@@ -8674,11 +8674,11 @@ runner 会在运行时的隔离临时目录中生成六个插件形态 fixture
- **里程碑**:M6+
- **状态**:草稿
-#### E2E-PLUGIN-platform-unreachable-install-falls-back-to-the-catalog-url:平台不可达时安装回退到目录地址
+#### E2E-PLUGIN-platform-unreachable-install-falls-back-to-the-catalog-url:平台 resolve 缓慢或不可用时快速回退到目录地址
-- **先决条件**:官方目录已成功刷新并缓存;安装期间 `plugins.aiuo.net` 不可达(被阻断的存根,或被拒绝的 DNS/代理线路)。
-- **步骤**:1) 在平台可达时刷新目录,然后让它不可达。 2) 安装一个目录条目里带相对 `url` 的插件。 3) 确认是哪个主机提供了安装包,以及平台是否收到 resolve 请求。 4) 恢复可达后,依次安装平台分别以 `403 NOT_PUBLISHED`、`403 PLUGIN_ARCHIVED`、`404`、`429` 和 `503` 拒绝的版本。
-- **预期**:安装从目录自身的地址解析安装包——`artifactBaseUrl` 加相对 `url`——并在同样的 shasum 校验之后完成;该次安装不会向平台发出 resolve 请求,也不计入统计;resolve 失败的原因会出现在安装日志里而不是被隐藏;平台恢复应答后,各拒绝码各自给出对应的提示——尚未发布不重试、已归档会从安装与更新选择中隐藏该插件、平台没有该版本、限流按 `Retry-After` 等待一次、`503` 报部署问题——并且任何拒绝都不会静默切到别的渠道或别的版本。
+- **先决条件**:官方目录已刷新;本地存根可让 `POST /api/v1/download/resolve` 延迟超过三秒,或返回 `429`、`503 NO_DOWNLOAD_SOURCE` 与发布拒绝。
+- **步骤**:1) 让 resolve 存根延迟超过三秒并安装插件。 2) 确认界面离开 Resolve 阶段,开始从目录 URL 下载。 3) 分别用 `429` 和 `503 NO_DOWNLOAD_SOURCE` 重复。 4) 对所选版本分别返回 `403 NOT_PUBLISHED`、`403 PLUGIN_ARCHIVED` 和 `404`。
+- **预期**:慢 resolve 三秒后被放弃;超时、`429` 和 `503 NO_DOWNLOAD_SOURCE` 都从目录的 `artifactBaseUrl` 与相对 `url` 回退,且在安装前通过目录摘要校验;限流不等待、不重试;`403 NOT_PUBLISHED`、`403 PLUGIN_ARCHIVED` 和 `404` 仍明确报错,不会安装回退包;已归档插件仍从安装与更新选择中隐藏;所选渠道保持不变。
- **链接规格**:`07-plugins/07-plugin-marketplace.md` §2
- **验收**:G(远程市场来源)
- **里程碑**:M6+
diff --git a/docs/zh-CN/spec/07-plugins/07-plugin-marketplace.md b/docs/zh-CN/spec/07-plugins/07-plugin-marketplace.md
index aa44ce3d3..ecea410e7 100644
--- a/docs/zh-CN/spec/07-plugins/07-plugin-marketplace.md
+++ b/docs/zh-CN/spec/07-plugins/07-plugin-marketplace.md
@@ -33,39 +33,32 @@
### B阶段✅
- Browse/search + 下载安装是针对官方提供商实施的
-- 官方提供商是插件中心 `plugins.aiuo.net`(B 阶段最初指向 GitHub 仓库 `vastsa/pi-desktop-plugins`;见下方「目录来源选择」与 [ADR 0276](/adr/0276-official-plugin-channel-and-backup-channels))
+- 官方提供商是插件中心 `plugins.aiuo.net`(B 阶段最初指向 GitHub 仓库 `vastsa/pi-desktop-plugins`;见下方「目录来源」与 [ADR 0276](/adr/0276-official-plugin-channel-and-backup-channels))
- 默认目录 URL:`https://plugins.aiuo.net/catalog.json`
- 包 URL 可以是绝对 `https://` / `http://` / `file://`,或相对路径:目录声明了 `artifactBaseUrl` 时按它解析,否则按目录 URL 解析
- HTTPS 获取在 host-core 中使用 `curl`
-### 目录来源选择
+### 目录来源
-「插件 → 市场」决定目录从哪里获取。共有四个渠道,用户可以随时切换:
+「插件 → 市场」始终使用插件中心的官方目录
+`https://plugins.aiuo.net/catalog.json`,页面不提供来源选择器。旧版本持久化的
+`pluginMarketSource` 和 `pluginMarketCustomUrl` 仍保留以兼容设置读取,但会被忽略;
+无需迁移数据。开发与测试仍可通过 `PI_DESKTOP_PLUGIN_MARKET_URL` 指向本地目录,
+但已发布界面不会因此开放目录配置。
-| # | 渠道 | `pluginMarketSource` | 目录地址 | 包地址解析 |
-| --- | --- | --- | --- | --- |
-| 1 | 官方渠道 | `"official"`(默认) | `https://plugins.aiuo.net/catalog.json` | 平台 resolve(见下) |
-| 2 | 海外备份 | `"github"` | `https://raw.githubusercontent.com/AIUO-Net/pi-desktop-plugins/main/catalog.json` | 相对 URL + 目录 |
-| 3 | 国内备份 | `"mirror"` | `https://cnb.cool/aixk/pi-desktop-plugins/-/git/raw/main/catalog.json` | 相对 URL + 目录 |
-| 4 | 自定义 | `"custom"` | `pluginMarketCustomUrl` | 相对 URL + 目录 |
+市场目录与安装包下载遵循设置 → 常规 → 网络。系统模式会让 host-core 的 `curl`
+通过 Electron 的认证回环 SOCKS 中继,并按当前操作系统代理/PAC 解析目标。直连模式
+强制市场请求直连;自定义模式使用所配置的代理与绕过列表。中继凭据仅在运行期使用,
+不会传给工作区 Shell。
-来源标签按应用语言本地化:简体中文为官方渠道、海外备份、国内备份、自定义。未设置与
-无法识别的取值都归到官方渠道,`mirror` 仍然表示 CNB,因此不需要迁移任何已持久化的
-设置。环境变量 `PI_DESKTOP_PLUGIN_MARKET_URL` 仍高于所有渠道,开发构建和测试可以指向
-本地目录而不改动持久化设置。
+官方目录是插件中心生成并发布的 `catalog.json`。安装时客户端向平台解析包地址,而不
+是把相对路径拼到基址。如果 resolve 缓慢或不可用,客户端会从官方目录自己的包地址下载,
+并校验目录摘要。官方 resolve 路径仍可使用平台返回的 GitHub 与 CNB 包镜像;这些是
+官方渠道内部的包镜像,不会切换目录来源。每个镜像的字节都会按其声明的摘要校验。
-官方渠道就是插件中心:它的目录是中心发布的 `catalog.json`,从中安装的包通过平台的
-下载接口解析,而不再把相对路径拼到基址上。两个备份渠道与自定义仍沿用静态解析:
-相对包 URL 按携带它的那份目录解析(先 `artifactBaseUrl`,再目录所在目录),因此包
-URL 绝不跨提供方,切换来源也不会改变正在校验的摘要。海外备份与国内备份用于无法访问
-`plugins.aiuo.net` 或彼此的网络环境。国内备份本应复制分发仓库,但可能滞后——实测该
-镜像上的目录更旧(22 个插件,且同一版本的字节与另一镜像不同)——所以官方渠道逐个
-校验镜像的字节,而不是信任单一地址。
-
-缓存目录会通过 `plugins/market/cache-meta.json` 记录其来源。来自其他来源的快照
-只被忽略而不删除——它的包 URL 指向用户刚切走的那个提供商——所以切回去时无需
-重新请求即可恢复该目录。`settings.set` 只在内存中重新指定来源;在那里发起抓取
-会让 host RPC 状态锁卡在市场超时上,因此切换后由渲染进程触发 `market.refresh`。
+缓存目录通过 `plugins/market/cache-meta.json` 按来源记录。官方目录缓存是市场快照;
+旧来源留下的缓存会被忽略但不会删除。`settings.set` 会让 host 的市场选择保持为官方;
+远程抓取仍由显式的 `market.refresh` 触发,避免设置写入因市场超时而持有 host RPC 状态锁。
### 设备标识
@@ -83,15 +76,18 @@ Windows 的 `HKLM\SOFTWARE\Microsoft\Cryptography\MachineGuid`、macOS 的平台
官方渠道的每一次安装或更新都在刷新目录之后通过平台解析安装包:
-1. 刷新目录并选定插件与版本,与其他渠道完全一致。
+1. 刷新目录并选定插件与版本。
2. `POST {中心 origin}/api/v1/download/resolve`——即提供该官方目录的 origin——JSON
body 为 `{ deviceId, pluginId, version }`,用户选定版本时才带 `version`。使用
POST 而非 GET,因为平台自己的契约指出设备 ID 出现在查询串里会落到访问日志。
+ 元数据请求总时限为三秒且只发起一次,避免慢端点让安装一直停留在 `resolve`。
3. 按顺序尝试返回的 `downloads` 每一项:下载、校验返回的 `sha256` 与声明的
`sizeBytes`,再把字节交给安装器。某个镜像失败——网络错误、HTTP 错误、摘要不符、
大小不符——就放弃它并尝试下一个。请求仍限于下文的白名单主机。
-4. 列表耗尽,或 resolve 本身失败时,回退到目录自身的包地址(`artifactBaseUrl` 加
- 相对 `url`)。这是平台文档规定的回退路径,该次安装不计入统计。
+4. resolve 超时、传输失败、返回 `429` 或 `503 NO_DOWNLOAD_SOURCE` 时,立即回退到
+ 目录自身的包地址(`artifactBaseUrl` 加相对 `url`)。目录摘要与大小仍会校验,且
+ 该次安装不计入统计。如果所有可用镜像都在传输层失败,也使用同一回退。响应格式
+ 错误或完整性校验失败不会触发回退。
5. 每次安装或更新只调用一次 resolve。响应从不缓存,这也是平台发送
`Cache-Control: no-store` 的原因;`counted: false` 是正常应答,不是错误。
@@ -101,14 +97,13 @@ Windows 的 `HKLM\SOFTWARE\Microsoft\Cryptography\MachineGuid`、macOS 的平台
- `403 PLUGIN_ARCHIVED`——插件已归档。从安装与更新选择中隐藏它。
- `404`——平台没有该版本。报告它;字节路由无法承载的版本字符串(例如带 `+` 的构建
元数据后缀)属于版本缺失,不能靠猜 URL 绕过。
-- `429`——平台按设备 ID 限流(默认每分钟 600 次)。按 `Retry-After` 等待后重试一次,
- 然后报告。
-- `503`——部署问题(没有任何镜像可服务该版本时为 `NO_DOWNLOAD_SOURCE`)。报告它,
- 不进入重试循环。
+- `429`——平台按设备 ID 限流(默认每分钟 600 次)。不等待或重试;改用目录地址,
+ 并按目录摘要校验安装包。
+- `503 NO_DOWNLOAD_SOURCE`——平台没有可用镜像时使用目录地址。其他 `503` 部署错误也
+ 快速回退到目录地址。
-这条路径上以 resolve 返回的摘要为准;两个备份渠道与第 4 步的回退仍以目录的 `shasum`
-为准。此处不会自动切换渠道:平台不可达会在回退之后如实报告,用户通过既有选择器切换
-渠道。
+resolve 镜像路径以平台返回的摘要为准;回退路径以目录的 `shasum` 为准。明确的 `403`
+或 `404` 发布拒绝不会回退到其他包来源。回退不会切换目录来源,产品始终使用官方渠道。
### 安装进度与取消
@@ -172,10 +167,8 @@ interface MarketProvider {
}
```
-支持多个提供商:
-- `official`
-- `custom`(企业私有源)
-- `local-mock`(开发)
+已发布客户端目前只提供 `official` 提供商。开发专用的
+`PI_DESKTOP_PLUGIN_MARKET_URL` 覆盖允许本地测试目录,但不会在产品界面增加来源控制。
## 4. 数据模型
@@ -459,25 +452,10 @@ UI 必须使信任级别可见。
布尔 `verified` 仍按原义映射为 `verified` / `community`,因为 v1 目录只有市场
维护者能写入。
-## 9. 私人来源(面向企业)
-
-支持配置:
+## 9. 私有来源(未来的企业支持)
-```json
-{
- "marketProviders": [
- {
- "id": "official",
- "url": "https://market.example.com"
- },
- {
- "id": "corp",
- "url": "https://plugins.company.local",
- "tokenEnv": "PI_DESKTOP_MARKET_TOKEN"
- }
- ]
-}
-```
+已发布客户端不提供或持久化私有目录来源。`PI_DESKTOP_PLUGIN_MARKET_URL` 覆盖仅供本地
+开发与测试使用,不是产品设置。企业来源支持需要未来的产品决策,并需明确设计安全与授权。
## 10. 远程 API 草稿 (HTTP)
diff --git a/docs/zh-CN/spec/07-plugins/15-plugin-center.md b/docs/zh-CN/spec/07-plugins/15-plugin-center.md
index 7a0a62a01..16e31746b 100644
--- a/docs/zh-CN/spec/07-plugins/15-plugin-center.md
+++ b/docs/zh-CN/spec/07-plugins/15-plugin-center.md
@@ -326,7 +326,9 @@ POST /v2/webhooks/github
稳定的设备标识(`deviceId`),让平台能够对下载去重,并按设备而不是按来源地址限流。
该路由的字节兄弟 `GET /download/{id}/{version}` 供市场页面与控制台使用,不是客户端的
路径。浏览与检查更新仍然只需要静态文件;当 resolve 请求无法到达平台时,安装会回退到
-目录自身的包地址,因此该 API 不可用不会让已发布插件无法安装。客户端一侧的契约——
+目录自身的包地址,因此该 API 不可用不会让已发布插件无法安装。客户端给 resolve 请求
+三秒时限;超时、限流或 `NO_DOWNLOAD_SOURCE` 会回退到目录地址,并继续校验目录摘要。
+尚未发布、已归档或无此版本等明确发布拒绝仍会直接报错。客户端一侧的契约——
渠道、镜像、摘要校验以及标识的派生方式——见
[07-plugin-marketplace.md](/zh-CN/spec/07-plugins/07-plugin-marketplace)。
diff --git a/packages/shared/src/types/plugins.ts b/packages/shared/src/types/plugins.ts
index d2bef8242..10478390d 100644
--- a/packages/shared/src/types/plugins.ts
+++ b/packages/shared/src/types/plugins.ts
@@ -3,12 +3,9 @@ import type { ActivationScope } from "../activation.js";
import type { TrustedExtensionDiagnostic } from "../trusted-extensions.js";
/**
- * Where the marketplace catalog comes from.
- *
- * `official` keeps its meaning — the official one — and the official one is the
- * plugin center, so a settings row written before the center existed keeps
- * meaning what its author picked instead of needing a migration. `github` and
- * `mirror` are the two backup channels, and `custom` is a URL the user typed.
+ * Legacy persisted marketplace-source values. The application ignores these
+ * values and always uses the official plugin center, but the union remains so
+ * existing settings can be read without a schema migration.
*/
export type PluginMarketSource = "official" | "github" | "mirror" | "custom";
diff --git a/packages/shared/src/types/settings.ts b/packages/shared/src/types/settings.ts
index 03eae315b..6e9d33b5a 100644
--- a/packages/shared/src/types/settings.ts
+++ b/packages/shared/src/types/settings.ts
@@ -129,13 +129,9 @@ export type AppSettings = {
keybindings?: KeybindingOverrides;
/** Unlocks the devtools console (settings button, F12, macOS View menu). */
developerMode?: boolean;
- /**
- * Extension marketplace provider. `mirror` targets the cnb.cool copy for
- * networks that cannot reach `raw.githubusercontent.com`; both serve the
- * same catalog and packages.
- */
+ /** @deprecated Retained for persisted settings compatibility; the marketplace always uses the official source. */
pluginMarketSource?: PluginMarketSource;
- /** Catalog URL used when `pluginMarketSource` is `custom`. */
+ /** @deprecated Retained for persisted settings compatibility and ignored by the marketplace. */
pluginMarketCustomUrl?: string;
/**
* Outbound proxy for app-owned HTTP (D340). Absent means System: Chromium
diff --git a/scripts/e2e-trusted-extensions.mjs b/scripts/e2e-trusted-extensions.mjs
index 7100238e6..d1fc578fa 100644
--- a/scripts/e2e-trusted-extensions.mjs
+++ b/scripts/e2e-trusted-extensions.mjs
@@ -77,17 +77,21 @@ function findElectron() {
}
}
-async function freePort() {
- const server = createServer();
- await new Promise((resolvePromise, reject) => {
- server.once("error", reject);
- server.listen(0, "127.0.0.1", resolvePromise);
- });
- const address = server.address();
- const port = typeof address === "object" && address ? address.port : null;
- await new Promise((resolvePromise) => server.close(resolvePromise));
- if (!port) throw new Error("failed to allocate a loopback port");
- return port;
+async function freePort(allocatedPorts) {
+ for (;;) {
+ const server = createServer();
+ await new Promise((resolvePromise, reject) => {
+ server.once("error", reject);
+ server.listen(0, "127.0.0.1", resolvePromise);
+ });
+ const address = server.address();
+ const port = typeof address === "object" && address ? address.port : null;
+ await new Promise((resolvePromise) => server.close(resolvePromise));
+ if (!port) throw new Error("failed to allocate a loopback port");
+ if (allocatedPorts.has(port)) continue;
+ allocatedPorts.add(port);
+ return port;
+ }
}
function spawnChild(label, command, args, options = {}) {
@@ -242,10 +246,10 @@ async function main() {
mkdirSync(runRoot, { recursive: true });
rmSync(homeDir, { recursive: true, force: true });
rmSync(requestLog, { force: true });
- const stubPort = await freePort();
- const mcpPort = await freePort();
- const cdpPort = await freePort();
- if (stubPort === mcpPort) throw new Error("allocated duplicate E2E ports");
+ const allocatedPorts = new Set();
+ const stubPort = await freePort(allocatedPorts);
+ const mcpPort = await freePort(allocatedPorts);
+ const cdpPort = await freePort(allocatedPorts);
await runCommand(
"trusted-extension-seed",