Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 区分 OAuth 授权失败原因 (#694)
DavidShenXD3de983964ee8
diff --git a/apps/desktop/src/main/__tests__/deviceId.test.ts b/apps/desktop/src/main/__tests__/deviceId.test.tsindex 10035320e5..9fe21f6ba6 100644--- a/apps/desktop/src/main/__tests__/deviceId.test.ts+++ b/apps/desktop/src/main/__tests__/deviceId.test.ts@@ -47,9 +47,13 @@ describe('ensureSystemBinPathForMachineId', () => {it('追加而非前置:不覆盖已有的用户 PATH 项', () => {process.env.PATH = '/opt/homebrew/bin:/usr/bin:/bin';ensureSystemBinPathForMachineId();- const dirs = (process.env.PATH ?? '').split(path.delimiter);- expect(dirs[0]).toBe('/opt/homebrew/bin'); // 原有优先项仍在最前- if (PATCHES_PATH) expect(dirs).toContain('/usr/sbin');+ if (PATCHES_PATH) {+ const dirs = (process.env.PATH ?? '').split(path.delimiter);+ expect(dirs[0]).toBe('/opt/homebrew/bin'); // 原有优先项仍在最前+ expect(dirs).toContain('/usr/sbin');+ } else {+ expect(process.env.PATH).toBe('/opt/homebrew/bin:/usr/bin:/bin'); // Windows: 不动 PATH+ }});it('保留原 PATH 的空段(Unix 下代表 CWD),不改语义', () => {diff --git a/apps/desktop/src/main/cindy-brain/__tests__/forge.oauth.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/forge.oauth.test.tsindex 17719ef7c3..a85f42d668 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/forge.oauth.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/forge.oauth.test.ts@@ -22,6 +22,7 @@ describe('FORGE_GUIDE · oauth 凭证章节', () => {'clientConfigured','authAccount','AUTH_EXPIRED',+ 'SERVICE_UNAVAILABLE',]) {expect(FORGE_GUIDE).toContain(marker);}diff --git a/apps/desktop/src/main/cindy-brain/__tests__/ghostOauthBroker.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/ghostOauthBroker.test.tsindex 9eed1f3039..cc7e76add0 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/ghostOauthBroker.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/ghostOauthBroker.test.ts@@ -87,6 +87,41 @@ describe('createGhostOauthBrokerClient', () => {});});+ it('账号能力切换等非传输异常→ EXCHANGE_FAILED,不误报 NETWORK', async () => {+ const client = createGhostOauthBrokerClient({+ apiPost: vi.fn(async () => {+ throw Object.assign(new Error('[PRECONDITION_FAILED] app session is switching'), {+ code: 'PRECONDITION_FAILED',+ });+ }),+ hasLoginToken: () => true,+ });+ await expect(client.refresh('jira', { refreshToken: 'rt' })).resolves.toMatchObject({+ ok: false,+ error: 'EXCHANGE_FAILED',+ invalidGrant: false,+ });+ });++ it.each([+ ['HTTP_404', 404],+ ['INTERNAL_ERROR', 503],+ ])('broker 路由或服务不可用(%s / %i)→ SERVICE_UNAVAILABLE', async (code, statusCode) => {+ const client = createGhostOauthBrokerClient({+ apiPost: vi.fn(async () => {+ throw apiError(code, statusCode, 'upstream detail must stay in Main');+ }),+ hasLoginToken: () => true,+ });+ await expect(+ client.exchange('feishu', { code: 'c', redirectUri: 'http://127.0.0.1/callback' }),+ ).resolves.toEqual({+ ok: false,+ error: 'SERVICE_UNAVAILABLE',+ invalidGrant: false,+ });+ });+it('未知 slug:不打请求直接拒;白名单认 feishu / jira(slack 已随意识退役)', async () => {expect(SUPPORTED_TOKEN_BROKERS.has('jira')).toBe(true);expect(SUPPORTED_TOKEN_BROKERS.has('feishu')).toBe(true);diff --git a/apps/desktop/src/main/cindy-brain/__tests__/ghostOauthFlow.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/ghostOauthFlow.test.tsindex 864f541707..ffcf017eb1 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/ghostOauthFlow.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/ghostOauthFlow.test.ts@@ -473,6 +473,30 @@ describe('startGhostOauthFlow', () => {expect(broker.exchange).toHaveBeenCalledTimes(1);});+ it('tokenBroker 服务不可用时保留 SERVICE_UNAVAILABLE 分类', async () => {+ const broker: GhostOauthBrokerClient = {+ exchange: vi.fn(async () => ({+ ok: false as const,+ error: 'SERVICE_UNAVAILABLE' as const,+ invalidGrant: false,+ })),+ refresh: vi.fn(),+ };+ const result = await startGhostOauthFlow({+ config: { ...BASE_CONFIG, tokenBroker: 'feishu' },+ fetchImpl: vi.fn() as unknown as typeof fetch,+ broker,+ openExternal: (url) => {+ browserRedirect(url, (authorizeUrl) => ({+ code: 'c-unavailable',+ state: authorizeUrl.searchParams.get('state') ?? '',+ }));+ },+ });++ expect(result).toEqual({ ok: false, error: 'SERVICE_UNAVAILABLE', detail: undefined });+ });+it('tokenBroker + pkce:false(jira/slack 形态):授权页无 challenge,broker 不收 verifier', async () => {const broker: GhostOauthBrokerClient = {exchange: vi.fn(diff --git a/apps/desktop/src/main/cindy-brain/__tests__/ghostOauthSetupError.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/ghostOauthSetupError.test.tsnew file mode 100644index 0000000000..5825f99661--- /dev/null+++ b/apps/desktop/src/main/cindy-brain/__tests__/ghostOauthSetupError.test.ts@@ -0,0 +1,15 @@+import { describe, expect, it } from 'vitest';++import { mapGhostOauthConnectError } from '../ghostOauthSetupError.js';++describe('mapGhostOauthConnectError', () => {+ it.each([+ ['CANCELLED', 'AUTH_CANCELLED'],+ ['NETWORK', 'AUTH_NETWORK'],+ ['SERVICE_UNAVAILABLE', 'AUTH_SERVICE_UNAVAILABLE'],+ ['EXCHANGE_FAILED', 'AUTH_FAILED'],+ ['INVALID_CONFIG', 'AUTH_FAILED'],+ ] as const)('%s → %s', (error, expected) => {+ expect(mapGhostOauthConnectError(error)).toBe(expected);+ });+});diff --git a/apps/desktop/src/main/cindy-brain/forge.ts b/apps/desktop/src/main/cindy-brain/forge.tsindex 2d05238210..7a01e15136 100644--- a/apps/desktop/src/main/cindy-brain/forge.ts+++ b/apps/desktop/src/main/cindy-brain/forge.ts@@ -1602,7 +1602,9 @@ const connectInit = { method:'POST' };// 典型用法是先读 /app-context,由意识按 region 选择公开 App ID。if (selectedClientId) connectInit.body = JSON.stringify({ clientId: selectedClientId });const r = await (await fetch('/oauth/acct/connect', connectInit)).json();-// → { ok:true, account } 或 { ok:false, error: 'NO_CLIENT_CONFIG'|'TIMEOUT'|'CANCELLED'|'CALLBACK_INVALID'|'EXCHANGE_FAILED'|'NETWORK'|'ACCOUNT_LIMIT', detail? }+// → { ok:true, account } 或 { ok:false, error: 'NO_CLIENT_CONFIG'|'ACCOUNT_LIMIT'|'VAULT_WRITE_FAILED'|'INVALID_CONFIG'|'LISTEN_FAILED'|'TIMEOUT'|'CANCELLED'|'CALLBACK_INVALID'|'EXCHANGE_FAILED'|'SERVICE_UNAVAILABLE'|'NETWORK', detail? }+// NETWORK = 客户端无法连接授权服务,提示用户检查网络后重试;+// SERVICE_UNAVAILABLE = broker 路由缺失或服务端 5xx,提示用户稍后重试。// 授权成功时主机会自动弹「授权成功,已连接 xxx」的系统提示(带你的身份头,// 无需声明 notify 槽);设置页只管刷新自己的账号列表。// 断开账号 / 设默认账号:diff --git a/apps/desktop/src/main/cindy-brain/ghostOauthBroker.ts b/apps/desktop/src/main/cindy-brain/ghostOauthBroker.tsindex 86a46d3ab2..a424b2ad50 100644--- a/apps/desktop/src/main/cindy-brain/ghostOauthBroker.ts+++ b/apps/desktop/src/main/cindy-brain/ghostOauthBroker.ts@@ -18,6 +18,8 @@* invalidGrant:false——server JWT secret 轮换这类全员性登录层故障绝不能* 连带销毁所有人的第三方授权;* - 网络不通(statusCode 0 / NETWORK_ERROR)→ NETWORK(瞬时,可重试)。+ * - broker 路由未部署或服务端故障(404 / 5xx)→ SERVICE_UNAVAILABLE,供宿主+ * 显示可操作的服务不可用提示,不暴露上游响应正文。** 依赖注入(规则 14):server 调用与登录态判断全经 deps,单测内存假体覆盖,* 零 Electron。@@ -127,6 +129,15 @@ export function createGhostOauthBrokerClient(deps: GhostOauthBrokerDeps): GhostOif (err.statusCode === 0 || err.code === 'NETWORK_ERROR') {return { ok: false, error: 'NETWORK', invalidGrant: false, detail: err.message };}+ if (err.statusCode === 404 || err.statusCode >= 500) {+ deps.logger?.warn('ghost oauth broker 服务不可用', {+ slug,+ action,+ status: err.statusCode,+ code: err.code,+ });+ return { ok: false, error: 'SERVICE_UNAVAILABLE', invalidGrant: false };+ }const invalidGrant = err.statusCode === 401 && UPSTREAM_REJECTION_CODES.has(err.code);deps.logger?.warn('ghost oauth broker 调用被拒', {slug,@@ -142,7 +153,10 @@ export function createGhostOauthBrokerClient(deps: GhostOauthBrokerDeps): GhostOdetail: `${err.code} ${err.message}`.slice(0, 200),};}- return { ok: false, error: 'NETWORK', invalidGrant: false, detail: String(err) };+ // serverApiFetch 的真实传输失败会带 statusCode:0 / NETWORK_ERROR,+ // 已在上方精确归类。其余异常可能来自账号能力门禁或调用前置条件,+ // 不能误导用户检查网络。+ return { ok: false, error: 'EXCHANGE_FAILED', invalidGrant: false, detail: String(err) };}const bundle = toBundle(raw);if (!bundle) {diff --git a/apps/desktop/src/main/cindy-brain/ghostOauthFlow.ts b/apps/desktop/src/main/cindy-brain/ghostOauthFlow.tsindex 65f67ba060..b7ecc051e1 100644--- a/apps/desktop/src/main/cindy-brain/ghostOauthFlow.ts+++ b/apps/desktop/src/main/cindy-brain/ghostOauthFlow.ts@@ -120,6 +120,7 @@ export type GhostOauthFlowError =| 'CANCELLED'| 'CALLBACK_INVALID'| 'EXCHANGE_FAILED'+ | 'SERVICE_UNAVAILABLE'| 'NETWORK';export type GhostOauthFlowResult =@@ -132,12 +133,12 @@ export type GhostOauthRefreshResult =* invalidGrant = 服务商明确拒绝 refresh token(吊销 / 过期 / 用户改密),* 调用方应作废存量并引导重新授权;其余失败是瞬时性的,可原 token 重试。*/- | { ok: false; error: 'EXCHANGE_FAILED' | 'NETWORK'; invalidGrant: boolean; detail?: string };+ | { ok: false; error: 'EXCHANGE_FAILED' | 'SERVICE_UNAVAILABLE' | 'NETWORK'; invalidGrant: boolean; detail?: string };/** broker 一次交换 / 刷新的结果(形态对齐 GhostOauthRefreshResult,便于两条链路共用消费端)。 */export type GhostOauthBrokerResult =| { ok: true; bundle: GhostOauthTokenBundle }- | { ok: false; error: 'EXCHANGE_FAILED' | 'NETWORK'; invalidGrant: boolean; detail?: string };+ | { ok: false; error: 'EXCHANGE_FAILED' | 'SERVICE_UNAVAILABLE' | 'NETWORK'; invalidGrant: boolean; detail?: string };/*** XDT server token broker 调用器(tokenBroker 声明的执行通道)。实现方负责diff --git a/apps/desktop/src/main/cindy-brain/ghostOauthSetupError.ts b/apps/desktop/src/main/cindy-brain/ghostOauthSetupError.tsnew file mode 100644index 0000000000..958fc1cdbe--- /dev/null+++ b/apps/desktop/src/main/cindy-brain/ghostOauthSetupError.ts@@ -0,0 +1,22 @@+import type { GhostSetupErrorCode } from '../../shared/ghost.js';+import type { GhostOauthConnectResult } from './ghostOauthAccounts.js';++type GhostOauthConnectError = Exclude<GhostOauthConnectResult, { ok: true }>['error'];++/**+ * 把 Main 内部 OAuth 失败分类收窄成可跨进程传输的稳定 UI 错误码。+ * 不传 detail:服务端响应、路径和登录诊断只留在 Main 日志,Renderer 只拿+ * 可本地化且可操作的错误类别。+ */+export function mapGhostOauthConnectError(error: GhostOauthConnectError): GhostSetupErrorCode {+ switch (error) {+ case 'CANCELLED':+ return 'AUTH_CANCELLED';+ case 'NETWORK':+ return 'AUTH_NETWORK';+ case 'SERVICE_UNAVAILABLE':+ return 'AUTH_SERVICE_UNAVAILABLE';+ default:+ return 'AUTH_FAILED';+ }+}diff --git a/apps/desktop/src/main/cindy-brain/index.ts b/apps/desktop/src/main/cindy-brain/index.tsindex b27d6432b4..935fc6f76a 100644--- a/apps/desktop/src/main/cindy-brain/index.ts+++ b/apps/desktop/src/main/cindy-brain/index.ts@@ -85,6 +85,7 @@ import { handleGhostSecretsRequest } from './runtime/ghostSecretsEndpoint.js';import { handleGhostOauthRequest } from './runtime/ghostOauthEndpoint.js';import { handleGhostConnectionsRequest } from './runtime/ghostConnectionsEndpoint.js';import { GhostOauthAccountManager, type GhostOauthDecl } from './ghostOauthAccounts.js';+import { mapGhostOauthConnectError } from './ghostOauthSetupError.js';import { reclaimLoopbackPort } from './portReclaim.js';import { GhostConnectionManager } from './ghostConnections.js';import { getResolvedMainLocale, t } from '../i18n.js';@@ -2058,11 +2059,10 @@ export async function executeGhostSetupAction(args: {? { ok: true }: {ok: false,- errorCode: connected.error === 'CANCELLED' ? 'AUTH_CANCELLED' : 'AUTH_FAILED',- message:- connected.error === 'CANCELLED'- ? t('newChat.pluginSetup.oauthCancelled')- : connected.detail ?? t('newChat.pluginSetup.oauthFailed').replace('{{detail}}', connected.error),+ errorCode: mapGhostOauthConnectError(connected.error),+ // interaction snapshot 只传稳定 errorCode;detail 可能含服务路径或+ // 上游诊断,留在 Main,不下放 Renderer。+ message: connected.detail ?? connected.error,};}diff --git a/apps/desktop/src/renderer/__tests__/PluginSetupPrompt.test.tsx b/apps/desktop/src/renderer/__tests__/PluginSetupPrompt.test.tsxindex bc2e2f4781..8b1a88ed9a 100644--- a/apps/desktop/src/renderer/__tests__/PluginSetupPrompt.test.tsx+++ b/apps/desktop/src/renderer/__tests__/PluginSetupPrompt.test.tsx@@ -335,6 +335,27 @@ describe('PluginSetupPrompt', () => {expect(screen.queryByText('等待超时')).toBeNull();});+ it.each([+ ['AUTH_NETWORK', "Couldn't reach the authorization service. Check your network and try again."],+ ['AUTH_SERVICE_UNAVAILABLE', 'The authorization service is temporarily unavailable. Try again later.'],+ ] as const)('renders an actionable OAuth error for %s', (errorCode, expectedCopy) => {+ render(+ <PluginSetupPrompt+ pending={{+ ...pending,+ steps: [{ ...pending.steps[0], phase: 'failed', errorCode }],+ }}+ viewerState="expanded"+ commandInFlight={null}+ remote={false}+ onViewerStateChange={vi.fn()}+ onCommand={vi.fn()}+ />,+ );++ expect(screen.getByText(expectedCopy)).toBeTruthy();+ });+it('hides actions after a partially satisfied setup is cancelled', () => {render(<PluginSetupPromptdiff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex 3f186b085a..95d3a3e2ab 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -3813,6 +3813,8 @@"ACTION_STALE": "This setup changed. Choose the setup action again.","AUTH_CANCELLED": "Authorization was cancelled. Authorize the account again when ready.","AUTH_FAILED": "Couldn't authorize the account. Try again.",+ "AUTH_NETWORK": "Couldn't reach the authorization service. Check your network and try again.",+ "AUTH_SERVICE_UNAVAILABLE": "The authorization service is temporarily unavailable. Try again later.","INLINE_INVALID": "This configuration is invalid. Check it and try again.","INLINE_UNAVAILABLE": "This Cindy version can't save this configuration in chat. Update Cindy and try again.","SAVE_FAILED": "Couldn't save this configuration. Try again.",diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex a187d583d7..9da8acabf5 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -3812,6 +3812,8 @@"ACTION_STALE": "設定内容が更新されました。設定操作を選び直してください。","AUTH_CANCELLED": "認証がキャンセルされました。必要に応じてもう一度認証してください。","AUTH_FAILED": "認証を完了できませんでした。もう一度お試しください。",+ "AUTH_NETWORK": "認証サービスに接続できませんでした。ネットワーク接続を確認して、もう一度お試しください。",+ "AUTH_SERVICE_UNAVAILABLE": "認証サービスは一時的に利用できません。しばらくしてからもう一度お試しください。","INLINE_INVALID": "設定内容が無効です。内容を確認してもう一度お試しください。","INLINE_UNAVAILABLE": "このバージョンの Cindy ではチャット内でこの設定を保存できません。Cindy を更新してもう一度お試しください。","SAVE_FAILED": "設定を保存できませんでした。もう一度お試しください。",diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex 80ee509a49..c7b9a7b2a3 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -3812,6 +3812,8 @@"ACTION_STALE": "설정 내용이 변경되었습니다. 설정 작업을 다시 선택하세요.","AUTH_CANCELLED": "인증이 취소되었습니다. 필요한 경우 다시 인증하세요.","AUTH_FAILED": "인증을 완료할 수 없습니다. 다시 시도하세요.",+ "AUTH_NETWORK": "인증 서비스에 연결할 수 없습니다. 네트워크 연결을 확인한 후 다시 시도하세요.",+ "AUTH_SERVICE_UNAVAILABLE": "인증 서비스를 일시적으로 사용할 수 없습니다. 잠시 후 다시 시도하세요.","INLINE_INVALID": "설정 내용이 올바르지 않습니다. 확인한 후 다시 시도하세요.","INLINE_UNAVAILABLE": "이 Cindy 버전에서는 채팅에서 이 설정을 저장할 수 없습니다. Cindy를 업데이트한 후 다시 시도하세요.","SAVE_FAILED": "설정을 저장할 수 없습니다. 다시 시도하세요.",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex fe28c6b9cc..d4cdbfe89c 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -3812,6 +3812,8 @@"ACTION_STALE": "设置已更新,请重新选择配置操作。","AUTH_CANCELLED": "授权已取消,您可以重新授权。","AUTH_FAILED": "未能完成授权,请重试。",+ "AUTH_NETWORK": "无法连接授权服务,请检查网络后重试。",+ "AUTH_SERVICE_UNAVAILABLE": "授权服务暂不可用,请稍后重试。","INLINE_INVALID": "配置内容无效,请检查后重试。","INLINE_UNAVAILABLE": "当前版本无法在对话中保存此配置,请更新 Cindy 后重试。","SAVE_FAILED": "未能保存配置,请重试。",diff --git a/apps/desktop/src/shared/ghost.ts b/apps/desktop/src/shared/ghost.tsindex 2e130c4c33..ec06a73769 100644--- a/apps/desktop/src/shared/ghost.ts+++ b/apps/desktop/src/shared/ghost.ts@@ -1049,6 +1049,8 @@ export const GHOST_SETUP_ERROR_CODES = ['ACTION_STALE','AUTH_CANCELLED','AUTH_FAILED',+ 'AUTH_NETWORK',+ 'AUTH_SERVICE_UNAVAILABLE','INLINE_INVALID','INLINE_UNAVAILABLE','SAVE_FAILED',diff --git a/apps/mobile/src/i18n/locales/en/interaction.json b/apps/mobile/src/i18n/locales/en/interaction.jsonindex 8f63ebe1b4..fcd75d06d1 100644--- a/apps/mobile/src/i18n/locales/en/interaction.json+++ b/apps/mobile/src/i18n/locales/en/interaction.json@@ -199,6 +199,8 @@"ACTION_STALE": "This setup changed. Choose the setup action again.","AUTH_CANCELLED": "Authorization was cancelled. Authorize the account again when ready.","AUTH_FAILED": "Couldn't authorize the account. Try again.",+ "AUTH_NETWORK": "Couldn't reach the authorization service. Check your network and try again.",+ "AUTH_SERVICE_UNAVAILABLE": "The authorization service is temporarily unavailable. Try again later.","INLINE_INVALID": "This configuration is invalid. Check it and try again.","INLINE_UNAVAILABLE": "This Cindy version can't save this configuration in chat. Update Cindy and try again.","SAVE_FAILED": "Couldn't save this configuration. Try again.",diff --git a/apps/mobile/src/i18n/locales/ja/interaction.json b/apps/mobile/src/i18n/locales/ja/interaction.jsonindex d2d8cde8b2..9bff9c30ed 100644--- a/apps/mobile/src/i18n/locales/ja/interaction.json+++ b/apps/mobile/src/i18n/locales/ja/interaction.json@@ -199,6 +199,8 @@"ACTION_STALE": "設定内容が更新されました。設定操作を選び直してください。","AUTH_CANCELLED": "認証がキャンセルされました。必要に応じてもう一度認証してください。","AUTH_FAILED": "認証を完了できませんでした。もう一度お試しください。",+ "AUTH_NETWORK": "認証サービスに接続できませんでした。ネットワーク接続を確認して、もう一度お試しください。",+ "AUTH_SERVICE_UNAVAILABLE": "認証サービスは一時的に利用できません。しばらくしてからもう一度お試しください。","INLINE_INVALID": "設定内容が無効です。内容を確認してもう一度お試しください。","INLINE_UNAVAILABLE": "このバージョンの Cindy ではチャット内でこの設定を保存できません。Cindy を更新してもう一度お試しください。","SAVE_FAILED": "設定を保存できませんでした。もう一度お試しください。",diff --git a/apps/mobile/src/i18n/locales/ko/interaction.json b/apps/mobile/src/i18n/locales/ko/interaction.jsonindex 882e648904..e03d42f461 100644--- a/apps/mobile/src/i18n/locales/ko/interaction.json+++ b/apps/mobile/src/i18n/locales/ko/interaction.json@@ -199,6 +199,8 @@"ACTION_STALE": "설정 내용이 변경되었습니다. 설정 작업을 다시 선택하세요.","AUTH_CANCELLED": "인증이 취소되었습니다. 필요한 경우 다시 인증하세요.","AUTH_FAILED": "인증을 완료할 수 없습니다. 다시 시도하세요.",+ "AUTH_NETWORK": "인증 서비스에 연결할 수 없습니다. 네트워크 연결을 확인한 후 다시 시도하세요.",+ "AUTH_SERVICE_UNAVAILABLE": "인증 서비스를 일시적으로 사용할 수 없습니다. 잠시 후 다시 시도하세요.","INLINE_INVALID": "설정 내용이 올바르지 않습니다. 확인한 후 다시 시도하세요.","INLINE_UNAVAILABLE": "이 Cindy 버전에서는 채팅에서 이 설정을 저장할 수 없습니다. Cindy를 업데이트한 후 다시 시도하세요.","SAVE_FAILED": "설정을 저장할 수 없습니다. 다시 시도하세요.",diff --git a/apps/mobile/src/i18n/locales/zh-CN/interaction.json b/apps/mobile/src/i18n/locales/zh-CN/interaction.jsonindex 9ce495b523..5106035088 100644--- a/apps/mobile/src/i18n/locales/zh-CN/interaction.json+++ b/apps/mobile/src/i18n/locales/zh-CN/interaction.json@@ -199,6 +199,8 @@"ACTION_STALE": "设置已更新,请重新选择配置操作。","AUTH_CANCELLED": "授权已取消,您可以重新授权。","AUTH_FAILED": "未能完成授权,请重试。",+ "AUTH_NETWORK": "无法连接授权服务,请检查网络后重试。",+ "AUTH_SERVICE_UNAVAILABLE": "授权服务暂不可用,请稍后重试。","INLINE_INVALID": "配置内容无效,请检查后重试。","INLINE_UNAVAILABLE": "当前版本无法在对话中保存此配置,请更新 Cindy 后重试。","SAVE_FAILED": "未能保存配置,请重试。",diff --git a/packages/maker-shared/src/__tests__/interaction.test.ts b/packages/maker-shared/src/__tests__/interaction.test.tsindex 1dc56be1ac..1d5f6be870 100644--- a/packages/maker-shared/src/__tests__/interaction.test.ts+++ b/packages/maker-shared/src/__tests__/interaction.test.ts@@ -678,6 +678,19 @@ describe('interaction shared model', () => {});});+ it.each([+ 'AUTH_NETWORK',+ 'AUTH_SERVICE_UNAVAILABLE',+ ] as const)('preserves remote OAuth setup error %s', (errorCode) => {+ const presentation = buildRemotePluginSetupPresentation({+ kind: 'plugin_setup',+ requestId: 's1',+ steps: [{ id: 'oauth', title: 'OAuth', phase: 'failed', errorCode }],+ });++ expect(presentation.groups[0]?.steps[0]?.errorCode).toBe(errorCode);+ });+it('collapses unknown plugin setup enums instead of passing them through to copy lookups', () => {const presentation = buildRemotePluginSetupPresentation({kind: 'plugin_setup',diff --git a/packages/maker-shared/src/interaction.ts b/packages/maker-shared/src/interaction.tsindex 78028a0567..fee090d1c5 100644--- a/packages/maker-shared/src/interaction.ts+++ b/packages/maker-shared/src/interaction.ts@@ -489,6 +489,8 @@ export const REMOTE_PLUGIN_SETUP_ERROR_CODES = ['ACTION_STALE','AUTH_CANCELLED','AUTH_FAILED',+ 'AUTH_NETWORK',+ 'AUTH_SERVICE_UNAVAILABLE','INLINE_INVALID','INLINE_UNAVAILABLE','SAVE_FAILED',