From a22f040b80424b2a557be258537d761653e89f07 Mon Sep 17 00:00:00 2001 From: dand Date: Thu, 12 Nov 2026 06:46:03 -0500 Subject: [PATCH 1/4] feat(composer): choose when large pastes become text attachments Pasted text only folds into a text-file attachment at 32 KiB, so everyday logs, stack traces, and code blocks land in the composer as text. On a phone that text fills the whole composer and the prompt around it is hard to reach or edit. Add a client setting with three presets (1 KB, 5 KB, and 32 KB, the default and today's behavior) on web, desktop, and mobile. The shared paste disposition and the native editors read the chosen threshold instead of a constant. Presets are labelled by size because the comparison counts UTF-8 bytes, and a stored value that is no longer a preset decodes to the default instead of failing the settings decode. Co-Authored-By: Claude Fable 5.2 --- .../settings/SettingsFollowUpRouteScreen.tsx | 38 ++++++++++++ .../src/features/settings/settings-search.ts | 10 +++- .../src/features/threads/ThreadComposer.tsx | 3 + .../lib/usePastedTextAttachmentThreshold.ts | 19 ++++++ .../src/native/T3ComposerEditor.ios.tsx | 5 +- .../src/native/T3ComposerEditor.native.tsx | 5 +- .../src/persistence/mobile-preferences.ts | 7 +++ apps/web/src/components/chat/ChatComposer.tsx | 1 + .../chat/useComposerAttachmentIntake.ts | 3 + .../components/settings/SettingsPanels.tsx | 58 +++++++++++++++++++ .../src/components/settings/settingsSearch.ts | 6 ++ docs/user/composer.md | 14 +++-- packages/client-runtime/src/textPaste.test.ts | 32 +++++++++- packages/client-runtime/src/textPaste.ts | 22 +++++-- packages/contracts/src/settings.test.ts | 11 ++++ packages/contracts/src/settings.ts | 17 ++++++ 16 files changed, 234 insertions(+), 17 deletions(-) create mode 100644 apps/mobile/src/lib/usePastedTextAttachmentThreshold.ts diff --git a/apps/mobile/src/features/settings/SettingsFollowUpRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsFollowUpRouteScreen.tsx index a7cd04f5f5c1f..80ce0812305bc 100644 --- a/apps/mobile/src/features/settings/SettingsFollowUpRouteScreen.tsx +++ b/apps/mobile/src/features/settings/SettingsFollowUpRouteScreen.tsx @@ -1,5 +1,10 @@ import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView"; import { useAtomSet, useAtomValue } from "@effect/atom-react"; +import { + DEFAULT_PASTED_TEXT_ATTACHMENT_THRESHOLD, + type PastedTextAttachmentThreshold, +} from "@t3tools/contracts"; +import { pastedTextThresholdLabel } from "@t3tools/client-runtime/text-paste"; import { AsyncResult } from "effect/reactivity"; import { Platform } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; @@ -28,6 +33,17 @@ const FOLLOW_UP_OPTIONS: ReadonlyArray<{ }, ]; +const THRESHOLD_OPTIONS: ReadonlyArray<{ + readonly threshold: PastedTextAttachmentThreshold; + readonly description: string; +}> = [ + { threshold: 1_000, description: "Most logs, stack traces, and code snippets become files." }, + { threshold: 5_000, description: "Long logs and documents become files; snippets stay as text." }, + { threshold: 32_768, description: "Default. Only very large pastes become files." }, +]; + +const PASTE_AS_TEXT_SHORTCUT = Platform.OS === "ios" ? "Command + Shift + V" : "Ctrl + Shift + V"; + export function SettingsFollowUpRouteScreen() { const insets = useSafeAreaInsets(); const preferencesResult = useAtomValue(mobilePreferencesAtom); @@ -36,6 +52,10 @@ export function SettingsFollowUpRouteScreen() { const selectedBehavior = AsyncResult.isSuccess(preferencesResult) ? (preferencesResult.value.followUpBehavior ?? DEFAULT_FOLLOW_UP_BEHAVIOR) : null; + const selectedThreshold = AsyncResult.isSuccess(preferencesResult) + ? (preferencesResult.value.pastedTextAttachmentThreshold ?? + DEFAULT_PASTED_TEXT_ATTACHMENT_THRESHOLD) + : null; const content = ( + + {THRESHOLD_OPTIONS.map(({ threshold, description }, index) => ( + 0} + disabled={!preferencesReady} + onPress={() => savePreferences({ pastedTextAttachmentThreshold: threshold })} + /> + ))} + + + Shorter pastes go into the message as text. Non-Latin text and emoji use more bytes per + character, so they reach the limit sooner. With a hardware keyboard, press{" "} + {PASTE_AS_TEXT_SHORTCUT} to paste a long block as text instead. + ); diff --git a/apps/mobile/src/features/settings/settings-search.ts b/apps/mobile/src/features/settings/settings-search.ts index 49e1a8dbe082e..0b821e75aae5e 100644 --- a/apps/mobile/src/features/settings/settings-search.ts +++ b/apps/mobile/src/features/settings/settings-search.ts @@ -76,7 +76,15 @@ const SETTINGS_SEARCH_TERMS = { "auto-resume", "thread behavior", ], - SettingsFollowUp: ["follow-ups", "queue", "steer", "while the agent is running"], + SettingsFollowUp: [ + "follow-ups", + "queue", + "steer", + "while the agent is running", + "large pastes", + "attachment", + "text file", + ], SettingsArchive: ["archive", "archived", "restore", "unarchive"], SettingsProviderAccounts: [ "provider accounts", diff --git a/apps/mobile/src/features/threads/ThreadComposer.tsx b/apps/mobile/src/features/threads/ThreadComposer.tsx index 9c2eb6d4c38df..76e0b16c19ad9 100644 --- a/apps/mobile/src/features/threads/ThreadComposer.tsx +++ b/apps/mobile/src/features/threads/ThreadComposer.tsx @@ -52,6 +52,7 @@ import Animated, { withTiming, } from "react-native-reanimated"; import { useUniwindTheme } from "../../lib/useUniwindTheme"; +import { usePastedTextAttachmentThreshold } from "../../lib/usePastedTextAttachmentThreshold"; import { themeColorWithAlpha } from "../../lib/mobileTheme"; import { armAgentAwarenessLiveActivityForLocalWork } from "../agent-awareness/remoteRegistration"; import { scopedThreadKey } from "../../lib/scopedEntities"; @@ -422,6 +423,7 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps const navigation = useNavigation(); const foregroundColor = useUniwindTheme()["--color-foreground"]; const bodyText = useScaledTextRole("body"); + const pastedTextAttachmentThreshold = usePastedTextAttachmentThreshold(); const fallbackInputRef = useRef(null); const inputRef = props.editorRef ?? fallbackInputRef; const [isFocused, setIsFocused] = useState(false); @@ -1013,6 +1015,7 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps text: paste.text, wouldExceedInputLimit, canAttach: true, + thresholdBytes: pastedTextAttachmentThreshold, }) === "attachment" ) { if (canAttach) { diff --git a/apps/mobile/src/lib/usePastedTextAttachmentThreshold.ts b/apps/mobile/src/lib/usePastedTextAttachmentThreshold.ts new file mode 100644 index 0000000000000..a798ea756b301 --- /dev/null +++ b/apps/mobile/src/lib/usePastedTextAttachmentThreshold.ts @@ -0,0 +1,19 @@ +import { useAtomValue } from "@effect/atom-react"; +import { DEFAULT_PASTED_TEXT_ATTACHMENT_THRESHOLD } from "@t3tools/contracts"; +import { AsyncResult } from "effect/reactivity"; + +import { mobilePreferencesAtom } from "../state/preferences"; + +/** + * Paste size at which the composer folds clipboard text into a text-file + * attachment. Selects only the threshold so unrelated preference writes do not + * re-render the composer editors. + */ +export function usePastedTextAttachmentThreshold() { + return useAtomValue(mobilePreferencesAtom, (preferences) => + AsyncResult.isSuccess(preferences) + ? (preferences.value.pastedTextAttachmentThreshold ?? + DEFAULT_PASTED_TEXT_ATTACHMENT_THRESHOLD) + : DEFAULT_PASTED_TEXT_ATTACHMENT_THRESHOLD, + ); +} diff --git a/apps/mobile/src/native/T3ComposerEditor.ios.tsx b/apps/mobile/src/native/T3ComposerEditor.ios.tsx index 437bcda4d012d..f32b4caf49e08 100644 --- a/apps/mobile/src/native/T3ComposerEditor.ios.tsx +++ b/apps/mobile/src/native/T3ComposerEditor.ios.tsx @@ -1,4 +1,3 @@ -import { PASTED_TEXT_ATTACHMENT_THRESHOLD_BYTES } from "@t3tools/client-runtime/text-paste"; import { PROVIDER_SEND_TURN_MAX_INPUT_CHARS } from "@t3tools/contracts"; import { collectComposerInlineTokens } from "@t3tools/shared/composerInlineTokens"; import { composerContextEditorTokens, composerSkillLabels } from "../lib/composerContext"; @@ -27,6 +26,7 @@ import { contextChipIconUri, modelChipIcon, modelChipIconUri } from "../lib/cont import { useUniwindTheme } from "../lib/useUniwindTheme"; import { createNativeComposerTheme } from "../lib/nativeComposerTheme"; import { FONT_FAMILIES } from "../lib/fontFamilies"; +import { usePastedTextAttachmentThreshold } from "../lib/usePastedTextAttachmentThreshold"; import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole"; import { acknowledgeComposerNativeEvent, @@ -179,6 +179,7 @@ export function ComposerEditor({ const bodyText = useScaledTextRole("body"); const theme = useUniwindTheme(); const fontFamily = FONT_FAMILIES.regular; + const pastedTextAttachmentThreshold = usePastedTextAttachmentThreshold(); const skillLabels = useMemo(() => composerSkillLabels(skills), [skills]); const { modelsBySource, modelTokens } = useComposerModelTokens(props.value, models); @@ -372,7 +373,7 @@ export function ComposerEditor({ autoFocus={props.autoFocus ?? false} autoCorrect={props.autoCorrect ?? true} spellCheck={props.spellCheck ?? true} - textPasteThresholdBytes={onPasteText ? PASTED_TEXT_ATTACHMENT_THRESHOLD_BYTES : 0} + textPasteThresholdBytes={onPasteText ? pastedTextAttachmentThreshold : 0} maxInputChars={PROVIDER_SEND_TURN_MAX_INPUT_CHARS} style={style as StyleProp} onComposerChange={(event) => applyNativeChange(event.nativeEvent)} diff --git a/apps/mobile/src/native/T3ComposerEditor.native.tsx b/apps/mobile/src/native/T3ComposerEditor.native.tsx index 5aabd8e0d6071..b957a4d1e054c 100644 --- a/apps/mobile/src/native/T3ComposerEditor.native.tsx +++ b/apps/mobile/src/native/T3ComposerEditor.native.tsx @@ -1,4 +1,3 @@ -import { PASTED_TEXT_ATTACHMENT_THRESHOLD_BYTES } from "@t3tools/client-runtime/text-paste"; import { PROVIDER_SEND_TURN_MAX_INPUT_CHARS } from "@t3tools/contracts"; import { collectComposerInlineTokens } from "@t3tools/shared/composerInlineTokens"; import { composerContextEditorTokens, composerSkillLabels } from "../lib/composerContext"; @@ -29,6 +28,7 @@ import { contextChipIconUri, modelChipIcon, modelChipIconUri } from "../lib/cont import { MOBILE_TYPOGRAPHY } from "../lib/typography"; import { useNativePaste } from "../lib/useNativePaste"; import { FONT_FAMILIES } from "../lib/fontFamilies"; +import { usePastedTextAttachmentThreshold } from "../lib/usePastedTextAttachmentThreshold"; import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider"; import { useUniwindTheme } from "../lib/useUniwindTheme"; import { createNativeComposerTheme } from "../lib/nativeComposerTheme"; @@ -313,6 +313,7 @@ export function ComposerEditor({ }); const resolvedTextStyle = StyleSheet.flatten(textStyle) ?? {}; const regularFontFamily = FONT_FAMILIES.regular; + const pastedTextAttachmentThreshold = usePastedTextAttachmentThreshold(); return ( { diff --git a/apps/mobile/src/persistence/mobile-preferences.ts b/apps/mobile/src/persistence/mobile-preferences.ts index 852d96c608520..d4f8fb3024351 100644 --- a/apps/mobile/src/persistence/mobile-preferences.ts +++ b/apps/mobile/src/persistence/mobile-preferences.ts @@ -10,6 +10,7 @@ import { PullRequestInvolvement, PullRequestListFilters, PullRequestListState, + PastedTextAttachmentThreshold, type ProviderInstanceId, type PullRequestMergeMethod, type SidebarProjectGroupingMode, @@ -27,6 +28,7 @@ import { MobileStorageDecodeError, MobileStorageEncodeError } from "./mobile-sto const PREFERENCES_KEY = "t3code.preferences"; const PREFERENCES_FALLBACK_KEY = "t3code.preferences.fallback"; const encodeJson = Schema.encodeUnknownEffect(Schema.fromJsonString(Schema.Unknown)); +const isPastedTextAttachmentThreshold = Schema.is(PastedTextAttachmentThreshold); export const PullRequestListControls = Schema.Struct({ state: PullRequestListState, @@ -113,6 +115,7 @@ export interface Preferences { /** Hardware-keyboard Return behavior in the composer. */ readonly composerEnterBehavior?: ComposerEnterBehavior; readonly followUpBehavior?: FollowUpBehavior; + readonly pastedTextAttachmentThreshold?: PastedTextAttachmentThreshold; /** The client `language` setting: a locale code or "system". Unset means English. */ readonly language?: string; readonly microphones?: ReadonlyArray; @@ -199,6 +202,7 @@ function sanitizePreferences(parsed: Preferences): Preferences { dismissedDatabaseStorageNotices?: readonly string[]; composerEnterBehavior?: ComposerEnterBehavior; followUpBehavior?: FollowUpBehavior; + pastedTextAttachmentThreshold?: PastedTextAttachmentThreshold; language?: string; microphones?: ReadonlyArray; projectGroupingEnabled?: boolean; @@ -308,6 +312,9 @@ function sanitizePreferences(parsed: Preferences): Preferences { if (parsed.followUpBehavior === "queue" || parsed.followUpBehavior === "steer") { preferences.followUpBehavior = parsed.followUpBehavior; } + if (isPastedTextAttachmentThreshold(parsed.pastedTextAttachmentThreshold)) { + preferences.pastedTextAttachmentThreshold = parsed.pastedTextAttachmentThreshold; + } if (typeof parsed.language === "string") preferences.language = parsed.language; if (Array.isArray(parsed.microphones)) { preferences.microphones = parsed.microphones.flatMap((entry): MicrophoneEntry[] => { diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx index bafafcb9612cf..d4f7a791cf0bd 100644 --- a/apps/web/src/components/chat/ChatComposer.tsx +++ b/apps/web/src/components/chat/ChatComposer.tsx @@ -2612,6 +2612,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) questionAttachmentTarget, attachmentTargetKey, fileStagingLimit, + pastedTextAttachmentThreshold: settings.pastedTextAttachmentThreshold, promptRef, composerImagesRef, composerFilesRef, diff --git a/apps/web/src/components/chat/useComposerAttachmentIntake.ts b/apps/web/src/components/chat/useComposerAttachmentIntake.ts index fe3a56a392203..f1aeb262456cd 100644 --- a/apps/web/src/components/chat/useComposerAttachmentIntake.ts +++ b/apps/web/src/components/chat/useComposerAttachmentIntake.ts @@ -67,6 +67,7 @@ export function useComposerAttachmentIntake(input: { readonly questionAttachmentTarget: DraftId | null; readonly attachmentTargetKey: string; readonly fileStagingLimit: number | null; + readonly pastedTextAttachmentThreshold: number; readonly promptRef: ChatComposerProps["promptRef"]; readonly composerImagesRef: ChatComposerProps["composerImagesRef"]; readonly composerFilesRef: ChatComposerProps["composerFilesRef"]; @@ -94,6 +95,7 @@ export function useComposerAttachmentIntake(input: { questionAttachmentTarget, attachmentTargetKey, fileStagingLimit, + pastedTextAttachmentThreshold, promptRef, composerImagesRef, composerFilesRef, @@ -381,6 +383,7 @@ export function useComposerAttachmentIntake(input: { bypassAutoAttachment, wouldExceedInputLimit, canAttach: true, + thresholdBytes: pastedTextAttachmentThreshold, }) === "attachment"; if (!shouldFold) { return false; diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsx index 95acb62765c98..8ab1aabdabb33 100644 --- a/apps/web/src/components/settings/SettingsPanels.tsx +++ b/apps/web/src/components/settings/SettingsPanels.tsx @@ -15,11 +15,13 @@ import { type ProviderInstanceId, type SidebarProjectGroupingMode, } from "@t3tools/contracts"; +import { pastedTextThresholdLabel } from "@t3tools/client-runtime/text-paste"; import { DEFAULT_UNIFIED_SETTINGS, type DiffLayout, MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS, MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS, + PASTED_TEXT_ATTACHMENT_THRESHOLDS, type ResponseStreamingMode, type QuitConfirmationMode, SidebarProjectSortOrder, @@ -532,6 +534,10 @@ export function useSettingsRestore(onRestored?: () => void) { ? ["Rich text composer"] : []), ...(settings.sendShortcut !== DEFAULT_UNIFIED_SETTINGS.sendShortcut ? ["Send shortcut"] : []), + ...(settings.pastedTextAttachmentThreshold !== + DEFAULT_UNIFIED_SETTINGS.pastedTextAttachmentThreshold + ? ["Large paste threshold"] + : []), ...(settings.followUpBehavior !== DEFAULT_UNIFIED_SETTINGS.followUpBehavior ? ["Follow-up behavior"] : []), @@ -655,6 +661,7 @@ export function useSettingsRestore(onRestored?: () => void) { showSkillsInSlashMenu: DEFAULT_UNIFIED_SETTINGS.showSkillsInSlashMenu, composerRichTextEnabled: DEFAULT_UNIFIED_SETTINGS.composerRichTextEnabled, sendShortcut: DEFAULT_UNIFIED_SETTINGS.sendShortcut, + pastedTextAttachmentThreshold: DEFAULT_UNIFIED_SETTINGS.pastedTextAttachmentThreshold, followUpBehavior: DEFAULT_UNIFIED_SETTINGS.followUpBehavior, toolCallVisibility: DEFAULT_UNIFIED_SETTINGS.toolCallVisibility, screenReaderAnnouncements: DEFAULT_UNIFIED_SETTINGS.screenReaderAnnouncements, @@ -1214,6 +1221,57 @@ export function ChatSettingsPanel() { } /> + + updateSettings({ + pastedTextAttachmentThreshold: + DEFAULT_UNIFIED_SETTINGS.pastedTextAttachmentThreshold, + }) + } + /> + ) : null + } + control={ + + } + /> { it("accepts the V key on non-Latin layouts but follows the letter on Latin ones", () => { @@ -10,3 +11,32 @@ describe("isPasteAsTextShortcut", () => { expect(isPasteAsTextShortcut({ ...chord, key: "V", code: "Period" }, false)).toBe(true); }); }); + +describe("pastedTextDisposition", () => { + it("folds at each selectable threshold", () => { + for (const thresholdBytes of PASTED_TEXT_ATTACHMENT_THRESHOLDS) { + expect( + pastedTextDisposition({ + text: "x".repeat(thresholdBytes - 1), + canAttach: true, + thresholdBytes, + }), + ).toBe("inline"); + expect( + pastedTextDisposition({ + text: "x".repeat(thresholdBytes), + canAttach: true, + thresholdBytes, + }), + ).toBe("attachment"); + } + }); + + it("counts UTF-8 bytes, so non-Latin text folds with fewer characters", () => { + const text = "日本語".repeat(120); + expect(text.length).toBeLessThan(1_000); + expect(pastedTextDisposition({ text, canAttach: true, thresholdBytes: 1_000 })).toBe( + "attachment", + ); + }); +}); diff --git a/packages/client-runtime/src/textPaste.ts b/packages/client-runtime/src/textPaste.ts index 59a6182034572..ea6e677d288b8 100644 --- a/packages/client-runtime/src/textPaste.ts +++ b/packages/client-runtime/src/textPaste.ts @@ -1,5 +1,3 @@ -export const PASTED_TEXT_ATTACHMENT_THRESHOLD_BYTES = 32 * 1024; - const textEncoder = new TextEncoder(); export type PastedTextDisposition = "attachment" | "inline"; @@ -25,12 +23,14 @@ export function isPasteAsTextShortcut( } /** - * The threshold is byte-based: character counts substantially understate the - * context cost of some Unicode-heavy clipboard contents. + * `thresholdBytes` is the `pastedTextAttachmentThreshold` setting. It is compared + * with both the length and the UTF-8 byte count: character counts substantially + * understate the context cost of some Unicode-heavy clipboard contents. */ export function pastedTextDisposition(input: { readonly text: string; readonly canAttach: boolean; + readonly thresholdBytes: number; readonly bypassAutoAttachment?: boolean; readonly wouldExceedInputLimit?: boolean; }): PastedTextDisposition { @@ -38,12 +38,22 @@ export function pastedTextDisposition(input: { return "inline"; } return input.wouldExceedInputLimit || - input.text.length >= PASTED_TEXT_ATTACHMENT_THRESHOLD_BYTES || - textEncoder.encode(input.text).byteLength >= PASTED_TEXT_ATTACHMENT_THRESHOLD_BYTES + input.text.length >= input.thresholdBytes || + textEncoder.encode(input.text).byteLength >= input.thresholdBytes ? "attachment" : "inline"; } +/** + * Settings label for a `pastedTextAttachmentThreshold` preset, such as + * "5 KB (~5,000 chars)". Sizes come first because the threshold also counts + * UTF-8 bytes, so non-Latin text and emoji fold with fewer characters. + */ +export function pastedTextThresholdLabel(thresholdBytes: number) { + const kilobytes = Math.floor(thresholdBytes / 1000); + return `${kilobytes} KB (~${(kilobytes * 1000).toLocaleString("en-US")} chars)`; +} + export function nextPastedTextFileName(existingNames: ReadonlyArray): string { const names = new Set(existingNames.map((name) => name.toLowerCase())); if (!names.has("pasted-text.txt")) { diff --git a/packages/contracts/src/settings.test.ts b/packages/contracts/src/settings.test.ts index 4c194f473c7b0..f9c89f994ed4c 100644 --- a/packages/contracts/src/settings.test.ts +++ b/packages/contracts/src/settings.test.ts @@ -303,6 +303,17 @@ describe("resolveIdleCompaction", () => { }); }); +describe("ClientSettings large paste threshold", () => { + it("falls back to the default for a stored preset this build no longer offers", () => { + const settings = decodeClientSettings({ + pastedTextAttachmentThreshold: 4_000, + sendShortcut: "mod-enter", + }); + expect(settings.pastedTextAttachmentThreshold).toBe(32_768); + expect(settings.sendShortcut).toBe("mod-enter"); + }); +}); + describe("ClientSettings notifications", () => { it("requires opt-in when existing settings omit notification preferences", () => { expect(decodeClientSettings({}).notificationMode).toBe("off"); diff --git a/packages/contracts/src/settings.ts b/packages/contracts/src/settings.ts index 00eeb1797870a..79962d803fc42 100644 --- a/packages/contracts/src/settings.ts +++ b/packages/contracts/src/settings.ts @@ -336,6 +336,16 @@ export const LoadBalancingWeights = Schema.Record( export const DiffColorScheme = Schema.Literals(["red-green", "blue-orange"]); +/** + * Paste sizes at which the composer folds clipboard text into a text-file + * attachment. A paste folds when either its length or its UTF-8 byte count + * reaches the threshold. + */ +export const PASTED_TEXT_ATTACHMENT_THRESHOLDS = [1_000, 5_000, 32_768] as const; +export const PastedTextAttachmentThreshold = Schema.Literals(PASTED_TEXT_ATTACHMENT_THRESHOLDS); +export type PastedTextAttachmentThreshold = typeof PastedTextAttachmentThreshold.Type; +export const DEFAULT_PASTED_TEXT_ATTACHMENT_THRESHOLD: PastedTextAttachmentThreshold = 32_768; + export const ChatWidth = Schema.Literals(["comfortable", "wide", "full"]); export type ChatWidth = typeof ChatWidth.Type; @@ -512,6 +522,12 @@ export const ClientSettingsSchema = Schema.Struct({ pullRequestLinksOpenInApp: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))), composerRichTextEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))), + // A stored preset this build no longer offers falls back to the default + // instead of failing the whole settings decode. + pastedTextAttachmentThreshold: PastedTextAttachmentThreshold.pipe( + Schema.catchDecoding(() => Effect.succeedSome(DEFAULT_PASTED_TEXT_ATTACHMENT_THRESHOLD)), + Schema.withDecodingDefault(Effect.succeed(DEFAULT_PASTED_TEXT_ATTACHMENT_THRESHOLD)), + ), sendShortcut: Schema.Literals(["enter", "mod-enter-multiline", "mod-enter"]).pipe( Schema.withDecodingDefault(Effect.succeed("enter")), ), @@ -2046,6 +2062,7 @@ export const ClientSettingsPatch = Schema.Struct({ ), pullRequestLinksOpenInApp: Schema.optionalKey(Schema.Boolean), composerRichTextEnabled: Schema.optionalKey(Schema.Boolean), + pastedTextAttachmentThreshold: Schema.optionalKey(PastedTextAttachmentThreshold), sendShortcut: Schema.optionalKey(Schema.Literals(["enter", "mod-enter-multiline", "mod-enter"])), followUpBehavior: Schema.optionalKey(Schema.Literals(["queue", "steer"])), proactivePanelsEnabled: Schema.optionalKey(Schema.Boolean), From 87e74680ab073ab96346fa9219621d4227d3ed7b Mon Sep 17 00:00:00 2001 From: dand Date: Sat, 14 Nov 2026 21:00:59 -0500 Subject: [PATCH 2/4] test(web): the configured paste threshold reaches the composer's paste path Co-Authored-By: Claude Fable 5.2 --- ...eComposerAttachmentIntake.browser.test.tsx | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/apps/web/src/components/chat/useComposerAttachmentIntake.browser.test.tsx b/apps/web/src/components/chat/useComposerAttachmentIntake.browser.test.tsx index 40346d4f744eb..c4ee753eebffd 100644 --- a/apps/web/src/components/chat/useComposerAttachmentIntake.browser.test.tsx +++ b/apps/web/src/components/chat/useComposerAttachmentIntake.browser.test.tsx @@ -220,3 +220,53 @@ it.each(["thread", "session"] as const)( expect(restored?.images).toEqual([]); }, ); + +it.each([ + { thresholdBytes: 1_000, folds: true }, + { thresholdBytes: DEFAULT_PASTED_TEXT_ATTACHMENT_THRESHOLD, folds: false }, +])( + "a 4,600-byte paste at a $thresholdBytes-byte threshold folds: $folds", + async ({ thresholdBytes, folds }) => { + const attachedNames: string[] = []; + const input = { + activeThreadId: ThreadId.make("thread"), + activePendingProgress: null, + activePendingIsResponding: false, + pendingUserInputs: [], + supportsQuestionAttachments: false, + isLiteralPendingAnswer: false, + projectSelectionRequired: false, + questionAttachmentTarget: null, + attachmentTargetKey: DraftId.make("intake-paste-threshold"), + fileStagingLimit: 1_000_000, + pastedTextAttachmentThreshold: thresholdBytes, + promptRef: { current: "" }, + composerImagesRef: { current: [] }, + composerFilesRef: { current: [] }, + composerEditorRef: { current: null }, + isRevertingCheckpointRef: { current: false }, + setThreadError: () => {}, + countReservedAttachments: () => 0, + addComposerImage: () => [], + addComposerImagesToDraft: () => [], + addComposerFilesToDraft: (files) => { + attachedNames.push(...files.map((file) => file.name)); + return []; + }, + removeComposerImageFromDraft: () => {}, + insertAttachmentReferences: () => false, + } satisfies IntakeInput; + let intake!: Intake; + await using _screen = await render( + { + intake = value; + }} + />, + ); + + expect(intake.foldPastedText("x".repeat(4_600), false)).toBe(folds); + expect(attachedNames).toEqual(folds ? ["pasted-text.txt"] : []); + }, +); From 298861313ae9a6b6d61f7731f629432b9d41582c Mon Sep 17 00:00:00 2001 From: dand Date: Wed, 18 Nov 2026 09:22:15 -0500 Subject: [PATCH 3/4] fix(composer): paste threshold labels show the real boundary in the app's language The default preset read "32 KB (~32,000 chars)" for a 32,768 limit, and the count was grouped in the host's locale. The mobile help text also promised that shorter pastes always stay inline. Co-Authored-By: Claude Fable 5.2 --- .../src/features/settings/SettingsFollowUpRouteScreen.tsx | 4 ++-- apps/mobile/src/i18n/translations/de.json | 6 +++--- apps/mobile/src/i18n/translations/en.json | 6 +++--- apps/mobile/src/i18n/translations/es.json | 6 +++--- apps/mobile/src/i18n/translations/fr.json | 6 +++--- apps/mobile/src/i18n/translations/ja.json | 6 +++--- apps/mobile/src/i18n/translations/ko.json | 6 +++--- apps/mobile/src/i18n/translations/pt-BR.json | 6 +++--- apps/mobile/src/i18n/translations/ru.json | 6 +++--- apps/mobile/src/i18n/translations/sv.json | 6 +++--- apps/mobile/src/i18n/translations/zh.json | 6 +++--- apps/web/src/i18n/translations/de.json | 2 +- apps/web/src/i18n/translations/en.json | 2 +- apps/web/src/i18n/translations/es.json | 2 +- apps/web/src/i18n/translations/fr.json | 2 +- apps/web/src/i18n/translations/ja.json | 2 +- apps/web/src/i18n/translations/ko.json | 2 +- apps/web/src/i18n/translations/pt-BR.json | 2 +- apps/web/src/i18n/translations/ru.json | 2 +- apps/web/src/i18n/translations/sv.json | 2 +- apps/web/src/i18n/translations/zh.json | 2 +- packages/client-runtime/src/textPaste.ts | 7 +++---- 22 files changed, 45 insertions(+), 46 deletions(-) diff --git a/apps/mobile/src/features/settings/SettingsFollowUpRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsFollowUpRouteScreen.tsx index 4824ed6083080..aee00d9630704 100644 --- a/apps/mobile/src/features/settings/SettingsFollowUpRouteScreen.tsx +++ b/apps/mobile/src/features/settings/SettingsFollowUpRouteScreen.tsx @@ -108,8 +108,8 @@ export function SettingsFollowUpRouteScreen() { - Shorter pastes go into the message as text. Non-Latin text and emoji use more bytes per - character, so they reach the limit sooner. With a hardware keyboard, press{" "} + Shorter pastes go into the message as text when they fit. Non-Latin text and emoji use + more bytes per character, so they reach the limit sooner. With a hardware keyboard, press{" "} {PASTE_AS_TEXT_SHORTCUT} to paste a long block as text instead. diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index 19dd3f992c843..a777dc2680ffe 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Versucht, {started} Review-Leitfaden zu starten, {failed} fehlgeschlagen} other {Versucht, {started} Review-Leitfäden zu starten, {failed} fehlgeschlagen}}", "672850007e49cfb6": "{started, plural, one {{started} Review-Leitfaden gestartet} other {{started} Review-Leitfäden gestartet}}", "5dce4a54eaffeccf": "{started, plural, one {Versucht, {started} Review-Leitfaden zu starten} other {Versucht, {started} Review-Leitfäden zu starten}}", - "83570ea312582bc8": "{kilobytes} KB (~{characters} Zeichen)", + "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} Zeichen)", "420bea546d5f8802": "Thread kopiert", "2efb2dd3bf170f67": "Thread konnte nicht kopiert werden", "6c03545936b55e0b": "PR-Link kopiert", @@ -3237,8 +3237,8 @@ }, " gedrückt." ], - "ab73b90398e6771b": [ - "Kürzerer eingefügter Text landet als Text in der Nachricht. Nicht-lateinische Schrift und Emoji belegen mehr Bytes pro Zeichen und erreichen die Grenze daher früher. Mit einer Hardware-Tastatur drückst du ", + "ac88b5819c86bc5b": [ + "Kürzerer eingefügter Text landet als Text in der Nachricht, sofern er hineinpasst. Nicht-lateinische Schrift und Emoji belegen mehr Bytes pro Zeichen und erreichen die Grenze daher früher. Mit einer Hardware-Tastatur drückst du ", { "i": 1, "k": "_gt_value_1", diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index e7579bccd90d7..6a404ecbabb21 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Tried to start {started} review guide, {failed} failed} other {Tried to start {started} review guides, {failed} failed}}", "672850007e49cfb6": "{started, plural, one {Started {started} review guide} other {Started {started} review guides}}", "5dce4a54eaffeccf": "{started, plural, one {Tried to start {started} review guide} other {Tried to start {started} review guides}}", - "83570ea312582bc8": "{kilobytes} KB (~{characters} chars)", + "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} chars)", "420bea546d5f8802": "Thread copied", "2efb2dd3bf170f67": "Failed to copy thread", "6c03545936b55e0b": "PR link copied", @@ -3238,8 +3238,8 @@ }, " while sending." ], - "ab73b90398e6771b": [ - "Shorter pastes go into the message as text. Non-Latin text and emoji use more bytes per character, so they reach the limit sooner. With a hardware keyboard, press", + "ac88b5819c86bc5b": [ + "Shorter pastes go into the message as text when they fit. Non-Latin text and emoji use more bytes per character, so they reach the limit sooner. With a hardware keyboard, press", " ", { "i": 1, diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index eea5c84bb1952..0d4d2f32e8410 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Intentó iniciar {started} guía de revisión, {failed} con errores} other {Intentó iniciar {started} guías de revisión, {failed} con errores}}", "672850007e49cfb6": "{started, plural, one {Inició {started} guía de revisión} other {Inició {started} guías de revisión}}", "5dce4a54eaffeccf": "{started, plural, one {Intentó iniciar {started} guía de revisión} other {Intentó iniciar {started} guías de revisión}}", - "83570ea312582bc8": "{kilobytes} KB (~{characters} caracteres)", + "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} caracteres)", "420bea546d5f8802": "Hilo copiado", "2efb2dd3bf170f67": "No se pudo copiar el hilo", "6c03545936b55e0b": "Enlace de la PR copiado", @@ -3232,8 +3232,8 @@ }, " al enviar." ], - "ab73b90398e6771b": [ - "Los pegados más cortos entran en el mensaje como texto. El texto no latino y los emojis ocupan más bytes por carácter, así que alcanzan el límite antes. Con un teclado físico, pulsa ", + "ac88b5819c86bc5b": [ + "Los pegados más cortos entran en el mensaje como texto si caben. El texto no latino y los emojis ocupan más bytes por carácter, así que alcanzan el límite antes. Con un teclado físico, pulsa ", { "i": 1, "k": "_gt_value_1", diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index 6af1cf0cb3462..807e92e544a14 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Tentative de lancer {started} guide de revue, {failed} en échec} other {Tentative de lancer {started} guides de revue, {failed} en échec}}", "672850007e49cfb6": "{started, plural, one {{started} guide de revue lancé} other {{started} guides de revue lancés}}", "5dce4a54eaffeccf": "{started, plural, one {Tentative de lancer {started} guide de revue} other {Tentative de lancer {started} guides de revue}}", - "83570ea312582bc8": "{kilobytes} Ko (~{characters} caractères)", + "c62d732adb53f0ab": "{kilobytes} Ko (~{characters, number} caractères)", "420bea546d5f8802": "Fil copié", "2efb2dd3bf170f67": "Échec de la copie du fil", "6c03545936b55e0b": "Lien de la PR copié", @@ -3232,8 +3232,8 @@ }, " pendant l’envoi." ], - "ab73b90398e6771b": [ - "Les collages plus courts sont insérés dans le message sous forme de texte. Les textes non latins et les émojis occupent plus d’octets par caractère et atteignent donc la limite plus tôt. Avec un clavier physique, appuyez sur ", + "ac88b5819c86bc5b": [ + "Les collages plus courts sont insérés dans le message sous forme de texte s’ils y tiennent. Les textes non latins et les émojis occupent plus d’octets par caractère et atteignent donc la limite plus tôt. Avec un clavier physique, appuyez sur ", { "i": 1, "k": "_gt_value_1", diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index a543d89b4bb74..abf000077bf58 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, other {{started} 件のレビューガイドを開始しようとしました。{failed} 件失敗しました}}", "672850007e49cfb6": "{started, plural, other {{started} 件のレビューガイドを開始しました}}", "5dce4a54eaffeccf": "{started, plural, other {{started} 件のレビューガイドを開始しようとしました}}", - "83570ea312582bc8": "{kilobytes} KB(約 {characters} 文字)", + "c62d732adb53f0ab": "{kilobytes} KB(約 {characters, number} 文字)", "420bea546d5f8802": "スレッドをコピーしました", "2efb2dd3bf170f67": "スレッドをコピーできませんでした", "6c03545936b55e0b": "PR のリンクをコピーしました", @@ -3229,8 +3229,8 @@ }, " を押しながら送信します。" ], - "ab73b90398e6771b": [ - "これより短い貼り付けはテキストとしてメッセージに入ります。ラテン文字以外の文字や絵文字は 1 文字あたりのバイト数が多いため、より少ない文字数で上限に達します。ハードウェアキーボードでは、", + "ac88b5819c86bc5b": [ + "これより短い貼り付けは、メッセージに収まる場合はテキストとして入ります。ラテン文字以外の文字や絵文字は 1 文字あたりのバイト数が多いため、より少ない文字数で上限に達します。ハードウェアキーボードでは、", { "i": 1, "k": "_gt_value_1", diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index bc2a59f9ec11a..f3cb5f7e3b0ca 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, other {검토 가이드 {started}개 시작 시도함, {failed}개 실패}}", "672850007e49cfb6": "{started, plural, other {검토 가이드 {started}개 시작함}}", "5dce4a54eaffeccf": "{started, plural, other {검토 가이드 {started}개 시작 시도함}}", - "83570ea312582bc8": "{kilobytes} KB(약 {characters}자)", + "c62d732adb53f0ab": "{kilobytes} KB(약 {characters, number}자)", "420bea546d5f8802": "스레드 복사됨", "2efb2dd3bf170f67": "스레드를 복사하지 못했습니다", "6c03545936b55e0b": "PR 링크 복사됨", @@ -3233,8 +3233,8 @@ }, "를 누른 채 보내세요." ], - "ab73b90398e6771b": [ - "이보다 짧은 붙여넣기는 텍스트로 메시지에 들어갑니다. 라틴 문자가 아닌 글자와 이모지는 글자당 바이트 수가 많아 더 적은 글자 수로 한도에 도달합니다. 하드웨어 키보드에서는 ", + "ac88b5819c86bc5b": [ + "이보다 짧은 붙여넣기는 메시지에 들어갈 수 있으면 텍스트로 들어갑니다. 라틴 문자가 아닌 글자와 이모지는 글자당 바이트 수가 많아 더 적은 글자 수로 한도에 도달합니다. 하드웨어 키보드에서는 ", { "i": 1, "k": "_gt_value_1", diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index aec256efdb6fd..5297a36d46349 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Tentou iniciar {started} guia de revisão, {failed} com falha} other {Tentou iniciar {started} guias de revisão, {failed} com falha}}", "672850007e49cfb6": "{started, plural, one {Iniciou {started} guia de revisão} other {Iniciou {started} guias de revisão}}", "5dce4a54eaffeccf": "{started, plural, one {Tentou iniciar {started} guia de revisão} other {Tentou iniciar {started} guias de revisão}}", - "83570ea312582bc8": "{kilobytes} KB (~{characters} caracteres)", + "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} caracteres)", "420bea546d5f8802": "Thread copiada", "2efb2dd3bf170f67": "Falha ao copiar a thread", "6c03545936b55e0b": "Link do PR copiado", @@ -3232,8 +3232,8 @@ }, " ao enviar." ], - "ab73b90398e6771b": [ - "Colagens mais curtas entram na mensagem como texto. Texto não latino e emojis usam mais bytes por caractere, então chegam ao limite antes. Com um teclado físico, pressione ", + "ac88b5819c86bc5b": [ + "Colagens mais curtas entram na mensagem como texto se couberem. Texto não latino e emojis usam mais bytes por caractere, então chegam ao limite antes. Com um teclado físico, pressione ", { "i": 1, "k": "_gt_value_1", diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index ef1cb04afd4a2..8b06506ccf35d 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Попытка начать {started} руководство по ревью, ошибок: {failed}} few {Попытка начать {started} руководства по ревью, ошибок: {failed}} many {Попытка начать {started} руководств по ревью, ошибок: {failed}} other {Попытка начать {started} руководства по ревью, ошибок: {failed}}}", "672850007e49cfb6": "{started, plural, one {Начато {started} руководство по ревью} few {Начато {started} руководства по ревью} many {Начато {started} руководств по ревью} other {Начато {started} руководства по ревью}}", "5dce4a54eaffeccf": "{started, plural, one {Попытка начать {started} руководство по ревью} few {Попытка начать {started} руководства по ревью} many {Попытка начать {started} руководств по ревью} other {Попытка начать {started} руководства по ревью}}", - "83570ea312582bc8": "{kilobytes} КБ (~{characters} симв.)", + "c62d732adb53f0ab": "{kilobytes} КБ (~{characters, number} симв.)", "420bea546d5f8802": "Тред скопирован", "2efb2dd3bf170f67": "Не удалось скопировать тред", "6c03545936b55e0b": "Ссылка на PR скопирована", @@ -3286,8 +3286,8 @@ }, " при отправке." ], - "ab73b90398e6771b": [ - "Более короткие вставки попадают в сообщение как текст. Нелатинский текст и эмодзи занимают больше байтов на символ, поэтому достигают лимита раньше. С аппаратной клавиатурой нажмите ", + "ac88b5819c86bc5b": [ + "Более короткие вставки попадают в сообщение как текст, если помещаются. Нелатинский текст и эмодзи занимают больше байтов на символ, поэтому достигают лимита раньше. С аппаратной клавиатурой нажмите ", { "i": 1, "k": "_gt_value_1", diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index aff7892e28275..4e7e9bb45a223 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Försökte starta {started} granskningsguide, {failed} misslyckades} other {Försökte starta {started} granskningsguider, {failed} misslyckades}}", "672850007e49cfb6": "{started, plural, one {Startade {started} granskningsguide} other {Startade {started} granskningsguider}}", "5dce4a54eaffeccf": "{started, plural, one {Försökte starta {started} granskningsguide} other {Försökte starta {started} granskningsguider}}", - "83570ea312582bc8": "{kilobytes} kB (~{characters} tecken)", + "c62d732adb53f0ab": "{kilobytes} kB (~{characters, number} tecken)", "420bea546d5f8802": "Tråden kopierades", "2efb2dd3bf170f67": "Det gick inte att kopiera tråden", "6c03545936b55e0b": "PR-länken kopierades", @@ -3238,8 +3238,8 @@ }, " när du skickar." ], - "ab73b90398e6771b": [ - "Kortare inklistringar hamnar som text i meddelandet. Icke-latinsk text och emojier tar fler byte per tecken och når gränsen därför tidigare. Med ett fysiskt tangentbord trycker du på ", + "ac88b5819c86bc5b": [ + "Kortare inklistringar hamnar som text i meddelandet om de får plats. Icke-latinsk text och emojier tar fler byte per tecken och når gränsen därför tidigare. Med ett fysiskt tangentbord trycker du på ", { "i": 1, "k": "_gt_value_1", diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index 923d31afb06e2..8efc05b3b6544 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, other {尝试开始 {started} 份审查导览,{failed} 份失败}}", "672850007e49cfb6": "{started, plural, other {已开始 {started} 份审查导览}}", "5dce4a54eaffeccf": "{started, plural, other {尝试开始 {started} 份审查导览}}", - "83570ea312582bc8": "{kilobytes} KB(约 {characters} 个字符)", + "c62d732adb53f0ab": "{kilobytes} KB(约 {characters, number} 个字符)", "420bea546d5f8802": "已复制会话", "2efb2dd3bf170f67": "无法复制会话", "6c03545936b55e0b": "已复制 PR 链接", @@ -3234,8 +3234,8 @@ }, "。" ], - "ab73b90398e6771b": [ - "较短的粘贴内容会作为文字进入消息。非拉丁文字和表情符号每个字符占用更多字节,因此会更早达到上限。使用硬件键盘时,按 ", + "ac88b5819c86bc5b": [ + "较短的粘贴内容在消息容纳得下时会作为文字进入消息。非拉丁文字和表情符号每个字符占用更多字节,因此会更早达到上限。使用硬件键盘时,按 ", { "i": 1, "k": "_gt_value_1", diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 7c5222b01e19e..eac327c7e500e 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Versucht, {started} Review-Leitfaden zu starten, {failed} fehlgeschlagen} other {Versucht, {started} Review-Leitfäden zu starten, {failed} fehlgeschlagen}}", "672850007e49cfb6": "{started, plural, one {{started} Review-Leitfaden gestartet} other {{started} Review-Leitfäden gestartet}}", "5dce4a54eaffeccf": "{started, plural, one {Versucht, {started} Review-Leitfaden zu starten} other {Versucht, {started} Review-Leitfäden zu starten}}", - "83570ea312582bc8": "{kilobytes} KB (~{characters} Zeichen)", + "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} Zeichen)", "420bea546d5f8802": "Thread kopiert", "2efb2dd3bf170f67": "Thread konnte nicht kopiert werden", "6c03545936b55e0b": "PR-Link kopiert", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index 5c8159a0a4872..35d187ee3ffc4 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Tried to start {started} review guide, {failed} failed} other {Tried to start {started} review guides, {failed} failed}}", "672850007e49cfb6": "{started, plural, one {Started {started} review guide} other {Started {started} review guides}}", "5dce4a54eaffeccf": "{started, plural, one {Tried to start {started} review guide} other {Tried to start {started} review guides}}", - "83570ea312582bc8": "{kilobytes} KB (~{characters} chars)", + "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} chars)", "420bea546d5f8802": "Thread copied", "2efb2dd3bf170f67": "Failed to copy thread", "6c03545936b55e0b": "PR link copied", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index f1622ec153098..0522ee1610989 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Intentó iniciar {started} guía de revisión, {failed} con errores} other {Intentó iniciar {started} guías de revisión, {failed} con errores}}", "672850007e49cfb6": "{started, plural, one {Inició {started} guía de revisión} other {Inició {started} guías de revisión}}", "5dce4a54eaffeccf": "{started, plural, one {Intentó iniciar {started} guía de revisión} other {Intentó iniciar {started} guías de revisión}}", - "83570ea312582bc8": "{kilobytes} KB (~{characters} caracteres)", + "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} caracteres)", "420bea546d5f8802": "Hilo copiado", "2efb2dd3bf170f67": "No se pudo copiar el hilo", "6c03545936b55e0b": "Enlace de la PR copiado", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index 18d2f1b190e5d..c7f2e1e772874 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Tentative de lancer {started} guide de revue, {failed} en échec} other {Tentative de lancer {started} guides de revue, {failed} en échec}}", "672850007e49cfb6": "{started, plural, one {{started} guide de revue lancé} other {{started} guides de revue lancés}}", "5dce4a54eaffeccf": "{started, plural, one {Tentative de lancer {started} guide de revue} other {Tentative de lancer {started} guides de revue}}", - "83570ea312582bc8": "{kilobytes} Ko (~{characters} caractères)", + "c62d732adb53f0ab": "{kilobytes} Ko (~{characters, number} caractères)", "420bea546d5f8802": "Fil copié", "2efb2dd3bf170f67": "Échec de la copie du fil", "6c03545936b55e0b": "Lien de la PR copié", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index 0f0e8165165b7..fea996e018d0c 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, other {{started} 件のレビューガイドを開始しようとしました。{failed} 件失敗しました}}", "672850007e49cfb6": "{started, plural, other {{started} 件のレビューガイドを開始しました}}", "5dce4a54eaffeccf": "{started, plural, other {{started} 件のレビューガイドを開始しようとしました}}", - "83570ea312582bc8": "{kilobytes} KB(約 {characters} 文字)", + "c62d732adb53f0ab": "{kilobytes} KB(約 {characters, number} 文字)", "420bea546d5f8802": "スレッドをコピーしました", "2efb2dd3bf170f67": "スレッドをコピーできませんでした", "6c03545936b55e0b": "PR のリンクをコピーしました", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index 558cfa4435e80..5a9258e2a1c9b 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, other {검토 가이드 {started}개 시작 시도함, {failed}개 실패}}", "672850007e49cfb6": "{started, plural, other {검토 가이드 {started}개 시작함}}", "5dce4a54eaffeccf": "{started, plural, other {검토 가이드 {started}개 시작 시도함}}", - "83570ea312582bc8": "{kilobytes} KB(약 {characters}자)", + "c62d732adb53f0ab": "{kilobytes} KB(약 {characters, number}자)", "420bea546d5f8802": "스레드 복사됨", "2efb2dd3bf170f67": "스레드를 복사하지 못했습니다", "6c03545936b55e0b": "PR 링크 복사됨", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index b637ff79de8bb..6046e2df2e2be 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Tentou iniciar {started} guia de revisão, {failed} com falha} other {Tentou iniciar {started} guias de revisão, {failed} com falha}}", "672850007e49cfb6": "{started, plural, one {Iniciou {started} guia de revisão} other {Iniciou {started} guias de revisão}}", "5dce4a54eaffeccf": "{started, plural, one {Tentou iniciar {started} guia de revisão} other {Tentou iniciar {started} guias de revisão}}", - "83570ea312582bc8": "{kilobytes} KB (~{characters} caracteres)", + "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} caracteres)", "420bea546d5f8802": "Thread copiada", "2efb2dd3bf170f67": "Falha ao copiar a thread", "6c03545936b55e0b": "Link do PR copiado", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 4535e0900a2e5..7d0a9de344c61 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Попытка начать {started} руководство по ревью, ошибок: {failed}} few {Попытка начать {started} руководства по ревью, ошибок: {failed}} many {Попытка начать {started} руководств по ревью, ошибок: {failed}} other {Попытка начать {started} руководства по ревью, ошибок: {failed}}}", "672850007e49cfb6": "{started, plural, one {Начато {started} руководство по ревью} few {Начато {started} руководства по ревью} many {Начато {started} руководств по ревью} other {Начато {started} руководства по ревью}}", "5dce4a54eaffeccf": "{started, plural, one {Попытка начать {started} руководство по ревью} few {Попытка начать {started} руководства по ревью} many {Попытка начать {started} руководств по ревью} other {Попытка начать {started} руководства по ревью}}", - "83570ea312582bc8": "{kilobytes} КБ (~{characters} симв.)", + "c62d732adb53f0ab": "{kilobytes} КБ (~{characters, number} симв.)", "420bea546d5f8802": "Тред скопирован", "2efb2dd3bf170f67": "Не удалось скопировать тред", "6c03545936b55e0b": "Ссылка на PR скопирована", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index 3a2d4e6fc3ef8..e418fddc07e7c 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Försökte starta {started} granskningsguide, {failed} misslyckades} other {Försökte starta {started} granskningsguider, {failed} misslyckades}}", "672850007e49cfb6": "{started, plural, one {Startade {started} granskningsguide} other {Startade {started} granskningsguider}}", "5dce4a54eaffeccf": "{started, plural, one {Försökte starta {started} granskningsguide} other {Försökte starta {started} granskningsguider}}", - "83570ea312582bc8": "{kilobytes} kB (~{characters} tecken)", + "c62d732adb53f0ab": "{kilobytes} kB (~{characters, number} tecken)", "420bea546d5f8802": "Tråden kopierades", "2efb2dd3bf170f67": "Det gick inte att kopiera tråden", "6c03545936b55e0b": "PR-länken kopierades", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index 5c887be1283a6..b800c7be0a0db 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -306,7 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, other {尝试开始 {started} 份审查导览,{failed} 份失败}}", "672850007e49cfb6": "{started, plural, other {已开始 {started} 份审查导览}}", "5dce4a54eaffeccf": "{started, plural, other {尝试开始 {started} 份审查导览}}", - "83570ea312582bc8": "{kilobytes} KB(约 {characters} 个字符)", + "c62d732adb53f0ab": "{kilobytes} KB(约 {characters, number} 个字符)", "420bea546d5f8802": "已复制会话", "2efb2dd3bf170f67": "无法复制会话", "6c03545936b55e0b": "已复制 PR 链接", diff --git a/packages/client-runtime/src/textPaste.ts b/packages/client-runtime/src/textPaste.ts index 5c5b8aab7d61d..45036378f0017 100644 --- a/packages/client-runtime/src/textPaste.ts +++ b/packages/client-runtime/src/textPaste.ts @@ -56,11 +56,10 @@ export function pastedTextThresholdLabel( thresholdBytes: number, resolve: MFunctionType = mFallback, ) { - const kilobytes = Math.floor(thresholdBytes / 1000); return resolve( - msg("{kilobytes} KB (~{characters} chars)", { - kilobytes, - characters: (kilobytes * 1000).toLocaleString(), + msg("{kilobytes} KB (~{characters, number} chars)", { + kilobytes: Math.floor(thresholdBytes / 1000), + characters: thresholdBytes, }), ); } From ae0983f8584d3e29c8326414affb309195d57c97 Mon Sep 17 00:00:00 2001 From: dand Date: Wed, 18 Nov 2026 10:42:59 -0500 Subject: [PATCH 4/4] fix(composer): the default paste threshold reads 32 KiB, not 32 KB The default preset is 32,768 bytes, which is 32 KiB. Its label rounded that down to "32 KB", and the user guide said "about 32,000 characters", so both understated where a paste starts to fold. The label now uses KiB for the binary preset and the guide is back to main's "32 KiB" wording. The 1 KB and 5 KB presets and the fold behavior are unchanged. Co-Authored-By: Claude Fable 5.2 --- apps/mobile/src/i18n/translations/de.json | 1 + apps/mobile/src/i18n/translations/en.json | 1 + apps/mobile/src/i18n/translations/es.json | 1 + apps/mobile/src/i18n/translations/fr.json | 1 + apps/mobile/src/i18n/translations/ja.json | 1 + apps/mobile/src/i18n/translations/ko.json | 1 + apps/mobile/src/i18n/translations/pt-BR.json | 1 + apps/mobile/src/i18n/translations/ru.json | 1 + apps/mobile/src/i18n/translations/sv.json | 1 + apps/mobile/src/i18n/translations/zh.json | 1 + apps/web/src/i18n/translations/de.json | 1 + apps/web/src/i18n/translations/en.json | 1 + apps/web/src/i18n/translations/es.json | 1 + apps/web/src/i18n/translations/fr.json | 1 + apps/web/src/i18n/translations/ja.json | 1 + apps/web/src/i18n/translations/ko.json | 1 + apps/web/src/i18n/translations/pt-BR.json | 1 + apps/web/src/i18n/translations/ru.json | 1 + apps/web/src/i18n/translations/sv.json | 1 + apps/web/src/i18n/translations/zh.json | 1 + docs/user/composer.md | 2 +- packages/client-runtime/src/textPaste.ts | 13 +++++++++---- 22 files changed, 30 insertions(+), 5 deletions(-) diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index a777dc2680ffe..8c358a726a4fe 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Versucht, {started} Review-Leitfaden zu starten, {failed} fehlgeschlagen} other {Versucht, {started} Review-Leitfäden zu starten, {failed} fehlgeschlagen}}", "672850007e49cfb6": "{started, plural, one {{started} Review-Leitfaden gestartet} other {{started} Review-Leitfäden gestartet}}", "5dce4a54eaffeccf": "{started, plural, one {Versucht, {started} Review-Leitfaden zu starten} other {Versucht, {started} Review-Leitfäden zu starten}}", + "de2c541d89da7d2d": "{kibibytes} KiB (~{characters, number} Zeichen)", "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} Zeichen)", "420bea546d5f8802": "Thread kopiert", "2efb2dd3bf170f67": "Thread konnte nicht kopiert werden", diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index 6a404ecbabb21..0d27924f218e3 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Tried to start {started} review guide, {failed} failed} other {Tried to start {started} review guides, {failed} failed}}", "672850007e49cfb6": "{started, plural, one {Started {started} review guide} other {Started {started} review guides}}", "5dce4a54eaffeccf": "{started, plural, one {Tried to start {started} review guide} other {Tried to start {started} review guides}}", + "de2c541d89da7d2d": "{kibibytes} KiB (~{characters, number} chars)", "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} chars)", "420bea546d5f8802": "Thread copied", "2efb2dd3bf170f67": "Failed to copy thread", diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index 0d4d2f32e8410..bef3b43c83503 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Intentó iniciar {started} guía de revisión, {failed} con errores} other {Intentó iniciar {started} guías de revisión, {failed} con errores}}", "672850007e49cfb6": "{started, plural, one {Inició {started} guía de revisión} other {Inició {started} guías de revisión}}", "5dce4a54eaffeccf": "{started, plural, one {Intentó iniciar {started} guía de revisión} other {Intentó iniciar {started} guías de revisión}}", + "de2c541d89da7d2d": "{kibibytes} KiB (~{characters, number} caracteres)", "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} caracteres)", "420bea546d5f8802": "Hilo copiado", "2efb2dd3bf170f67": "No se pudo copiar el hilo", diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index 807e92e544a14..a4d111e43262c 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Tentative de lancer {started} guide de revue, {failed} en échec} other {Tentative de lancer {started} guides de revue, {failed} en échec}}", "672850007e49cfb6": "{started, plural, one {{started} guide de revue lancé} other {{started} guides de revue lancés}}", "5dce4a54eaffeccf": "{started, plural, one {Tentative de lancer {started} guide de revue} other {Tentative de lancer {started} guides de revue}}", + "de2c541d89da7d2d": "{kibibytes} Kio (~{characters, number} caractères)", "c62d732adb53f0ab": "{kilobytes} Ko (~{characters, number} caractères)", "420bea546d5f8802": "Fil copié", "2efb2dd3bf170f67": "Échec de la copie du fil", diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index abf000077bf58..1e16862f49463 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, other {{started} 件のレビューガイドを開始しようとしました。{failed} 件失敗しました}}", "672850007e49cfb6": "{started, plural, other {{started} 件のレビューガイドを開始しました}}", "5dce4a54eaffeccf": "{started, plural, other {{started} 件のレビューガイドを開始しようとしました}}", + "de2c541d89da7d2d": "{kibibytes} KiB(約 {characters, number} 文字)", "c62d732adb53f0ab": "{kilobytes} KB(約 {characters, number} 文字)", "420bea546d5f8802": "スレッドをコピーしました", "2efb2dd3bf170f67": "スレッドをコピーできませんでした", diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index f3cb5f7e3b0ca..81ee724e3a879 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, other {검토 가이드 {started}개 시작 시도함, {failed}개 실패}}", "672850007e49cfb6": "{started, plural, other {검토 가이드 {started}개 시작함}}", "5dce4a54eaffeccf": "{started, plural, other {검토 가이드 {started}개 시작 시도함}}", + "de2c541d89da7d2d": "{kibibytes} KiB(약 {characters, number}자)", "c62d732adb53f0ab": "{kilobytes} KB(약 {characters, number}자)", "420bea546d5f8802": "스레드 복사됨", "2efb2dd3bf170f67": "스레드를 복사하지 못했습니다", diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index 5297a36d46349..e7770790b1a46 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Tentou iniciar {started} guia de revisão, {failed} com falha} other {Tentou iniciar {started} guias de revisão, {failed} com falha}}", "672850007e49cfb6": "{started, plural, one {Iniciou {started} guia de revisão} other {Iniciou {started} guias de revisão}}", "5dce4a54eaffeccf": "{started, plural, one {Tentou iniciar {started} guia de revisão} other {Tentou iniciar {started} guias de revisão}}", + "de2c541d89da7d2d": "{kibibytes} KiB (~{characters, number} caracteres)", "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} caracteres)", "420bea546d5f8802": "Thread copiada", "2efb2dd3bf170f67": "Falha ao copiar a thread", diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index 8b06506ccf35d..08fbbc780903e 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Попытка начать {started} руководство по ревью, ошибок: {failed}} few {Попытка начать {started} руководства по ревью, ошибок: {failed}} many {Попытка начать {started} руководств по ревью, ошибок: {failed}} other {Попытка начать {started} руководства по ревью, ошибок: {failed}}}", "672850007e49cfb6": "{started, plural, one {Начато {started} руководство по ревью} few {Начато {started} руководства по ревью} many {Начато {started} руководств по ревью} other {Начато {started} руководства по ревью}}", "5dce4a54eaffeccf": "{started, plural, one {Попытка начать {started} руководство по ревью} few {Попытка начать {started} руководства по ревью} many {Попытка начать {started} руководств по ревью} other {Попытка начать {started} руководства по ревью}}", + "de2c541d89da7d2d": "{kibibytes} КиБ (~{characters, number} симв.)", "c62d732adb53f0ab": "{kilobytes} КБ (~{characters, number} симв.)", "420bea546d5f8802": "Тред скопирован", "2efb2dd3bf170f67": "Не удалось скопировать тред", diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index 4e7e9bb45a223..1b5ea667c7692 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Försökte starta {started} granskningsguide, {failed} misslyckades} other {Försökte starta {started} granskningsguider, {failed} misslyckades}}", "672850007e49cfb6": "{started, plural, one {Startade {started} granskningsguide} other {Startade {started} granskningsguider}}", "5dce4a54eaffeccf": "{started, plural, one {Försökte starta {started} granskningsguide} other {Försökte starta {started} granskningsguider}}", + "de2c541d89da7d2d": "{kibibytes} KiB (~{characters, number} tecken)", "c62d732adb53f0ab": "{kilobytes} kB (~{characters, number} tecken)", "420bea546d5f8802": "Tråden kopierades", "2efb2dd3bf170f67": "Det gick inte att kopiera tråden", diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index 8efc05b3b6544..b7d0eedb84ba3 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, other {尝试开始 {started} 份审查导览,{failed} 份失败}}", "672850007e49cfb6": "{started, plural, other {已开始 {started} 份审查导览}}", "5dce4a54eaffeccf": "{started, plural, other {尝试开始 {started} 份审查导览}}", + "de2c541d89da7d2d": "{kibibytes} KiB(约 {characters, number} 个字符)", "c62d732adb53f0ab": "{kilobytes} KB(约 {characters, number} 个字符)", "420bea546d5f8802": "已复制会话", "2efb2dd3bf170f67": "无法复制会话", diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index eac327c7e500e..942ffb4beebd8 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Versucht, {started} Review-Leitfaden zu starten, {failed} fehlgeschlagen} other {Versucht, {started} Review-Leitfäden zu starten, {failed} fehlgeschlagen}}", "672850007e49cfb6": "{started, plural, one {{started} Review-Leitfaden gestartet} other {{started} Review-Leitfäden gestartet}}", "5dce4a54eaffeccf": "{started, plural, one {Versucht, {started} Review-Leitfaden zu starten} other {Versucht, {started} Review-Leitfäden zu starten}}", + "de2c541d89da7d2d": "{kibibytes} KiB (~{characters, number} Zeichen)", "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} Zeichen)", "420bea546d5f8802": "Thread kopiert", "2efb2dd3bf170f67": "Thread konnte nicht kopiert werden", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index 35d187ee3ffc4..023264df9e88c 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Tried to start {started} review guide, {failed} failed} other {Tried to start {started} review guides, {failed} failed}}", "672850007e49cfb6": "{started, plural, one {Started {started} review guide} other {Started {started} review guides}}", "5dce4a54eaffeccf": "{started, plural, one {Tried to start {started} review guide} other {Tried to start {started} review guides}}", + "de2c541d89da7d2d": "{kibibytes} KiB (~{characters, number} chars)", "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} chars)", "420bea546d5f8802": "Thread copied", "2efb2dd3bf170f67": "Failed to copy thread", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 0522ee1610989..5b50b4210c0cc 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Intentó iniciar {started} guía de revisión, {failed} con errores} other {Intentó iniciar {started} guías de revisión, {failed} con errores}}", "672850007e49cfb6": "{started, plural, one {Inició {started} guía de revisión} other {Inició {started} guías de revisión}}", "5dce4a54eaffeccf": "{started, plural, one {Intentó iniciar {started} guía de revisión} other {Intentó iniciar {started} guías de revisión}}", + "de2c541d89da7d2d": "{kibibytes} KiB (~{characters, number} caracteres)", "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} caracteres)", "420bea546d5f8802": "Hilo copiado", "2efb2dd3bf170f67": "No se pudo copiar el hilo", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index c7f2e1e772874..973c3eb4545a4 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Tentative de lancer {started} guide de revue, {failed} en échec} other {Tentative de lancer {started} guides de revue, {failed} en échec}}", "672850007e49cfb6": "{started, plural, one {{started} guide de revue lancé} other {{started} guides de revue lancés}}", "5dce4a54eaffeccf": "{started, plural, one {Tentative de lancer {started} guide de revue} other {Tentative de lancer {started} guides de revue}}", + "de2c541d89da7d2d": "{kibibytes} Kio (~{characters, number} caractères)", "c62d732adb53f0ab": "{kilobytes} Ko (~{characters, number} caractères)", "420bea546d5f8802": "Fil copié", "2efb2dd3bf170f67": "Échec de la copie du fil", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index fea996e018d0c..bd20602e58e41 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, other {{started} 件のレビューガイドを開始しようとしました。{failed} 件失敗しました}}", "672850007e49cfb6": "{started, plural, other {{started} 件のレビューガイドを開始しました}}", "5dce4a54eaffeccf": "{started, plural, other {{started} 件のレビューガイドを開始しようとしました}}", + "de2c541d89da7d2d": "{kibibytes} KiB(約 {characters, number} 文字)", "c62d732adb53f0ab": "{kilobytes} KB(約 {characters, number} 文字)", "420bea546d5f8802": "スレッドをコピーしました", "2efb2dd3bf170f67": "スレッドをコピーできませんでした", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index 5a9258e2a1c9b..e9f764edc192c 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, other {검토 가이드 {started}개 시작 시도함, {failed}개 실패}}", "672850007e49cfb6": "{started, plural, other {검토 가이드 {started}개 시작함}}", "5dce4a54eaffeccf": "{started, plural, other {검토 가이드 {started}개 시작 시도함}}", + "de2c541d89da7d2d": "{kibibytes} KiB(약 {characters, number}자)", "c62d732adb53f0ab": "{kilobytes} KB(약 {characters, number}자)", "420bea546d5f8802": "스레드 복사됨", "2efb2dd3bf170f67": "스레드를 복사하지 못했습니다", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index 6046e2df2e2be..827699a3a42a1 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Tentou iniciar {started} guia de revisão, {failed} com falha} other {Tentou iniciar {started} guias de revisão, {failed} com falha}}", "672850007e49cfb6": "{started, plural, one {Iniciou {started} guia de revisão} other {Iniciou {started} guias de revisão}}", "5dce4a54eaffeccf": "{started, plural, one {Tentou iniciar {started} guia de revisão} other {Tentou iniciar {started} guias de revisão}}", + "de2c541d89da7d2d": "{kibibytes} KiB (~{characters, number} caracteres)", "c62d732adb53f0ab": "{kilobytes} KB (~{characters, number} caracteres)", "420bea546d5f8802": "Thread copiada", "2efb2dd3bf170f67": "Falha ao copiar a thread", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 7d0a9de344c61..e989e047beaca 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Попытка начать {started} руководство по ревью, ошибок: {failed}} few {Попытка начать {started} руководства по ревью, ошибок: {failed}} many {Попытка начать {started} руководств по ревью, ошибок: {failed}} other {Попытка начать {started} руководства по ревью, ошибок: {failed}}}", "672850007e49cfb6": "{started, plural, one {Начато {started} руководство по ревью} few {Начато {started} руководства по ревью} many {Начато {started} руководств по ревью} other {Начато {started} руководства по ревью}}", "5dce4a54eaffeccf": "{started, plural, one {Попытка начать {started} руководство по ревью} few {Попытка начать {started} руководства по ревью} many {Попытка начать {started} руководств по ревью} other {Попытка начать {started} руководства по ревью}}", + "de2c541d89da7d2d": "{kibibytes} КиБ (~{characters, number} симв.)", "c62d732adb53f0ab": "{kilobytes} КБ (~{characters, number} симв.)", "420bea546d5f8802": "Тред скопирован", "2efb2dd3bf170f67": "Не удалось скопировать тред", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index e418fddc07e7c..71c21f3334fee 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, one {Försökte starta {started} granskningsguide, {failed} misslyckades} other {Försökte starta {started} granskningsguider, {failed} misslyckades}}", "672850007e49cfb6": "{started, plural, one {Startade {started} granskningsguide} other {Startade {started} granskningsguider}}", "5dce4a54eaffeccf": "{started, plural, one {Försökte starta {started} granskningsguide} other {Försökte starta {started} granskningsguider}}", + "de2c541d89da7d2d": "{kibibytes} KiB (~{characters, number} tecken)", "c62d732adb53f0ab": "{kilobytes} kB (~{characters, number} tecken)", "420bea546d5f8802": "Tråden kopierades", "2efb2dd3bf170f67": "Det gick inte att kopiera tråden", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index b800c7be0a0db..26978d659281a 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -306,6 +306,7 @@ "1b659e38a50d9bc5": "{started, plural, other {尝试开始 {started} 份审查导览,{failed} 份失败}}", "672850007e49cfb6": "{started, plural, other {已开始 {started} 份审查导览}}", "5dce4a54eaffeccf": "{started, plural, other {尝试开始 {started} 份审查导览}}", + "de2c541d89da7d2d": "{kibibytes} KiB(约 {characters, number} 个字符)", "c62d732adb53f0ab": "{kilobytes} KB(约 {characters, number} 个字符)", "420bea546d5f8802": "已复制会话", "2efb2dd3bf170f67": "无法复制会话", diff --git a/docs/user/composer.md b/docs/user/composer.md index b40d61232dab3..9ed3f4b61d8f5 100644 --- a/docs/user/composer.md +++ b/docs/user/composer.md @@ -6,7 +6,7 @@ include a skill when the task needs more context. Messages can contain up to 120,000 characters. Longer drafts stay in the composer so you can shorten them or split them into several messages. -Pasting 32 KB (about 32,000 characters) or more of text adds that fragment as a +Pasting 32 KiB (about 32,768 characters) or more of text adds that fragment as a text-file attachment so the agent can inspect it without filling the model context. To turn shorter pastes into attachments, choose 1 KB or 5 KB under **Settings → Chat → Large paste threshold** on web and desktop, or **Settings → diff --git a/packages/client-runtime/src/textPaste.ts b/packages/client-runtime/src/textPaste.ts index 45036378f0017..065a51ecad396 100644 --- a/packages/client-runtime/src/textPaste.ts +++ b/packages/client-runtime/src/textPaste.ts @@ -57,10 +57,15 @@ export function pastedTextThresholdLabel( resolve: MFunctionType = mFallback, ) { return resolve( - msg("{kilobytes} KB (~{characters, number} chars)", { - kilobytes: Math.floor(thresholdBytes / 1000), - characters: thresholdBytes, - }), + thresholdBytes % 1024 === 0 + ? msg("{kibibytes} KiB (~{characters, number} chars)", { + kibibytes: thresholdBytes / 1024, + characters: thresholdBytes, + }) + : msg("{kilobytes} KB (~{characters, number} chars)", { + kilobytes: Math.floor(thresholdBytes / 1000), + characters: thresholdBytes, + }), ); }