Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(plugins): 企业目录被拒时提示原因并保留公开插件 (#5896)
fattycatb66eac1e0aca
diff --git a/apps/desktop/src/main/plugin-market/__tests__/agentTools.test.ts b/apps/desktop/src/main/plugin-market/__tests__/agentTools.test.tsindex 0d0a2f7477..2e72d7f2be 100644--- a/apps/desktop/src/main/plugin-market/__tests__/agentTools.test.ts+++ b/apps/desktop/src/main/plugin-market/__tests__/agentTools.test.ts@@ -2,6 +2,7 @@ import { describe, expect, it, vi } from 'vitest';import { createPluginMarketAgentTools } from '../agentTools.js';import type { PluginMarketDetail, PluginMarketSnapshot } from '../../../shared/pluginMarket.js';import type { InstalledGhost } from '../../../shared/ghost.js';+import { ServerApiError } from '../../serverApiClient.js';import { throwIpcError } from '../../utils/ipcValidate.js';import type { PluginMarketInstallContext } from '../service.js';@@ -77,6 +78,50 @@ describe('Agent plugin discovery and installation', () => {expect(h.market.install).not.toHaveBeenCalled();});+ it('does not call an organization-only outage a complete catalog', async () => {+ const h = harness();+ h.snapshot.organizationAccessError = 'PLUGIN_NAMESPACE_CLIENT_REQUIRED';+ expect(await h.tools.search('gmail')).toMatchObject({+ ok: true,+ complete: false,+ unavailable_sources: ['organization'],+ });+ });++ it.each([+ ['PLUGIN_NAMESPACE_CLIENT_REQUIRED', 'update Cindy'],+ ['PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE', 'Retry later'],+ ['PLUGIN_LIST_CHANGED', 'Retry later'],+ ['PLUGIN_NAMESPACE_CONFIG_REQUIRED', 'Do not retry repeatedly'],+ ] as const)('returns %s from a market install failure', async (code, guidance) => {+ const h = harness();+ h.market.detail.mockRejectedValue(new ServerApiError(code, code === 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE' ? 503 : 409, 'secret-plugin-id'));+ const result = await h.tools.install({ pluginId: 'catalog-id', releaseId: 'release-1' });+ expect(result).toMatchObject({ ok: false, errorCode: code });+ expect(String(result.message)).toContain(guidance);+ expect(JSON.stringify(result)).not.toContain('secret-plugin-id');+ expect(h.release).toHaveBeenCalledOnce();+ });++ it('keeps the guidance when the service reports a catalog-level organization outage', async () => {+ const h = harness();+ h.market.install.mockImplementation(async () =>+ throwIpcError('PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE', 'Organization plugin catalog is unavailable'));+ const result = await h.tools.install({ pluginId: 'catalog-id', releaseId: 'release-1' });+ expect(result).toMatchObject({ ok: false, errorCode: 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE' });+ expect(String(result.message)).toContain('Retry later');+ expect(h.release).toHaveBeenCalledOnce();+ });++ it('keeps an ordinary install failure unavailable', async () => {+ const h = harness();+ h.market.install.mockRejectedValue(new Error('disk failed'));+ expect(await h.tools.install({ pluginId: 'catalog-id', releaseId: 'release-1' })).toMatchObject({+ ok: false,+ errorCode: 'INSTALL_UNAVAILABLE',+ });+ });+it('distinguishes unavailable sources from an exhaustive empty result without leaking errors', async () => {const h = harness(); h.snapshot.items = [];h.snapshot.unavailableReason = '/private/credentials?token=secret';diff --git a/apps/desktop/src/main/plugin-market/__tests__/api.test.ts b/apps/desktop/src/main/plugin-market/__tests__/api.test.tsindex f3b685101f..19e9022921 100644--- a/apps/desktop/src/main/plugin-market/__tests__/api.test.ts+++ b/apps/desktop/src/main/plugin-market/__tests__/api.test.ts@@ -67,6 +67,12 @@ describe('PluginMarketApi 默认 fetcher 的日志隐私', () => {const opts = serverApi.serverApiFetch.mock.calls[0]?.[1] ?? {};expect(opts.redactErrorDetails).toBe(true);expect(opts.logLabel).toBe('/api/plugins');+ expect(opts.allowedRedactedErrorCodes).toEqual([+ 'PLUGIN_NAMESPACE_CLIENT_REQUIRED',+ 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE',+ 'PLUGIN_NAMESPACE_CONFIG_REQUIRED',+ 'PLUGIN_LIST_CHANGED',+ ]);});});@@ -270,4 +276,100 @@ describe('PluginMarketApi', () => {currentOrganization: null,});});++ it('keeps one organization access error across pages and rejects a disagreement', async () => {+ const organization = { organizationId: 'org-acme', orgSlug: 'acme', pluginPrefix: 'acme' };+ const accessError = { code: 'PLUGIN_NAMESPACE_CONFIG_REQUIRED', message: '暂不可用' };+ const consistent = pagedFetcher(+ {+ plugins: [summary(PLUGIN_A, 'alpha')],+ nextCursor: 'cursor-1',+ currentOrganization: organization,+ organizationAccessError: accessError,+ },+ {+ plugins: [summary(PLUGIN_B, 'beta')],+ nextCursor: null,+ currentOrganization: organization,+ organizationAccessError: accessError,+ },+ );+ await expect(new PluginMarketApi(consistent).listAll()).resolves.toMatchObject({+ plugins: [{ id: PLUGIN_A }, { id: PLUGIN_B }],+ removals: [],+ organizationAccessError: accessError,+ });++ const changedReason = pagedFetcher(+ {+ plugins: [summary(PLUGIN_A, 'alpha')],+ nextCursor: 'cursor-1',+ currentOrganization: organization,+ organizationAccessError: {+ code: 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE',+ message: '稍后重试',+ },+ },+ {+ plugins: [summary(PLUGIN_B, 'beta')],+ nextCursor: null,+ currentOrganization: organization,+ organizationAccessError: accessError,+ },+ );+ await expect(new PluginMarketApi(changedReason).listAll()).resolves.toMatchObject({+ plugins: [{ id: PLUGIN_A }, { id: PLUGIN_B }],+ organizationAccessError: {+ code: 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE',+ message: '稍后重试',+ },+ });++ const disagreed = pagedFetcher(+ {+ plugins: [summary(PLUGIN_A, 'alpha')],+ nextCursor: 'cursor-1',+ currentOrganization: organization,+ organizationAccessError: accessError,+ },+ {+ plugins: [summary(PLUGIN_B, 'beta')],+ nextCursor: null,+ currentOrganization: organization,+ },+ );+ await expect(new PluginMarketApi(disagreed).listAll()).rejects.toThrow('organizationAccessError');+ });++ it('restarts the catalog once after PLUGIN_LIST_CHANGED and does not loop', async () => {+ const changed = Object.assign(new Error('changed'), {+ code: 'PLUGIN_LIST_CHANGED',+ statusCode: 409,+ });+ const restarted = vi.fn()+ .mockResolvedValueOnce({+ schemaVersion: 2,+ plugins: [summary(PLUGIN_A, 'alpha')],+ nextCursor: 'cursor-1',+ currentOrganization: { organizationId: 'org-acme', orgSlug: 'acme', pluginPrefix: 'acme' },+ })+ .mockRejectedValueOnce(changed)+ .mockResolvedValueOnce({+ schemaVersion: 2,+ plugins: [summary(PLUGIN_B, 'beta')],+ nextCursor: null,+ currentOrganization: { organizationId: 'org-acme', orgSlug: 'acme', pluginPrefix: 'acme' },+ });+ await expect(new PluginMarketApi(restarted).listAll()).resolves.toMatchObject({+ plugins: [{ id: PLUGIN_B }],+ });+ expect(restarted).toHaveBeenCalledTimes(3);+ expect(String(restarted.mock.calls[2]?.[0])).not.toContain('cursor=');++ const stuck = vi.fn().mockRejectedValue(changed);+ await expect(new PluginMarketApi(stuck).listAll()).rejects.toMatchObject({+ code: 'PLUGIN_LIST_CHANGED',+ });+ expect(stuck).toHaveBeenCalledTimes(2);+ });});diff --git a/apps/desktop/src/main/plugin-market/__tests__/defaultMarketPluginSyncOutcome.test.ts b/apps/desktop/src/main/plugin-market/__tests__/defaultMarketPluginSyncOutcome.test.tsindex c9410844d5..a0c3c0b64e 100644--- a/apps/desktop/src/main/plugin-market/__tests__/defaultMarketPluginSyncOutcome.test.ts+++ b/apps/desktop/src/main/plugin-market/__tests__/defaultMarketPluginSyncOutcome.test.ts@@ -30,4 +30,19 @@ describe('defaultMarketPluginSyncOutcome', () => {it('fails retryably when an individual default install or upgrade failed', () => {expect(defaultMarketPluginSyncOutcome(snapshot(null), 'failed')).toBe('failed');});++ it.each([+ 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE',+ 'PLUGIN_NAMESPACE_CONFIG_REQUIRED',+ 'PLUGIN_FUTURE_REASON',+ ])('keeps retrying while the organization catalog is unavailable with %s', (code) => {+ expect(defaultMarketPluginSyncOutcome({ ...snapshot(null), organizationAccessError: code })).toBe('failed');+ });++ it('does not retry an organization catalog that needs a newer client', () => {+ expect(defaultMarketPluginSyncOutcome({+ ...snapshot(null),+ organizationAccessError: 'PLUGIN_NAMESPACE_CLIENT_REQUIRED',+ })).toBe('completed');+ });});diff --git a/apps/desktop/src/main/plugin-market/__tests__/ipcErrorBoundary.test.ts b/apps/desktop/src/main/plugin-market/__tests__/ipcErrorBoundary.test.tsindex 387ef62edb..4c743fc3d2 100644--- a/apps/desktop/src/main/plugin-market/__tests__/ipcErrorBoundary.test.ts+++ b/apps/desktop/src/main/plugin-market/__tests__/ipcErrorBoundary.test.ts@@ -36,6 +36,8 @@ describe('Plugin Market IPC error boundary', () => {const body = registerSource.slice(start, end);expect(body).toContain('if (isIpcError(error)) throw error;');+ expect(body).toContain('isPluginMarketPassthroughErrorCode(error.code)');+ expect(body).toContain("throwIpcError(error.code, 'Plugin market operation failed');");expect(body).toContain("throwIpcError('INTERNAL', 'Plugin market operation failed');");expect(registerSource.match(/return invokePluginMarket\(/g)?.length).toBe(12);});diff --git a/apps/desktop/src/main/plugin-market/__tests__/service.test.ts b/apps/desktop/src/main/plugin-market/__tests__/service.test.tsindex 23a060f382..f29d4809f2 100644--- a/apps/desktop/src/main/plugin-market/__tests__/service.test.ts+++ b/apps/desktop/src/main/plugin-market/__tests__/service.test.ts@@ -5972,3 +5972,90 @@ describe('PluginMarketService install consent', () => {);});});++describe('organization catalog access error', () => {+ const ORGANIZATION_PLUGIN_ID = `c${'e'.repeat(24)}`;++ function deniedCatalog(publicItem: VisiblePluginSummary, code = 'PLUGIN_NAMESPACE_CLIENT_REQUIRED') {+ return {+ plugins: [publicItem],+ removals: [],+ currentOrganization: { organizationId: 'org-1', orgSlug: 'acme', pluginPrefix: 'acme' },+ organizationAccessError: { code, message: '企业部分不可用' },+ };+ }++ it.each([+ ['a full refresh', { deferReconciliation: false }],+ ['a deferred reconciliation', { deferReconciliation: true }],+ ] as const)('keeps public plugins and the installed organization plugin through %s', async (_label, options) => {+ const publicItem = summary();+ const h = harness([publicItem]);+ h.api.listAll.mockResolvedValue(deniedCatalog(publicItem));+ installOrganizationHelper();+ h.ledger.upsertInstallation(removalRecord({+ pluginId: ORGANIZATION_PLUGIN_ID,+ ghostId: 'helper',+ namespace: 'acme',+ manifestDigest: ghostManifestDigest(manifest('helper')),+ }));+ const organizationRecord = h.ledger.installationForPlugin({ ghostId: 'helper', namespace: 'acme' });+ const settled = vi.fn();++ const snapshot = await h.service.snapshot({ ...options, onDeferredReconciliationSettled: settled });+ if (options.deferReconciliation) await vi.waitFor(() => expect(settled).toHaveBeenCalledOnce());++ expect(snapshot.organizationAccessError).toBe('PLUGIN_NAMESPACE_CLIENT_REQUIRED');+ expect(snapshot.unavailableReason).toBeNull();+ expect(snapshot.items.map((entry) => entry.pluginId)).toContain(publicItem.id);+ expect(runtime.uninstall).not.toHaveBeenCalled();+ expect(h.ledger.installationForPlugin({ ghostId: 'helper', namespace: 'acme' })).toEqual(organizationRecord);+ });++ it.each([+ 'PLUGIN_NAMESPACE_CLIENT_REQUIRED',+ 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE',+ 'PLUGIN_NAMESPACE_CONFIG_REQUIRED',+ ])('reports %s instead of NOT_FOUND for an unlisted plugin without reading its detail', async (code) => {+ const publicItem = summary();+ const h = harness([publicItem]);+ h.api.listAll.mockResolvedValue(deniedCatalog(publicItem, code));+ const organizationItem = summary({ id: ORGANIZATION_PLUGIN_ID, ghostId: 'helper', scope: 'organization', organizationId: 'org-1' });++ await expect(h.service.detail(ORGANIZATION_PLUGIN_ID)).rejects.toThrow(`[${code}]`);+ await expect(h.service.install(+ ORGANIZATION_PLUGIN_ID,+ reviewedInstallOptions(organizationItem),+ TEST_INSTALL_CONTEXT,+ )).rejects.toThrow(`[${code}]`);+ expect(h.api.detail).not.toHaveBeenCalled();+ expect(h.api.download).not.toHaveBeenCalled();+ expect(runtime.install).not.toHaveBeenCalled();+ });++ it('keeps NOT_FOUND for an unlisted plugin when the reason is not a known access code', async () => {+ const publicItem = summary();+ const h = harness([publicItem]);+ h.api.listAll.mockResolvedValue(deniedCatalog(publicItem, 'PLUGIN_FUTURE_REASON'));++ await expect(h.service.detail(ORGANIZATION_PLUGIN_ID)).rejects.toThrow('[NOT_FOUND]');+ expect(h.api.detail).not.toHaveBeenCalled();+ });++ it('keeps a future organization access code with the public catalog', async () => {+ const item = summary();+ const h = harness([item]);+ h.api.listAll.mockResolvedValueOnce({+ plugins: [item],+ removals: [],+ currentOrganization: { organizationId: 'org-1', orgSlug: 'acme', pluginPrefix: 'acme' },+ organizationAccessError: { code: 'PLUGIN_FUTURE_REASON', message: '以后再说' },+ });++ const snapshot = await h.service.snapshot({ discoveryOnly: true });++ expect(snapshot.organizationAccessError).toBe('PLUGIN_FUTURE_REASON');+ expect(snapshot.unavailableReason).toBeNull();+ expect(snapshot.items.map((entry) => entry.pluginId)).toContain(item.id);+ });+});diff --git a/apps/desktop/src/main/plugin-market/agentTools.ts b/apps/desktop/src/main/plugin-market/agentTools.tsindex 02da0bdff7..dc8111d5f5 100644--- a/apps/desktop/src/main/plugin-market/agentTools.ts+++ b/apps/desktop/src/main/plugin-market/agentTools.ts@@ -3,7 +3,12 @@ import type { PluginMarketService } from './service.js';import type { PluginMarketItem } from '../../shared/pluginMarket.js';import { deliveryNamespaceFields } from '../../shared/pluginIdentity.js';import { isIpcError } from '../../shared/ipc-errors.js';+import { ServerApiError } from '../serverApiClient.js';import { throwIpcError } from '../utils/ipcValidate.js';+import {+ isPluginMarketPassthroughErrorCode,+ type PluginMarketPassthroughErrorCode,+} from './api.js';interface InstalledState {exists: boolean;@@ -55,10 +60,14 @@ export function createPluginMarketAgentTools(deps: PluginMarketAgentDeps) {ok: true,items: matches.slice(0, 20).map(item => catalogItem(item, deps.installedState(item.ghostId, item.namespace))),has_more: matches.length > 20,- complete: !snapshot.unavailableReason && snapshot.unavailableCustomSourceNames.length === 0,+ complete:+ !snapshot.unavailableReason &&+ !snapshot.organizationAccessError &&+ snapshot.unavailableCustomSourceNames.length === 0,// Source errors can contain local paths or server responses; expose status only.unavailable_sources: [...(snapshot.unavailableReason ? ['server'] : []),+ ...(snapshot.organizationAccessError ? ['organization'] : []),...snapshot.unavailableCustomSourceNames.map(() => 'custom'),],};@@ -113,6 +122,17 @@ export function createPluginMarketAgentTools(deps: PluginMarketAgentDeps) {message: 'The user declined this plugin installation. Do not retry unless the user asks for it again.',};}+ // The service raises catalog-level outages as IPC errors; detail/download+ // failures arrive as server errors. Both carry the same fixed codes.+ const accessCode =+ isIpcError(error) || error instanceof ServerApiError ? error.code : null;+ if (accessCode && isPluginMarketPassthroughErrorCode(accessCode)) {+ return {+ ok: false,+ errorCode: accessCode,+ message: agentMarketAccessMessage(accessCode),+ };+ }return {ok: false, errorCode: isIpcError(error) ? error.code : 'INSTALL_UNAVAILABLE',message: 'Installation was not confirmed. Inspect the selected plugin before retrying; do not claim an account connection or completed work.',@@ -121,3 +141,15 @@ export function createPluginMarketAgentTools(deps: PluginMarketAgentDeps) {},};}++function agentMarketAccessMessage(code: PluginMarketPassthroughErrorCode): string {+ switch (code) {+ case 'PLUGIN_NAMESPACE_CLIENT_REQUIRED':+ return 'The user must update Cindy before this organization plugin can be installed. Do not retry.';+ case 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE':+ case 'PLUGIN_LIST_CHANGED':+ return 'Organization plugin access is temporarily unavailable. Retry later. Do not claim the plugin is absent.';+ case 'PLUGIN_NAMESPACE_CONFIG_REQUIRED':+ return 'The organization plugin service is unavailable. Do not retry repeatedly.';+ }+}diff --git a/apps/desktop/src/main/plugin-market/api.ts b/apps/desktop/src/main/plugin-market/api.tsindex 16475e1448..6a40aa2b54 100644--- a/apps/desktop/src/main/plugin-market/api.ts+++ b/apps/desktop/src/main/plugin-market/api.ts@@ -6,6 +6,7 @@ import {parsePluginDownloadResponse,type GetPluginResponse,type ListPluginsResponse,+ type OrganizationPluginAccessError,type PluginRemovalNotice,type PluginDownloadResponse,} from '@cindy/plugin-protocol';@@ -17,6 +18,31 @@ import { serverApiFetch, type ApiFetchOptions } from '../serverApiClient.js';const log = createLogger('plugin-market-api');const PLUGIN_MARKET_API_TIMEOUT_MS = 15_000;+/** 固定业务码,不含插件身份,可以穿过市场请求的脱敏边界。 */+export const PLUGIN_MARKET_PASSTHROUGH_ERROR_CODES = [+ 'PLUGIN_NAMESPACE_CLIENT_REQUIRED',+ 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE',+ 'PLUGIN_NAMESPACE_CONFIG_REQUIRED',+ 'PLUGIN_LIST_CHANGED',+] as const;++export type PluginMarketPassthroughErrorCode =+ (typeof PLUGIN_MARKET_PASSTHROUGH_ERROR_CODES)[number];++export function isPluginMarketPassthroughErrorCode(+ code: string,+): code is PluginMarketPassthroughErrorCode {+ return (PLUGIN_MARKET_PASSTHROUGH_ERROR_CODES as readonly string[]).includes(code);+}++function isPluginListChangedError(error: unknown): boolean {+ return (+ typeof error === 'object' &&+ error !== null &&+ (error as { code?: unknown }).code === 'PLUGIN_LIST_CHANGED'+ );+}+type Fetcher = <T>(apiPath: string,options: Omit<ApiFetchOptions, 'baseUrl'>,@@ -31,6 +57,7 @@ const defaultFetcher: Fetcher = (apiPath, options) =>// 详情,logLabel 用不含 ID 的路由模板代替真实 path(2026-08-06 review)。redactErrorDetails: true,logLabel: '/api/plugins',+ allowedRedactedErrorCodes: PLUGIN_MARKET_PASSTHROUGH_ERROR_CODES,});/** plugin-server 普通客户端 API;每个响应都经过共享 v2 parser fail-closed。 */@@ -50,10 +77,28 @@ export class PluginMarketApi {async listAll(query?: string,- ): Promise<Pick<ListPluginsResponse, 'plugins' | 'removals' | 'currentOrganization'>> {+ ): Promise<+ Pick<ListPluginsResponse, 'plugins' | 'removals' | 'currentOrganization' | 'organizationAccessError'>+ > {+ try {+ return await this.collectList(query);+ } catch (error) {+ if (!isPluginListChangedError(error)) throw error;+ log.warn('plugin list cursor invalidated, retrying from the first page');+ return this.collectList(query);+ }+ }++ private async collectList(+ query?: string,+ ): Promise<+ Pick<ListPluginsResponse, 'plugins' | 'removals' | 'currentOrganization' | 'organizationAccessError'>+ > {const plugins: ListPluginsResponse['plugins'] = [];const removalsByPluginId = new Map<string, PluginRemovalNotice>();let currentOrganization: ListPluginsResponse['currentOrganization'] = null;+ let organizationAccessError: OrganizationPluginAccessError | undefined;+ let organizationAccessState: 'unknown' | 'present' | 'absent' = 'unknown';let cursor: string | null = null;const seen = new Set<string>();for (let page = 0; page < 100; page += 1) {@@ -86,6 +131,23 @@ export class PluginMarketApi {throw new Error('Plugin 市场分页 currentOrganization 不一致');}currentOrganization ??= response.currentOrganization;+ const pageError = response.organizationAccessError;+ if (organizationAccessState === 'unknown') {+ organizationAccessState = pageError ? 'present' : 'absent';+ organizationAccessError = pageError;+ } else if (pageError) {+ if (organizationAccessState !== 'present') {+ throw new Error('Plugin 市场分页 organizationAccessError 不一致');+ }+ if (organizationAccessError?.code !== pageError.code) {+ log.warn('organization access error code changed across pages', {+ first: organizationAccessError?.code,+ next: pageError.code,+ });+ }+ } else if (organizationAccessState !== 'absent') {+ throw new Error('Plugin 市场分页 organizationAccessError 不一致');+ }if (!response.nextCursor) {// 在架优先(契约:通告与**任一页** plugins 有交集即作废)的作用域是// 未经 owner 过滤的完整目录,必须留在聚合层;挪到 service 的 owner@@ -98,7 +160,12 @@ export class PluginMarketApi {return false;});assertPluginListOrganizationNamespace(currentOrganization, plugins, removals);- return { plugins, removals, currentOrganization };+ return {+ plugins,+ removals,+ currentOrganization,+ ...(organizationAccessError ? { organizationAccessError } : {}),+ };}if (response.nextCursor === cursor) throw new Error('Plugin 市场分页游标未前进');cursor = response.nextCursor;diff --git a/apps/desktop/src/main/plugin-market/registerIpc.ts b/apps/desktop/src/main/plugin-market/registerIpc.tsindex 4a9a356030..9840ba1d01 100644--- a/apps/desktop/src/main/plugin-market/registerIpc.ts+++ b/apps/desktop/src/main/plugin-market/registerIpc.ts@@ -3,6 +3,8 @@ import os from 'node:os';import { ipcMain } from 'electron';import { isIpcError } from '../../shared/ipc-errors.js';+import { ServerApiError } from '../serverApiClient.js';+import { isPluginMarketPassthroughErrorCode } from './api.js';import {isGhostInstallApprovalToken,type GhostManifest,@@ -66,9 +68,15 @@ export function defaultMarketPluginSyncOutcome(snapshot: PluginMarketSnapshot,reconciliationOutcome: 'completed' | 'failed' = 'completed',): DefaultMarketPluginSyncOutcome {+ // The organization catalog was not reconciled. Only an upgrade can fix a+ // client-version rejection; every other reason may clear on retry.+ const organizationRetryable =+ Boolean(snapshot.organizationAccessError)+ && snapshot.organizationAccessError !== 'PLUGIN_NAMESPACE_CLIENT_REQUIRED';if ((snapshot.unavailableReason === null || snapshot.unavailableReason === 'not-configured')&& reconciliationOutcome === 'completed'+ && !organizationRetryable) {return 'completed';}@@ -96,6 +104,7 @@ export async function syncDefaultMarketPlugins(): Promise<DefaultMarketPluginSynif (outcome === 'failed') {log.warn('default plugin startup sync incomplete', {unavailableReason: snapshot.unavailableReason,+ organizationAccessError: snapshot.organizationAccessError ?? null,});}return outcome;@@ -117,6 +126,9 @@ async function invokePluginMarket<T>(operation: () => Promise<T>): Promise<T> {return await operation();} catch (error) {if (isIpcError(error)) throw error;+ if (error instanceof ServerApiError && isPluginMarketPassthroughErrorCode(error.code)) {+ throwIpcError(error.code, 'Plugin market operation failed');+ }log.warn('plugin market IPC failed', {error: error instanceof Error ? error.message : String(error),});diff --git a/apps/desktop/src/main/plugin-market/service.ts b/apps/desktop/src/main/plugin-market/service.tsindex 71d9f6efeb..358c60921b 100644--- a/apps/desktop/src/main/plugin-market/service.ts+++ b/apps/desktop/src/main/plugin-market/service.ts@@ -6,6 +6,7 @@ import {isValidPluginResourceId,isValidPluginNamespace,PLUGIN_PREFIX_PATTERN,+ type OrganizationPluginAccessError,type PluginCurrentOrganization,type PluginRemovalNotice,type VisiblePluginDetail,@@ -102,7 +103,7 @@ import {type GhostInstallConsentPrompt,} from '../cindy-brain/ghostInstallConsent.js';import type { GhostInstallConsentInitiator } from '../../shared/ghostInstallConsent.js';-import { PluginMarketApi } from './api.js';+import { isPluginMarketPassthroughErrorCode, PluginMarketApi } from './api.js';import { createOrganizationPrefixStore } from './organizationPrefixStore.js';import { downloadVerifiedPlugin } from './download.js';import {@@ -128,6 +129,28 @@ import { MarketSourceStore } from './sources/store.js';const log = createLogger('plugin-market');+function organizationAccessErrorCode(+ error: OrganizationPluginAccessError | undefined,+): string | null {+ if (!error) return null;+ log.warn('organization plugin catalog unavailable', { code: error.code });+ return error.code;+}++/**+ * 目录里找不到条目时的拒绝。企业部分被拒时,条目可能只是没有下发:保留准入原因,+ * 但仍不读取详情、不安装。+ */+function throwListedPluginUnavailable(+ organizationAccessError: OrganizationPluginAccessError | undefined,+): never {+ const code = organizationAccessError?.code;+ if (code && isPluginMarketPassthroughErrorCode(code)) {+ throwIpcError(code, 'Organization plugin catalog is unavailable');+ }+ throwIpcError('NOT_FOUND', 'Plugin is unavailable to the active account');+}+class SilentUpgradeBusyError extends Error {}class SilentDefaultInstallCancelledError extends Error {}class SilentOrganizationDefaultTakeoverSupersededError extends Error {}@@ -1036,6 +1059,7 @@ export class PluginMarketService {let plugins: VisiblePluginSummary[];let removals: PluginRemovalNotice[];let currentOrganization: PluginCurrentOrganization | null | undefined;+ let organizationAccessError: string | null = null;let customDiscovery: CustomMarketDiscovery;try {// 官方目录与自定义发现并行;单个本地/网络盘来源卡顿不会串行拖住官方请求。@@ -1043,6 +1067,7 @@ export class PluginMarketService {plugins = visiblePluginsForOwner(owner, catalog.plugins);removals = catalog.removals;currentOrganization = catalog.currentOrganization;+ organizationAccessError = organizationAccessErrorCode(catalog.organizationAccessError);customDiscovery = discovered;} catch (error) {log.warn('market list unavailable', {@@ -1126,6 +1151,7 @@ export class PluginMarketService {unavailableReason: null,customSourceNames,unavailableCustomSourceNames: customDiscovery.unavailableSourceNames,+ organizationAccessError,};if (!options.discoveryOnly && options.deferReconciliation) {// 目录展示不等待默认插件下载;对账仍复用原有串行锁和 owner 校验。@@ -1152,6 +1178,7 @@ export class PluginMarketService {unavailableReason: null,customSourceNames: [],unavailableCustomSourceNames: [],+ organizationAccessError: organizationAccessErrorCode(catalog.organizationAccessError),};} catch (error) {log.warn('public market list unavailable', {@@ -1230,9 +1257,7 @@ export class PluginMarketService {this.rememberCurrentOrganization(listed.currentOrganization);const catalog = visiblePluginsForOwner(owner, listed.plugins);const summary = catalog.find((candidate) => candidate.id === pluginId);- if (!summary) {- throwIpcError('NOT_FOUND', 'Plugin is unavailable to the active account');- }+ if (!summary) throwListedPluginUnavailable(listed.organizationAccessError);const plugin = await this.api.detail(pluginId);requireSameMarketOwner(owner);assertDetailMatchesSummary(summary, plugin);@@ -1440,9 +1465,7 @@ export class PluginMarketService {this.rememberCurrentOrganization(listed.currentOrganization);const catalog = visiblePluginsForOwner(owner, listed.plugins);const selected = catalog.find((candidate) => candidate.id === pluginId);- if (!selected) {- throwIpcError('NOT_FOUND', 'Plugin is unavailable to the active account');- }+ if (!selected) throwListedPluginUnavailable(listed.organizationAccessError);if (!isGhostAvailableForActiveSession(selected.ghostId)) {throwIpcError('PERMISSION_DENIED', 'This Plugin requires a Cindy account');}diff --git a/apps/desktop/src/main/plugin-publisher/__tests__/api.test.ts b/apps/desktop/src/main/plugin-publisher/__tests__/api.test.tsindex dca3634031..9623b2d049 100644--- a/apps/desktop/src/main/plugin-publisher/__tests__/api.test.ts+++ b/apps/desktop/src/main/plugin-publisher/__tests__/api.test.ts@@ -61,7 +61,13 @@ describe('PluginPublisherApi', () => {expect(opts.redactErrorDetails).toBe(true);expect(opts.logLabel).toBe('/api/publisher');expect(opts.headers).toEqual({ 'x-cindy-version': '1.2.3' });- expect(opts.allowedRedactedErrorCodes).toContain('PLUGIN_NAMESPACE_CLIENT_REQUIRED');+ expect(opts.allowedRedactedErrorCodes).toEqual(expect.arrayContaining([+ 'PLUGIN_NAMESPACE_CLIENT_REQUIRED',+ 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE',+ 'PLUGIN_NAMESPACE_CONFIG_REQUIRED',+ 'PUBLISH_GHOST_ID_INVALID',+ 'PLUGIN_GHOST_ID_RESERVED',+ ]));}});diff --git a/apps/desktop/src/main/plugin-publisher/__tests__/orchestrator.test.ts b/apps/desktop/src/main/plugin-publisher/__tests__/orchestrator.test.tsindex c22830b673..f0620d9fe8 100644--- a/apps/desktop/src/main/plugin-publisher/__tests__/orchestrator.test.ts+++ b/apps/desktop/src/main/plugin-publisher/__tests__/orchestrator.test.ts@@ -729,16 +729,22 @@ describe('PluginPublisherOrchestrator', () => {{ status: 503, code: 'RATE_LIMIT_UNAVAILABLE', expected: 'RATE_LIMIT_UNAVAILABLE' },{ status: 503, code: 'STORAGE_UNAVAILABLE', expected: 'STORAGE_UNAVAILABLE' },{ status: 409, code: 'PLUGIN_NAMESPACE_CLIENT_REQUIRED', expected: 'PLUGIN_NAMESPACE_CLIENT_REQUIRED' },+ { status: 503, code: 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE', expected: 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE' },+ { status: 409, code: 'PLUGIN_NAMESPACE_CONFIG_REQUIRED', expected: 'PLUGIN_NAMESPACE_CONFIG_REQUIRED' },+ { status: 409, code: 'PUBLISH_GHOST_ID_INVALID', expected: 'PUBLISH_GHOST_ID_INVALID' },+ { status: 409, code: 'PLUGIN_GHOST_ID_RESERVED', expected: 'PLUGIN_GHOST_ID_RESERVED' },])('maps prepare $status/$code to $expected', async ({ status, code, expected }) => {const filePath = await packagePath();const snapshots: PluginPublisherProgress[] = [];+ const commit = vi.fn();+ const statusCall = vi.fn();const orch = createPluginPublisherOrchestrator({api: {prepare: async () => {throw new PluginPublisherApiError(code, status, 'redacted');},- commit: vi.fn(),- status: vi.fn(),+ commit,+ status: statusCall,} as unknown as PluginPublisherApi,inspectPackage: async () => ({ ghostId: 'demo', name: 'Demo', version: '1.0.0' }),confirm: async () => true,@@ -751,5 +757,19 @@ describe('PluginPublisherOrchestrator', () => {if (code === 'PLUGIN_NAMESPACE_CLIENT_REQUIRED') {expect(failed.message).toBe('请更新 Cindy 后再发布此组织的插件');}+ if (code === 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE') {+ expect(failed.message).toBe('暂时无法确认企业身份,请稍后重试');+ }+ if (code === 'PLUGIN_NAMESPACE_CONFIG_REQUIRED') {+ expect(failed.message).toBe('企业插件发布暂不可用,请稍后重试');+ }+ if (code === 'PUBLISH_GHOST_ID_INVALID') {+ expect(failed.message).toBe('新插件 ID 必须以小写字母开头,请修改 ID 后重新发布');+ }+ if (code === 'PLUGIN_GHOST_ID_RESERVED') {+ expect(failed.message).toBe('cindy- 开头的 ID 为官方保留,请修改 ID 后重新发布');+ }+ expect(commit).not.toHaveBeenCalled();+ expect(statusCall).not.toHaveBeenCalled();});});diff --git a/apps/desktop/src/main/plugin-publisher/api.ts b/apps/desktop/src/main/plugin-publisher/api.tsindex 91e129e0ec..b811d70808 100644--- a/apps/desktop/src/main/plugin-publisher/api.ts+++ b/apps/desktop/src/main/plugin-publisher/api.ts@@ -131,6 +131,10 @@ export class PluginPublisherApi {'INVALID_CONNECTION_TOKEN','CONNECTION_TOKEN_EXPIRED','PLUGIN_NAMESPACE_CLIENT_REQUIRED',+ 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE',+ 'PLUGIN_NAMESPACE_CONFIG_REQUIRED',+ 'PUBLISH_GHOST_ID_INVALID',+ 'PLUGIN_GHOST_ID_RESERVED',],...options,headers: { ...options.headers, [CINDY_CLIENT_VERSION_HEADER]: this.deps.getClientVersion() },diff --git a/apps/desktop/src/main/plugin-publisher/orchestrator.ts b/apps/desktop/src/main/plugin-publisher/orchestrator.tsindex 508563cc3f..4e4cb3e53d 100644--- a/apps/desktop/src/main/plugin-publisher/orchestrator.ts+++ b/apps/desktop/src/main/plugin-publisher/orchestrator.ts@@ -698,6 +698,7 @@ function isTerminalStage(stage: PluginPublisherStage): boolean {function isTransientPublisherApiError(error: unknown): boolean {if (!(error instanceof PluginPublisherApiError)) return false;+ if (error.code === 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE') return true;if (error.status >= 500) return true;return (error.code === 'RATE_LIMIT_UNAVAILABLE' ||@@ -707,11 +708,20 @@ function isTransientPublisherApiError(error: unknown): boolean {}function isTerminalPublisherClientError(error: PluginPublisherApiError): boolean {- return error.status === 403 || error.status === 404;+ return (+ error.status === 403 ||+ error.status === 404 ||+ error.code === 'PUBLISH_GHOST_ID_INVALID' ||+ error.code === 'PLUGIN_GHOST_ID_RESERVED'+ );}function mapPublisherApiMessage(error: PluginPublisherApiError): string {if (error.code === 'PLUGIN_NAMESPACE_CLIENT_REQUIRED') return '请更新 Cindy 后再发布此组织的插件';+ if (error.code === 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE') return '暂时无法确认企业身份,请稍后重试';+ if (error.code === 'PLUGIN_NAMESPACE_CONFIG_REQUIRED') return '企业插件发布暂不可用,请稍后重试';+ if (error.code === 'PUBLISH_GHOST_ID_INVALID') return '新插件 ID 必须以小写字母开头,请修改 ID 后重新发布';+ if (error.code === 'PLUGIN_GHOST_ID_RESERVED') return 'cindy- 开头的 ID 为官方保留,请修改 ID 后重新发布';if (error.status === 403 && error.code === 'FORBIDDEN') {return '本企业未开启成员发布,请联系管理员';}diff --git a/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx b/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsxindex 41f879188d..7d6c9928be 100644--- a/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx+++ b/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx@@ -151,7 +151,10 @@ import {type PluginPresentationOrigin,} from './lib/pluginMarketPresentation';import { AddMarketplaceDialog } from './AddMarketplaceDialog';-import { pluginMarketErrorKey } from './lib/pluginMarketErrorKey';+import {+ pluginMarketErrorKey,+ pluginMarketOrganizationAccessErrorKey,+} from './lib/pluginMarketErrorKey';import { usePluginIconRefresh } from './lib/usePluginIconRefresh';import { usePluginMarketIcon } from './lib/usePluginMarketIcon';import { usePluginMarketForegroundRefresh } from './lib/usePluginMarketForegroundRefresh';@@ -796,6 +799,9 @@ export function GhostPluginPage({[effectiveOriginFilter, searchedAvailableMarketItems],);// 「自定义」档内按来源市场分组(≥2 个源时展示小标题);组顺序沿用市场添加顺序。+ const organizationAccessErrorKey = pluginMarketOrganizationAccessErrorKey(+ marketSnapshot?.organizationAccessError,+ );const customGroups = useMemo(() => {if (effectiveOriginFilter !== 'custom') return null;const groups = new Map<string, PluginMarketItem[]>();@@ -1929,6 +1935,7 @@ export function GhostPluginPage({{availableMarketItems.length > 0 ||searchedAvailableMarketItems.length > 0 ||marketSnapshot?.unavailableReason ||+ marketSnapshot?.organizationAccessError ||marketSnapshot?.unavailableCustomSourceNames.length ? (<section className="plugin-motion-page-section mt-10 min-w-0"><div className={PLUGIN_CATALOG_TOOLBAR_CLASS}>@@ -1988,6 +1995,12 @@ export function GhostPluginPage({</p>) : null}+ {organizationAccessErrorKey ? (+ <p className="mb-4 rounded-xl border border-[var(--border-default)] bg-[var(--surface-chip)] px-4 py-3 text-12 text-[var(--text-secondary)]">+ {t(organizationAccessErrorKey)}+ </p>+ ) : null}+{availableMarketItems.length > 0 ? (customGroups && customGroups.length > 1 ? (<div className="flex flex-col gap-6">@@ -2046,6 +2059,7 @@ export function GhostPluginPage({</div>)) : marketSnapshot?.unavailableReason ||+ marketSnapshot?.organizationAccessError ||marketSnapshot?.unavailableCustomSourceNames.length ? null : (<div className="rounded-xl border-[0.5px] border-[var(--border-default)] px-5 py-10 text-center"><p className="text-13 text-[var(--text-secondary)]">diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginPage.navigation.test.tsx b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginPage.navigation.test.tsxindex d87469884d..1874b455d7 100644--- a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginPage.navigation.test.tsx+++ b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginPage.navigation.test.tsx@@ -445,3 +445,46 @@ describe('retirement migration from the original plugin', () => {expect(screen.queryByRole('button', { name: 'settings.ghosts.retirement.install' })).toBeNull();});});++describe('organization catalog access notice', () => {+ function marketSnapshot(organizationAccessError?: string, items = [detail]) {+ window.electronAPI.pluginMarket.snapshot = async () => ({+ items,+ unavailableReason: null,+ customSourceNames: [],+ unavailableCustomSourceNames: [],+ ...(organizationAccessError ? { organizationAccessError } : {}),+ });+ }++ it('shows the upgrade hint beside a public plugin', async () => {+ marketSnapshot('PLUGIN_NAMESPACE_CLIENT_REQUIRED');+ render(page('/plugins'));+ expect(await screen.findByText('Navigation Plugin')).toBeTruthy();+ expect(screen.getByText('settings.ghosts.market.errors.namespaceClientRequired')).toBeTruthy();+ });++ it('keeps the catalog notice when nothing is installable', async () => {+ marketSnapshot('PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE', []);+ render(page('/plugins'));+ expect(+ await screen.findByText('settings.ghosts.market.errors.organizationContextUnavailable'),+ ).toBeTruthy();+ expect(screen.getByText('settings.ghosts.page.recommendedSection')).toBeTruthy();+ expect(screen.queryByText('settings.ghosts.page.emptyFiltered')).toBeNull();+ });++ it('uses the generic hint for an unknown organization access code', async () => {+ marketSnapshot('PLUGIN_FUTURE_REASON');+ render(page('/plugins'));+ expect(await screen.findByText('settings.ghosts.market.errors.organizationUnavailable')).toBeTruthy();+ expect(screen.getByText('Navigation Plugin')).toBeTruthy();+ });++ it('does not show an organization access hint when the catalog is complete', async () => {+ render(page('/plugins'));+ expect(await screen.findByText('Navigation Plugin')).toBeTruthy();+ expect(screen.queryByText('settings.ghosts.market.errors.namespaceClientRequired')).toBeNull();+ expect(screen.queryByText('settings.ghosts.market.errors.organizationUnavailable')).toBeNull();+ });+});diff --git a/apps/desktop/src/renderer/features/plugin/lib/__tests__/pluginMarketErrorKey.test.ts b/apps/desktop/src/renderer/features/plugin/lib/__tests__/pluginMarketErrorKey.test.tsindex 146be1ff4c..a7af6f2cf7 100644--- a/apps/desktop/src/renderer/features/plugin/lib/__tests__/pluginMarketErrorKey.test.ts+++ b/apps/desktop/src/renderer/features/plugin/lib/__tests__/pluginMarketErrorKey.test.ts@@ -2,7 +2,10 @@ import { describe, expect, it } from 'vitest';import i18n from '../../../../i18n';import { GHOST_OFFICIAL_ID_PREFIX } from '../../../../../shared/ghost';-import { pluginMarketErrorKey } from '../pluginMarketErrorKey';+import {+ pluginMarketErrorKey,+ pluginMarketOrganizationAccessErrorKey,+} from '../pluginMarketErrorKey';function serializedIpcError(code: string): Error {return new Error(`Error invoking remote method: Error: [${code}] internal detail`);@@ -20,6 +23,10 @@ describe('pluginMarketErrorKey', () => {['GHOST_DOWNLOAD_TIMEOUT', 'downloadTimeout'],['GHOST_DOWNLOAD_FAILED', 'downloadFailed'],['GHOST_BROKER_REDIRECT_PORT_REQUIRED', 'brokerRedirectPortRequired'],+ ['PLUGIN_NAMESPACE_CLIENT_REQUIRED', 'namespaceClientRequired'],+ ['PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE', 'organizationContextUnavailable'],+ ['PLUGIN_NAMESPACE_CONFIG_REQUIRED', 'namespaceConfigRequired'],+ ['PLUGIN_LIST_CHANGED', 'listChanged'],])('maps %s to localized market copy', (code, suffix) => {expect(pluginMarketErrorKey(serializedIpcError(code))).toBe(`settings.ghosts.market.errors.${suffix}`,@@ -32,6 +39,29 @@ describe('pluginMarketErrorKey', () => {);});+ it('maps an unknown organization access code to the generic enterprise hint', () => {+ expect(pluginMarketOrganizationAccessErrorKey('PLUGIN_FUTURE_REASON')).toBe(+ 'settings.ghosts.market.errors.organizationUnavailable',+ );+ expect(pluginMarketOrganizationAccessErrorKey(null)).toBeNull();+ });++ it.each(['zh-CN', 'zh-TW', 'en', 'ja', 'ko'])('has organization access copy in %s', (locale) => {+ for (const code of [+ 'PLUGIN_NAMESPACE_CLIENT_REQUIRED',+ 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE',+ 'PLUGIN_NAMESPACE_CONFIG_REQUIRED',+ 'PLUGIN_LIST_CHANGED',+ ]) {+ const key = pluginMarketErrorKey(serializedIpcError(code));+ expect(i18n.getResource(locale, 'common', key)).toEqual(expect.any(String));+ expect(i18n.getFixedT(locale)(key)).not.toBe(key);+ }+ const generic = 'settings.ghosts.market.errors.organizationUnavailable';+ expect(i18n.getResource(locale, 'common', generic)).toEqual(expect.any(String));+ expect(i18n.getFixedT(locale)(generic)).not.toBe(generic);+ });+it.each(['zh-CN', 'zh-TW', 'en', 'ja', 'ko'])('has download error copy in %s', (locale) => {for (const code of ['GHOST_FILE_INVALID', 'GHOST_DOWNLOAD_TIMEOUT', 'GHOST_DOWNLOAD_FAILED']) {const key = pluginMarketErrorKey(serializedIpcError(code));diff --git a/apps/desktop/src/renderer/features/plugin/lib/pluginMarketErrorKey.ts b/apps/desktop/src/renderer/features/plugin/lib/pluginMarketErrorKey.tsindex 824868ecae..cb8442a82f 100644--- a/apps/desktop/src/renderer/features/plugin/lib/pluginMarketErrorKey.ts+++ b/apps/desktop/src/renderer/features/plugin/lib/pluginMarketErrorKey.ts@@ -1,8 +1,29 @@import { extractIpcError } from '@/utils/ipcError';/** Stable Plugin Market IPC error codes → localized renderer copy keys. */+export function pluginMarketOrganizationAccessErrorKey(+ code: string | null | undefined,+): string | null {+ if (!code) return null;+ switch (code) {+ case 'PLUGIN_NAMESPACE_CLIENT_REQUIRED':+ return 'settings.ghosts.market.errors.namespaceClientRequired';+ case 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE':+ return 'settings.ghosts.market.errors.organizationContextUnavailable';+ case 'PLUGIN_NAMESPACE_CONFIG_REQUIRED':+ return 'settings.ghosts.market.errors.namespaceConfigRequired';+ default:+ return 'settings.ghosts.market.errors.organizationUnavailable';+ }+}+export function pluginMarketErrorKey(error: unknown): string {- switch (extractIpcError(error)?.code) {+ const code = extractIpcError(error)?.code;+ switch (code) {+ case 'PLUGIN_NAMESPACE_CLIENT_REQUIRED':+ case 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE':+ case 'PLUGIN_NAMESPACE_CONFIG_REQUIRED':+ return pluginMarketOrganizationAccessErrorKey(code)!;case 'INVALID_PARAMS':return 'settings.ghosts.market.errors.invalidRequest';case 'NOT_FOUND':@@ -11,6 +32,8 @@ export function pluginMarketErrorKey(error: unknown): string {return 'settings.ghosts.market.errors.conflict';case 'PRECONDITION_FAILED':return 'settings.ghosts.market.errors.stateChanged';+ case 'PLUGIN_LIST_CHANGED':+ return 'settings.ghosts.market.errors.listChanged';case 'PERMISSION_DENIED':return 'settings.ghosts.market.errors.accessDenied';case 'UNSUPPORTED_CAPABILITY':diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex 1a6202319b..b7954160ac 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -6116,7 +6116,12 @@"invalidPackage": "This plugin package is invalid and cannot be installed. Contact the publisher.","downloadTimeout": "The plugin download timed out. Please try again later.","downloadFailed": "The plugin download failed. Check your connection and try again.",- "brokerRedirectPortRequired": "This plugin declares an authorization broker but is missing redirectPort in the same OAuth configuration, so it cannot be installed from the plugin marketplace. Contact the publisher to add the field and publish a new release."+ "brokerRedirectPortRequired": "This plugin declares an authorization broker but is missing redirectPort in the same OAuth configuration, so it cannot be installed from the plugin marketplace. Contact the publisher to add the field and publish a new release.",+ "namespaceClientRequired": "This version cannot show organization plugins. Update Cindy to continue. Installed organization plugins remain available.",+ "organizationContextUnavailable": "Organization identity is temporarily unavailable. Try again later. Installed organization plugins remain available.",+ "namespaceConfigRequired": "Organization plugins are temporarily unavailable. Installed organization plugins remain available.",+ "listChanged": "The organization plugin catalog changed. Try again.",+ "organizationUnavailable": "Organization plugins are temporarily unavailable. Installed organization plugins remain available."},"securityTitle": "Install and permissions","securityDescription": "Cindy verifies package size and SHA-256 in the main process, validates the plugin manifest, then installs atomically. You confirm the plugin’s permissions before it is installed; first-time installs are then enabled automatically and can be disabled anytime on the Plugins page. Updates keep the current enabled state, and you are asked first when a new version needs more permissions.",diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 8f28a6854b..10a643e4c8 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -6091,7 +6091,12 @@"invalidPackage": "プラグインパッケージに問題があるため、インストールできません。発行元にお問い合わせください。","downloadTimeout": "プラグインのダウンロードがタイムアウトしました。しばらくしてからもう一度お試しください。","downloadFailed": "プラグインのダウンロードに失敗しました。接続を確認して、もう一度お試しください。",- "brokerRedirectPortRequired": "このプラグインは認可 broker を宣言していますが、同じ OAuth 設定に redirectPort がないため、プラグインマーケットからインストールできません。発行元にこのフィールドを追加して新しいバージョンを公開するよう連絡してください。"+ "brokerRedirectPortRequired": "このプラグインは認可 broker を宣言していますが、同じ OAuth 設定に redirectPort がないため、プラグインマーケットからインストールできません。発行元にこのフィールドを追加して新しいバージョンを公開するよう連絡してください。",+ "namespaceClientRequired": "このバージョンでは組織プラグインを表示できません。Cindy を更新してください。インストール済みの組織プラグインは引き続き使えます。",+ "organizationContextUnavailable": "組織の識別を一時的に確認できません。しばらくしてからもう一度お試しください。インストール済みの組織プラグインは引き続き使えます。",+ "namespaceConfigRequired": "組織プラグインは一時的に利用できません。インストール済みの組織プラグインは引き続き使えます。",+ "listChanged": "組織プラグインの一覧が変わりました。もう一度お試しください。",+ "organizationUnavailable": "組織プラグインは一時的に利用できません。インストール済みの組織プラグインは引き続き使えます。"},"securityTitle": "インストールと権限","securityDescription": "メインプロセスでサイズと SHA-256、プラグインマニフェストを検証してからアトミックにインストールします。インストール前にプラグインの権限を確認していただき、インストール後は自動的に有効になり、プラグインページからいつでも無効化できます。更新では現在の有効/無効の状態が維持され、新しいバージョンで権限が増える場合は先に確認します。",diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex 4c85896b90..1d15eafb99 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -6091,7 +6091,12 @@"invalidPackage": "플러그인 패키지에 문제가 있어 설치할 수 없습니다. 게시자에게 문의해 주세요.","downloadTimeout": "플러그인 다운로드 시간이 초과되었습니다. 잠시 후 다시 시도해 주세요.","downloadFailed": "플러그인을 다운로드하지 못했습니다. 네트워크 연결을 확인한 후 다시 시도해 주세요.",- "brokerRedirectPortRequired": "이 플러그인은 인증 broker를 선언했지만 같은 OAuth 설정에 redirectPort가 없어 플러그인 마켓에서 설치할 수 없습니다. 게시자에게 이 필드를 추가해 새 버전을 게시해 달라고 알려 주세요."+ "brokerRedirectPortRequired": "이 플러그인은 인증 broker를 선언했지만 같은 OAuth 설정에 redirectPort가 없어 플러그인 마켓에서 설치할 수 없습니다. 게시자에게 이 필드를 추가해 새 버전을 게시해 달라고 알려 주세요.",+ "namespaceClientRequired": "이 버전에서는 조직 플러그인을 볼 수 없습니다. Cindy를 업데이트하세요. 설치된 조직 플러그인은 계속 사용할 수 있습니다.",+ "organizationContextUnavailable": "조직 신원을 일시적으로 확인할 수 없습니다. 나중에 다시 시도하세요. 설치된 조직 플러그인은 계속 사용할 수 있습니다.",+ "namespaceConfigRequired": "조직 플러그인을 일시적으로 사용할 수 없습니다. 설치된 조직 플러그인은 계속 사용할 수 있습니다.",+ "listChanged": "조직 플러그인 목록이 변경되었습니다. 다시 시도하세요.",+ "organizationUnavailable": "조직 플러그인을 일시적으로 사용할 수 없습니다. 설치된 조직 플러그인은 계속 사용할 수 있습니다."},"securityTitle": "설치 및 권한","securityDescription": "메인 프로세스에서 크기와 SHA-256 및 플러그인 매니페스트를 검증한 뒤 원자적으로 설치합니다. 설치 전에 플러그인 권한을 확인받으며, 설치 후 자동으로 활성화되고 플러그인 페이지에서 언제든지 비활성화할 수 있습니다. 업데이트 시 현재 활성화 상태가 유지되며, 새 버전의 권한이 늘어나면 먼저 확인받습니다.",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex 8ad88cf095..be3e49dc92 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -6091,7 +6091,12 @@"invalidPackage": "插件安装包异常,无法安装,请联系发布者。","downloadTimeout": "插件下载超时,请稍后重试。","downloadFailed": "插件下载失败,请检查网络后重试。",- "brokerRedirectPortRequired": "该插件声明了授权 broker,但同一项 OAuth 配置缺少 redirectPort,无法从插件市场安装。请联系发布者补充该字段并重新发布。"+ "brokerRedirectPortRequired": "该插件声明了授权 broker,但同一项 OAuth 配置缺少 redirectPort,无法从插件市场安装。请联系发布者补充该字段并重新发布。",+ "namespaceClientRequired": "当前版本无法查看企业插件,请更新 Cindy。已安装的企业插件仍可使用。",+ "organizationContextUnavailable": "暂时无法确认企业身份,请稍后重试。已安装的企业插件仍可使用。",+ "namespaceConfigRequired": "企业插件服务暂不可用。已安装的企业插件仍可使用。",+ "listChanged": "企业插件目录已变化,请重试。",+ "organizationUnavailable": "企业插件暂不可用。已安装的企业插件仍可使用。"},"securityTitle": "安装与权限","securityDescription": "安装包会在主进程中校验大小与 SHA-256,再经 Cindy 插件清单校验后原子安装。安装前会请你确认插件的权限,装好后即自动开启,可随时在插件页停用;更新会保留当前生效状态,新版本权限变多时会先请你确认。",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.jsonindex fb0d475565..4cb59a903a 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json@@ -6090,7 +6090,12 @@"invalidPackage": "插件安裝包異常,無法安裝,請聯絡釋出者。","downloadTimeout": "插件下載逾時,請稍後重試。","downloadFailed": "插件下載失敗,請檢查網路後重試。",- "brokerRedirectPortRequired": "此插件宣告了授權 broker,但同一項 OAuth 設定缺少 redirectPort,無法從插件市場安裝。請聯絡釋出者補上該欄位並重新釋出。"+ "brokerRedirectPortRequired": "此插件宣告了授權 broker,但同一項 OAuth 設定缺少 redirectPort,無法從插件市場安裝。請聯絡釋出者補上該欄位並重新釋出。",+ "namespaceClientRequired": "目前版本無法查看企業插件,請更新 Cindy。已安裝的企業插件仍可使用。",+ "organizationContextUnavailable": "暫時無法確認企業身份,請稍後重試。已安裝的企業插件仍可使用。",+ "namespaceConfigRequired": "企業插件服務暫時無法使用。已安裝的企業插件仍可使用。",+ "listChanged": "企業插件目錄已變化,請重試。",+ "organizationUnavailable": "企業插件暫時無法使用。已安裝的企業插件仍可使用。"},"securityTitle": "安裝與權限","securityDescription": "安裝包會在主處理程序中校驗大小與 SHA-256,再經 Cindy 插件清單校驗後原子安裝。安裝前會請你確認插件的權限,安裝好後即自動開啟,可隨時在插件頁停用;更新會保留當前生效狀態,新版本權限變多時會先請你確認。",diff --git a/apps/desktop/src/shared/ipc-errors.ts b/apps/desktop/src/shared/ipc-errors.tsindex 21e42b7b8e..30cec7b408 100644--- a/apps/desktop/src/shared/ipc-errors.ts+++ b/apps/desktop/src/shared/ipc-errors.ts@@ -269,6 +269,10 @@ export type IpcErrorCode =| 'MARKET_CLONE_FAILED' // 克隆/拉取失败:网络、代理或远端其它错误| 'MARKET_REF_NOT_FOUND' // 指定的 Git 引用(分支/tag/commit)在远端不存在| 'MARKET_MANIFEST_MISSING' // 来源内找不到受支持的 marketplace.json+ | 'PLUGIN_NAMESPACE_CLIENT_REQUIRED' // 企业插件需要支持 namespace 的客户端+ | 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE' // 暂时无法确认企业身份,可重试+ | 'PLUGIN_NAMESPACE_CONFIG_REQUIRED' // 企业插件服务配置不可用+ | 'PLUGIN_LIST_CHANGED' // 企业准入在翻页期间变化,需要从头重拉// 网关凭据自动下发(model-access)| 'MODEL_ACCESS_FAILED' // 拉取/轮换失败(网络或服务端错误),可重试| 'MODEL_ACCESS_DISABLED' // 服务端灰度未启用(503)——走手填兜底@@ -478,6 +482,10 @@ const IPC_ERROR_CODES: ReadonlySet<IpcErrorCode> = new Set<IpcErrorCode>(['MARKET_CLONE_FAILED','MARKET_REF_NOT_FOUND','MARKET_MANIFEST_MISSING',+ 'PLUGIN_NAMESPACE_CLIENT_REQUIRED',+ 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE',+ 'PLUGIN_NAMESPACE_CONFIG_REQUIRED',+ 'PLUGIN_LIST_CHANGED','MODEL_ACCESS_FAILED','MODEL_ACCESS_DISABLED','MODEL_ACCESS_UNSUPPORTED',diff --git a/apps/desktop/src/shared/pluginMarket.ts b/apps/desktop/src/shared/pluginMarket.tsindex 579fd39ae5..3a107ed261 100644--- a/apps/desktop/src/shared/pluginMarket.ts+++ b/apps/desktop/src/shared/pluginMarket.ts@@ -53,6 +53,11 @@ export interface PluginMarketSnapshot {customSourceNames: string[];/** 本轮发现失败的自定义市场名;失败来源不影响其它来源和官方市场。 */unavailableCustomSourceNames: string[];+ /**+ * 企业目录单独不可用时的错误码,包含客户端尚未认识的新码。null 或缺失表示本轮没有这个状态;+ * 公开目录和已安装插件照常。+ */+ organizationAccessError?: string | null;}/** 服务端清理的一次性汇总提示:按 owner 缓存,consume 前跨多轮对账累加,consume 后即清。 */diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.mdindex d7bda88487..995b6cc243 100644--- a/docs/design-rules/design-inventory.md+++ b/docs/design-rules/design-inventory.md@@ -37,7 +37,7 @@| `desktop.overlay.splash` | desktop | 启动遮罩 | App → SplashScreen;同源 gating 下并挂 LoginBrandStage(z-9980 品牌画布,启动期即可见、Splash(z-9999) 之下) | LoginBrandStage, SplashScreen | apps/desktop/src/renderer/components/login/LoginBrandStage.tsx, apps/desktop/src/renderer/components/splash/SplashScreen.tsx | 3 | 0 | 5 || `desktop.overlay.toast` | desktop | Toast | App 常驻 ToastContainer(用户可见出口,不展开业务逻辑) | Toast, ToastContainer | apps/desktop/src/renderer/components/ui/toast/Toast.tsx, apps/desktop/src/renderer/components/ui/toast/ToastContainer.tsx, apps/desktop/src/renderer/components/ui/toast/index.ts | 5 | 4 | 3 || `desktop.plugins.app-main` | desktop | 插件主视图 | hash `/apps/:ghostId`(GhostMainViewFeatureLayout) | GhostMainViewFeatureLayout, GhostMainViewHost | apps/desktop/src/renderer/features/plugin/GhostMainViewFeatureLayout.tsx, apps/desktop/src/renderer/features/plugin/GhostMainViewHost.tsx | 0 | 0 | 0 |-| `desktop.plugins.installed` | desktop | 已装插件 | hash `/plugins`(GhostPluginPage) | AddMarketplaceDialog, GhostPluginDetailView, GhostPluginPage, MarketPluginDetailView, MyPublishesSection, PluginManagementLayout, PluginScopePicker, UpdateAllDialog | apps/desktop/src/renderer/features/plugin/AddMarketplaceDialog.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx, apps/desktop/src/renderer/features/plugin/MarketPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/MyPublishesSection.tsx, apps/desktop/src/renderer/features/plugin/PluginManagementLayout.tsx, apps/desktop/src/renderer/features/plugin/PluginScopePicker.tsx, apps/desktop/src/renderer/features/plugin/UpdateAllDialog.tsx, apps/desktop/src/renderer/features/plugin/plugin-motion.css | 28 | 0 | 48 |+| `desktop.plugins.installed` | desktop | 已装插件 | hash `/plugins`(GhostPluginPage) | AddMarketplaceDialog, GhostPluginDetailView, GhostPluginPage, MarketPluginDetailView, MyPublishesSection, PluginManagementLayout, PluginScopePicker, UpdateAllDialog | apps/desktop/src/renderer/features/plugin/AddMarketplaceDialog.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx, apps/desktop/src/renderer/features/plugin/MarketPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/MyPublishesSection.tsx, apps/desktop/src/renderer/features/plugin/PluginManagementLayout.tsx, apps/desktop/src/renderer/features/plugin/PluginScopePicker.tsx, apps/desktop/src/renderer/features/plugin/UpdateAllDialog.tsx, apps/desktop/src/renderer/features/plugin/plugin-motion.css | 28 | 0 | 49 || `desktop.settings` | desktop | 设置 | hash `/settings`(SettingsView;tab 含 general / personalization / providers / billing / usage / voice-input / im-bot / shortcuts / agent-island / import / remote-control / ghosts / builtin-tools / computer-use / help / about) | SettingsView | apps/desktop/src/renderer/components/settings/AboutSection.settings-search.ts, apps/desktop/src/renderer/components/settings/AboutSection.tsx, apps/desktop/src/renderer/components/settings/AccountDeletionSection.tsx, apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx, apps/desktop/src/renderer/components/settings/AgentIslandSection.settings-search.ts, apps/desktop/src/renderer/components/settings/AgentIslandSection.tsx, apps/desktop/src/renderer/components/settings/AgentResourceSection.settings-search.ts, apps/desktop/src/renderer/components/settings/AgentResourceSection.tsx, apps/desktop/src/renderer/components/settings/AppearanceSection.settings-search.ts, apps/desktop/src/renderer/components/settings/AppearanceSection.tsx, apps/desktop/src/renderer/components/settings/AuxiliaryModelSection.tsx, apps/desktop/src/renderer/components/settings/BetaChannelCell.tsx, apps/desktop/src/renderer/components/settings/BillingSettings.settings-search.ts, apps/desktop/src/renderer/components/settings/BrowserBackendSubsection.tsx, apps/desktop/src/renderer/components/settings/BrowserRealProfileSubsection.tsx, apps/desktop/src/renderer/components/settings/BuiltinToolsSection.settings-search.ts, apps/desktop/src/renderer/components/settings/BuiltinToolsSection.tsx, apps/desktop/src/renderer/components/settings/ChatEmbeddingCell.tsx, apps/desktop/src/renderer/components/settings/ChipMetricsSection.tsx, apps/desktop/src/renderer/components/settings/CindyMakeSection.settings-search.ts, apps/desktop/src/renderer/components/settings/CindyMakeSection.tsx, apps/desktop/src/renderer/components/settings/CollaborationSection.settings-search.ts, apps/desktop/src/renderer/components/settings/CollaborationSection.tsx, apps/desktop/src/renderer/components/settings/CompactionSection.tsx, apps/desktop/src/renderer/components/settings/ComposerSendShortcutSection.tsx, apps/desktop/src/renderer/components/settings/ComputerPermissionGuideWindow.tsx, apps/desktop/src/renderer/components/settings/ComputerPermissionRow.tsx, apps/desktop/src/renderer/components/settings/ComputerUseSection.settings-search.ts, apps/desktop/src/renderer/components/settings/ComputerUseSection.tsx, apps/desktop/src/renderer/components/settings/CustomProviderRuntimeFillOverlay.tsx, apps/desktop/src/renderer/components/settings/DefaultOverrideControls.tsx, apps/desktop/src/renderer/components/settings/DialogueDirectorySection.tsx, apps/desktop/src/renderer/components/settings/DingTalkBotSection.tsx, apps/desktop/src/renderer/components/settings/DiscordBotSection.tsx, apps/desktop/src/renderer/components/settings/DownloadMeter.tsx, apps/desktop/src/renderer/components/settings/ExperimentalSection.tsx, apps/desktop/src/renderer/components/settings/FeishuBotNotificationSection.tsx, apps/desktop/src/renderer/components/settings/FeishuBotSection.tsx, apps/desktop/src/renderer/components/settings/FontFamilyPicker.tsx, apps/desktop/src/renderer/components/settings/GeneralSettings.settings-search.ts, apps/desktop/src/renderer/components/settings/GenericGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/GitSafetySection.settings-search.ts, apps/desktop/src/renderer/components/settings/GitSafetySection.tsx, apps/desktop/src/renderer/components/settings/HarnessVersionMenuRow.tsx, apps/desktop/src/renderer/components/settings/HelpAssistantPanel.tsx, apps/desktop/src/renderer/components/settings/HelpSection.settings-search.ts, apps/desktop/src/renderer/components/settings/HelpSection.tsx, apps/desktop/src/renderer/components/settings/HelpThreadView.tsx, apps/desktop/src/renderer/components/settings/HookConnectionsSection.tsx, apps/desktop/src/renderer/components/settings/HookWorkspacePrefsEditor.tsx, apps/desktop/src/renderer/components/settings/ImBotSection.settings-search.ts, apps/desktop/src/renderer/components/settings/ImBotSection.tsx, apps/desktop/src/renderer/components/settings/ImChannelSettingsCard.tsx, apps/desktop/src/renderer/components/settings/ImDefaultSettingsSection.tsx, apps/desktop/src/renderer/components/settings/ImLifecycleAnnouncementSection.tsx, apps/desktop/src/renderer/components/settings/InputDeviceConnectionStatus.tsx, apps/desktop/src/renderer/components/settings/JoyConGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.settings-search.ts, apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx, apps/desktop/src/renderer/components/settings/LanguageSection.tsx, apps/desktop/src/renderer/components/settings/LayoutResetControl.tsx, apps/desktop/src/renderer/components/settings/LinkOpenSection.tsx, apps/desktop/src/renderer/components/settings/LlamaCppCandidates.tsx, apps/desktop/src/renderer/components/settings/LlamaCppProviderDetail.tsx, apps/desktop/src/renderer/components/settings/LocalModelDownloadUI.tsx, apps/desktop/src/renderer/components/settings/LocalOllamaInstall.tsx, apps/desktop/src/renderer/components/settings/LocalPackagingTag.tsx, apps/desktop/src/renderer/components/settings/LogoutSection.tsx, apps/desktop/src/renderer/components/settings/LspBetaCell.tsx, apps/desktop/src/renderer/components/settings/McpServerDialog.tsx, apps/desktop/src/renderer/components/settings/McpServersSection.tsx, apps/desktop/src/renderer/components/settings/MemorySection.tsx, apps/desktop/src/renderer/components/settings/MessageNavRailCell.tsx, apps/desktop/src/renderer/components/settings/ModelAdvancedDrawer.tsx, apps/desktop/src/renderer/components/settings/ModelPriceOverrideDialog.tsx, apps/desktop/src/renderer/components/settings/MyDevicesPanel.tsx, apps/desktop/src/renderer/components/settings/NotificationSection.settings-search.ts, apps/desktop/src/renderer/components/settings/NotificationSection.tsx, apps/desktop/src/renderer/components/settings/OAuthDeviceCodeCard.tsx, apps/desktop/src/renderer/components/settings/OllamaProviderDetail.tsx, apps/desktop/src/renderer/components/settings/OwnRemoteProviders.tsx, apps/desktop/src/renderer/components/settings/PersonalizationDetails.settings-search.ts, apps/desktop/src/renderer/components/settings/PersonalizationSettings.settings-search.ts, apps/desktop/src/renderer/components/settings/PiKernelVersionRow.tsx, apps/desktop/src/renderer/components/settings/PiPackagesSection.tsx, apps/desktop/src/renderer/components/settings/PlayStationGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/ProfileEditDialog.tsx, apps/desktop/src/renderer/components/settings/ProviderConnectionDialog.tsx, apps/desktop/src/renderer/components/settings/ProviderImportDialog.tsx, apps/desktop/src/renderer/components/settings/ProvidersSection.settings-search.ts, apps/desktop/src/renderer/components/settings/ProvidersSection.tsx, apps/desktop/src/renderer/components/settings/ReadOnlyProviderModels.tsx, apps/desktop/src/renderer/components/settings/RemoteControlSection.settings-search.ts, apps/desktop/src/renderer/components/settings/RemoteControlSection.tsx, apps/desktop/src/renderer/components/settings/RemoteDesktopPermissions.tsx, apps/desktop/src/renderer/components/settings/RemoteDesktopSetting.tsx, apps/desktop/src/renderer/components/settings/RemoteHostDetail.tsx, apps/desktop/src/renderer/components/settings/RemoteSection.tsx, apps/desktop/src/renderer/components/settings/SessionImportSection.settings-search.ts, apps/desktop/src/renderer/components/settings/SessionImportSection.tsx, apps/desktop/src/renderer/components/settings/SessionRuntimeFallbackCell.tsx, apps/desktop/src/renderer/components/settings/SessionShareImportWizard.tsx, apps/desktop/src/renderer/components/settings/SettingsCatalogPanel.settings-search.ts, apps/desktop/src/renderer/components/settings/SettingsCatalogPanel.tsx, apps/desktop/src/renderer/components/settings/SettingsSearchBox.tsx, apps/desktop/src/renderer/components/settings/SettingsSearchNavigation.ts, apps/desktop/src/renderer/components/settings/SettingsSidebarNav.tsx, apps/desktop/src/renderer/components/settings/SettingsTextInput.tsx, apps/desktop/src/renderer/components/settings/SettingsView.tsx, apps/desktop/src/renderer/components/settings/SharedTasks.settings-search.ts, apps/desktop/src/renderer/components/settings/SilentEncryptedRetryCell.tsx, apps/desktop/src/renderer/components/settings/SshKeySetupDialog.tsx, apps/desktop/src/renderer/components/settings/StorageManagementCard.settings-search.ts, apps/desktop/src/renderer/components/settings/StorageManagementCard.tsx, apps/desktop/src/renderer/components/settings/StreamFadeSection.tsx, apps/desktop/src/renderer/components/settings/SubagentModelSection.settings-search.ts, apps/desktop/src/renderer/components/settings/SubagentModelSection.tsx, apps/desktop/src/renderer/components/settings/SwitchProGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/TelegramBehaviorSettings.tsx, apps/desktop/src/renderer/components/settings/TelegramBotSection.tsx, apps/desktop/src/renderer/components/settings/TelegramRemoteDevices.tsx, apps/desktop/src/renderer/components/settings/TerminalShellSection.tsx, apps/desktop/src/renderer/components/settings/TipsSection.settings-search.ts, apps/desktop/src/renderer/components/settings/TipsSection.tsx, apps/desktop/src/renderer/components/settings/UnifiedModelList.tsx, apps/desktop/src/renderer/components/settings/UserProfileCard.tsx, apps/desktop/src/renderer/components/settings/UserPromptSection.tsx, apps/desktop/src/renderer/components/settings/VisionBridgeSection.settings-search.ts, apps/desktop/src/renderer/components/settings/VisionBridgeSection.tsx, apps/desktop/src/renderer/components/settings/VoiceInputSection.settings-search.ts, apps/desktop/src/renderer/components/settings/VoiceInputSection.tsx, apps/desktop/src/renderer/components/settings/WallpaperSection.tsx, apps/desktop/src/renderer/components/settings/WechatBotSection.tsx, apps/desktop/src/renderer/components/settings/WecomBotSection.tsx, apps/desktop/src/renderer/components/settings/WindowBehaviorSection.settings-search.ts, apps/desktop/src/renderer/components/settings/WindowBehaviorSection.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexKeyboardLayout.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexKeycapGlyphs.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx, apps/desktop/src/renderer/components/settings/WorktreeRecycleCard.settings-search.ts, apps/desktop/src/renderer/components/settings/WorktreeRecycleCard.tsx, apps/desktop/src/renderer/components/settings/XUsageGuide.tsx, apps/desktop/src/renderer/components/settings/XboxGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsx, apps/desktop/src/renderer/components/settings/androidStatusPresentation.ts, apps/desktop/src/renderer/components/settings/billingVisibility.ts, apps/desktop/src/renderer/components/settings/browserOpenForLoginError.ts, apps/desktop/src/renderer/components/settings/cindyMakeVisibility.ts, apps/desktop/src/renderer/components/settings/computerPermissionFlow.ts, apps/desktop/src/renderer/components/settings/contacts/ContactDetailPane.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsImportDialog.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsListPane.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsManagerDialog.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsSection.tsx, apps/desktop/src/renderer/components/settings/contacts/startContactsAiSession.ts, apps/desktop/src/renderer/components/settings/dialogueDirectoryDisplay.ts, apps/desktop/src/renderer/components/settings/dualSenseSilhouette.ts, apps/desktop/src/renderer/components/settings/feishuBotPresentation.ts, apps/desktop/src/renderer/components/settings/fontFamilyValue.ts, apps/desktop/src/renderer/components/settings/gamepadLayoutPrimitives.tsx, apps/desktop/src/renderer/components/settings/gamepadSilhouetteGeom.ts, apps/desktop/src/renderer/components/settings/hookWorkspacePrefsLogic.ts, apps/desktop/src/renderer/components/settings/imBotVisibility.ts, apps/desktop/src/renderer/components/settings/imDefaultSettingsLogic.ts, apps/desktop/src/renderer/components/settings/joyConSilhouette.ts, apps/desktop/src/renderer/components/settings/modelManagementPresentation.ts, apps/desktop/src/renderer/components/settings/modelManagementState.ts, apps/desktop/src/renderer/components/settings/myDevicesModel.ts, apps/desktop/src/renderer/components/settings/providerAssetModule.ts, apps/desktop/src/renderer/components/settings/realProfilePermissionGuide.ts, apps/desktop/src/renderer/components/settings/settingsSearchCatalog.ts, apps/desktop/src/renderer/components/settings/settingsSearchTypes.ts, apps/desktop/src/renderer/components/settings/switchProSilhouette.ts, apps/desktop/src/renderer/components/settings/ultimateC1Silhouette.ts, apps/desktop/src/renderer/components/settings/usage/UsageBarsTooltip.tsx, apps/desktop/src/renderer/components/settings/usage/UsageBreakdownTables.tsx, apps/desktop/src/renderer/components/settings/usage/UsageDeviceSelect.tsx, apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.settings-search.ts, apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx, apps/desktop/src/renderer/components/settings/usage/UsageStatRow.tsx, apps/desktop/src/renderer/components/settings/usage/UsageTaskTable.tsx, apps/desktop/src/renderer/components/settings/usage/UsageTokenBars.tsx, apps/desktop/src/renderer/components/settings/usage/formatUsagePercent.ts, apps/desktop/src/renderer/components/settings/usage/usageCharts.css, apps/desktop/src/renderer/components/settings/usage/usageHistoryColors.ts, apps/desktop/src/renderer/components/settings/usage/usageHistoryStats.ts, apps/desktop/src/renderer/components/settings/usageVisibility.ts, apps/desktop/src/renderer/components/settings/useProviderSubscriptionCard.ts, apps/desktop/src/renderer/components/settings/useSettingsEscape.ts, apps/desktop/src/renderer/components/settings/useSettingsSectionTarget.ts, apps/desktop/src/renderer/components/settings/wizardRecommend.ts, apps/desktop/src/renderer/components/settings/workLouderCodexCommandCopy.ts, apps/desktop/src/renderer/components/settings/xboxSeriesSilhouette.ts, apps/desktop/src/renderer/styles/sortable.css | 137 | 100 | 544 || `desktop.shell.main-layout` | desktop | 主窗口壳(标题栏 / 左右栏 / 内容区) | main BrowserWindow → renderer/index.tsx → main-entry.tsx → App → MainLayout (`#/` 受保护壳) | ChromeActions, DeviceSectionHeader, FeishuConflictDialogHost, GhostMediaLightboxHost, MainLayout, ProjectsSection, RightSidebar, RightSidebarShell, SessionShareImportWizard, Sidebar, UpdateNoticeDialog, WindowControls | apps/desktop/src/renderer/cindy-brain/GhostMediaLightboxHost.tsx, apps/desktop/src/renderer/components/UpdateNoticeDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialogHost.tsx, apps/desktop/src/renderer/components/layout/AppBadgeAttentionSync.tsx, apps/desktop/src/renderer/components/layout/BrowserWebviewPool.tsx, apps/desktop/src/renderer/components/layout/ChromeActions.tsx, apps/desktop/src/renderer/components/layout/ContentHeader.tsx, apps/desktop/src/renderer/components/layout/CredentialStoreBanner.tsx, apps/desktop/src/renderer/components/layout/FadeSwitcher.tsx, apps/desktop/src/renderer/components/layout/GhostPanelWindowLayout.tsx, apps/desktop/src/renderer/components/layout/GlobalDropImportListener.tsx, apps/desktop/src/renderer/components/layout/MainEntryRedirect.tsx, apps/desktop/src/renderer/components/layout/MainLayout.tsx, apps/desktop/src/renderer/components/layout/RightSidebar.tsx, apps/desktop/src/renderer/components/layout/RightSidebarDetach.tsx, apps/desktop/src/renderer/components/layout/RightSidebarMaximize.tsx, apps/desktop/src/renderer/components/layout/RightSidebarToggle.tsx, apps/desktop/src/renderer/components/layout/SidebarWindowLayout.tsx, apps/desktop/src/renderer/components/layout/WallpaperVideo.tsx, apps/desktop/src/renderer/components/layout/chromeActionsGeometry.ts, apps/desktop/src/renderer/components/layout/chromeActionsLayout.ts, apps/desktop/src/renderer/components/layout/railChromeActions.ts, apps/desktop/src/renderer/components/layout/windowDrag.tsx, apps/desktop/src/renderer/components/settings/SessionShareImportWizard.tsx, apps/desktop/src/renderer/components/sidebar/AccountSwitcherDialog.tsx, apps/desktop/src/renderer/components/sidebar/AttentionDot.tsx, apps/desktop/src/renderer/components/sidebar/DatabaseSizeWarningBanner.tsx, apps/desktop/src/renderer/components/sidebar/GhostMainViewNavEntries.tsx, apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx, apps/desktop/src/renderer/components/sidebar/NavigationCountBadge.tsx, apps/desktop/src/renderer/components/sidebar/Sidebar.tsx, apps/desktop/src/renderer/components/sidebar/SidebarIconButton.tsx, apps/desktop/src/renderer/components/sidebar/SidebarNavigationCustomize.tsx, apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx, apps/desktop/src/renderer/components/sidebar/SortableList.tsx, apps/desktop/src/renderer/components/sidebar/UpdateBanner.tsx, apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx, apps/desktop/src/renderer/components/sidebar/VendorIcon.tsx, apps/desktop/src/renderer/components/sidebar/VendorReadinessBadge.tsx, apps/desktop/src/renderer/components/sidebar/WorktreeBadge.tsx, apps/desktop/src/renderer/components/sidebar/sidebarNavigationPrefs.ts, apps/desktop/src/renderer/components/sidebar/useHoverOpenMenu.ts, apps/desktop/src/renderer/components/title-bar/ChromeIconButton.tsx, apps/desktop/src/renderer/components/title-bar/MenuButton.tsx, apps/desktop/src/renderer/components/title-bar/WindowControls.tsx, apps/desktop/src/renderer/features/cc-agent/sidebar/DeviceSectionHeader.tsx, apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx, apps/desktop/src/renderer/features/right-sidebar/AddTabDropdown.tsx, apps/desktop/src/renderer/features/right-sidebar/EmptyState.tsx, apps/desktop/src/renderer/features/right-sidebar/RightSidebarShell.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBar.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBodyErrorBoundary.tsx, apps/desktop/src/renderer/features/right-sidebar/hooks/useBrowserWebview.ts, apps/desktop/src/renderer/features/right-sidebar/hooks/useNativePopupSurface.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserPartition.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserWebviewPool.ts, apps/desktop/src/renderer/features/right-sidebar/lib/detachedSidebarRouting.ts, apps/desktop/src/renderer/features/right-sidebar/lib/executeSidebarCommand.ts, apps/desktop/src/renderer/features/right-sidebar/lib/lastTurnChangedFiles.ts, apps/desktop/src/renderer/features/right-sidebar/lib/nativePopupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openBackgroundTasksTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openBotWorkbenchTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarFileBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openRoutinesTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openSubagentsTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTerminalShortcut.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTurnReview.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupRouter.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/rsbBrowserBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarCommands.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarHostSession.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/BackgroundTasksBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowAgentStrip.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowProgressTree.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/chatTaskFocusIntent.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/listSessionTasks.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/workflowProgressModel.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/bot-workbench/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/cindy-make/CindyMakeTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/cindy-make/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.css, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/dropExternalFile.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/fileTreeImagePreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/useSessionScopedTreeWidth.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/index.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersAttentionIcon.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/actions.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/closeDecision.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/ResourceUsageBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/resource-usage.css, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/subscription.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/retired-feature/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/ImageDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/MarkdownDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/PlainUnifiedDiff.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/diffRows.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/highlight.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/inlineDiff.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/useDiffHighlights.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/diffExpansionPreference.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/fileTree.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/gitApplyCommand.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/markdownPreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useLastTurnFilter.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewSource.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/routines/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/ConversationStream.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/RunList.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentToolCard.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentsBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentChangeFence.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentConversation.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentFormat.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/TerminalTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/lib/xtermPool.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserCommentPopover.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/browserCommentEditorDraft.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/lib/parseOmnibox.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useBrowserComment.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useLocalHtmlAutoReload.ts, apps/desktop/src/renderer/features/right-sidebar/registry.ts, apps/desktop/src/renderer/features/right-sidebar/store.ts, apps/desktop/src/renderer/features/right-sidebar/tabAvailability.ts, apps/desktop/src/renderer/features/right-sidebar/types.ts, apps/desktop/src/renderer/layout/LayoutRoot.tsx, apps/desktop/src/renderer/layout/PanelDragController.tsx, apps/desktop/src/renderer/layout/PanelDragPrototype.tsx, apps/desktop/src/renderer/layout/collapsePrefs.ts, apps/desktop/src/renderer/layout/layoutDevTools.ts, apps/desktop/src/renderer/layout/panePlacement.tsx, apps/desktop/src/renderer/layout/paneWidths.tsx, apps/desktop/src/renderer/layout/panelMaximize.tsx, apps/desktop/src/renderer/styles/generated/tokens.css, apps/desktop/src/renderer/styles/globals.css | 144 | 46 | 200 || `desktop.skillhub.local` | desktop | SkillHub 本地技能 | hash `/skillhub/local` 及统一详情 `/skillhub/detail`(旧详情链接重定向) | InstallTargetPicker, PluginManagementLayout, SkillDetailLayout, SkillhubDetailRoute, SkillhubDetailView, SkillhubFeatureLayout, SkillhubHomeView, SkillhubLocalLayout, SkillhubMarketDetailView | apps/desktop/src/renderer/features/plugin/PluginManagementLayout.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubDetailRoute.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubDetailView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubFeatureLayout.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubHomeView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubLocalLayout.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubMarketDetailView.tsx, apps/desktop/src/renderer/features/skillhub/components/InstallTargetPicker.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillDetailLayout.tsx | 35 | 0 | 43 |diff --git a/docs/dev-rules/plugin-security-and-authoring.md b/docs/dev-rules/plugin-security-and-authoring.mdindex 29d469f549..36f5150d90 100644--- a/docs/dev-rules/plugin-security-and-authoring.md+++ b/docs/dev-rules/plugin-security-and-authoring.md@@ -67,6 +67,8 @@ Forge 来源及当前组织分类都吻合时恢复,不能据此认领普查同来源 Forge 更新先持久化原/新批准修订的桥接证据,提交和回滚都保留该旧实例的恢复资格。旧组织身份缺少 orgSlug 时,发布先刷新已验签身份;仍缺失则从当前服务端市场的currentOrganization 核对同组织、同 membership 与 owner 后补齐,不能把前缀当成 namespace。+`scope=all` 的企业部分被拒时,列表仍成功并带 `organizationAccessError`。客户端保留公开目录+和已安装企业插件,提示原因,不把这种情况当成「企业没有插件」,也不据此卸载。安装、调用、项目启停、OAuth、媒体归属和卸载必须使用 Main 核准的实例键,不能用 URL host或裸插件名选取同名实例。调度器只绑定可信 XD 企业实例;旧调用没有明确实例且同名候选diff --git a/packages/plugin-protocol/src/__tests__/memberUpload.test.ts b/packages/plugin-protocol/src/__tests__/memberUpload.test.tsindex ba3c41d48d..af5313f155 100644--- a/packages/plugin-protocol/src/__tests__/memberUpload.test.ts+++ b/packages/plugin-protocol/src/__tests__/memberUpload.test.ts@@ -149,6 +149,10 @@ describe('member upload contract', () => {it.each(['PUBLISH_PREFIX_UNREGISTERED','PUBLISH_GHOST_ID_PREFIX_MISMATCH',+ 'PUBLISH_GHOST_ID_INVALID',+ 'PLUGIN_GHOST_ID_RESERVED',+ 'PLUGIN_NAMESPACE_CONFIG_REQUIRED',+ 'PLUGIN_NAMESPACE_CLIENT_REQUIRED','PUBLISH_VERSION_EXISTS',] as const)('parses %s failure codes without throwing', (code) => {const response = parsePluginMemberUploadStatusResponse({diff --git a/packages/plugin-protocol/src/__tests__/namespaceDelivery.test.ts b/packages/plugin-protocol/src/__tests__/namespaceDelivery.test.tsindex 0e35dae8df..98914f9841 100644--- a/packages/plugin-protocol/src/__tests__/namespaceDelivery.test.ts+++ b/packages/plugin-protocol/src/__tests__/namespaceDelivery.test.ts@@ -84,4 +84,66 @@ describe('namespace delivery contract', () => {});expect(parsed.removals[0]?.namespace).toBe('acme');});++ it.each([+ 'PLUGIN_NAMESPACE_CLIENT_REQUIRED',+ 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE',+ 'PLUGIN_NAMESPACE_CONFIG_REQUIRED',+ ] as const)('preserves public results when enterprise access fails with %s', (code) => {+ const response = {+ schemaVersion: 2,+ plugins: [namespaceFixtures[0]!.plugin],+ nextCursor: null,+ currentOrganization: { organizationId: 'org-example', orgSlug: 'acme', pluginPrefix: null },+ organizationAccessError: { code, message: '请升级 Cindy' },+ };+ expect(parseListPluginsResponse(response)).toMatchObject({+ plugins: [{ id: namespaceFixtures[0]!.plugin.id, scope: 'public' }],+ organizationAccessError: response.organizationAccessError,+ removals: [],+ });+ });++ it('rejects an enterprise access error that still carries enterprise data', () => {+ const currentOrganization = { organizationId: 'org-example', orgSlug: 'acme', pluginPrefix: null };+ const organizationAccessError = { code: 'PLUGIN_NAMESPACE_CLIENT_REQUIRED', message: '请升级 Cindy' };+ const base = { schemaVersion: 2, nextCursor: null, currentOrganization, organizationAccessError };+ expect(() => parseListPluginsResponse({+ ...base,+ plugins: [namespaceFixtures[1]!.plugin],+ })).toThrow('企业准入拒绝');+ expect(() => parseListPluginsResponse({+ ...base,+ plugins: [],+ removals: [{+ pluginId: namespaceFixtures[1]!.plugin.id,+ ghostId: 'x-manager',+ scope: 'organization',+ organizationId: 'org-example',+ namespace: 'acme',+ action: 'purge',+ removedAt: '2026-09-07T00:00:00.000Z',+ }],+ })).toThrow('企业准入拒绝');+ expect(() => parseListPluginsResponse({+ ...base,+ plugins: [],+ currentOrganization: null,+ })).toThrow('企业准入拒绝');+ expect(parseListPluginsResponse({+ ...base,+ plugins: [namespaceFixtures[0]!.plugin],+ organizationAccessError: { code: 'PLUGIN_FUTURE_REASON', message: '以后再说' },+ }).organizationAccessError).toEqual({ code: 'PLUGIN_FUTURE_REASON', message: '以后再说' });+ expect(() => parseListPluginsResponse({+ ...base,+ plugins: [],+ organizationAccessError: { code: 'not-a-code', message: 'bad' },+ })).toThrow('organizationAccessError.code');+ expect(() => parseListPluginsResponse({+ ...base,+ plugins: [],+ organizationAccessError: { code: 'PLUGIN_NAMESPACE_CLIENT_REQUIRED' },+ })).toThrow('organizationAccessError.message');+ });});diff --git a/packages/plugin-protocol/src/delivery.ts b/packages/plugin-protocol/src/delivery.tsindex 202bd3895e..4d2c3aef9a 100644--- a/packages/plugin-protocol/src/delivery.ts+++ b/packages/plugin-protocol/src/delivery.ts@@ -162,6 +162,19 @@ export interface PluginRemovalNotice {removedAt: string;}+/** scope=all 中企业部分被拒绝时的已知错误码。解析器也接受格式合法的未知码。 */+export const ORGANIZATION_PLUGIN_ACCESS_ERROR_CODES = [+ 'PLUGIN_NAMESPACE_CLIENT_REQUIRED',+ 'PLUGIN_ORGANIZATION_CONTEXT_UNAVAILABLE',+ 'PLUGIN_NAMESPACE_CONFIG_REQUIRED',+] as const;++export interface OrganizationPluginAccessError {+ /** 已知码见 ORGANIZATION_PLUGIN_ACCESS_ERROR_CODES;未知但格式合法的码也保留。 */+ code: string;+ message: string;+}+/** Plugin 分页列表响应。 */export interface ListPluginsResponse {/** Plugin HTTP envelope 版本。 */@@ -177,6 +190,11 @@ export interface ListPluginsResponse {* 规范化为 `null`。组织已登录但未登记前缀时为 `{ organizationId, pluginPrefix: null }`。*/currentOrganization: PluginCurrentOrganization | null;+ /**+ * scope=all 的企业部分被拒绝。每页重复;出现时必须同时有 currentOrganization,+ * 且本页不能有企业条目或清理通告。缺失表示企业部分按原规则返回。+ */+ organizationAccessError?: OrganizationPluginAccessError;}/** 单个 Plugin 详情响应。 */@@ -456,7 +474,8 @@ function parseCurrentOrganization(value: unknown): PluginCurrentOrganization | n* 未知字段会被忽略;已知字段缺失、值不合法或 schema 版本不支持时抛出* `PluginProtocolError`。`removals` 缺失时规范化为空数组,动作未知的通告* 会被跳过而不影响其余内容。`currentOrganization` 缺失或为 null 时规范化为- * `null`;对象存在但缺少 `pluginPrefix` 键时抛错。+ * `null`;对象存在但缺少 `pluginPrefix` 键时抛错。`organizationAccessError`+ * 缺失时不保留;出现时必须同时有组织身份,且不能夹带企业条目或清理通告。*/export function parseListPluginsResponse(value: unknown): ListPluginsResponse {const raw = object(value, 'response');@@ -467,6 +486,15 @@ export function parseListPluginsResponse(value: unknown): ListPluginsResponse {const plugins = raw.plugins.map(parseVisiblePluginSummary);const removals = parseRemovals(raw.removals);const currentOrganization = parseCurrentOrganization(raw.currentOrganization);+ const organizationAccessError = parseOrganizationAccessError(raw.organizationAccessError);+ if (+ organizationAccessError &&+ (!currentOrganization ||+ plugins.some((item) => item.scope === 'organization') ||+ removals.length > 0)+ ) {+ throw new PluginProtocolError('企业准入拒绝响应不能包含企业资源或清理通告');+ }assertPluginListOrganizationNamespace(currentOrganization, plugins, removals);return {schemaVersion: PLUGIN_API_SCHEMA_VERSION,@@ -474,6 +502,22 @@ export function parseListPluginsResponse(value: unknown): ListPluginsResponse {nextCursor: nextCursor(raw.nextCursor, 'response.nextCursor'),removals,currentOrganization,+ ...(organizationAccessError ? { organizationAccessError } : {}),+ };+}++const ORGANIZATION_PLUGIN_ACCESS_ERROR_CODE_PATTERN = /^[A-Z][A-Z0-9_]{0,63}$/;++function parseOrganizationAccessError(value: unknown): OrganizationPluginAccessError | undefined {+ if (value === undefined) return undefined;+ const error = object(value, 'response.organizationAccessError');+ const code = string(error.code, 'response.organizationAccessError.code', 64);+ if (!ORGANIZATION_PLUGIN_ACCESS_ERROR_CODE_PATTERN.test(code)) {+ throw new PluginProtocolError('organizationAccessError.code 不合法');+ }+ return {+ code,+ message: string(error.message, 'response.organizationAccessError.message', 512),};}diff --git a/packages/plugin-protocol/src/memberUpload.ts b/packages/plugin-protocol/src/memberUpload.tsindex b5ed521f83..ecae837123 100644--- a/packages/plugin-protocol/src/memberUpload.ts+++ b/packages/plugin-protocol/src/memberUpload.ts@@ -57,6 +57,10 @@ export const PLUGIN_MEMBER_UPLOAD_FAILURE_CODES = ['PLUGIN_GHOST_ID_CONFLICT','PUBLISH_PREFIX_UNREGISTERED','PUBLISH_GHOST_ID_PREFIX_MISMATCH',+ 'PUBLISH_GHOST_ID_INVALID',+ 'PLUGIN_GHOST_ID_RESERVED',+ 'PLUGIN_NAMESPACE_CONFIG_REQUIRED',+ 'PLUGIN_NAMESPACE_CLIENT_REQUIRED','PUBLISH_VERSION_EXISTS','PUBLISH_STORAGE_UNAVAILABLE','PUBLISH_INTERNAL_ERROR',