feat(gateway): bring /undo [N] to messaging platforms (parity with CLI/TUI) (#36699)
Gateway /undo was wired into every platform but still ran the old
single-turn hard-truncate. Now it matches the CLI/TUI: /undo [N] backs
up N user turns (default 1, clamps to oldest), soft-deletes the
truncated rows on disk (active=0, kept for audit, hidden from re-prompts
and search) via SessionDB.rewind_to_message, evicts the cached agent so
the next turn rebuilds from the active-only transcript (the gateway's
equivalent of the CLI's in-place history surgery + memory invalidation),
and echoes the backed-up message text so the user can copy/edit and
resend — platforms have no editable composer to prefill.
- gateway/session.py: SessionStore.rewind_session(session_id, n) wraps
the soft-delete primitive; load_transcript already returns active-only
- gateway/run.py: _handle_undo_command parses [N], calls rewind_session,
evicts the agent, echoes target text; confirm-prompt detail is count-aware
- locales: undo.removed gains {turns}; new undo.invalid_count, all 16 langs
- tests: tests/gateway/test_undo_rewind_session.py (6 cases)
This commit is contained in:
+2
-1
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "Niks om ongedaan te maak nie."
|
||||
removed: "↩️ {count} boodskap(pe) ongedaan gemaak.\nVerwyder: \"{preview}\""
|
||||
removed: "↩️ {turns} beurt(e) ongedaan gemaak ({count} boodskap(pe)).\nGerugsteun na: \"{preview}\"\nKopieer/wysig die teks hierbo en stuur dit om van hier af weer te vra."
|
||||
invalid_count: "Ongeldige getal \"{arg}\" — gebruik /undo of /undo N."
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update is slegs beskikbaar vanaf boodskapplatforms. Voer `hermes update` vanaf die terminale uit."
|
||||
|
||||
+2
-1
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "Nichts zum Rückgängigmachen."
|
||||
removed: "↩️ {count} Nachricht(en) rückgängig gemacht.\nEntfernt: \"{preview}\""
|
||||
removed: "↩️ {turns} Zug/Züge rückgängig gemacht ({count} Nachricht(en)).\nGesichert nach: \"{preview}\"\nKopieren/bearbeiten Sie den obigen Text und senden Sie ihn, um von hier aus erneut zu fragen."
|
||||
invalid_count: "Ungültige Anzahl \"{arg}\" — verwenden Sie /undo oder /undo N."
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update ist nur auf Messaging-Plattformen verfügbar. Führen Sie `hermes update` im Terminal aus."
|
||||
|
||||
+2
-1
@@ -305,7 +305,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "Nothing to undo."
|
||||
removed: "↩️ Undid {count} message(s).\nRemoved: \"{preview}\""
|
||||
removed: "↩️ Undid {turns} turn(s) ({count} message(s)).\nBacked up to: \"{preview}\"\nCopy/edit the text above and send it to re-prompt from here."
|
||||
invalid_count: "Invalid count \"{arg}\" — use /undo or /undo N."
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update is only available from messaging platforms. Run `hermes update` from the terminal."
|
||||
|
||||
+2
-1
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "Nada que deshacer."
|
||||
removed: "↩️ {count} mensaje(s) deshecho(s).\nEliminado: \"{preview}\""
|
||||
removed: "↩️ {turns} turno(s) deshecho(s) ({count} mensaje(s)).\nRespaldado en: \"{preview}\"\nCopia/edita el texto de arriba y envíalo para volver a preguntar desde aquí."
|
||||
invalid_count: "Cantidad no válida \"{arg}\" — usa /undo o /undo N."
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update solo está disponible en plataformas de mensajería. Ejecuta `hermes update` desde la terminal."
|
||||
|
||||
+2
-1
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "Rien à annuler."
|
||||
removed: "↩️ {count} message(s) annulé(s).\nSupprimé : « {preview} »"
|
||||
removed: "↩️ {turns} tour(s) annulé(s) ({count} message(s)).\nSauvegardé dans : « {preview} »\nCopiez/modifiez le texte ci-dessus et envoyez-le pour relancer à partir d'ici."
|
||||
invalid_count: "Nombre invalide « {arg} » — utilisez /undo ou /undo N."
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update n'est disponible que depuis les plateformes de messagerie. Exécutez `hermes update` depuis le terminal."
|
||||
|
||||
+2
-1
@@ -294,7 +294,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "Níl aon rud le cealú."
|
||||
removed: "↩️ Cealaíodh {count} teachtaireacht.\nBaineadh: \"{preview}\""
|
||||
removed: "↩️ Cealaíodh {turns} seal ({count} teachtaireacht).\nCúltacaíodh chuig: \"{preview}\"\nCóipeáil/cuir an téacs thuas in eagar agus seol é chun athleideadh ón áit seo."
|
||||
invalid_count: "Líon neamhbhailí \"{arg}\" — úsáid /undo nó /undo N."
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ Tá /update ar fáil amháin ó ardáin teachtaireachtaí. Rith `hermes update` ón teirminéal."
|
||||
|
||||
+2
-1
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "Nincs mit visszavonni."
|
||||
removed: "↩️ {count} üzenet visszavonva.\nEltávolítva: \"{preview}\""
|
||||
removed: "↩️ {turns} fordulat visszavonva ({count} üzenet).\nBiztonsági mentés ide: \"{preview}\"\nMásold/szerkeszd a fenti szöveget, és küldd el, hogy innen újra kérdezz."
|
||||
invalid_count: "Érvénytelen szám \"{arg}\" — használd a /undo vagy /undo N parancsot."
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ A /update csak üzenetküldő platformokról érhető el. Futtasd a `hermes update` parancsot a terminálból."
|
||||
|
||||
+2
-1
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "Niente da annullare."
|
||||
removed: "↩️ Annullati {count} messaggio/i.\nRimosso: \"{preview}\""
|
||||
removed: "↩️ Annullati {turns} turno/i ({count} messaggio/i).\nSalvato in: \"{preview}\"\nCopia/modifica il testo qui sopra e invialo per ripartire da qui."
|
||||
invalid_count: "Conteggio non valido \"{arg}\" — usa /undo o /undo N."
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update è disponibile solo dalle piattaforme di messaggistica. Esegui `hermes update` dal terminale."
|
||||
|
||||
+2
-1
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "元に戻せる操作がありません。"
|
||||
removed: "↩️ {count} 件のメッセージを取り消しました。\n削除: 「{preview}」"
|
||||
removed: "↩️ {turns} ターンを取り消しました({count} 件のメッセージ)。\nバックアップ先: 「{preview}」\n上のテキストをコピー/編集して送信すると、ここから再入力できます。"
|
||||
invalid_count: "無効な数値「{arg}」— /undo または /undo N を使用してください。"
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update はメッセージングプラットフォームでのみ利用可能です。ターミナルで `hermes update` を実行してください。"
|
||||
|
||||
+2
-1
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "되돌릴 내용이 없습니다."
|
||||
removed: "↩️ 메시지 {count}개를 되돌렸습니다.\n제거됨: \"{preview}\""
|
||||
removed: "↩️ {turns}개 턴을 되돌렸습니다 (메시지 {count}개).\n백업 위치: \"{preview}\"\n위 텍스트를 복사/편집한 후 보내면 여기서 다시 프롬프트할 수 있습니다."
|
||||
invalid_count: "잘못된 개수 \"{arg}\" — /undo 또는 /undo N을 사용하세요."
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update는 메시징 플랫폼에서만 사용할 수 있습니다. 터미널에서 `hermes update`를 실행하세요."
|
||||
|
||||
+2
-1
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "Nada para anular."
|
||||
removed: "↩️ {count} mensagem(ns) anulada(s).\nRemovido: \"{preview}\""
|
||||
removed: "↩️ {turns} turno(s) anulado(s) ({count} mensagem(ns)).\nGuardado em: \"{preview}\"\nCopia/edita o texto acima e envia-o para voltar a perguntar a partir daqui."
|
||||
invalid_count: "Contagem inválida \"{arg}\" — usa /undo ou /undo N."
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update só está disponível em plataformas de mensagens. Executa `hermes update` a partir do terminal."
|
||||
|
||||
+2
-1
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "Нечего отменять."
|
||||
removed: "↩️ Отменено сообщений: {count}.\nУдалено: «{preview}»"
|
||||
removed: "↩️ Отменено ходов: {turns} (сообщений: {count}).\nРезервная копия: «{preview}»\nСкопируйте/отредактируйте текст выше и отправьте его, чтобы запросить заново отсюда."
|
||||
invalid_count: "Недопустимое число «{arg}» — используйте /undo или /undo N."
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update доступен только на платформах обмена сообщениями. Выполните `hermes update` в терминале."
|
||||
|
||||
+2
-1
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "Geri alınacak bir şey yok."
|
||||
removed: "↩️ {count} mesaj geri alındı.\nKaldırıldı: \"{preview}\""
|
||||
removed: "↩️ {turns} tur geri alındı ({count} mesaj).\nYedeklendiği yer: \"{preview}\"\nYukarıdaki metni kopyalayıp/düzenleyip göndererek buradan yeniden sorabilirsiniz."
|
||||
invalid_count: "Geçersiz sayı \"{arg}\" — /undo veya /undo N kullanın."
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update yalnızca mesajlaşma platformlarında kullanılabilir. Terminalden `hermes update` komutunu çalıştırın."
|
||||
|
||||
+2
-1
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "Немає чого скасовувати."
|
||||
removed: "↩️ Скасовано {count} повідомлень.\nВидалено: «{preview}»"
|
||||
removed: "↩️ Скасовано ходів: {turns} (повідомлень: {count}).\nРезервна копія: «{preview}»\nСкопіюйте/відредагуйте текст вище та надішліть його, щоб запитати знову звідси."
|
||||
invalid_count: "Недійсне число «{arg}» — використовуйте /undo або /undo N."
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update доступний лише на платформах обміну повідомленнями. Виконайте `hermes update` у терміналі."
|
||||
|
||||
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "沒有可復原的內容。"
|
||||
removed: "↩️ 已復原 {count} 則訊息。\n已移除:「{preview}」"
|
||||
removed: "↩️ 已復原 {turns} 個回合({count} 則訊息)。\n已備份至:「{preview}」\n複製/編輯上方的文字並傳送,即可從此處重新提問。"
|
||||
invalid_count: "無效的數量「{arg}」—— 請使用 /undo 或 /undo N。"
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update 僅在訊息平台上可用。請在終端機執行 `hermes update`。"
|
||||
|
||||
+2
-1
@@ -290,7 +290,8 @@ gateway:
|
||||
|
||||
undo:
|
||||
nothing: "没有可撤销的内容。"
|
||||
removed: "↩️ 已撤销 {count} 条消息。\n已移除:「{preview}」"
|
||||
removed: "↩️ 已撤销 {turns} 个回合({count} 条消息)。\n已备份到:「{preview}」\n复制/编辑上面的文本并发送,即可从此处重新提问。"
|
||||
invalid_count: "无效的数量「{arg}」—— 请使用 /undo 或 /undo N。"
|
||||
|
||||
update:
|
||||
platform_not_messaging: "✗ /update 仅在消息平台可用。请在终端运行 `hermes update`。"
|
||||
|
||||
Reference in New Issue
Block a user