The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): a thread's goal pill can be cleared or resumed (#39283)
Co-authored-by: ravdeep kainth <kainth.ravdeep@gmail.com> Co-authored-by: voida6 <voida6@users.noreply.github.com>
Julius Marminge committed
Nov 19, 2026 at 12:37 UTC
56cd65316495164fd27bef6594554e75f1a03e18
20 files changed
+234
-21
apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+1
@@ -1086,6 +1086,7 @@ export function NewTaskDraftScreen(props: {
1086
onResumeQueue={null}
1087
onSendMessage={handleStart}
1088
offersSideChat={false}
1089
+ onSendCommand={async () => null}
1090
onReconnectEnvironment={() => onReconnectEnvironment(selectedProject.environmentId)}
1091
canSwitchThreadProvider
1092
onRespondToApproval={async () => {}}
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+47
-1
@@ -193,7 +193,11 @@ import {
193
FLOATING_WORKING_CONTROL_COVERAGE,
194
FloatingWorkingControl,
195
} from "./floating-working-control";
196
-import { connectionFloatingStatus, type FloatingWorkingStatus } from "./floating-working-status";
196
+import {
197
+ connectionFloatingStatus,
198
+ type FloatingStatusAction,
199
+ type FloatingWorkingStatus,
200
+} from "./floating-working-status";
201
import type { ThreadStatusLineModel } from "./thread-context-divider";
202
import {
203
derivePendingUserInputMaxHeight,
@@ -311,6 +315,8 @@ export interface ThreadDetailScreenProps {
315
) => Promise<boolean | "responded">,
316
onWillEnqueue?: () => void,
317
) => Promise<MessageId | null>;
318
+ /** Queues a standalone text command, such as `/goal clear`, without touching the draft. */
319
+ readonly onSendCommand: (text: string) => Promise<MessageId | null>;
320
readonly onReconnectEnvironment: () => void;
321
readonly canSwitchThreadProvider: boolean;
322
readonly onRespondToApproval: ApprovalResponder;
@@ -716,6 +722,21 @@ function ThreadDetailBody(
722
);
723
}
724
};
725
+ const [goalCommandPending, setGoalCommandPending] = useState(false);
726
+ const runGoalCommand = async (command: string) => {
727
+ if (goalCommandPending || !props.canOperateThread) return;
728
+ setGoalCommandPending(true);
729
+ // No `finally`: React Compiler cannot lower it.
730
+ try {
731
+ await props.onSendCommand(command);
732
+ } catch (error) {
733
+ Dialog.alert(
734
+ gt("Could not update goal"),
735
+ error instanceof Error ? error.message : gt("Try again."),
736
+ );
737
+ }
738
+ setGoalCommandPending(false);
739
+ };
740
const pendingBackgroundWork = presentPendingBackgroundWork(
741
props.selectedThread.pendingBackgroundTasks,
742
messages,
@@ -860,10 +881,35 @@ function ThreadDetailBody(
881
}
882
if (props.selectedThread.goal !== null && contentPresentationKind === "ready") {
883
const goal = presentProviderGoal(props.selectedThread.goal, false, messages);
884
+ const goalDriver = props.serverConfig?.providers.find(
885
+ (provider) => provider.instanceId === props.selectedThread.modelSelection.instanceId,
886
+ )?.driver;
887
+ const goalAction = (
888
+ label: string,
889
+ accessibilityLabel: string,
890
+ command: string,
891
+ ): FloatingStatusAction => ({
892
+ label,
893
+ accessibilityLabel,
894
+ disabled: !props.canOperateThread || goalCommandPending,
895
+ onPress: () => void runGoalCommand(command),
896
+ });
897
+ // The server rejects Antigravity goal controls and Claude resume. Resume would stop
898
+ // unrelated work, so it waits for the thread to go idle.
899
+ const goalActions =
900
+ goalDriver === "antigravity"
901
+ ? []
902
+ : [
903
+ ...(goal.canResume && goalDriver !== "claudeAgent" && !props.activeThreadBusy
904
+ ? [goalAction(gt("Resume"), gt("Resume goal"), "/goal resume")]
905
+ : []),
906
+ goalAction(gt("Clear"), gt("Clear goal"), "/goal clear"),
907
+ ];
908
return {
909
kind: "goal",
910
label: goal.title,
911
accessibilityLabel: `${goal.title}: ${goal.objective}`,
912
+ actions: goalActions,
913
};
914
}
915
if (extensionStatus !== null && contentPresentationKind === "ready") {
apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+1
@@ -1125,6 +1125,7 @@ function ThreadRouteContent(
1125
onResumeQueue={composer.canResume ? handleResumeQueue : null}
1126
onSendMessage={composer.onSendMessage}
1127
offersSideChat={composer.sideChatUnavailableReason === null}
1128
+ onSendCommand={composer.onSendCommand}
1129
onReconnectEnvironment={handleReconnectEnvironment}
1130
canSwitchThreadProvider={composer.canSwitchThreadProvider}
1131
onRespondToApproval={requests.onRespondToApproval}
apps/mobile/src/features/threads/floating-working-control.tsx
+28
-19
@@ -1,7 +1,7 @@
1
import type { SubagentPillSegment } from "@t3tools/client-runtime/state/thread-subagents";
2
import { GlassContainer, GlassView } from "expo-glass-effect";
3
import { useGT } from "gt-react-native";
4
-import { type ReactNode, useEffect, useRef, useState } from "react";
4
+import { Fragment, type ReactNode, useEffect, useRef, useState } from "react";
5
import { type LayoutChangeEvent, Pressable, useWindowDimensions, View } from "react-native";
6
import Animated, {
7
Easing,
@@ -23,7 +23,7 @@ import { ControlPill } from "../../components/ui/ControlPill";
23
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
24
import { BrowserPreviewButton } from "../browser/browser-preview-button";
25
import { DevicePreviewButton } from "../devices/device-preview-button";
26
-import type { FloatingWorkingStatus } from "./floating-working-status";
26
+import type { FloatingStatusAction, FloatingWorkingStatus } from "./floating-working-status";
27
import { ShimmeringWorkContent } from "./thread-work-log";
28
29
const CONTROL_HEIGHT = 38.5;
@@ -83,7 +83,12 @@ export function FloatingWorkingControl(props: {
83
const extensionStatus = props.extensionStatus ?? null;
84
const extensionOnly = props.status?.kind === "extension";
85
const useGlass = NATIVE_LIQUID_GLASS_SUPPORTED && !extensionOnly;
86
- const action = props.status?.kind === "stop" ? props.status.action : null;
86
+ const actions: ReadonlyArray<FloatingStatusAction> =
87
+ props.status?.kind === "goal"
88
+ ? props.status.actions
89
+ : props.status?.kind === "stop" && props.status.action !== null
90
+ ? [props.status.action]
91
+ : [];
92
const [agentsWidth, setAgentsWidth] = useState(0);
93
const hasQueue = props.queuedCount > 0;
94
const hasPreview = props.devicePreview !== null || props.browserPreview !== null;
@@ -96,7 +101,7 @@ export function FloatingWorkingControl(props: {
101
0,
102
Math.min(overlayWidth, windowWidth) -
103
reservedWidth -
99
- (action !== null ? actionWidth : 0) -
104
+ (actions.length > 0 ? actionWidth : 0) -
105
(hasQueue ? queueWidth : 0) -
106
(hasAgents ? agentsWidth : 0) -
107
(hasPreview ? previewWidth : 0),
@@ -167,7 +172,7 @@ export function FloatingWorkingControl(props: {
172
const capsuleInteractive =
173
statusInteractive ||
174
extensionStatus !== null ||
170
- action !== null ||
175
+ actions.length > 0 ||
176
hasQueue ||
177
hasAgents ||
178
hasPreview;
@@ -215,24 +220,28 @@ export function FloatingWorkingControl(props: {
220
</Text>
221
</Pressable>
222
) : null}
218
- {action !== null ? (
223
+ {actions.length > 0 ? (
224
<View
225
onLayout={(event) => setActionWidth(settleWidth(event.nativeEvent.layout.width))}
226
className="h-11 flex-row items-center"
227
>
223
- <View className="h-4 w-px bg-border" />
224
- <Pressable
225
- accessibilityRole="button"
226
- accessibilityLabel={action.accessibilityLabel}
227
- accessibilityState={{ disabled: action.disabled }}
228
- disabled={action.disabled}
229
- onPress={action.onPress}
230
- className={`h-11 items-center justify-center px-3 active:opacity-70 ${action.disabled ? "opacity-50" : ""}`}
231
- >
232
- <Text className="font-t3-medium text-xs text-foreground" numberOfLines={1}>
233
- {action.label}
234
- </Text>
235
- </Pressable>
228
+ {actions.map((action) => (
229
+ <Fragment key={action.label}>
230
+ <View className="h-4 w-px bg-border" />
231
+ <Pressable
232
+ accessibilityRole="button"
233
+ accessibilityLabel={action.accessibilityLabel}
234
+ accessibilityState={{ disabled: action.disabled }}
235
+ disabled={action.disabled}
236
+ onPress={action.onPress}
237
+ className={`h-11 items-center justify-center px-3 active:opacity-70 ${action.disabled ? "opacity-50" : ""}`}
238
+ >
239
+ <Text className="font-t3-medium text-xs text-foreground" numberOfLines={1}>
240
+ {action.label}
241
+ </Text>
242
+ </Pressable>
243
+ </Fragment>
244
+ ))}
245
</View>
246
) : null}
247
{hasPreview ? (
apps/mobile/src/features/threads/floating-working-status.ts
+6
-1
@@ -23,7 +23,12 @@ export type FloatingWorkingStatus =
23
readonly unresponsive: boolean;
24
readonly action: FloatingStatusAction | null;
25
}
26
- | { readonly kind: "goal"; readonly label: string; readonly accessibilityLabel: string }
26
+ | {
27
+ readonly kind: "goal";
28
+ readonly label: string;
29
+ readonly accessibilityLabel: string;
30
+ readonly actions: ReadonlyArray<FloatingStatusAction>;
31
+ }
32
| { readonly kind: "extension"; readonly label: string; readonly onPress: () => void }
33
| { readonly kind: "preparing"; readonly label: string }
34
| {
apps/mobile/src/i18n/translations/de.json
+4
@@ -4375,6 +4375,7 @@
4375
"f360accf1ccac178": "Runde gestoppt; der Agentenprozess läuft weiter",
4376
"967f83de030790dd": "{count, plural, =0 {Er wird mit anderen arbeitenden Threads geteilt. Stoppe diese, um ihn freizugeben.} one {Er wird mit {count} arbeitenden Thread geteilt. Stoppe diesen, um ihn freizugeben.} other {Er wird mit {count} arbeitenden Threads geteilt. Stoppe diese, um ihn freizugeben.}}",
4377
"5536ab75119ee3f9": "Thread konnte nicht aktualisiert werden",
4378
+ "04c7bba52daa6f53": "Ziel konnte nicht aktualisiert werden",
4379
"f5f145b33e2a9380": "Wird gestoppt...",
4380
"e734a8e4a58a3835": "Stoppen",
4381
"0ce0ab7586e91607": "Hintergrundarbeit stoppen",
@@ -4397,6 +4398,9 @@
4398
"a20b495b9e6f82b9": "Wird gestartet…",
4399
"7917e738e8c3fd41": "Genehmigungsanfrage von {title} öffnen",
4400
"54c8b8a3c6e6046b": "Frage von {title} öffnen",
4401
+ "715be2d41b9f1b72": "Ziel fortsetzen",
4402
+ "5d0c71caa8f328b0": "Löschen",
4403
+ "efe8657d62633cd4": "Ziel löschen",
4404
"cebceafe7ddc7d5d": "Feedback zur Genehmigung",
4405
"0830bd81f19bb753": "Sende Feedback zur Genehmigung ohne Anhänge oder zusätzlichen Kontext.",
4406
"d15878f290283f53": "Nachricht konnte nicht bearbeitet werden",
apps/mobile/src/i18n/translations/en.json
+4
@@ -4376,6 +4376,7 @@
4376
"f360accf1ccac178": "Turn stopped; the agent process kept running",
4377
"967f83de030790dd": "{count, plural, =0 {It is shared with other working threads. Stop those to free it.} one {It is shared with {count} working thread. Stop those to free it.} other {It is shared with {count} working threads. Stop those to free it.}}",
4378
"5536ab75119ee3f9": "Could not update thread",
4379
+ "04c7bba52daa6f53": "Could not update goal",
4380
"f5f145b33e2a9380": "Stopping...",
4381
"e734a8e4a58a3835": "Stop",
4382
"0ce0ab7586e91607": "Stop background work",
@@ -4398,6 +4399,9 @@
4399
"a20b495b9e6f82b9": "Starting…",
4400
"7917e738e8c3fd41": "Open approval from {title}",
4401
"54c8b8a3c6e6046b": "Open question from {title}",
4402
+ "715be2d41b9f1b72": "Resume goal",
4403
+ "5d0c71caa8f328b0": "Clear",
4404
+ "efe8657d62633cd4": "Clear goal",
4405
"cebceafe7ddc7d5d": "Approval feedback",
4406
"0830bd81f19bb753": "Send approval feedback without attachments or added context.",
4407
"d15878f290283f53": "Could not edit message",
apps/mobile/src/i18n/translations/es.json
+4
@@ -4368,6 +4368,7 @@
4368
"f360accf1ccac178": "Turno detenido; el proceso del agente siguió ejecutándose",
4369
"967f83de030790dd": "{count, plural, =0 {Se comparte con otros hilos en curso. Detenlos para liberarlo.} one {Se comparte con {count} hilo en curso. Detenlo para liberarlo.} other {Se comparte con {count} hilos en curso. Detenlos para liberarlo.}}",
4370
"5536ab75119ee3f9": "No se pudo actualizar el hilo",
4371
+ "04c7bba52daa6f53": "No se pudo actualizar el objetivo",
4372
"f5f145b33e2a9380": "Deteniendo...",
4373
"e734a8e4a58a3835": "Detener",
4374
"0ce0ab7586e91607": "Detener el trabajo en segundo plano",
@@ -4390,6 +4391,9 @@
4391
"a20b495b9e6f82b9": "Iniciando…",
4392
"7917e738e8c3fd41": "Abrir la aprobación de {title}",
4393
"54c8b8a3c6e6046b": "Abrir la pregunta de {title}",
4394
+ "715be2d41b9f1b72": "Reanudar objetivo",
4395
+ "5d0c71caa8f328b0": "Borrar",
4396
+ "efe8657d62633cd4": "Borrar objetivo",
4397
"cebceafe7ddc7d5d": "Comentarios de la aprobación",
4398
"0830bd81f19bb753": "Envía los comentarios de aprobación sin adjuntos ni contexto añadido.",
4399
"d15878f290283f53": "No se pudo editar el mensaje",
apps/mobile/src/i18n/translations/fr.json
+4
@@ -4369,6 +4369,7 @@
4369
"f360accf1ccac178": "Tour arrêté ; le processus de l’agent continue de tourner",
4370
"967f83de030790dd": "{count, plural, =0 {Il est partagé avec d’autres fils en cours. Arrêtez-les pour le libérer.} one {Il est partagé avec {count} fil en cours. Arrêtez-le pour le libérer.} other {Il est partagé avec {count} fils en cours. Arrêtez-les pour le libérer.}}",
4371
"5536ab75119ee3f9": "Impossible de mettre à jour le fil",
4372
+ "04c7bba52daa6f53": "Impossible de mettre à jour l’objectif",
4373
"f5f145b33e2a9380": "Arrêt...",
4374
"e734a8e4a58a3835": "Arrêter",
4375
"0ce0ab7586e91607": "Arrêter le travail en arrière-plan",
@@ -4391,6 +4392,9 @@
4392
"a20b495b9e6f82b9": "Démarrage…",
4393
"7917e738e8c3fd41": "Ouvrir l’approbation de {title}",
4394
"54c8b8a3c6e6046b": "Ouvrir la question de {title}",
4395
+ "715be2d41b9f1b72": "Reprendre l’objectif",
4396
+ "5d0c71caa8f328b0": "Effacer",
4397
+ "efe8657d62633cd4": "Effacer l’objectif",
4398
"cebceafe7ddc7d5d": "Retour sur l’approbation",
4399
"0830bd81f19bb753": "Envoyez votre réponse à l’approbation sans pièces jointes ni contexte ajouté.",
4400
"d15878f290283f53": "Impossible de modifier le message",
apps/mobile/src/i18n/translations/ja.json
+4
@@ -4350,6 +4350,7 @@
4350
"f360accf1ccac178": "ターンは停止しましたが、エージェントのプロセスは実行されたままです",
4351
"967f83de030790dd": "{count, plural, =0 {作業中の他のスレッドと共有されています。解放するにはそれらを停止してください。} other {作業中の {count} 個のスレッドと共有されています。解放するにはそれらを停止してください。}}",
4352
"5536ab75119ee3f9": "スレッドを更新できませんでした",
4353
+ "04c7bba52daa6f53": "目標を更新できませんでした",
4354
"f5f145b33e2a9380": "停止しています...",
4355
"e734a8e4a58a3835": "停止",
4356
"0ce0ab7586e91607": "バックグラウンドの作業を停止",
@@ -4372,6 +4373,9 @@
4373
"a20b495b9e6f82b9": "開始しています…",
4374
"7917e738e8c3fd41": "{title} からの承認を開く",
4375
"54c8b8a3c6e6046b": "{title} からの質問を開く",
4376
+ "715be2d41b9f1b72": "目標を再開",
4377
+ "5d0c71caa8f328b0": "クリア",
4378
+ "efe8657d62633cd4": "目標をクリア",
4379
"cebceafe7ddc7d5d": "承認へのフィードバック",
4380
"0830bd81f19bb753": "承認のフィードバックは、添付ファイルや追加のコンテキストなしで送信してください。",
4381
"d15878f290283f53": "メッセージを編集できませんでした",
apps/mobile/src/i18n/translations/ko.json
+4
@@ -4355,6 +4355,7 @@
4355
"f360accf1ccac178": "턴이 중지되었지만 에이전트 프로세스가 계속 실행 중입니다",
4356
"967f83de030790dd": "{count, plural, =0 {다른 작업 중인 스레드와 공유되어 있습니다. 해제하려면 해당 스레드를 중지하세요.} other {작업 중인 스레드 {count}개와 공유되어 있습니다. 해제하려면 해당 스레드를 중지하세요.}}",
4357
"5536ab75119ee3f9": "스레드를 업데이트할 수 없습니다",
4358
+ "04c7bba52daa6f53": "목표를 업데이트할 수 없습니다",
4359
"f5f145b33e2a9380": "중지하는 중...",
4360
"e734a8e4a58a3835": "중지",
4361
"0ce0ab7586e91607": "백그라운드 작업 중지",
@@ -4377,6 +4378,9 @@
4378
"a20b495b9e6f82b9": "시작하는 중…",
4379
"7917e738e8c3fd41": "{title}의 승인 요청 열기",
4380
"54c8b8a3c6e6046b": "{title}의 질문 열기",
4381
+ "715be2d41b9f1b72": "목표 재개",
4382
+ "5d0c71caa8f328b0": "지우기",
4383
+ "efe8657d62633cd4": "목표 지우기",
4384
"cebceafe7ddc7d5d": "승인 피드백",
4385
"0830bd81f19bb753": "첨부 파일이나 추가 컨텍스트 없이 승인 피드백을 보내세요.",
4386
"d15878f290283f53": "메시지를 편집할 수 없습니다",
apps/mobile/src/i18n/translations/pt-BR.json
+4
@@ -4369,6 +4369,7 @@
4369
"f360accf1ccac178": "Turno parado; o processo do agente continuou em execução",
4370
"967f83de030790dd": "{count, plural, =0 {Ele é compartilhado com outras threads em andamento. Pare-as para liberá-lo.} one {Ele é compartilhado com {count} thread em andamento. Pare-a para liberá-lo.} other {Ele é compartilhado com {count} threads em andamento. Pare-as para liberá-lo.}}",
4371
"5536ab75119ee3f9": "Não foi possível atualizar a thread",
4372
+ "04c7bba52daa6f53": "Não foi possível atualizar a meta",
4373
"f5f145b33e2a9380": "Parando...",
4374
"e734a8e4a58a3835": "Parar",
4375
"0ce0ab7586e91607": "Parar trabalho em segundo plano",
@@ -4391,6 +4392,9 @@
4392
"a20b495b9e6f82b9": "Iniciando…",
4393
"7917e738e8c3fd41": "Abrir aprovação de {title}",
4394
"54c8b8a3c6e6046b": "Abrir pergunta de {title}",
4395
+ "715be2d41b9f1b72": "Retomar meta",
4396
+ "5d0c71caa8f328b0": "Limpar",
4397
+ "efe8657d62633cd4": "Limpar meta",
4398
"cebceafe7ddc7d5d": "Feedback da aprovação",
4399
"0830bd81f19bb753": "Envie o feedback da aprovação sem anexos nem contexto adicional.",
4400
"d15878f290283f53": "Não foi possível editar a mensagem",
apps/mobile/src/i18n/translations/ru.json
+4
@@ -4447,6 +4447,7 @@
4447
"f360accf1ccac178": "Ход остановлен; процесс агента продолжает работать",
4448
"967f83de030790dd": "{count, plural, =0 {Он используется другими работающими тредами. Остановите их, чтобы освободить его.} one {Он используется {count} работающим тредом. Остановите его, чтобы освободить.} few {Он используется {count} работающими тредами. Остановите их, чтобы освободить его.} many {Он используется {count} работающими тредами. Остановите их, чтобы освободить его.} other {Он используется {count} работающего треда. Остановите их, чтобы освободить его.}}",
4449
"5536ab75119ee3f9": "Не удалось обновить тред",
4450
+ "04c7bba52daa6f53": "Не удалось обновить цель",
4451
"f5f145b33e2a9380": "Остановка...",
4452
"e734a8e4a58a3835": "Остановить",
4453
"0ce0ab7586e91607": "Остановить фоновую работу",
@@ -4469,6 +4470,9 @@
4470
"a20b495b9e6f82b9": "Запуск…",
4471
"7917e738e8c3fd41": "Открыть запрос подтверждения из {title}",
4472
"54c8b8a3c6e6046b": "Открыть вопрос из {title}",
4473
+ "715be2d41b9f1b72": "Возобновить цель",
4474
+ "5d0c71caa8f328b0": "Очистить",
4475
+ "efe8657d62633cd4": "Очистить цель",
4476
"cebceafe7ddc7d5d": "Отзыв на подтверждение",
4477
"0830bd81f19bb753": "Отправьте отзыв на подтверждение без вложений и добавленного контекста.",
4478
"d15878f290283f53": "Не удалось изменить сообщение",
apps/mobile/src/i18n/translations/sv.json
+4
@@ -4375,6 +4375,7 @@
4375
"f360accf1ccac178": "Omgången stoppades; agentprocessen fortsatte att köras",
4376
"967f83de030790dd": "{count, plural, =0 {Den delas med andra arbetande trådar. Stoppa dem för att frigöra den.} one {Den delas med {count} arbetande tråd. Stoppa den för att frigöra den.} other {Den delas med {count} arbetande trådar. Stoppa dem för att frigöra den.}}",
4377
"5536ab75119ee3f9": "Kunde inte uppdatera tråden",
4378
+ "04c7bba52daa6f53": "Det gick inte att uppdatera målet",
4379
"f5f145b33e2a9380": "Stoppar...",
4380
"e734a8e4a58a3835": "Stoppa",
4381
"0ce0ab7586e91607": "Stoppa bakgrundsarbete",
@@ -4397,6 +4398,9 @@
4398
"a20b495b9e6f82b9": "Startar…",
4399
"7917e738e8c3fd41": "Öppna godkännande från {title}",
4400
"54c8b8a3c6e6046b": "Öppna fråga från {title}",
4401
+ "715be2d41b9f1b72": "Återuppta mål",
4402
+ "5d0c71caa8f328b0": "Rensa",
4403
+ "efe8657d62633cd4": "Rensa mål",
4404
"cebceafe7ddc7d5d": "Feedback på godkännande",
4405
"0830bd81f19bb753": "Skicka feedback om godkännandet utan bilagor eller tillagd kontext.",
4406
"d15878f290283f53": "Kunde inte redigera meddelandet",
apps/mobile/src/i18n/translations/zh.json
+4
@@ -4358,6 +4358,7 @@
4358
"f360accf1ccac178": "这一轮已停止,但智能体进程仍在运行",
4359
"967f83de030790dd": "{count, plural, =0 {它被其他正在工作的会话共用。停止那些会话即可释放。} other {它被 {count} 个正在工作的会话共用。停止那些会话即可释放。}}",
4360
"5536ab75119ee3f9": "无法更新会话",
4361
+ "04c7bba52daa6f53": "无法更新目标",
4362
"f5f145b33e2a9380": "正在停止…",
4363
"e734a8e4a58a3835": "停止",
4364
"0ce0ab7586e91607": "停止后台工作",
@@ -4380,6 +4381,9 @@
4381
"a20b495b9e6f82b9": "正在启动…",
4382
"7917e738e8c3fd41": "打开来自 {title} 的批准请求",
4383
"54c8b8a3c6e6046b": "打开来自 {title} 的问题",
4384
+ "715be2d41b9f1b72": "恢复目标",
4385
+ "5d0c71caa8f328b0": "清除",
4386
+ "efe8657d62633cd4": "清除目标",
4387
"cebceafe7ddc7d5d": "批准反馈",
4388
"0830bd81f19bb753": "发送审批反馈时请不要带附件或额外上下文。",
4389
"d15878f290283f53": "无法编辑消息",
apps/mobile/src/state/thread-outbox-model.ts
+2
@@ -56,6 +56,7 @@ export const QueuedThreadMessageSchema = Schema.Struct({
56
messageId: MessageId,
57
commandId: CommandId,
58
text: Schema.String,
59
+ restoreToDraft: Schema.optional(Schema.Boolean),
60
context: Schema.optional(OrchestrationMessageContext),
61
attachments: Schema.Array(DraftComposerAttachmentSchema),
62
modelSelection: Schema.optional(ModelSelection),
@@ -88,6 +89,7 @@ export interface QueuedThreadMessage {
89
readonly messageId: MessageId;
90
readonly commandId: CommandId;
91
readonly text: string;
92
+ readonly restoreToDraft?: boolean;
93
readonly context?: OrchestrationMessageContext;
94
readonly attachments: ReadonlyArray<DraftComposerAttachment>;
95
readonly modelSelection?: ModelSelectionType;
apps/mobile/src/state/thread-task-permissions.test.ts
+32
@@ -560,6 +560,38 @@ describe("mobile task permissions", () => {
560
);
561
});
562
563
+ it("queues a goal command with the thread's settings and leaves the draft alone", async () => {
564
+ state.grantedEnvironments.add("secondary");
565
+ state.draft.modelSelection = {
566
+ instanceId: ProviderInstanceId.make("claudeAgent"),
567
+ model: "claude-sonnet-5-5",
568
+ };
569
+ Object.assign(state.draft, { runtimeMode: "approval-required" });
570
+ const composer = useThreadComposerState(NO_SIDE_CHATS);
571
+ expect(await composer.onSendCommand("/goal clear")).toBe("message");
572
+ expect(state.enqueue).toHaveBeenCalledExactlyOnceWith(
573
+ expect.objectContaining({
574
+ environmentId: "secondary",
575
+ threadId: "thread",
576
+ text: "/goal clear",
577
+ restoreToDraft: false,
578
+ attachments: [],
579
+ modelSelection: state.thread.modelSelection,
580
+ runtimeMode: state.thread.runtimeMode,
581
+ }),
582
+ );
583
+ expect(state.clearDraft).not.toHaveBeenCalled();
584
+ expect(state.draft.text).toBe("Keep my draft");
585
+ });
586
+
587
+ it("rechecks the operate grant before queueing a command", async () => {
588
+ state.grantedEnvironments.add("secondary");
589
+ const composer = useThreadComposerState(NO_SIDE_CHATS);
590
+ state.grantedEnvironments.delete("secondary");
591
+ expect(await composer.onSendCommand("/goal clear")).toBeNull();
592
+ expect(state.enqueue).not.toHaveBeenCalled();
593
+ });
594
+
595
it("rechecks the target environment before an approval response", async () => {
596
state.grantedEnvironments.add("secondary");
597
const requests = useSelectedThreadRequests();
apps/mobile/src/state/threadOutboxDelivery.test.ts
+24
@@ -939,6 +939,30 @@ describe("thread outbox recovery rollback", () => {
939
}),
940
);
941
942
+ it.effect("keeps the draft unchanged when a standalone goal command is rejected", () =>
943
+ Effect.gen(function* () {
944
+ const message: QueuedThreadMessage = {
945
+ ...queuedMessage({ messageId: "goal-rejected", text: "/goal clear" }),
946
+ restoreToDraft: false,
947
+ modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.6-sol" },
948
+ runtimeMode: "full-access",
949
+ };
950
+ const threadKey = `${message.environmentId}:${message.threadId}`;
951
+ appAtomRegistry.set(composerDrafts.composerDraftsAtom, {
952
+ [threadKey]: { text: "Keep my draft", attachments: [], runtimeMode: "approval-required" },
953
+ });
954
+ const draft = composerDrafts.getComposerDraftSnapshot(threadKey);
955
+ yield* Effect.promise(() => harness.manager.enqueue(message));
956
+ expect(yield* restoreRejectedQueuedMessage(message, "rejected")).toBe("restored");
957
+ expect(composerDrafts.getComposerDraftSnapshot(threadKey)).toEqual(draft);
958
+ expect(remainingMessages()).toEqual([]);
959
+ expect(appAtomRegistry.get(threadComposerErrorsAtom)[threadKey]).toEqual({
960
+ message: "rejected",
961
+ messageId: message.messageId,
962
+ });
963
+ }),
964
+ );
965
+
966
it.effect("does not record a creation outcome for a rejected follow-up message", () =>
967
Effect.gen(function* () {
968
const message = queuedMessage({ messageId: "message-followup-restore", text: "follow up" });
apps/mobile/src/state/threadOutboxDelivery.ts
+8
@@ -478,6 +478,14 @@ export const restoreRejectedQueuedMessage = Effect.fn("ThreadOutbox.restoreRejec
478
return "deferred" as const;
479
}
480
const revision = threadOutboxRevision(queuedMessage.messageId);
481
+ if (queuedMessage.restoreToDraft === false) {
482
+ const removed = yield* storage("remove-unsendable", queuedMessage.messageId, () =>
483
+ removeThreadOutboxMessage(queuedMessage, revision, () => !editing()),
484
+ );
485
+ if (!removed) return "deferred" as const;
486
+ setThreadComposerError(threadKey, message, queuedMessage.messageId);
487
+ return "restored" as const;
488
+ }
489
yield* storage("load-drafts", queuedMessage.messageId, () => waitForComposerDraftsLoaded());
490
if (editing()) return "deferred" as const;
491
const originalDraft = getComposerDraftSnapshot(draftKey);
apps/mobile/src/state/use-thread-composer-state.ts
+45
@@ -979,6 +979,50 @@ export function useThreadComposerState(input: {
979
return null;
980
})();
981
982
+ /** Queues a standalone text command such as `/goal clear` and leaves the composer draft alone. */
983
+ const onSendCommand = async (text: string) => {
984
+ if (
985
+ !selectedThreadShell ||
986
+ selectedThreadCreation !== null ||
987
+ (selectedEnvironmentRuntime?.connectionState === "connected" &&
988
+ !readEnvironmentScope(selectedThreadShell.environmentId, AuthOrchestrationOperateScope))
989
+ ) {
990
+ return null;
991
+ }
992
+ const thread = selectedThreadShell;
993
+ // Goal commands belong to the thread itself, not the model or modes picked in the draft.
994
+ const modelSelection = thread.modelSelection;
995
+ const serverConfig = selectedEnvironmentRuntime?.serverConfig;
996
+ if (
997
+ selectedEnvironmentRuntime?.connectionState === "connected" &&
998
+ isModelSelectionUnavailable(serverConfig, modelSelection, thread.projectId)
999
+ ) {
1000
+ const { title, detail } = describeUnavailableModelSelection(
1001
+ serverConfig,
1002
+ modelSelection,
1003
+ thread.projectId,
1004
+ );
1005
+ Dialog.alert(title, detail);
1006
+ return null;
1007
+ }
1008
+ const metadata = makeQueuedMessageMetadata();
1009
+ const messageId = MessageId.make(metadata.messageId);
1010
+ await enqueueThreadOutboxMessage({
1011
+ environmentId: thread.environmentId,
1012
+ threadId: thread.id,
1013
+ messageId,
1014
+ commandId: CommandId.make(metadata.commandId),
1015
+ text,
1016
+ restoreToDraft: false,
1017
+ attachments: [],
1018
+ modelSelection,
1019
+ runtimeMode: thread.runtimeMode,
1020
+ interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE,
1021
+ createdAt: metadata.createdAt,
1022
+ });
1023
+ return messageId;
1024
+ };
1025
+
1026
const onChangeDraftMessage = (value: string) => {
1027
if (!selectedThreadShell) {
1028
return;
@@ -1052,6 +1096,7 @@ export function useThreadComposerState(input: {
1096
onNativePasteText,
1097
onRemoveDraftImage,
1098
onSendMessage,
1099
+ onSendCommand,
1100
sideChatUnavailableReason,
1101
};
1102
}