Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): localize broker port market rejection

fmfsaisaidbecc6ad1864
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.ts
index 8fa234750a..8b9198b850 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
@@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest';
+import i18n from '../../../../i18n';
import { pluginMarketErrorKey } from '../pluginMarketErrorKey';
function serializedIpcError(code: string): Error {
@@ -15,6 +16,7 @@ describe('pluginMarketErrorKey', () => {
['PERMISSION_DENIED', 'accessDenied'],
['UNSUPPORTED_CAPABILITY', 'notConfigured'],
['GHOST_FILE_INVALID', 'invalidPackage'],
+ ['GHOST_BROKER_REDIRECT_PORT_REQUIRED', 'brokerRedirectPortRequired'],
])('maps %s to localized market copy', (code, suffix) => {
expect(pluginMarketErrorKey(serializedIpcError(code))).toBe(
`settings.ghosts.market.errors.${suffix}`,
@@ -26,4 +28,27 @@ describe('pluginMarketErrorKey', () => {
'settings.ghosts.market.errors.generic',
);
});
+
+ it.each([
+ { locale: 'zh-CN', publisherAction: '联系发布者' },
+ { locale: 'zh-TW', publisherAction: '聯絡釋出者' },
+ { locale: 'en', publisherAction: 'Contact the publisher' },
+ { locale: 'ja', publisherAction: '発行元' },
+ { locale: 'ko', publisherAction: '게시자' },
+ ])(
+ 'keeps the broker redirect-port market guidance local and actionable in $locale',
+ ({ locale, publisherAction }) => {
+ const key = pluginMarketErrorKey(serializedIpcError('GHOST_BROKER_REDIRECT_PORT_REQUIRED'));
+ const rawMessage = i18n.getResource(locale, 'common', key);
+ const message = i18n.getFixedT(locale)(key).toString();
+
+ // Reading the locale's raw resource excludes a missing key being hidden by English fallback.
+ expect(rawMessage).toEqual(expect.any(String));
+ // These fragments exclude falling back to the generic retry toast or reusing author-facing copy.
+ expect(rawMessage).toContain('redirectPort');
+ expect(rawMessage).toContain(publisherAction);
+ expect(message).toBe(rawMessage);
+ expect(message).not.toBe(i18n.getFixedT(locale)('settings.ghosts.market.errors.generic'));
+ },
+ );
});
diff --git a/apps/desktop/src/renderer/features/plugin/lib/pluginMarketErrorKey.ts b/apps/desktop/src/renderer/features/plugin/lib/pluginMarketErrorKey.ts
index 8f93c891ee..5d94f65409 100644
--- a/apps/desktop/src/renderer/features/plugin/lib/pluginMarketErrorKey.ts
+++ b/apps/desktop/src/renderer/features/plugin/lib/pluginMarketErrorKey.ts
@@ -17,6 +17,8 @@ export function pluginMarketErrorKey(error: unknown): string {
return 'settings.ghosts.market.errors.notConfigured';
case 'GHOST_FILE_INVALID':
return 'settings.ghosts.market.errors.invalidPackage';
+ case 'GHOST_BROKER_REDIRECT_PORT_REQUIRED':
+ return 'settings.ghosts.market.errors.brokerRedirectPortRequired';
default:
return 'settings.ghosts.market.errors.generic';
}
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 376b371458..c0909a6a9c 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -4140,7 +4140,8 @@
"stateChanged": "The account, plugin, or release changed during this operation. Review the latest state and try again.",
"accessDenied": "This plugin operation is not permitted or was cancelled.",
"notConfigured": "The plugin market is not available in this environment.",
- "invalidPackage": "This plugin package is invalid or is not supported by this version of Cindy."
+ "invalidPackage": "This plugin package is invalid or is not supported by this version of Cindy.",
+ "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."
},
"securityTitle": "Install and permissions",
"securityDescription": "Cindy verifies package size and SHA-256 in the main process, validates the plugin manifest, then installs atomically. First-time installs are enabled automatically and can be disabled anytime on the Plugins page; updates keep the current enabled state.",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 4a872fa2dc..1a6e9707d2 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -4139,7 +4139,8 @@
"stateChanged": "操作中にアカウント、プラグイン、またはリリースが変更されました。最新の状態を確認して、もう一度お試しください。",
"accessDenied": "このプラグイン操作は許可されていないか、キャンセルされました。",
"notConfigured": "この環境ではプラグインマーケットを利用できません。",
- "invalidPackage": "このプラグインパッケージは無効か、現在の Cindy バージョンではサポートされていません。"
+ "invalidPackage": "このプラグインパッケージは無効か、現在の Cindy バージョンではサポートされていません。",
+ "brokerRedirectPortRequired": "このプラグインは認可 broker を宣言していますが、同じ OAuth 設定に redirectPort がないため、プラグインマーケットからインストールできません。発行元にこのフィールドを追加して新しいバージョンを公開するよう連絡してください。"
},
"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.json
index 3771f69726..eb902d567c 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -4139,7 +4139,8 @@
"stateChanged": "작업 중 계정, 플러그인 또는 릴리스가 변경되었습니다. 최신 상태를 확인한 후 다시 시도해 주세요.",
"accessDenied": "이 플러그인 작업은 허용되지 않았거나 취소되었습니다.",
"notConfigured": "이 환경에서는 플러그인 마켓을 사용할 수 없습니다.",
- "invalidPackage": "이 플러그인 패키지가 올바르지 않거나 현재 Cindy 버전에서 지원되지 않습니다."
+ "invalidPackage": "이 플러그인 패키지가 올바르지 않거나 현재 Cindy 버전에서 지원되지 않습니다.",
+ "brokerRedirectPortRequired": "이 플러그인은 인증 broker를 선언했지만 같은 OAuth 설정에 redirectPort가 없어 플러그인 마켓에서 설치할 수 없습니다. 게시자에게 이 필드를 추가해 새 버전을 게시해 달라고 알려 주세요."
},
"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.json
index 5d37ff9c76..dd5ac9986a 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -4139,7 +4139,8 @@
"stateChanged": "操作期间账号、插件或版本已发生变化,请确认最新状态后重试。",
"accessDenied": "当前插件操作不被允许,或操作已取消。",
"notConfigured": "当前环境未提供插件市场。",
- "invalidPackage": "该插件包无效,或当前 Cindy 版本不支持它。"
+ "invalidPackage": "该插件包无效,或当前 Cindy 版本不支持它。",
+ "brokerRedirectPortRequired": "该插件声明了授权 broker,但同一项 OAuth 配置缺少 redirectPort,无法从插件市场安装。请联系发布者补充该字段并重新发布。"
},
"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.json
index 1696d87707..7e534dca02 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -4138,7 +4138,8 @@
"stateChanged": "操作期間帳號、插件或版本已發生變化,請確認最新狀態後重試。",
"accessDenied": "當前插件操作不被允許,或操作已取消。",
"notConfigured": "當前環境未提供插件市場。",
- "invalidPackage": "該插件包無效,或當前 Cindy 版本不支援它。"
+ "invalidPackage": "該插件包無效,或當前 Cindy 版本不支援它。",
+ "brokerRedirectPortRequired": "此插件宣告了授權 broker,但同一項 OAuth 設定缺少 redirectPort,無法從插件市場安裝。請聯絡釋出者補上該欄位並重新釋出。"
},
"securityTitle": "安裝與權限",
"securityDescription": "安裝包會在主處理程序中校驗大小與 SHA-256,再經 Cindy 插件清單校驗後原子安裝。首次安裝完成後即自動開啟,可隨時在插件頁停用;更新會保留當前生效狀態。",