From 54784e60c6497f80dc083184928078fad98de6ee Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Tue, 6 Oct 2026 22:32:36 -0700 Subject: [PATCH] fix(native-chat): move the attachment failure words to their own module so lint passes on main The failure-words table grew past the 300-line limit when two changes landed back to back, which fails Lint on main and makes every PR's static-analysis job skip typecheck. --- ...t-session-failure-attachment-words-text.ts | 56 +++++++++++++++++++ .../agent-session-failure-words-text.ts | 48 +--------------- 2 files changed, 58 insertions(+), 46 deletions(-) create mode 100644 src/renderer/src/components/native-chat/agent-session-failure-attachment-words-text.ts diff --git a/src/renderer/src/components/native-chat/agent-session-failure-attachment-words-text.ts b/src/renderer/src/components/native-chat/agent-session-failure-attachment-words-text.ts new file mode 100644 index 000000000000..cefd70a625e3 --- /dev/null +++ b/src/renderer/src/components/native-chat/agent-session-failure-attachment-words-text.ts @@ -0,0 +1,56 @@ +// Desktop words for the attachment refusals, kept beside the other failure pieces' translations. + +import { translate } from '@/i18n/i18n' +import { + AGENT_SESSION_FAILURE_COPY as COPY, + type AgentSessionFailureCopyId, + type AgentSessionFailureCopyValues +} from '../../../../shared/agent-session-failure-copy' + +export const ATTACHMENT_FAILURE_PIECES = { + attachmentEmpty: () => + translate('components.native-chat.failureWords.attachmentEmpty', COPY.attachmentEmpty), + attachmentTooLarge: () => + translate('components.native-chat.failureWords.attachmentTooLarge', COPY.attachmentTooLarge), + attachmentLargerThan: (values) => + translate( + 'components.native-chat.failureWords.attachmentLargerThan', + COPY.attachmentLargerThan, + values + ), + attachmentTooMany: () => + translate('components.native-chat.failureWords.attachmentTooMany', COPY.attachmentTooMany), + attachmentAtMost: (values) => + translate( + 'components.native-chat.failureWords.attachmentAtMost', + COPY.attachmentAtMost, + values + ), + attachmentTotalTooLarge: () => + translate( + 'components.native-chat.failureWords.attachmentTotalTooLarge', + COPY.attachmentTotalTooLarge + ), + attachmentTotalMoreThan: (values) => + translate( + 'components.native-chat.failureWords.attachmentTotalMoreThan', + COPY.attachmentTotalMoreThan, + values + ), + attachmentUnsupportedType: (values) => + translate( + 'components.native-chat.failureWords.attachmentUnsupportedType', + COPY.attachmentUnsupportedType, + values + ), + attachmentNotAFile: () => + translate('components.native-chat.failureWords.attachmentNotAFile', COPY.attachmentNotAFile), + attachmentNoSource: () => + translate('components.native-chat.failureWords.attachmentNoSource', COPY.attachmentNoSource), + attachmentInvalid: () => + translate('components.native-chat.failureWords.attachmentInvalid', COPY.attachmentInvalid), + attachmentUnreadable: () => + translate('components.native-chat.failureWords.attachmentUnreadable', COPY.attachmentUnreadable) +} satisfies Partial< + Record string> +> diff --git a/src/renderer/src/components/native-chat/agent-session-failure-words-text.ts b/src/renderer/src/components/native-chat/agent-session-failure-words-text.ts index 4648beff363d..a1b020aeba8a 100644 --- a/src/renderer/src/components/native-chat/agent-session-failure-words-text.ts +++ b/src/renderer/src/components/native-chat/agent-session-failure-words-text.ts @@ -8,6 +8,7 @@ import { type AgentSessionFailureCopyValues, type AgentSessionFailureSay } from '../../../../shared/agent-session-failure-copy' +import { ATTACHMENT_FAILURE_PIECES } from './agent-session-failure-attachment-words-text' // The pieces a refusal notice says too keep the notice's keys, so each has one translation. const PIECES: Record string> = @@ -155,52 +156,7 @@ const PIECES: Record - translate('components.native-chat.failureWords.attachmentEmpty', COPY.attachmentEmpty), - attachmentTooLarge: () => - translate('components.native-chat.failureWords.attachmentTooLarge', COPY.attachmentTooLarge), - attachmentLargerThan: (values) => - translate( - 'components.native-chat.failureWords.attachmentLargerThan', - COPY.attachmentLargerThan, - values - ), - attachmentTooMany: () => - translate('components.native-chat.failureWords.attachmentTooMany', COPY.attachmentTooMany), - attachmentAtMost: (values) => - translate( - 'components.native-chat.failureWords.attachmentAtMost', - COPY.attachmentAtMost, - values - ), - attachmentTotalTooLarge: () => - translate( - 'components.native-chat.failureWords.attachmentTotalTooLarge', - COPY.attachmentTotalTooLarge - ), - attachmentTotalMoreThan: (values) => - translate( - 'components.native-chat.failureWords.attachmentTotalMoreThan', - COPY.attachmentTotalMoreThan, - values - ), - attachmentUnsupportedType: (values) => - translate( - 'components.native-chat.failureWords.attachmentUnsupportedType', - COPY.attachmentUnsupportedType, - values - ), - attachmentNotAFile: () => - translate('components.native-chat.failureWords.attachmentNotAFile', COPY.attachmentNotAFile), - attachmentNoSource: () => - translate('components.native-chat.failureWords.attachmentNoSource', COPY.attachmentNoSource), - attachmentInvalid: () => - translate('components.native-chat.failureWords.attachmentInvalid', COPY.attachmentInvalid), - attachmentUnreadable: () => - translate( - 'components.native-chat.failureWords.attachmentUnreadable', - COPY.attachmentUnreadable - ), + ...ATTACHMENT_FAILURE_PIECES, emptyMessage: () => translate('components.native-chat.failureWords.emptyMessage', COPY.emptyMessage), queueFull: () => translate('components.native-chat.failureWords.queueFull', COPY.queueFull),