From 75717c0d3f59e607a0fc0dd03856af9b9f3e6ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20Andr=C3=A9?= Date: Mon, 9 Nov 2026 00:59:04 +0100 Subject: [PATCH 1/2] feat(sessions): archive and restore native conversations Use OpenCode's existing archive API to keep completed conversations without deleting their history. Add row archive/restore actions and an Unarchived/Archived/All filter in session search, with native archived badges. Hide idle archived branches during ordinary browsing and keyboard cycling, while keeping selected conversations, running work and pending-question ancestor paths reachable. Child archive flags remain native and independent. Serialize archive writes with session actions, refresh authoritative inventory and verify the returned flag. Preserve newer archive events against metadata reads started earlier. Retain complete inventory for ownership and recovery; never synthesize local archive state or replay uncertain writes. Runtime minimum and dependency pins stay unchanged. Add native minimum/latest archive probes for persistence, filtered cursors, idempotent events, transcript preservation and unchanged children; store and real-browser coverage for actions, filtering, failures and stale reads. Update technical docs and user help in all ten locales. Focused UI regressions, proxy tests, typechecks and native 2.2.3/2.2.6 checks pass. --- .github/workflows/pr-build.yml | 3 + dev-docs/OPENCODE_COMPATIBILITY.md | 6 +- dev-docs/UI_SHELL.md | 1 + docs/help/de/conversations.md | 6 ++ docs/help/en/conversations.md | 6 ++ docs/help/es/conversations.md | 6 ++ docs/help/fr/conversations.md | 6 ++ docs/help/he/conversations.md | 6 ++ docs/help/ja/conversations.md | 6 ++ docs/help/ne/conversations.md | 6 ++ docs/help/ru/conversations.md | 6 ++ docs/help/tr/conversations.md | 6 ++ docs/help/zh-Hans/conversations.md | 6 ++ packages/ui/src/components/session-list.tsx | 48 +++++++++- .../ui/src/lib/i18n/messages/de/session.ts | 9 ++ .../ui/src/lib/i18n/messages/en/session.ts | 9 ++ .../ui/src/lib/i18n/messages/es/session.ts | 9 ++ .../ui/src/lib/i18n/messages/fr/session.ts | 9 ++ .../ui/src/lib/i18n/messages/he/session.ts | 9 ++ .../ui/src/lib/i18n/messages/ja/session.ts | 9 ++ .../ui/src/lib/i18n/messages/ne/session.ts | 9 ++ .../ui/src/lib/i18n/messages/ru/session.ts | 9 ++ .../ui/src/lib/i18n/messages/tr/session.ts | 9 ++ .../src/lib/i18n/messages/zh-Hans/session.ts | 9 ++ .../ui/src/stores/session-archive.test.ts | 90 +++++++++++++++++++ packages/ui/src/stores/session-archive.ts | 24 +++++ packages/ui/src/stores/session-events.ts | 12 ++- packages/ui/src/stores/session-state.ts | 3 +- packages/ui/src/stores/session-tree.test.ts | 23 +++++ packages/ui/src/stores/session-tree.ts | 31 ++++++- .../browser/fixtures/session-archives.tsx | 61 +++++++++++++ .../ui/tests/browser/session-archives.test.ts | 86 ++++++++++++++++++ scripts/test-session-archive-native.mjs | 72 +++++++++++++++ 33 files changed, 602 insertions(+), 8 deletions(-) create mode 100644 packages/ui/src/stores/session-archive.test.ts create mode 100644 packages/ui/src/stores/session-archive.ts create mode 100644 packages/ui/tests/browser/fixtures/session-archives.tsx create mode 100644 packages/ui/tests/browser/session-archives.test.ts create mode 100644 scripts/test-session-archive-native.mjs diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 64f7311995..a92cc191cf 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -207,6 +207,8 @@ jobs: if ($LASTEXITCODE) { exit $LASTEXITCODE } node scripts/test-session-pruning-native.mjs $cli if ($LASTEXITCODE) { exit $LASTEXITCODE } + node scripts/test-session-archive-native.mjs $cli + if ($LASTEXITCODE) { exit $LASTEXITCODE } if ('${{ matrix.runtime }}' -eq 'latest') { node scripts/test-session-pruning-native.mjs $cli --part-rows if ($LASTEXITCODE) { exit $LASTEXITCODE } @@ -593,6 +595,7 @@ jobs: packages/ui/src/stores/permission-lifecycle.test.ts packages/ui/src/stores/shell-store-reactivity.test.ts packages/ui/src/stores/session-actions.test.ts + packages/ui/src/stores/session-archive.test.ts packages/ui/src/stores/session-model-reconciliation.test.ts packages/ui/src/stores/session-pruning-events.test.ts packages/ui/src/stores/session-pruning-projection.test.ts diff --git a/dev-docs/OPENCODE_COMPATIBILITY.md b/dev-docs/OPENCODE_COMPATIBILITY.md index 94f3ef62e9..103b271fd4 100644 --- a/dev-docs/OPENCODE_COMPATIBILITY.md +++ b/dev-docs/OPENCODE_COMPATIBILITY.md @@ -173,8 +173,10 @@ reasoning identity and `stores/session-actions.ts` refuses pruning `Session.Message.Compaction.Completed` with `metadata` but no `recent` (`compatibility/negotiate.ts`). `planner.ts` hashes the `SessionLegacy` projection and writes surviving stored parts back unchanged -(`pruning.test.ts`). CodeNomad never archives (`session.archived`/`unarchived` -only invalidate); the UI compaction part keeps `native` (`normalizers.ts`). The +(`pruning.test.ts`). Session archive/restore uses native `session.update` with +`archived: true|false`, authoritative `time.archived` and `session.archived`/`unarchived` +events; `scripts/test-session-archive-native.mjs` covers filtered cursor pages, +idempotence and transcript/child preservation. The UI compaction part keeps `native` (`normalizers.ts`). The packed pruning plugin declares every bare import, including `@opencode/schema` (`package.test.ts`). diff --git a/dev-docs/UI_SHELL.md b/dev-docs/UI_SHELL.md index 637a6961d7..c67c03098a 100644 --- a/dev-docs/UI_SHELL.md +++ b/dev-docs/UI_SHELL.md @@ -14,6 +14,7 @@ Panel toggles, floating drawers, project/right-panel tabs, the session sidebar a - Conversation header actions (inline and in their overflow menu) offer the web preview on every platform, with Full screen added on mobile. Remote Control clients hide the preview entry while their host keeps web previews off: `/api/meta` then reports `previewsUnavailable` (`previewsUnavailable()` in `lib/server-meta.ts`). Validate with `tests/browser/header-windows.test.ts`. - Session hierarchy geometry lives in `styles/components/session-tree.css`; connector axes follow the parent expander at every depth, including selection mode, RTL and touch layouts. - Session search/filter mode uses flat per-session results with an optional subsession switch; filters, sorting, worktree badges and selection use each result's own identity. Normal browsing retains the session hierarchy. +- Session archive actions use native `session.update({ archived })`, serialized with other session actions, followed by an authoritative inventory refresh and flag verification. Native events project `time.archived`; stale metadata reads retain newer event authority. Normal browsing and list-cycling hide idle archived branches, keeping selected conversations and running/pending-request paths reachable. Children retain their own flags and remain independently discoverable in flat search/filter mode. The archive selector is local to that search surface (Unarchived / Archived / All), with the native flag badge and Restore action; never persist a separate archive state or treat archive as interruption/deletion. Validate `session-archive.test.ts`, `session-tree.test.ts`, browser `session-archives.test.ts` and `scripts/test-session-archive-native.mjs`. - Project and right-panel tabs share `components/tab-scroll.tsx` and `styles/components/tab-scroll.css`. Keep their native scrollbar above upright content without mirrored transforms, negative border overlaps or permanent compositing hints. Validate shared scrollbar styling and adjoining edges at fractional zoom in the browser and isolated Electron renderer fixtures (`tests/browser/tab-chrome.test.ts`). - The Status tab starts with the shown session's goal line (`components/session/session-goal-line.tsx`, `styles/panels/status-goal.css`) only while that session has a `/goal`: one row above the sections with the status badge (`.session-goal-badge` in `styles/components/badges.css`), the objective truncated with its full text and the reason in its tooltip (the reason is also the row's accessible description), the rounds, one Pause/Resume button that keeps focus as the status flips, and Clear. While a command runs its actions are `aria-disabled` and ignore activation, never `disabled`, so the focused button keeps keyboard focus. Never add it to `CORE_STATUS_SECTION_ITEMS` or the right-panel customization, and never show a hint, empty state or gap without a goal. Contract, commands and freshness: [OPENCODE_COMPATIBILITY.md](OPENCODE_COMPATIBILITY.md) (Session goal). Validate with `tests/browser/session-goal.test.ts`. - Built-in right-panel tabs are constructed directly in `right-panel/core-runtime.tsx` (never add a first-party plugin loader for them); external sandboxed panels keep their independent consent/loading path. diff --git a/docs/help/de/conversations.md b/docs/help/de/conversations.md index 714ad54f2b..d2f16066c7 100644 --- a/docs/help/de/conversations.md +++ b/docs/help/de/conversations.md @@ -19,6 +19,12 @@ Normales Durchsuchen ist hierarchisch; Such-/Filterergebnisse sind flache Eintr Zurück/Vorwärts ist ein Besuchsverlauf pro Projekt-Tab und Fenster, nicht die Reihenfolge der Liste. Er bleibt im Arbeitsspeicher, überspringt nicht verfügbare/gelöschte Unterhaltungen und wird nach einem Neustart nicht wiederhergestellt. Die Auswahl einer neuen Unterhaltung nach dem Zurückgehen ersetzt den Vorwärtspfad. **Vorherige Sitzung** / **Nächste Sitzung** in der Palette durchlaufen stattdessen die sichtbare Liste. +## Archivieren und wiederherstellen {#archive} + +Wählen Sie **Sitzung archivieren** in den Zeilenaktionen, um den Verlauf zu behalten und den inaktiven Zweig aus der normalen Ansicht auszublenden. Die ausgewählte Unterhaltung sowie laufende Arbeit und offene Fragen bleiben erreichbar. Archivieren beendet keine Arbeit, löscht keine Nachrichten und ändert nicht die eigenen Archivkennzeichen der Untersitzungen. + +Öffnen Sie die Sitzungssuche und wählen Sie **Archivierte Sitzungen** oder **Alle Sitzungen**. Die Zeilen zeigen **Archiviert** und bieten **Sitzung wiederherstellen**. Aktivieren Sie Untersitzungen, um Kinder auch unter archivierten Eltern unabhängig zu finden. **Nicht archivierte Sitzungen** filtert nach dem eigenen Kennzeichen jeder Unterhaltung. Stellen Sie einen archivierten Vorfahren wieder her, um seinen inaktiven Zweig wieder normal anzuzeigen. Aktualisieren Sie bei unbestätigter Aktion die Liste vor einem erneuten Versuch. + ## Agent, Modell und Denkaufwand wählen {#agent-model-thinking} 1. Verwenden Sie vor dem Senden die Agenten- und Modellauswahl in der Fußzeile des Eingabefelds. diff --git a/docs/help/en/conversations.md b/docs/help/en/conversations.md index a223945e6f..c8bcb426d6 100644 --- a/docs/help/en/conversations.md +++ b/docs/help/en/conversations.md @@ -19,6 +19,12 @@ Normal browsing is hierarchical; search/filter results are flat entries with eac Back/Forward is a per-project-tab, per-window visit history, not list order. It is kept in memory, skips unavailable/deleted conversations and is not restored after restart. Selecting a new conversation after going back replaces the forward path. The palette's **Previous Session** / **Next Session** instead cycle the visible list. +## Archive and restore {#archive} + +Choose **Archive session** in a session row's actions to keep its history while removing its idle branch from normal browsing. The selected conversation and conversations with running work or pending questions remain reachable. Archiving does not stop work, delete messages or change subsessions' own archive flags. + +Open **Search sessions…** and choose **Archived sessions** or **All sessions** to find archived conversations. Rows show **Archived** and offer **Restore session**. Enable **Subsessions** to find children independently, including children beneath an archived parent. **Unarchived sessions** filters by each conversation's own flag. Restore an archived ancestor to bring its idle branch back into normal browsing. If an action is not confirmed, refresh the session list before trying again. + ## Choose Agent, Model and Thinking {#agent-model-thinking} 1. Use the composer footer's agent and model selectors before sending. diff --git a/docs/help/es/conversations.md b/docs/help/es/conversations.md index 5c42fa9c27..12ce2bf3fd 100644 --- a/docs/help/es/conversations.md +++ b/docs/help/es/conversations.md @@ -19,6 +19,12 @@ La exploración normal es jerárquica; los resultados de búsqueda/filtro son en Atrás/Adelante es un historial de visitas por pestaña de proyecto y ventana, no el orden de la lista. Se conserva en memoria, omite conversaciones no disponibles/eliminadas y no se restaura tras reiniciar. Seleccionar una conversación nueva después de retroceder reemplaza la ruta hacia delante. En cambio, **Sesión anterior** / **Siguiente sesión** en la paleta recorren cíclicamente la lista visible. +## Archivar y restaurar {#archive} + +Elige **Archivar sesión** en las acciones de una fila para conservar su historial y ocultar su rama inactiva de la navegación normal. La conversación seleccionada y las que tienen trabajo en curso o preguntas pendientes siguen accesibles. Archivar no detiene el trabajo, no elimina mensajes ni cambia el estado de archivo propio de las subsesiones. + +Abre la búsqueda de sesiones y elige **Sesiones archivadas** o **Todas las sesiones**. Las filas muestran **Archivada** y ofrecen **Restaurar sesión**. Activa las subsesiones para encontrar hijos de forma independiente, incluso bajo un padre archivado. **Sesiones sin archivar** filtra por el estado propio de cada conversación. Restaura un antecesor archivado para volver a mostrar su rama inactiva en la navegación normal. Si una acción no se confirma, actualiza la lista antes de reintentar. + ## Elegir Agente, Modelo y Razonamiento {#agent-model-thinking} 1. Usa los selectores de agente y modelo del pie del editor de mensajes antes de enviar. diff --git a/docs/help/fr/conversations.md b/docs/help/fr/conversations.md index 4c2b5a8625..de803819a5 100644 --- a/docs/help/fr/conversations.md +++ b/docs/help/fr/conversations.md @@ -19,6 +19,12 @@ La navigation normale est hiérarchique ; les résultats de recherche/filtre son Retour/Avancer est un historique de visites par onglet de projet et par fenêtre, pas l’ordre de la liste. Il reste en mémoire, ignore les conversations indisponibles/supprimées et n’est pas restauré après redémarrage. Sélectionner une nouvelle conversation après un retour remplace le parcours suivant. **Session précédente** / **Session suivante** dans la palette parcourent plutôt la liste visible. +## Archiver et restaurer {#archive} + +Choisissez **Archiver la session** dans les actions d’une ligne pour conserver son historique tout en retirant sa branche inactive de la navigation normale. La conversation sélectionnée et les conversations en cours de travail ou attendant une réponse restent accessibles. L’archivage n’arrête pas le travail, ne supprime aucun message et ne change pas l’état d’archivage propre aux sous-sessions. + +Ouvrez la recherche de sessions et choisissez **Sessions archivées** ou **Toutes les sessions**. Les lignes portent la mention **Archivée** et proposent **Restaurer la session**. Activez le filtre des sous-sessions pour trouver les enfants indépendamment, y compris sous un parent archivé. **Sessions non archivées** filtre selon l’état propre à chaque conversation. Restaurez un ancêtre archivé pour retrouver sa branche inactive dans la navigation normale. Si une action n’est pas confirmée, actualisez la liste avant de réessayer. + ## Choisir Agent, Modèle et Réflexion {#agent-model-thinking} 1. Utilisez les sélecteurs d’agent et de modèle du pied de la zone de saisie avant l’envoi. diff --git a/docs/help/he/conversations.md b/docs/help/he/conversations.md index f778a7df7d..0378c1dae9 100644 --- a/docs/help/he/conversations.md +++ b/docs/help/he/conversations.md @@ -19,6 +19,12 @@ CodeNomad מציג סשנים מקוריים של OpenCode כשיחות, עם ה אחורה/קדימה הם היסטוריית ביקורים לכל לשונית פרויקט ולכל חלון, לא סדר הרשימה. היא נשמרת בזיכרון, מדלגת על שיחות לא זמינות/שנמחקו ואינה משוחזרת לאחר הפעלה מחדש. בחירת שיחה חדשה לאחר חזרה אחורה מחליפה את המסלול קדימה. **סשן קודם** / **סשן הבא** בלוח הפקודות עוברים במקום זאת במחזור ברשימה הגלויה. +## ארכיון ושחזור {#archive} + +בחרו **העברה לארכיון** בפעולות השורה כדי לשמור את ההיסטוריה ולהסתיר את הענף הלא פעיל מהתצוגה הרגילה. השיחה הנבחרת ושיחות עם עבודה פעילה או שאלות ממתינות נשארות נגישות. הארכיון אינו מפסיק עבודה, מוחק הודעות או משנה את מצב הארכיון העצמי של שיחות המשנה. + +פתחו את חיפוש השיחות ובחרו **שיחות בארכיון** או **כל השיחות**. השורות מציגות **בארכיון** ומציעות **שחזור שיחה**. הפעילו שיחות משנה כדי למצוא ילדים בנפרד, גם תחת הורה בארכיון. **שיחות שלא בארכיון** מסנן לפי המצב העצמי של כל שיחה. שחזרו הורה שבארכיון כדי להחזיר את הענף הלא פעיל לתצוגה הרגילה. אם פעולה לא אושרה, רעננו את הרשימה לפני ניסיון נוסף. + ## בחירת סוכן, מודל וחשיבה {#agent-model-thinking} 1. השתמשו בבוררי הסוכן והמודל בשורה התחתונה של שדה הקלט לפני שליחה. diff --git a/docs/help/ja/conversations.md b/docs/help/ja/conversations.md index cf98afc9a7..e875535464 100644 --- a/docs/help/ja/conversations.md +++ b/docs/help/ja/conversations.md @@ -19,6 +19,12 @@ CodeNomad は、OpenCode ネイティブのセッションを会話として表 戻る/進むは、一覧の順序ではなく、プロジェクトタブごと、ウィンドウごとの閲覧履歴です。メモリ内に保持され、利用不可/削除済みの会話はスキップし、再起動後は復元されません。戻った後に新しい会話を選ぶと、進む先の経路が置き換わります。一方、パレットの **前のセッション**/**次のセッション** は、表示中の一覧を巡回します。 +## アーカイブと復元 {#archive} + +行の操作で **セッションをアーカイブ** を選ぶと、履歴を保持して通常の一覧から非アクティブな枝を隠します。選択中の会話、実行中の作業、回答待ちの質問がある会話には引き続きアクセスできます。アーカイブは作業を停止せず、メッセージを削除せず、子セッション自身のアーカイブ状態も変更しません。 + +セッション検索を開き、**アーカイブ済みのセッション** または **すべてのセッション** を選びます。行には **アーカイブ済み** と表示され、**セッションを復元** を選べます。子セッションの表示を有効にすると、アーカイブされた親の下でも個別に検索できます。**未アーカイブのセッション** は各会話自身の状態で絞り込みます。非アクティブな枝を通常の一覧に戻すには、アーカイブされた祖先を復元してください。操作を確認できない場合は、再試行する前に一覧を更新してください。 + ## エージェント、モデル、思考を選ぶ {#agent-model-thinking} 1. 送信前に、入力欄フッターのエージェントとモデルのセレクターを使用します。 diff --git a/docs/help/ne/conversations.md b/docs/help/ne/conversations.md index 90a7f8cb97..c8bee61326 100644 --- a/docs/help/ne/conversations.md +++ b/docs/help/ne/conversations.md @@ -19,6 +19,12 @@ CodeNomad ले नेटिभ OpenCode सत्रलाई कुराक Back/Forward प्रति-परियोजना-ट्याब, प्रति-विन्डो भ्रमण इतिहास हो, सूची क्रम होइन। यो memory मा रहन्छ, अनुपलब्ध/मेटिएका कुराकानी छोड्छ र पुनःसुरुवातपछि फर्किँदैन। पछाडि गएपछि नयाँ कुराकानी चयन गर्दा अगाडिको मार्ग बदलिन्छ। प्यालेटका **अघिल्लो सत्र** / **अर्को सत्र** ले भने देखिएको सूची घुमाउँछन्। +## अभिलेख र पुनर्स्थापना {#archive} + +इतिहास राख्दै निष्क्रिय शाखालाई सामान्य सूचीबाट लुकाउन पङ्क्तिको कार्यमा **सत्र अभिलेखमा राख्नुहोस्** रोज्नुहोस्। चयन गरिएको संवाद, चलिरहेको काम र उत्तर पर्खिरहेका प्रश्न भएका संवाद पहुँचयोग्य रहन्छन्। अभिलेखमा राख्दा काम रोकिन्न, सन्देश मेटिँदैन र उपसत्रको आफ्नै अभिलेख स्थिति बदलिँदैन। + +सत्र खोज खोलेर **अभिलेखमा राखिएका सत्रहरू** वा **सबै सत्रहरू** रोज्नुहोस्। पङ्क्तिमा **अभिलेखमा** देखिन्छ र **सत्र पुनर्स्थापना गर्नुहोस्** उपलब्ध हुन्छ। अभिलेखमा रहेको मूल सत्रका उपसत्रसमेत अलग खोज्न उपसत्र विकल्प खोल्नुहोस्। **अभिलेखमा नराखिएका सत्रहरू** ले हरेक संवादको आफ्नै स्थिति प्रयोग गर्छ। निष्क्रिय शाखालाई सामान्य सूचीमा फर्काउन अभिलेखमा रहेको पूर्वज सत्र पुनर्स्थापना गर्नुहोस्। कार्य पुष्टि नभए फेरि प्रयास गर्नुअघि सूची ताजा गर्नुहोस्। + ## Agent, Model र Thinking रोज्नुहोस् {#agent-model-thinking} 1. पठाउनुअघि कम्पोजर footer का agent र model selector प्रयोग गर्नुहोस्। diff --git a/docs/help/ru/conversations.md b/docs/help/ru/conversations.md index 11a8214859..f6f5f22a61 100644 --- a/docs/help/ru/conversations.md +++ b/docs/help/ru/conversations.md @@ -19,6 +19,12 @@ CodeNomad представляет нативные сессии OpenCode как Назад/Вперёд — история посещений для каждой вкладки проекта и окна, а не порядок списка. Она хранится в памяти, пропускает недоступные/удалённые разговоры и не восстанавливается после перезапуска. Выбор нового разговора после возврата назад заменяет путь вперёд. Команды палитры **Предыдущая сессия** / **Следующая сессия**, напротив, перебирают видимый список. +## Архивация и восстановление {#archive} + +Выберите **Архивировать сессию** в действиях строки, чтобы сохранить историю и скрыть неактивную ветку из обычного списка. Выбранный разговор, текущая работа и разговоры с ожидающими ответа вопросами остаются доступны. Архивация не останавливает работу, не удаляет сообщения и не меняет собственные признаки архива у дочерних сессий. + +Откройте поиск сессий и выберите **Архивированные сессии** или **Все сессии**. Строки помечены **В архиве** и предлагают **Восстановить сессию**. Включите подсессии, чтобы находить детей независимо, в том числе под архивированным родителем. **Неархивированные сессии** фильтрует по собственному признаку каждого разговора. Восстановите архивированного предка, чтобы вернуть неактивную ветку в обычный список. Если действие не подтверждено, обновите список перед повторной попыткой. + ## Выбор агента, модели и мышления {#agent-model-thinking} 1. Перед отправкой используйте переключатели агента и модели внизу поля ввода. diff --git a/docs/help/tr/conversations.md b/docs/help/tr/conversations.md index 758fc16e83..e2724f44e3 100644 --- a/docs/help/tr/conversations.md +++ b/docs/help/tr/conversations.md @@ -19,6 +19,12 @@ Normal gezinme hiyerarşiktir; arama/filtre sonuçları her konuşmanın kendi k Geri/İleri, liste sırası değil, proje sekmesi başına, pencere başına ziyaret geçmişidir. Bellekte tutulur, kullanılamayan/silinmiş konuşmalar atlanır ve yeniden başlatıldıktan sonra geri yüklenmez. Geri döndükten sonra yeni bir görüşme seçmek ileri yolun yerini alır. Paletin **Önceki Session** / **Sonraki Session**'si bunun yerine görünür listeyi döndürür. +## Arşivleme ve geri yükleme {#archive} + +Geçmişi koruyup etkin olmayan dalı normal listeden gizlemek için satır eylemlerinden **Oturumu arşivle** seçeneğini kullanın. Seçili konuşma, çalışan işler ve yanıt bekleyen soruları olan konuşmalar erişilebilir kalır. Arşivleme işi durdurmaz, mesajları silmez ve alt oturumların kendi arşiv durumlarını değiştirmez. + +Oturum aramasını açıp **Arşivlenmiş oturumlar** veya **Tüm oturumlar** seçeneğini kullanın. Satırlar **Arşivlendi** olarak işaretlenir ve **Oturumu geri yükle** eylemini sunar. Arşivlenmiş üst oturumların altındakiler dahil çocukları bağımsız bulmak için alt oturumları etkinleştirin. **Arşivlenmemiş oturumlar**, her konuşmanın kendi durumuna göre filtreler. Etkin olmayan dalı normal listeye döndürmek için arşivlenmiş üst oturumu geri yükleyin. Eylem doğrulanmazsa yeniden denemeden önce listeyi yenileyin. + ## Ajan, Model ve Düşünme seçimi {#agent-model-thinking} 1. Göndermeden önce ileti düzenleyicisinin altındaki ajan ve model seçicilerini kullanın. diff --git a/docs/help/zh-Hans/conversations.md b/docs/help/zh-Hans/conversations.md index 213cbe4dcd..133d6535a5 100644 --- a/docs/help/zh-Hans/conversations.md +++ b/docs/help/zh-Hans/conversations.md @@ -19,6 +19,12 @@ CodeNomad 将原生 OpenCode 会话呈现为对话,为委派工作提供层级 后退/前进是每个项目标签页、每个窗口的访问历史,而非列表顺序。它保存在内存中,跳过不可用/已删除对话,重启后不会恢复。后退后选择新对话会替换前进路径。命令面板的**上一个会话** / **下一个会话**则按可见列表循环切换。 +## 归档与恢复 {#archive} + +在会话行的操作中选择 **归档会话**,即可保留历史并从普通列表中隐藏其空闲分支。当前选中的会话、正在工作的会话及等待回答问题的会话仍可访问。归档不会停止工作、删除消息或更改子会话自身的归档状态。 + +打开会话搜索,选择 **已归档会话** 或 **所有会话**。会话行显示 **已归档**,并提供 **恢复会话** 操作。启用子会话筛选即可独立查找子会话,包括已归档父会话下的子会话。**未归档会话** 按每个会话自身的状态筛选。恢复已归档的祖先会话,可让其空闲分支重新出现在普通列表中。如果操作未获确认,请先刷新列表,再尝试操作。 + ## 选择智能体、模型和思考 {#agent-model-thinking} 1. 发送前使用输入框底栏的智能体和模型选择器。 diff --git a/packages/ui/src/components/session-list.tsx b/packages/ui/src/components/session-list.tsx index fd536076f1..8f806ec026 100644 --- a/packages/ui/src/components/session-list.tsx +++ b/packages/ui/src/components/session-list.tsx @@ -4,7 +4,7 @@ import { Virtualizer, type VirtualizerHandle } from "virtua/solid" import type { SessionStatus } from "../types/session" import type { SessionThread } from "../stores/session-state" import { clearSessionIdleFade, getRetrySeconds, getSessionIdleFadeClass, getSessionRetry, getSessionStatus, shouldShowSessionStatus } from "../stores/session-status" -import { Bot, User, Copy, Trash2, Pencil, ShieldAlert, ChevronRight, Search, Square, CheckSquare, MinusSquare, Split, RotateCw } from "lucide-solid" +import { Archive, ArchiveRestore, Bot, User, Copy, Trash2, Pencil, ShieldAlert, ChevronRight, Search, Square, CheckSquare, MinusSquare, Split, RotateCw } from "lucide-solid" import { childActivityKind, childActivityLabel } from "./session-child-activity" import LoadErrorState from "./load-error-state" import SessionRenameDialog from "./session-rename-dialog" @@ -40,7 +40,8 @@ import { isSessionSearchLoading, } from "../stores/sessions" import { getGitRepoStatus, getWorktreeSlugForParentSession, getWorktrees } from "../stores/worktrees" -import { collectDescendantActivity, collectSessionThreadIds, findSessionThread, flattenVisibleSessionThreads, projectSessionFamilies, projectSessionSearchResults, sortSessionIdsDeepestFirst, type SessionFamilySort } from "../stores/session-tree" +import { collectDescendantActivity, collectSessionThreadIds, findSessionThread, flattenVisibleSessionThreads, isSessionArchived, projectSessionFamilies, projectSessionSearchResults, projectUnarchivedSessionThreads, sortSessionIdsDeepestFirst, type SessionFamilySort, type SessionArchiveFilter } from "../stores/session-tree" +import { setSessionArchived } from "../stores/session-archive" import { normalizeSessionDirectory } from "../stores/session-list-options" import { getLogger } from "../lib/logger" import { copyToClipboard } from "../lib/clipboard" @@ -79,6 +80,8 @@ const SessionList: Component = (props) => { const [worktreeDirectory, setWorktreeDirectory] = createSignal("") const [includeMainSessions, setIncludeMainSessions] = createSignal(true) const [includeSubsessions, setIncludeSubsessions] = createSignal(false) + const [archiveFilter, setArchiveFilter] = createSignal("active") + const [archivingSessionIds, setArchivingSessionIds] = createSignal>(new Set()) const normalizedQuery = createMemo(() => (props.enableFilterBar ? filterQuery().trim().toLowerCase() : "")) let failedSortExhaustion: string | undefined @@ -242,7 +245,7 @@ const SessionList: Component = (props) => { const worktree = worktrees.find((candidate) => normalizeSessionDirectory(candidate.serviceDirectory ?? candidate.directory) === normalized) return worktree?.kind === "root" ? t("sessionList.worktree.workspace") : worktree?.label ?? worktree?.slug ?? directory } - if (!props.enableFilterBar) return projectSessionFamilies(props.threads, { sort: sortBy(), getWorktreeLabel }) + if (!props.enableFilterBar) return projectSessionFamilies(projectUnarchivedSessionThreads(props.threads, props.activeSessionId), { sort: sortBy(), getWorktreeLabel }) const instanceSessions = sessionStateSessions().get(props.instanceId) const candidates = hasSearchResults ? getSessionSearchSessions(props.instanceId) : collectSessionThreadIds(props.threads).flatMap(id => { @@ -254,6 +257,7 @@ const SessionList: Component = (props) => { worktreeDirectory: worktreeDirectory(), includeSubsessions: includeSubsessions(), includeMainSessions: includeMainSessions(), + archive: archiveFilter(), getWorktreeLabel, ...(query && !hasSearchResults ? { matchesSession: (session) => sessionMatchesQuery(session.id, query) } @@ -418,6 +422,23 @@ const SessionList: Component = (props) => { setRenameTarget({ id: sessionId, title: session.title ?? "", label }) } + const handleArchiveSession = async (sessionId: string) => { + const instanceId = props.instanceId + const session = sessionStateSessions().get(instanceId)?.get(sessionId) + if (!session || archivingSessionIds().has(sessionId)) return + const archived = !isSessionArchived(session) + setArchivingSessionIds(previous => new Set(previous).add(sessionId)) + try { + await setSessionArchived(instanceId, sessionId, archived) + } catch (error) { + log.error("Failed to change native session archive", { instanceId, sessionId, error }) + if (props.instanceId === instanceId) showToastNotification({ category: "sessions", variant: "error", + message: t(archived ? "sessionList.archive.error" : "sessionList.restore.error") }) + } finally { + setArchivingSessionIds(previous => { const next = new Set(previous); next.delete(sessionId); return next }) + } + } + const isSessionReloading = (sessionId: string) => reloadingSessionIds().has(sessionId) const handleReloadSession = async (sessionId: string) => { @@ -761,6 +782,13 @@ const SessionList: Component = (props) => { get disabled() { return isSessionDeleting(sessionId()) }, onSelect: () => handleDeleteSession(sessionId()), }, + { + key: "archive", + get label() { return t(isSessionArchived(rowProps.session) ? "sessionList.actions.restore.title" : "sessionList.actions.archive.title") }, + get icon() { return isSessionArchived(rowProps.session) ? : }, + get disabled() { return archivingSessionIds().has(sessionId()) || isSessionDeleting(sessionId()) }, + onSelect: () => handleArchiveSession(sessionId()), + }, ] return ( @@ -819,6 +847,12 @@ const SessionList: Component = (props) => { class="session-item-badges" onClick={(event) => { if (!(event.target as Element).closest("button")) selectRow() }} > + + + + = (props) => { + +