Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions apps/mobile/src/features/settings/SettingsFollowUpRouteScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { msg, T, useGT, useMessages, Var } from "gt-react-native";
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";
Expand Down Expand Up @@ -29,6 +34,23 @@ const FOLLOW_UP_OPTIONS: ReadonlyArray<{
},
];

const THRESHOLD_OPTIONS: ReadonlyArray<{
readonly threshold: PastedTextAttachmentThreshold;
readonly description: string;
}> = [
{
threshold: 1_000,
description: msg("Most logs, stack traces, and code snippets become files."),
},
{
threshold: 5_000,
description: msg("Long logs and documents become files; snippets stay as text."),
},
{ threshold: 32_768, description: msg("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 gt = useGT();
const m = useMessages();
Expand All @@ -39,6 +61,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 = (
<ScrollView
Expand Down Expand Up @@ -67,6 +93,26 @@ export function SettingsFollowUpRouteScreen() {
keyboard, hold <Var>{Platform.OS === "android" ? "Ctrl" : "Command"}</Var> while sending.
</T>
</Text>
<SettingsSection title={gt("Attach pastes as files from")}>
{THRESHOLD_OPTIONS.map(({ threshold, description }, index) => (
<SettingsChoiceRow
key={threshold}
label={pastedTextThresholdLabel(threshold, m)}
description={m(description)}
selected={selectedThreshold === threshold}
separated={index > 0}
disabled={!preferencesReady}
onPress={() => savePreferences({ pastedTextAttachmentThreshold: threshold })}
/>
))}
</SettingsSection>
<Text className="px-2 text-sm text-foreground-muted">
<T>
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{" "}
<Var>{PASTE_AS_TEXT_SHORTCUT}</Var> to paste a long block as text instead.
</T>
</Text>
</ScrollView>
);

Expand Down
3 changes: 3 additions & 0 deletions apps/mobile/src/features/settings/settings-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ const SETTINGS_SEARCH_TERMS = {
msg("queue", { $context: "settings search keyword" }),
msg("steer", { $context: "settings search keyword" }),
msg("while the agent is running", { $context: "settings search keyword" }),
msg("large pastes", { $context: "settings search keyword" }),
msg("attachment", { $context: "settings search keyword" }),
msg("text file", { $context: "settings search keyword" }),
],
SettingsArchive: [
msg("archive", { $context: "settings search keyword" }),
Expand Down
3 changes: 3 additions & 0 deletions apps/mobile/src/features/threads/ThreadComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
} from "../../state/composer-attachment-uploads";
import Animated, { FadeIn, FadeOut, ReduceMotion } 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";
Expand Down Expand Up @@ -262,6 +263,7 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
const navigation = useNavigation();
const foregroundColor = useUniwindTheme()["--color-foreground"];
const bodyText = useComposerTextRole();
const pastedTextAttachmentThreshold = usePastedTextAttachmentThreshold();
const fallbackInputRef = useRef<ComposerEditorHandle>(null);
const inputRef = props.editorRef ?? fallbackInputRef;
const [isFocused, setIsFocused] = useState(false);
Expand Down Expand Up @@ -910,6 +912,7 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
text: paste.text,
wouldExceedInputLimit,
canAttach: true,
thresholdBytes: pastedTextAttachmentThreshold,
}) === "attachment"
) {
if (canAttach) {
Expand Down
18 changes: 18 additions & 0 deletions apps/mobile/src/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@
"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",
"6c03545936b55e0b": "PR-Link kopiert",
Expand Down Expand Up @@ -3221,7 +3223,11 @@
"00b1b3b0bf010b1d": "Deine Nachricht wartet und wird nach der aktuellen Runde ausgeführt.",
"79e87310525279f8": "Umlenken",
"a1e23f7b109d5925": "Deine Nachricht erreicht den Agenten sofort und ändert, woran er arbeitet.",
"12fbffef5c5d01d6": "Die meisten Logs, Stacktraces und Code-Schnipsel werden zu Dateien.",
"6f73933b65186db1": "Lange Logs und Dokumente werden zu Dateien; Schnipsel bleiben Text.",
"ac160279d6fd62ea": "Standard. Nur sehr große Einfügungen werden zu Dateien.",
"683838755eb7fe37": "Während der Agent läuft",
"e0b70d25f7b2238d": "Eingefügten Text als Datei anhängen ab",
"afda415d2d75a5d3": "Chat",
"85163bc64c8c56a1": [
"Drücke lange auf die Senden-Schaltfläche, um für eine einzelne Nachricht die andere Option zu verwenden. Mit einer Hardware-Tastatur halte beim Senden ",
Expand All @@ -3232,6 +3238,15 @@
},
" gedrückt."
],
"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",
"v": "v"
},
", um einen langen Block stattdessen als Text einzufügen."
],
"95ee62a0d6968b89": "Nachricht senden",
"1ad8b2750f0d2b17": "{returnKey} sendet die Nachricht. {shiftReturn} fügt eine neue Zeile ein.",
"92390c8eef972ca0": "Neue Zeile einfügen",
Expand Down Expand Up @@ -3807,6 +3822,9 @@
"4c2495d10dfbf72f": "warteschlange",
"4ebe2aa17b91e168": "umlenken",
"48f04bb3132077ef": "während der agent läuft",
"1481b12232710e91": "große einfügungen",
"715a3f6de78e8e6d": "anhang",
"f4da8226929a4a4c": "textdatei",
"ffb1ded95eb81974": "archivieren",
"3d5aeb06f2128b12": "archiviert",
"2a34f68d985e9fde": "wiederherstellen",
Expand Down
19 changes: 19 additions & 0 deletions apps/mobile/src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@
"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",
"6c03545936b55e0b": "PR link copied",
Expand Down Expand Up @@ -3222,7 +3224,11 @@
"00b1b3b0bf010b1d": "Your message waits and runs after the current turn finishes.",
"79e87310525279f8": "Steer",
"a1e23f7b109d5925": "Your message reaches the agent right away, changing what it is working on.",
"12fbffef5c5d01d6": "Most logs, stack traces, and code snippets become files.",
"6f73933b65186db1": "Long logs and documents become files; snippets stay as text.",
"ac160279d6fd62ea": "Default. Only very large pastes become files.",
"683838755eb7fe37": "While the agent is running",
"e0b70d25f7b2238d": "Attach pastes as files from",
"afda415d2d75a5d3": "Chat",
"85163bc64c8c56a1": [
"Long-press the send button to use the other option for a single message. With a hardware keyboard, hold ",
Expand All @@ -3233,6 +3239,16 @@
},
" while sending."
],
"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,
"k": "_gt_value_1",
"v": "v"
},
" to paste a long block as text instead."
],
"95ee62a0d6968b89": "Send message",
"1ad8b2750f0d2b17": "{returnKey} sends the message. {shiftReturn} inserts a new line.",
"92390c8eef972ca0": "Insert new line",
Expand Down Expand Up @@ -3808,6 +3824,9 @@
"4c2495d10dfbf72f": "queue",
"4ebe2aa17b91e168": "steer",
"48f04bb3132077ef": "while the agent is running",
"1481b12232710e91": "large pastes",
"715a3f6de78e8e6d": "attachment",
"f4da8226929a4a4c": "text file",
"ffb1ded95eb81974": "archive",
"3d5aeb06f2128b12": "archived",
"2a34f68d985e9fde": "restore",
Expand Down
18 changes: 18 additions & 0 deletions apps/mobile/src/i18n/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@
"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",
"6c03545936b55e0b": "Enlace de la PR copiado",
Expand Down Expand Up @@ -3216,7 +3218,11 @@
"00b1b3b0bf010b1d": "Tu mensaje espera y se ejecuta cuando termina el turno actual.",
"79e87310525279f8": "Redirigir",
"a1e23f7b109d5925": "Tu mensaje llega al agente al instante y cambia aquello en lo que está trabajando.",
"12fbffef5c5d01d6": "La mayoría de los registros, trazas de pila y fragmentos de código se convierten en archivos.",
"6f73933b65186db1": "Los registros y documentos largos se convierten en archivos; los fragmentos siguen como texto.",
"ac160279d6fd62ea": "Predeterminado. Solo los pegados muy grandes se convierten en archivos.",
"683838755eb7fe37": "Mientras el agente trabaja",
"e0b70d25f7b2238d": "Adjuntar el texto pegado como archivo a partir de",
"afda415d2d75a5d3": "Chat",
"85163bc64c8c56a1": [
"Mantén pulsado el botón de enviar para usar la otra opción con un solo mensaje. Con un teclado físico, mantén ",
Expand All @@ -3227,6 +3233,15 @@
},
" al enviar."
],
"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",
"v": "v"
},
" para pegar un bloque largo como texto."
],
"95ee62a0d6968b89": "Enviar mensaje",
"1ad8b2750f0d2b17": "{returnKey} envía el mensaje. {shiftReturn} inserta una línea nueva.",
"92390c8eef972ca0": "Insertar línea nueva",
Expand Down Expand Up @@ -3802,6 +3817,9 @@
"4c2495d10dfbf72f": "cola",
"4ebe2aa17b91e168": "redirigir",
"48f04bb3132077ef": "mientras el agente trabaja",
"1481b12232710e91": "pegados grandes",
"715a3f6de78e8e6d": "adjunto",
"f4da8226929a4a4c": "archivo de texto",
"ffb1ded95eb81974": "archivar",
"3d5aeb06f2128b12": "archivados",
"2a34f68d985e9fde": "restaurar",
Expand Down
18 changes: 18 additions & 0 deletions apps/mobile/src/i18n/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@
"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",
"6c03545936b55e0b": "Lien de la PR copié",
Expand Down Expand Up @@ -3216,7 +3218,11 @@
"00b1b3b0bf010b1d": "Votre message attend et s’exécute une fois le tour actuel terminé.",
"79e87310525279f8": "Réorienter",
"a1e23f7b109d5925": "Votre message parvient immédiatement à l’agent et modifie ce sur quoi il travaille.",
"12fbffef5c5d01d6": "La plupart des journaux, traces de pile et extraits de code deviennent des fichiers.",
"6f73933b65186db1": "Les longs journaux et documents deviennent des fichiers ; les extraits restent du texte.",
"ac160279d6fd62ea": "Par défaut. Seuls les très longs collages deviennent des fichiers.",
"683838755eb7fe37": "Pendant que l’agent travaille",
"e0b70d25f7b2238d": "Joindre les collages en fichier à partir de",
"afda415d2d75a5d3": "Discussion",
"85163bc64c8c56a1": [
"Appuyez longuement sur le bouton d’envoi pour utiliser l’autre option pour un seul message. Avec un clavier physique, maintenez ",
Expand All @@ -3227,6 +3233,15 @@
},
" pendant l’envoi."
],
"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",
"v": "v"
},
" pour coller un long bloc en tant que texte."
],
"95ee62a0d6968b89": "Envoyer le message",
"1ad8b2750f0d2b17": "{returnKey} envoie le message. {shiftReturn} insère une nouvelle ligne.",
"92390c8eef972ca0": "Insérer une nouvelle ligne",
Expand Down Expand Up @@ -3802,6 +3817,9 @@
"4c2495d10dfbf72f": "file d’attente",
"4ebe2aa17b91e168": "réorienter",
"48f04bb3132077ef": "pendant que l’agent travaille",
"1481b12232710e91": "longs collages",
"715a3f6de78e8e6d": "pièce jointe",
"f4da8226929a4a4c": "fichier texte",
"ffb1ded95eb81974": "archiver",
"3d5aeb06f2128b12": "archivés",
"2a34f68d985e9fde": "restaurer",
Expand Down
18 changes: 18 additions & 0 deletions apps/mobile/src/i18n/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@
"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": "スレッドをコピーできませんでした",
"6c03545936b55e0b": "PR のリンクをコピーしました",
Expand Down Expand Up @@ -3213,7 +3215,11 @@
"00b1b3b0bf010b1d": "メッセージは待機し、現在のターンが終わった後に実行されます。",
"79e87310525279f8": "軌道修正",
"a1e23f7b109d5925": "メッセージはすぐにエージェントに届き、作業内容を変更します。",
"12fbffef5c5d01d6": "ほとんどのログ、スタックトレース、コードスニペットがファイルになります。",
"6f73933b65186db1": "長いログやドキュメントはファイルになり、スニペットはテキストのままです。",
"ac160279d6fd62ea": "デフォルト。非常に大きな貼り付けだけがファイルになります。",
"683838755eb7fe37": "エージェントの実行中",
"e0b70d25f7b2238d": "貼り付けをファイルとして添付するサイズ",
"afda415d2d75a5d3": "チャット",
"85163bc64c8c56a1": [
"1 つのメッセージだけもう一方のオプションを使うには、送信ボタンを長押しします。ハードウェアキーボードでは、",
Expand All @@ -3224,6 +3230,15 @@
},
" を押しながら送信します。"
],
"ac88b5819c86bc5b": [
"これより短い貼り付けは、メッセージに収まる場合はテキストとして入ります。ラテン文字以外の文字や絵文字は 1 文字あたりのバイト数が多いため、より少ない文字数で上限に達します。ハードウェアキーボードでは、",
{
"i": 1,
"k": "_gt_value_1",
"v": "v"
},
" を押すと長いブロックをテキストのまま貼り付けられます。"
],
"95ee62a0d6968b89": "メッセージを送信",
"1ad8b2750f0d2b17": "{returnKey} でメッセージを送信し、{shiftReturn} で改行します。",
"92390c8eef972ca0": "改行を挿入",
Expand Down Expand Up @@ -3799,6 +3814,9 @@
"4c2495d10dfbf72f": "キュー",
"4ebe2aa17b91e168": "軌道修正",
"48f04bb3132077ef": "エージェントの実行中",
"1481b12232710e91": "大きな貼り付け",
"715a3f6de78e8e6d": "添付",
"f4da8226929a4a4c": "テキストファイル",
"ffb1ded95eb81974": "アーカイブ",
"3d5aeb06f2128b12": "アーカイブ済み",
"2a34f68d985e9fde": "復元",
Expand Down
Loading
Loading