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
7 changes: 7 additions & 0 deletions apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import {
import { SymbolView } from "../../components/ui/AppSymbol";
import { AppText as Text } from "../../components/ui/AppText";
import { threadContextsOutsideEnvironment } from "@t3tools/shared/composerContextReferences";
import { parseNoteCommand } from "@t3tools/shared/composerTrigger";

import { makeTurnCommandMetadata } from "../../lib/commandMetadata";

Expand Down Expand Up @@ -644,6 +645,12 @@ export function NewTaskDraftScreen(props: {
const selectedBranchName = workspaceSelection.branch;
const initialMessageText = draft.text.trim();

// A new task has no thread to leave a note in; its text would become the agent's prompt.
if (parseNoteCommand(initialMessageText)) {
Dialog.alert(gt("Note not sent"), gt("Send a message before leaving a note."));
return null;
}

if (
attachmentBlockReason !== null ||
!modelSelection ||
Expand Down
18 changes: 17 additions & 1 deletion apps/mobile/src/features/threads/ThreadComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,9 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
const draftRunsLocally = composerRunsDraftLocally({
text: draftMessage,
holdsOnlyText: draftAttachments.length === 0,
// A redirect's text answers its approval, so `/side` there is that text.
// A redirect's text answers its approval, so `/side` and `/note` there are that text.
sideChat: !props.redirectsApproval,
note: !props.redirectsApproval,
usageLimits: usageLimitsOffered,
codexFeedback: selectedProviderStatus?.driver === "codex",
freshSession: props.onFreshSession !== undefined && draftContext === undefined,
Expand Down Expand Up @@ -422,6 +423,19 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
undefined,
props.selectedThread.projectId,
);
const noteAvailable =
!props.redirectsApproval &&
queuedEdit === null &&
props.selectedThread.source?.inbox?.audience === "shared";
const noteDisabledReason = !noteAvailable
? null
: props.serverConfig === null
? gt("Private notes are not ready yet. Try again in a moment.")
: props.serverConfig.environment.capabilities.humanNote !== true
? gt("Update this environment's T3 Code server to use /note.")
: props.isDraft
? gt("Send a message before leaving a note.")
: null;
const composerMenu = useComposerCommandMenu({
draftMessage: draftMessage,
ownerKey: composerDraftKey,
Expand All @@ -448,6 +462,8 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
modelProviders: props.serverConfig?.providers,
...(props.onFreshSession === undefined ? {} : { onFreshSession: props.onFreshSession }),
offersSideChat: props.offersSideChat === true,
offersNote: noteAvailable,
noteDisabledReason,
});
const voiceInput = useVoiceInputController({
ownerKey: composerDraftKey,
Expand Down
39 changes: 39 additions & 0 deletions apps/mobile/src/features/threads/use-composer-command-menu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,45 @@ describe("mobile slash commands", () => {
expect(build(false)).toEqual(["pcmd:clear"]);
expect(build(true, false)).toEqual([]);
});

it("shows /note on shared threads with its disabled reason when the server lacks support", () => {
const disabled = buildComposerSlashCommandItems({
query: "no",
atMessageStart: true,
hasThread: true,
offersNote: true,
noteDisabledReason: "Update this environment's T3 Code server to use /note.",
selectedProviderStatus: null,
});
expect(disabled).toEqual([
expect.objectContaining({
id: "cmd:note",
command: "note",
description: "Update this environment's T3 Code server to use /note.",
}),
]);

const enabled = buildComposerSlashCommandItems({
query: "no",
atMessageStart: true,
hasThread: true,
offersNote: true,
noteDisabledReason: null,
selectedProviderStatus: null,
});
expect(enabled[0]?.description).toContain("Leave a note for the other founder");

expect(
buildComposerSlashCommandItems({
query: "no",
atMessageStart: true,
hasThread: true,
offersNote: false,
noteDisabledReason: null,
selectedProviderStatus: null,
}),
).toEqual([]);
});
});

describe("mobile model mentions", () => {
Expand Down
23 changes: 23 additions & 0 deletions apps/mobile/src/features/threads/use-composer-command-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ export function buildComposerSlashCommandItems(
/** T3's `/clear` replaces the provider's, which would clear a session T3 still treats as live. */
readonly offersFreshSession?: boolean;
readonly offersSideChat?: boolean;
readonly offersNote?: boolean;
readonly noteDisabledReason?: string | null;
readonly selectedProviderStatus: Pick<ServerProvider, "driver" | "slashCommands"> | null;
},
resolve: MessageResolver = m,
Expand Down Expand Up @@ -150,6 +152,17 @@ export function buildComposerSlashCommandItems(
});
}
}
if ((input.offersNote || input.noteDisabledReason) && "note".includes(query)) {
items.push({
id: "cmd:note",
type: "slash-command",
command: "note",
label: "/note",
description:
input.noteDisabledReason ??
resolve(msg("Leave a note for the other founder. It does not wake the bot.")),
});
}
if (input.offersFreshSession && "clear".includes(query)) {
items.push({
id: "cmd:clear",
Expand Down Expand Up @@ -272,6 +285,8 @@ export function useComposerCommandMenu({
modelProviders,
onFreshSession,
offersSideChat = false,
offersNote = false,
noteDisabledReason = null,
}: {
readonly draftMessage: string;
readonly ownerKey: string | null;
Expand Down Expand Up @@ -299,6 +314,8 @@ export function useComposerCommandMenu({
/** Arms a fresh session for the next message; absent where `/clear` is unavailable. */
readonly onFreshSession?: () => void;
readonly offersSideChat?: boolean;
readonly offersNote?: boolean;
readonly noteDisabledReason?: string | null;
}) {
const gt = useGT();
const messages = useMessages();
Expand Down Expand Up @@ -408,6 +425,8 @@ export function useComposerCommandMenu({
offersUsageLimits,
offersFreshSession: onFreshSession !== undefined,
offersSideChat,
offersNote,
noteDisabledReason,
selectedProviderStatus: selectedProviderStatus
? {
...selectedProviderStatus,
Expand Down Expand Up @@ -676,6 +695,10 @@ export function useComposerCommandMenu({
clearTriggerThen(onFreshSession);
return;
}
if (item.type === "slash-command" && item.command === "note" && noteDisabledReason) {
Dialog.alert(gt("Note not sent"), noteDisabledReason);
return;
}
if (
item.type === "provider-slash-command" &&
item.command.name === USAGE_LIMITS_COMMAND.name &&
Expand Down
14 changes: 14 additions & 0 deletions apps/mobile/src/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,7 @@
"2c550c1d3c7bb8ba": "Entferne Anhänge aus dem Entwurf, bevor du diese Nachricht wiederherstellst. Nachrichten können höchstens {max} Anhänge enthalten.",
"6112d1a87300d1d0": "Die nicht gesendete Nachricht konnte nicht wiederhergestellt werden.",
"bf83acfba3fad1f7": "Die Nachricht konnte nicht gesendet werden.",
"ced08051d4bf8401": "A note can't be sent from the queue. Edit it and send it again.",
"1d128057483bd6a3": "Ein Anhang konnte nicht hochgeladen werden.",
"5a7ed42a083e47bc": "{term, select, mr {Der MR-Worktree hat lokale Änderungen und konnte nicht auf den MR-Head aktualisiert werden. Löse sie, bevor du es erneut versuchst.} cr {Der Änderungsanfrage-Worktree hat lokale Änderungen und konnte nicht auf den Änderungsanfrage-Head aktualisiert werden. Löse sie, bevor du es erneut versuchst.} other {Der PR-Worktree hat lokale Änderungen und konnte nicht auf den PR-Head aktualisiert werden. Löse sie, bevor du es erneut versuchst.}}",
"7e7c4e761ddf9c39": "Einige eingereihte Nachrichten konnten nicht geladen werden",
Expand Down Expand Up @@ -1751,6 +1752,7 @@
"0d6604f8740b863c": "Entferne Anhänge, bis es höchstens {max} sind.",
"55f9621a69825e20": "Nachricht in der Warteschlange nicht aktualisiert",
"97d648223abda254": "Eine eingereihte Nachricht kann nicht in einen Nebenchat verschoben werden. Entferne {side} oder {btw}, um sie zu speichern.",
"ead057303e98befd": "A queued message can't be a note. Remove /note to save it.",
"bdf11d0dcd29fc4c": "Die eingereihte Nachricht konnte nicht gespeichert werden",
"b02695b75d8b050d": "Deine Bearbeitung ist noch im Eingabefeld.",
"6ad508d2af838010": "Sie wurde möglicherweise bereits gestartet. Deine Bearbeitung ist noch im Eingabefeld.",
Expand All @@ -1759,15 +1761,25 @@
"a0269861cbd8c727": "Eine Nebenfrage stellen",
"d49fc7ca60395d59": "Gib die Frage nach {command} ein und sende sie dann.",
"d6783ef5e11f3e89": "Nebenchat konnte nicht gestartet werden.",
"51081a160319e4f2": "Note not sent",
"3dcb59bef0c3d4c9": "Write the note after /note.",
"8e80ce4a1e6aef13": "Notes take text only",
"faf9ee0a28119e10": "Remove the attachments and context, then send it again.",
"fdb543df304116c7": "Note not saved",
"ed68b68e83ee61bf": "Starte zuerst einen {provider}-Thread",
"c9852e2500018a3c": "Sende eine Nachricht, bevor du Feedback gibst.",
"1a26c7fd1b341467": "Notes can't answer an approval. Resolve the approval, then send the note.",
"7a4248cbd73fad20": "Die eingereihte Nachricht konnte nicht gespeichert werden.",
"94d640e2a0d2e849": "Nebenchats können keine Nebenchats starten.",
"3208297e5c0ed324": "Subagenten-Threads können keine Nebenchats starten.",
"cbf94e4eba3e039f": "Nebenchats sind noch nicht bereit. Versuche es gleich noch einmal.",
"0008675e485c269d": "Aktualisiere den {product}-Server dieser Umgebung, um Nebenchats zu nutzen.",
"98f445984c075971": "Nebenchats sind nach der ersten Nachricht verfügbar.",
"e9cf5c708ad52a85": "Verfügbar, sobald der Worktree des Threads eingerichtet ist.",
"b1d031664f548032": "A note is for a thread you share with the other founder.",
"2474917b7b287fad": "Private notes are not ready yet. Try again in a moment.",
"5c3a86664868ec6f": "Update this environment's {product} server to use /note.",
"cb386d3c64f45dd6": "Send a message before leaving a note.",
"248c36efb4c636c1": "Läuft seit {elapsed} s",
"5e66c9e2849a8514": "Veraltet",
"4f794e3eed73f206": "Fehlgeschlagen",
Expand Down Expand Up @@ -4617,6 +4629,7 @@
"069e8b1c3ad7b75e": "Wähle, wie diese Nachricht gesendet wird",
"548123cb74c4abcf": "Nutzungslimits nicht verfügbar",
"b0eadfef07c14ecb": "Dieser Anbieter meldet derzeit keine Limits.",
"8a921900527b93db": "Update this environment's T3 Code server to use /note.",
"da39f97188187260": "Eingefügter Text wird angehängt",
"ec69e0a9202da9d3": "Beim nächsten Senden bleiben alle {tokens} Tokens des Verlaufs erhalten",
"e5911cda35b05b57": "Beim nächsten Senden werden zuerst {tokens} Tokens des Verlaufs komprimiert",
Expand Down Expand Up @@ -5055,6 +5068,7 @@
"a20d82a1341680de": "Modell wechseln",
"929781439a221aae": "Eine Nebenfrage in einem neuen Nebenchat stellen",
"378c3404c430fc05": "Wie /side",
"48420609182797e4": "Leave a note for the other founder. It does not wake the bot.",
"08aa54cb113f64b1": "Neue Sitzung starten",
"2a6969164260cdee": "Pull Requests sind für dieses Projekt nicht verfügbar.",
"a0ce478324829283": "{term, select, mr {Dieser Merge Request konnte nicht verknüpft werden} cr {Diese Änderungsanfrage konnte nicht verknüpft werden} other {Dieser Pull Request konnte nicht verknüpft werden}}",
Expand Down
14 changes: 14 additions & 0 deletions apps/mobile/src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,7 @@
"2c550c1d3c7bb8ba": "Remove attachments from the draft before restoring this message. Messages can contain at most {max} attachments.",
"6112d1a87300d1d0": "The unsent message could not be restored.",
"bf83acfba3fad1f7": "The message could not be sent.",
"ced08051d4bf8401": "A note can't be sent from the queue. Edit it and send it again.",
"1d128057483bd6a3": "An attachment could not upload.",
"5a7ed42a083e47bc": "{term, select, mr {The MR worktree has local changes and could not update to the MR head. Resolve them before trying again.} cr {The change request worktree has local changes and could not update to the change request head. Resolve them before trying again.} other {The PR worktree has local changes and could not update to the PR head. Resolve them before trying again.}}",
"7e7c4e761ddf9c39": "Some queued messages could not be loaded",
Expand Down Expand Up @@ -1751,6 +1752,7 @@
"0d6604f8740b863c": "Remove attachments until there are at most {max}.",
"55f9621a69825e20": "Queued message not updated",
"97d648223abda254": "A queued message can't move to a side chat. Remove {side} or {btw} to save it.",
"ead057303e98befd": "A queued message can't be a note. Remove /note to save it.",
"bdf11d0dcd29fc4c": "Could not save the queued message",
"b02695b75d8b050d": "Your edit is still in the composer.",
"6ad508d2af838010": "It may have already started. Your edit is still in the composer.",
Expand All @@ -1759,15 +1761,25 @@
"a0269861cbd8c727": "Ask a side question",
"d49fc7ca60395d59": "Type the question after {command}, then send it.",
"d6783ef5e11f3e89": "Could not start a side chat.",
"51081a160319e4f2": "Note not sent",
"3dcb59bef0c3d4c9": "Write the note after /note.",
"8e80ce4a1e6aef13": "Notes take text only",
"faf9ee0a28119e10": "Remove the attachments and context, then send it again.",
"fdb543df304116c7": "Note not saved",
"ed68b68e83ee61bf": "Start a {provider} thread first",
"c9852e2500018a3c": "Send a message before you submit feedback.",
"1a26c7fd1b341467": "Notes can't answer an approval. Resolve the approval, then send the note.",
"7a4248cbd73fad20": "Failed to save the queued message.",
"94d640e2a0d2e849": "Side chats cannot start side chats.",
"3208297e5c0ed324": "Subagent threads cannot start side chats.",
"cbf94e4eba3e039f": "Side chats are not ready yet. Try again in a moment.",
"0008675e485c269d": "Update this environment's {product} server to use side chats.",
"98f445984c075971": "Side chats start after the first message.",
"e9cf5c708ad52a85": "Available once the thread's worktree is set up.",
"b1d031664f548032": "A note is for a thread you share with the other founder.",
"2474917b7b287fad": "Private notes are not ready yet. Try again in a moment.",
"5c3a86664868ec6f": "Update this environment's {product} server to use /note.",
"cb386d3c64f45dd6": "Send a message before leaving a note.",
"248c36efb4c636c1": "Running for {elapsed}s",
"5e66c9e2849a8514": "Out of date",
"4f794e3eed73f206": "Failed",
Expand Down Expand Up @@ -4619,6 +4631,7 @@
"069e8b1c3ad7b75e": "Choose how to send this message",
"548123cb74c4abcf": "Usage limits unavailable",
"b0eadfef07c14ecb": "This provider does not currently report limits.",
"8a921900527b93db": "Update this environment's T3 Code server to use /note.",
"da39f97188187260": "Attaching pasted text",
"ec69e0a9202da9d3": "Next send keeps all {tokens} tokens of history",
"e5911cda35b05b57": "Next send compacts {tokens} tokens of history first",
Expand Down Expand Up @@ -5057,6 +5070,7 @@
"a20d82a1341680de": "Switch model",
"929781439a221aae": "Ask a side question in a new side chat",
"378c3404c430fc05": "Same as /side",
"48420609182797e4": "Leave a note for the other founder. It does not wake the bot.",
"08aa54cb113f64b1": "Start a fresh session",
"2a6969164260cdee": "Pull requests are unavailable for this project.",
"a0ce478324829283": "{term, select, mr {Couldn't link this merge request} cr {Couldn't link this change request} other {Couldn't link this pull request}}",
Expand Down
14 changes: 14 additions & 0 deletions apps/mobile/src/i18n/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,7 @@
"2c550c1d3c7bb8ba": "Quita adjuntos del borrador antes de restaurar este mensaje. Los mensajes pueden tener como máximo {max} adjuntos.",
"6112d1a87300d1d0": "No se pudo restaurar el mensaje sin enviar.",
"bf83acfba3fad1f7": "No se pudo enviar el mensaje.",
"ced08051d4bf8401": "A note can't be sent from the queue. Edit it and send it again.",
"1d128057483bd6a3": "No se pudo subir un adjunto.",
"5a7ed42a083e47bc": "{term, select, mr {El worktree de la MR tiene cambios locales y no se pudo actualizar al head de la MR. Resuélvelos antes de volver a intentarlo.} cr {El worktree de la solicitud de cambios tiene cambios locales y no se pudo actualizar al head de la solicitud de cambios. Resuélvelos antes de volver a intentarlo.} other {El worktree de la PR tiene cambios locales y no se pudo actualizar al head de la PR. Resuélvelos antes de volver a intentarlo.}}",
"7e7c4e761ddf9c39": "No se pudieron cargar algunos mensajes en cola",
Expand Down Expand Up @@ -1751,6 +1752,7 @@
"0d6604f8740b863c": "Quita adjuntos hasta que haya como máximo {max}.",
"55f9621a69825e20": "Mensaje en cola no actualizado",
"97d648223abda254": "Un mensaje en cola no puede pasar a un chat lateral. Quita {side} o {btw} para guardarlo.",
"ead057303e98befd": "A queued message can't be a note. Remove /note to save it.",
"bdf11d0dcd29fc4c": "No se pudo guardar el mensaje en cola",
"b02695b75d8b050d": "Tu edición sigue en el cuadro de mensaje.",
"6ad508d2af838010": "Puede que ya haya empezado. Tu edición sigue en el cuadro de mensaje.",
Expand All @@ -1759,15 +1761,25 @@
"a0269861cbd8c727": "Haz una pregunta aparte",
"d49fc7ca60395d59": "Escribe la pregunta después de {command} y envíala.",
"d6783ef5e11f3e89": "No se pudo iniciar un chat lateral.",
"51081a160319e4f2": "Note not sent",
"3dcb59bef0c3d4c9": "Write the note after /note.",
"8e80ce4a1e6aef13": "Notes take text only",
"faf9ee0a28119e10": "Remove the attachments and context, then send it again.",
"fdb543df304116c7": "Note not saved",
"ed68b68e83ee61bf": "Primero inicia un hilo de {provider}",
"c9852e2500018a3c": "Envía un mensaje antes de enviar comentarios.",
"1a26c7fd1b341467": "Notes can't answer an approval. Resolve the approval, then send the note.",
"7a4248cbd73fad20": "No se pudo guardar el mensaje en cola.",
"94d640e2a0d2e849": "Los chats laterales no pueden iniciar chats laterales.",
"3208297e5c0ed324": "Los hilos de subagentes no pueden iniciar chats laterales.",
"cbf94e4eba3e039f": "Los chats laterales aún no están listos. Vuelve a intentarlo en un momento.",
"0008675e485c269d": "Actualiza el servidor de {product} de este entorno para usar chats laterales.",
"98f445984c075971": "Los chats laterales empiezan después del primer mensaje.",
"e9cf5c708ad52a85": "Disponible cuando el worktree del hilo esté configurado.",
"b1d031664f548032": "A note is for a thread you share with the other founder.",
"2474917b7b287fad": "Private notes are not ready yet. Try again in a moment.",
"5c3a86664868ec6f": "Update this environment's {product} server to use /note.",
"cb386d3c64f45dd6": "Send a message before leaving a note.",
"248c36efb4c636c1": "En ejecución desde hace {elapsed} s",
"5e66c9e2849a8514": "Desactualizado",
"4f794e3eed73f206": "Con errores",
Expand Down Expand Up @@ -4610,6 +4622,7 @@
"069e8b1c3ad7b75e": "Elige cómo enviar este mensaje",
"548123cb74c4abcf": "Límites de uso no disponibles",
"b0eadfef07c14ecb": "Este proveedor no informa de límites actualmente.",
"8a921900527b93db": "Update this environment's T3 Code server to use /note.",
"da39f97188187260": "Adjuntando texto pegado",
"ec69e0a9202da9d3": "El próximo envío conserva los {tokens} tokens del historial",
"e5911cda35b05b57": "El próximo envío compacta primero {tokens} tokens del historial",
Expand Down Expand Up @@ -5048,6 +5061,7 @@
"a20d82a1341680de": "Cambiar de modelo",
"929781439a221aae": "Hacer una pregunta aparte en un chat lateral nuevo",
"378c3404c430fc05": "Igual que /side",
"48420609182797e4": "Leave a note for the other founder. It does not wake the bot.",
"08aa54cb113f64b1": "Iniciar una sesión nueva",
"2a6969164260cdee": "Las pull requests no están disponibles para este proyecto.",
"a0ce478324829283": "{term, select, mr {No se pudo vincular esta merge request} cr {No se pudo vincular esta solicitud de cambios} other {No se pudo vincular esta pull request}}",
Expand Down
Loading
Loading