dsh-seal-scripts 0.5.2 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -178,8 +178,11 @@ window.__ModuleLoader__.load({
178
178
  'note.memDeleted': function (f) { return '已删除回顾 ' + f },
179
179
  'note.deleteConfirm': '再点一次确认删除(不可恢复)',
180
180
  'note.deleted': '已删除',
181
+ 'note.deletedWarn': "已删除(引擎重启前可能还记着它)",
181
182
  'note.deletedLost': '已删除(响应中断,列表已确认消失)',
182
183
  'note.compactConfirm': '再点一次确认:先压缩改写历史再删除,两者都不可逆',
184
+ 'note.compacting': "压缩中…(要调用模型,可能要几十秒,别关这个页面)",
185
+ 'btn.compacting': "压缩中…",
183
186
  'note.compacted': function (m) { return '已压缩并删除,回顾 ' + m },
184
187
  'err.request': function (p) { return '请求没送回结果(' + p + ')' },
185
188
  'cal.hint': '点两天选区间,再点一次清空',
@@ -259,7 +262,20 @@ window.__ModuleLoader__.load({
259
262
  'help.injectGroup': '回顾划分为四级深度,载入内容分别为:3级,载入原对话文本;2级,载入压缩概述;1级,载入模型总结;0级,仅载入关键词作为索引。\n回顾深度降低点分别为第二天、第三天、第二十八天及以后,在被用户指出模型内容记忆有误时,模型自身会调用session_mem_read直接读取回顾文件的原会话对话文本,并且对对应回顾加权并锁定载入内容。使用过程中出现深度为1级、0级的空回顾时,这是正常现象,插件会通过注入提醒来让模型调用session_mem_write写总结与提取关键词,上下文侧与系统提示词侧的遵守程度不同,请根据实际情况选用。\n不建议开启“全量加载”,关键节点建议直接使用DSH自带的分支功能。',
260
263
  'opt.auto': '自动回顾',
261
264
  'opt.auto.desc': '开启时维持原来的行为:压缩后创建回顾文件,并按下面的设置将回顾注入上下文,将提醒注入到选择的位置。关闭后停止创建与注入,下面所有选项变为不可改。',
262
- 'opt.auto.off': '未开启回顾功能,已停止回顾文件的创建与注入,如果你没有其他记忆插件或者回顾工作流系统,建议开启本项。'
265
+ 'opt.auto.off': '未开启回顾功能,已停止回顾文件的创建与注入,如果你没有其他记忆插件或者回顾工作流系统,建议开启本项。',
266
+ 'si.import': '导入',
267
+ 'si.target': '目标工作区',
268
+ 'si.preview': function (id, cwd) { return '包内会话:' + id + '\n工作目录:' + cwd },
269
+ 'si.previewTarget': function (title, path) { return '将导入到:' + (title || path) + '(' + path + ')' },
270
+ 'si.branchWarn': '同 id 已在目标工作区:导入会换成新 id,并挂成那条会话的分支;原来那条一个字都不动。',
271
+ 'si.renameWarn': '同 id 已在别的工作区,导入时会换成新 id;原来那条一个字节都不动。',
272
+ 'si.counts': function (m, f, s) { return '包内有图片 ' + m + ' 张、文件 ' + f + ' 个、子代理 ' + s + ' 条。' },
273
+ 'si.confirm': '确认导入',
274
+ 'si.cancel': '取消',
275
+ 'si.done': function (id, m, f) { return '已导入 ' + id + ';图片 ' + m + ' 张,文件 ' + f + ' 个。' },
276
+ 'si.doneRenamed': function (id, old) { return '已导入,id 换成 ' + id + '(原 ' + old + ');原来那条没动。' },
277
+ 'si.noTarget': '没有可选的工作区:先在 DSH 里建一个。',
278
+ 'si.noZstd': '这台机器的 Node 没有 zstdCompress,写不了会话日志,导入暂不可用。'
263
279
  },
264
280
  en: {
265
281
  'app.title': 'Tool (script) manager',
@@ -307,8 +323,11 @@ window.__ModuleLoader__.load({
307
323
  'note.memDeleted': function (f) { return 'Deleted review ' + f },
308
324
  'note.deleteConfirm': 'Click again to confirm delete (cannot be undone)',
309
325
  'note.deleted': 'Deleted',
326
+ 'note.deletedWarn': "Deleted (the engine may still hold a reference until it restarts)",
310
327
  'note.deletedLost': 'Deleted (the response was lost; the list confirms it is gone)',
311
328
  'note.compactConfirm': 'Click again: compact the history first, then delete — neither can be undone',
329
+ 'note.compacting': "Compacting… (this calls the model and can take a while; keep this page open)",
330
+ 'btn.compacting': "Compacting…",
312
331
  'note.compacted': function (m) { return 'Compacted and deleted; review ' + m },
313
332
  'err.request': function (p) { return 'No response from ' + p },
314
333
  'cal.hint': 'Click two days to pick a range; click again to clear',
@@ -388,7 +407,20 @@ window.__ModuleLoader__.load({
388
407
  'help.injectGroup': 'A review has four depths, each loading something different: level 3, the original transcript; level 2, the compaction summary; level 1, the model’s own summary; level 0, keywords only, used as an index.\nDepths drop on the second day, the third day, and the twenty-eighth day onward. When you point out that the model misremembers something, the model itself calls session_mem_read to read that review’s original transcript, then weights and locks the loaded content of that review. An empty review at depth 1 or 0 is normal: the plugin injects a reminder telling the model to call session_mem_write with a summary and keywords. Compliance differs between the context channel and the system-prompt channel, so pick whichever fits.\nTurning on “Full load” is not recommended; for important checkpoints, use DSH’s own branching instead.',
389
408
  'opt.auto': 'Auto review',
390
409
  'opt.auto.desc': 'When on, behaviour stays as before: a review is created on every compaction and injected into the context and system prompt per the options below. When off, creation and injection stop and every option below becomes read-only.',
391
- 'opt.auto.off': 'Review is off, so review files are neither created nor injected. If you have no other memory plugin or review workflow, turn this on.'
410
+ 'opt.auto.off': 'Review is off, so review files are neither created nor injected. If you have no other memory plugin or review workflow, turn this on.',
411
+ 'si.import': 'Import',
412
+ 'si.target': 'Target workspace',
413
+ 'si.preview': function (id, cwd) { return 'Session in the package: ' + id + '\nWorking directory: ' + cwd },
414
+ 'si.previewTarget': function (title, path) { return 'Import into: ' + (title || path) + ' (' + path + ')' },
415
+ 'si.branchWarn': 'This id already exists in the target workspace: the import will use a new id and attach it under that session as a branch, leaving the original untouched.',
416
+ 'si.renameWarn': 'This id already lives in another workspace; the import will use a new id and leave the original untouched.',
417
+ 'si.counts': function (m, f, s) { return 'The package holds ' + m + ' image(s), ' + f + ' file(s) and ' + s + ' subagent session(s).' },
418
+ 'si.confirm': 'Import',
419
+ 'si.cancel': 'Cancel',
420
+ 'si.done': function (id, m, f) { return 'Imported ' + id + '; ' + m + ' image(s), ' + f + ' file(s).' },
421
+ 'si.doneRenamed': function (id, old) { return 'Imported with a new id ' + id + ' (was ' + old + '); the original was left alone.' },
422
+ 'si.noTarget': 'No workspace to import into: create one in DSH first.',
423
+ 'si.noZstd': 'This host runs a Node without zstdCompress, so session logs cannot be written; import is unavailable.'
392
424
  },
393
425
  ja: {
394
426
  'app.title': 'ツール(スクリプト)管理',
@@ -436,8 +468,11 @@ window.__ModuleLoader__.load({
436
468
  'note.memDeleted': function (f) { return 'レビューを削除しました ' + f },
437
469
  'note.deleteConfirm': 'もう一度クリックで削除を確定(元に戻せません)',
438
470
  'note.deleted': '削除しました',
471
+ 'note.deletedWarn': "削除しました(再起動までエンジンがまだ参照している可能性があります)",
439
472
  'note.deletedLost': '削除しました(応答が途切れましたが、一覧から消えたことを確認しました)',
440
473
  'note.compactConfirm': 'もう一度クリックで確定:先に履歴を圧縮してから削除します。どちらも元に戻せません',
474
+ 'note.compacting': "圧縮中…(モデル呼び出しのため数十秒かかることがあります。このページを閉じないでください)",
475
+ 'btn.compacting': "圧縮中…",
441
476
  'note.compacted': function (m) { return '圧縮して削除しました。レビュー ' + m },
442
477
  'err.request': function (p) { return 'リクエストの結果が返ってきません(' + p + ')' },
443
478
  'cal.hint': '2 日をクリックで範囲選択、もう一度クリックで解除',
@@ -515,7 +550,20 @@ window.__ModuleLoader__.load({
515
550
  'help.injectGroup': 'レビューは 4 段階の深度に分かれ、読み込む内容が異なります:レベル 3 は元の会話文、レベル 2 は圧縮要約、レベル 1 はモデル自身のまとめ、レベル 0 はキーワードのみ(索引として使う)。\n深度は 2 日目、3 日目、28 日目以降に下がります。モデルの記憶違いを指摘すると、モデルは session_mem_read を呼んでそのレビューの原文を読み直し、該当レビューの重みを上げて読み込み内容をロックします。レベル 1・0 の空レビューは正常で、プラグインは注入リマインダーでモデルに session_mem_write でまとめとキーワードを書かせます。コンテキスト側とシステムプロンプト側で遵守度が異なるため、状況に応じて選んでください。\n「全量読み込み」は推奨しません。重要な区切りでは DSH 標準のブランチ機能を使ってください。',
516
551
  'opt.auto': '自動レビュー',
517
552
  'opt.auto.desc': 'オンにすると従来どおり:圧縮のたびにレビューファイルを作り、以下の設定でレビューをコンテキストとシステムプロンプトに注入し、リマインダーを選択位置に注入します。オフにすると作成と注入を停止し、以下の設定はすべて変更できなくなります。',
518
- 'opt.auto.off': 'レビュー機能はオフです。レビューファイルの作成も注入も停止しています。他の記憶プラグインやレビュー運用がない場合はこの項目をオンにしてください。'
553
+ 'opt.auto.off': 'レビュー機能はオフです。レビューファイルの作成も注入も停止しています。他の記憶プラグインやレビュー運用がない場合はこの項目をオンにしてください。',
554
+ 'si.import': 'インポート',
555
+ 'si.target': '対象ワークスペース',
556
+ 'si.preview': function (id, cwd) { return 'パッケージ内のセッション:' + id + '\n作業ディレクトリ:' + cwd },
557
+ 'si.previewTarget': function (title, path) { return 'インポート先:' + (title || path) + '(' + path + ')' },
558
+ 'si.branchWarn': '同じ id が対象ワークスペースにあります。インポートは新しい id を使い、そのセッションのブランチとして追加します。元のセッションは変更しません。',
559
+ 'si.renameWarn': '同じ id が他のワークスペースにあります。インポート時は新しい id を使い、元のセッションは変更しません。',
560
+ 'si.counts': function (m, f, s) { return 'パッケージ内:画像 ' + m + ' 枚、ファイル ' + f + ' 個、サブエージェント ' + s + ' 件。' },
561
+ 'si.confirm': 'インポート',
562
+ 'si.cancel': 'キャンセル',
563
+ 'si.done': function (id, m, f) { return id + ' をインポートしました(画像 ' + m + ' 枚、ファイル ' + f + ' 個)。' },
564
+ 'si.doneRenamed': function (id, old) { return 'インポートしました。id は ' + id + '(元は ' + old + ')。元のセッションは変更していません。' },
565
+ 'si.noTarget': 'インポート先のワークスペースがありません。先に DSH で作成してください。',
566
+ 'si.noZstd': 'この Node には zstdCompress がないためセッションログを書き込めません。インポートは使えません。'
519
567
  },
520
568
  es: {
521
569
  'app.title': 'Gestor de herramientas (scripts)',
@@ -563,8 +611,11 @@ window.__ModuleLoader__.load({
563
611
  'note.memDeleted': function (f) { return 'Revisión eliminada ' + f },
564
612
  'note.deleteConfirm': 'Haz clic otra vez para confirmar la eliminación (no se puede deshacer)',
565
613
  'note.deleted': 'Eliminado',
614
+ 'note.deletedWarn': "Eliminado (el motor puede seguir teniéndolo referenciado hasta reiniciar)",
566
615
  'note.deletedLost': 'Eliminado (se perdió la respuesta; la lista confirma que ya no está)',
567
616
  'note.compactConfirm': 'Haz clic otra vez: primero se comprime la historia y luego se elimina; nada de eso se puede deshacer',
617
+ 'note.compacting': "Comprimiendo… (llama al modelo y puede tardar; no cierres esta página)",
618
+ 'btn.compacting': "Comprimiendo…",
568
619
  'note.compacted': function (m) { return 'Comprimido y eliminado; revisión ' + m },
569
620
  'err.request': function (p) { return 'No hubo respuesta de ' + p },
570
621
  'cal.hint': 'Haz clic en dos días para elegir un rango; otro clic para borrarlo',
@@ -644,7 +695,20 @@ window.__ModuleLoader__.load({
644
695
  'help.injectGroup': 'Una revisión tiene cuatro profundidades, cada una carga algo distinto: nivel 3, la transcripción original; nivel 2, el resumen de la compactación; nivel 1, el resumen del propio modelo; nivel 0, solo palabras clave, como índice.\nLa profundidad baja al segundo día, al tercer día y del vigésimo octavo en adelante. Cuando señalas que el modelo recuerda algo mal, el propio modelo llama a session_mem_read para leer la transcripción de esa revisión y luego pondera y bloquea su contenido cargado. Una revisión vacía en nivel 1 o 0 es normal: el plugin inyecta un recordatorio para que el modelo llame a session_mem_write con un resumen y palabras clave. El cumplimiento difiere entre el canal de contexto y el del prompt del sistema, así que elige el que mejor te funcione.\nNo se recomienda activar «Carga completa»; para hitos importantes usa las ramas propias de DSH.',
645
696
  'opt.auto': 'Revisión automática',
646
697
  'opt.auto.desc': 'Cuando está activada, el comportamiento es el de siempre: se crea una revisión en cada compactación y se inyecta en el contexto y el prompt del sistema según las opciones de abajo. Al desactivarla, se detienen la creación y la inyección y todas las opciones de abajo quedan de solo lectura.',
647
- 'opt.auto.off': 'La revisión está desactivada, así que no se crean ni se inyectan archivos de revisión. Si no tienes otro plugin de memoria ni un flujo de revisiones, actívala.'
698
+ 'opt.auto.off': 'La revisión está desactivada, así que no se crean ni se inyectan archivos de revisión. Si no tienes otro plugin de memoria ni un flujo de revisiones, actívala.',
699
+ 'si.import': 'Importar',
700
+ 'si.target': 'Espacio de trabajo destino',
701
+ 'si.preview': function (id, cwd) { return 'Sesión del paquete: ' + id + '\nDirectorio de trabajo: ' + cwd },
702
+ 'si.previewTarget': function (title, path) { return 'Se importará en: ' + (title || path) + ' (' + path + ')' },
703
+ 'si.branchWarn': 'El mismo id ya existe en el espacio de trabajo destino: la importación usará un id nuevo y la colgará como rama de esa sesión, sin tocar la original.',
704
+ 'si.renameWarn': 'El mismo id ya está en otro espacio de trabajo: la importación usará un id nuevo y no tocará el original.',
705
+ 'si.counts': function (m, f, s) { return 'El paquete contiene ' + m + ' imagen(es), ' + f + ' archivo(s) y ' + s + ' sesión(es) de subagente.' },
706
+ 'si.confirm': 'Importar',
707
+ 'si.cancel': 'Cancelar',
708
+ 'si.done': function (id, m, f) { return 'Importado ' + id + '; ' + m + ' imagen(es), ' + f + ' archivo(s).' },
709
+ 'si.doneRenamed': function (id, old) { return 'Importado con id nuevo ' + id + ' (antes ' + old + '); el original no se tocó.' },
710
+ 'si.noTarget': 'No hay espacio de trabajo destino: crea uno en DSH primero.',
711
+ 'si.noZstd': 'Este Node no tiene zstdCompress; no se pueden escribir registros de sesión y la importación no está disponible.'
648
712
  },
649
713
  fr: {
650
714
  'app.title': 'Gestion des outils (scripts)',
@@ -692,8 +756,11 @@ window.__ModuleLoader__.load({
692
756
  'note.memDeleted': function (f) { return 'Revue supprimée ' + f },
693
757
  'note.deleteConfirm': 'Cliquez encore pour confirmer la suppression (irréversible)',
694
758
  'note.deleted': 'Supprimé',
759
+ 'note.deletedWarn': "Supprimé (le moteur peut encore le référencer jusqu’au redémarrage)",
695
760
  'note.deletedLost': 'Supprimé (la réponse s’est perdue ; la liste confirme qu’elle a disparu)',
696
761
  'note.compactConfirm': 'Cliquez encore : l’historique est d’abord compressé, puis supprimé — les deux sont irréversibles',
762
+ 'note.compacting': "Compactage… (appel au modèle, cela peut prendre du temps ; gardez cette page ouverte)",
763
+ 'btn.compacting': "Compactage…",
697
764
  'note.compacted': function (m) { return 'Compressé puis supprimé ; revue ' + m },
698
765
  'err.request': function (p) { return 'Aucune réponse de ' + p },
699
766
  'cal.hint': 'Cliquez sur deux jours pour choisir une plage ; cliquez encore pour effacer',
@@ -773,7 +840,20 @@ window.__ModuleLoader__.load({
773
840
  'help.injectGroup': 'Une revue a quatre profondeurs, chacune chargeant un contenu différent : niveau 3, la transcription d’origine ; niveau 2, le résumé de compaction ; niveau 1, le résumé du modèle lui-même ; niveau 0, les mots-clés seuls, comme index.\nLa profondeur baisse le deuxième jour, le troisième jour, puis à partir du vingt-huitième. Quand vous signalez un souvenir erroné, le modèle appelle lui-même session_mem_read pour relire la transcription de cette revue, puis pondère et verrouille son contenu chargé. Une revue vide en niveau 1 ou 0 est normale : le plugin injecte un rappel demandant au modèle d’appeler session_mem_write avec un résumé et des mots-clés. Le respect varie entre le canal contexte et le canal prompt système : choisissez celui qui vous convient.\nActiver « Chargement complet » n’est pas recommandé ; pour les étapes importantes, utilisez les branches natives de DSH.',
774
841
  'opt.auto': 'Revue automatique',
775
842
  'opt.auto.desc': 'Quand c’est activé, le comportement reste le même : une revue est créée à chaque compaction et injectée dans le contexte et le prompt système selon les options ci-dessous. Désactivé, la création et l’injection s’arrêtent et toutes les options ci-dessous deviennent en lecture seule.',
776
- 'opt.auto.off': 'La revue est désactivée : les fichiers de revue ne sont ni créés ni injectés. Si vous n’avez pas d’autre plugin de mémoire ni d’enchaînement de revues, activez cette option.'
843
+ 'opt.auto.off': 'La revue est désactivée : les fichiers de revue ne sont ni créés ni injectés. Si vous n’avez pas d’autre plugin de mémoire ni d’enchaînement de revues, activez cette option.',
844
+ 'si.import': 'Importer',
845
+ 'si.target': 'Espace de travail cible',
846
+ 'si.preview': function (id, cwd) { return 'Session du paquet : ' + id + '\nRépertoire de travail : ' + cwd },
847
+ 'si.previewTarget': function (title, path) { return 'Importer vers : ' + (title || path) + ' (' + path + ')' },
848
+ 'si.branchWarn': 'Cet id existe déjà dans l’espace de travail cible : l’import utilisera un nouvel id et le rattachera comme branche de cette session, sans toucher à l’original.',
849
+ 'si.renameWarn': 'Cet id existe déjà dans un autre espace de travail : l’import utilisera un nouvel id et ne touchera pas l’original.',
850
+ 'si.counts': function (m, f, s) { return 'Le paquet contient ' + m + ' image(s), ' + f + ' fichier(s) et ' + s + ' session(s) de sous-agent.' },
851
+ 'si.confirm': 'Importer',
852
+ 'si.cancel': 'Annuler',
853
+ 'si.done': function (id, m, f) { return id + ' importé ; ' + m + ' image(s), ' + f + ' fichier(s).' },
854
+ 'si.doneRenamed': function (id, old) { return 'Importé sous le nouvel id ' + id + ' (ancien : ' + old + ') ; l’original est intact.' },
855
+ 'si.noTarget': 'Aucun espace de travail cible : créez-en un dans DSH.',
856
+ 'si.noZstd': 'Ce Node n’a pas zstdCompress : impossible d’écrire les journaux de session, l’import est indisponible.'
777
857
  },
778
858
  de: {
779
859
  'app.title': 'Werkzeug- (Skript-)Verwaltung',
@@ -821,8 +901,11 @@ window.__ModuleLoader__.load({
821
901
  'note.memDeleted': function (f) { return 'Review gelöscht: ' + f },
822
902
  'note.deleteConfirm': 'Noch einmal klicken, um das Löschen zu bestätigen (nicht rückgängig zu machen)',
823
903
  'note.deleted': 'Gelöscht',
904
+ 'note.deletedWarn': "Gelöscht (der Motor kann bis zum Neustart noch darauf verweisen)",
824
905
  'note.deletedLost': 'Gelöscht (die Antwort ging verloren; die Liste bestätigt, dass sie weg ist)',
825
906
  'note.compactConfirm': 'Noch einmal klicken: erst wird der Verlauf komprimiert, dann gelöscht — beides ist unumkehrbar',
907
+ 'note.compacting': "Komprimiere… (Modellaufruf, kann dauern; diese Seite bitte offen lassen)",
908
+ 'btn.compacting': "Komprimiere…",
826
909
  'note.compacted': function (m) { return 'Komprimiert und gelöscht; Review ' + m },
827
910
  'err.request': function (p) { return 'Keine Antwort von ' + p },
828
911
  'cal.hint': 'Zwei Tage anklicken, um einen Bereich zu wählen; erneut klicken zum Leeren',
@@ -902,7 +985,20 @@ window.__ModuleLoader__.load({
902
985
  'help.injectGroup': 'Eine Review hat vier Tiefen, die jeweils etwas anderes laden: Stufe 3 das ursprüngliche Transkript, Stufe 2 die Kompressions-Zusammenfassung, Stufe 1 die eigene Zusammenfassung des Modells, Stufe 0 nur Stichwörter als Index.\nDie Tiefe sinkt am zweiten Tag, am dritten Tag und ab dem achtundzwanzigsten. Wenn du dem Modell eine falsche Erinnerung nachweist, ruft es selbst session_mem_read auf, liest das Transkript dieser Review und gewichtet und sperrt danach den geladenen Inhalt. Eine leere Review auf Stufe 1 oder 0 ist normal: Das Plugin injiziert eine Erinnerung, damit das Modell session_mem_write mit Zusammenfassung und Stichwörtern aufruft. Die Befolgung unterscheidet sich zwischen Kontext- und System-Prompt-Kanal, wähle je nach Bedarf.\n„Vollständig laden“ ist nicht empfehlenswert; nutze für wichtige Punkte die Branches von DSH.',
903
986
  'opt.auto': 'Automatische Review',
904
987
  'opt.auto.desc': 'Wenn ein, bleibt das Verhalten wie bisher: Bei jeder Kompression wird eine Review angelegt und gemäß den Optionen unten in Kontext und System-Prompt injiziert. Wenn aus, stoppen Anlegen und Injizieren und alle Optionen unten werden schreibgeschützt.',
905
- 'opt.auto.off': 'Die Review ist aus, es werden weder Review-Dateien angelegt noch injiziert. Wenn du kein anderes Speicher-Plugin oder keinen Review-Ablauf hast, schalte dies ein.'
988
+ 'opt.auto.off': 'Die Review ist aus, es werden weder Review-Dateien angelegt noch injiziert. Wenn du kein anderes Speicher-Plugin oder keinen Review-Ablauf hast, schalte dies ein.',
989
+ 'si.import': 'Importieren',
990
+ 'si.target': 'Ziel-Workspace',
991
+ 'si.preview': function (id, cwd) { return 'Session im Paket: ' + id + '\nArbeitsverzeichnis: ' + cwd },
992
+ 'si.previewTarget': function (title, path) { return 'Import nach: ' + (title || path) + ' (' + path + ')' },
993
+ 'si.branchWarn': 'Diese id existiert im Ziel-Workspace bereits: der Import nutzt eine neue id und hängt sie als Branch unter diese Session, das Original bleibt unangetastet.',
994
+ 'si.renameWarn': 'Diese id liegt bereits in einem anderen Workspace: der Import nutzt eine neue id und lässt das Original unangetastet.',
995
+ 'si.counts': function (m, f, s) { return 'Das Paket enthält ' + m + ' Bild(er), ' + f + ' Datei(en) und ' + s + ' Subagent-Session(s).' },
996
+ 'si.confirm': 'Importieren',
997
+ 'si.cancel': 'Abbrechen',
998
+ 'si.done': function (id, m, f) { return id + ' importiert; ' + m + ' Bild(er), ' + f + ' Datei(en).' },
999
+ 'si.doneRenamed': function (id, old) { return 'Importiert mit neuer id ' + id + ' (vorher ' + old + '); das Original blieb unverändert.' },
1000
+ 'si.noTarget': 'Kein Ziel-Workspace vorhanden: lege zuerst einen in DSH an.',
1001
+ 'si.noZstd': 'Dieses Node hat kein zstdCompress; Session-Logs lassen sich nicht schreiben, der Import ist nicht verfügbar.'
906
1002
  },
907
1003
  ru: {
908
1004
  'app.title': 'Управление инструментами (скриптами)',
@@ -950,8 +1046,11 @@ window.__ModuleLoader__.load({
950
1046
  'note.memDeleted': function (f) { return 'Обзор удалён: ' + f },
951
1047
  'note.deleteConfirm': 'Нажмите ещё раз, чтобы подтвердить удаление (необратимо)',
952
1048
  'note.deleted': 'Удалено',
1049
+ 'note.deletedWarn': "Удалено (движок может помнить о нём до перезапуска)",
953
1050
  'note.deletedLost': 'Удалено (ответ потерялся; список подтверждает, что его больше нет)',
954
1051
  'note.compactConfirm': 'Нажмите ещё раз: сначала сжимается история, затем удаление — оба шага необратимы',
1052
+ 'note.compacting': "Сжатие… (вызов модели, это может занять время; не закрывайте страницу)",
1053
+ 'btn.compacting': "Сжатие…",
955
1054
  'note.compacted': function (m) { return 'Сжато и удалено; обзор ' + m },
956
1055
  'err.request': function (p) { return 'Нет ответа от ' + p },
957
1056
  'cal.hint': 'Нажмите на два дня, чтобы выбрать диапазон; ещё раз — чтобы сбросить',
@@ -1031,7 +1130,20 @@ window.__ModuleLoader__.load({
1031
1130
  'help.injectGroup': 'У обзора четыре глубины, каждая загружает своё: уровень 3 — исходная расшифровка; уровень 2 — итог сжатия; уровень 1 — собственный итог модели; уровень 0 — только ключевые слова как индекс.\nГлубина снижается на второй день, на третий и начиная с двадцать восьмого. Когда вы указываете модели на ошибку в памяти, она сама вызывает session_mem_read, читает расшифровку этого обзора, затем повышает вес и закрепляет загруженное содержимое. Пустой обзор на уровне 1 или 0 — это нормально: плагин вставляет напоминание, чтобы модель вызвала session_mem_write с итогом и ключевыми словами. Соблюдение различается для канала контекста и канала системного промпта, выбирайте по ситуации.\nВключать «Полную загрузку» не рекомендуется; для важных точек используйте ветвления самого DSH.',
1032
1131
  'opt.auto': 'Автоматический обзор',
1033
1132
  'opt.auto.desc': 'Когда включено, поведение прежнее: при каждом сжатии создаётся обзор и вставляется в контекст и системный промпт согласно параметрам ниже. Когда выключено, создание и вставка останавливаются, а все параметры ниже становятся только для чтения.',
1034
- 'opt.auto.off': 'Обзоры выключены, файлы обзоров не создаются и не вставляются. Если у вас нет другого плагина памяти или процесса обзоров, включите этот параметр.'
1133
+ 'opt.auto.off': 'Обзоры выключены, файлы обзоров не создаются и не вставляются. Если у вас нет другого плагина памяти или процесса обзоров, включите этот параметр.',
1134
+ 'si.import': 'Импорт',
1135
+ 'si.target': 'Целевое рабочее пространство',
1136
+ 'si.preview': function (id, cwd) { return 'Сессия в пакете: ' + id + '\nРабочий каталог: ' + cwd },
1137
+ 'si.previewTarget': function (title, path) { return 'Импорт в: ' + (title || path) + ' (' + path + ')' },
1138
+ 'si.branchWarn': 'Этот id уже есть в целевом пространстве: импорт возьмёт новый id и повесит её ветвью под эту сессию, оригинал останется нетронутым.',
1139
+ 'si.renameWarn': 'Этот id уже есть в другом рабочем пространстве: импорт возьмёт новый id, оригинал останется нетронутым.',
1140
+ 'si.counts': function (m, f, s) { return 'В пакете: изображений ' + m + ', файлов ' + f + ', субагентских сессий ' + s + '.' },
1141
+ 'si.confirm': 'Импортировать',
1142
+ 'si.cancel': 'Отмена',
1143
+ 'si.done': function (id, m, f) { return 'Импортировано ' + id + '; изображений ' + m + ', файлов ' + f + '.' },
1144
+ 'si.doneRenamed': function (id, old) { return 'Импортировано с новым id ' + id + ' (был ' + old + '); оригинал не тронут.' },
1145
+ 'si.noTarget': 'Нет целевого рабочего пространства: сначала создайте его в DSH.',
1146
+ 'si.noZstd': 'В этом Node нет zstdCompress; журналы сессий записать нельзя, импорт недоступен.'
1035
1147
  },
1036
1148
  pt: {
1037
1149
  'app.title': 'Gerenciador de ferramentas (scripts)',
@@ -1079,8 +1191,11 @@ window.__ModuleLoader__.load({
1079
1191
  'note.memDeleted': function (f) { return 'Revisão excluída ' + f },
1080
1192
  'note.deleteConfirm': 'Clique de novo para confirmar a exclusão (não dá para desfazer)',
1081
1193
  'note.deleted': 'Excluído',
1194
+ 'note.deletedWarn': "Excluído (o motor pode ainda referenciá-lo até reiniciar)",
1082
1195
  'note.deletedLost': 'Excluído (a resposta se perdeu; a lista confirma que sumiu)',
1083
1196
  'note.compactConfirm': 'Clique de novo: primeiro o histórico é compactado e depois excluído — nada disso pode ser desfeito',
1197
+ 'note.compacting': "Comprimindo… (chama o modelo e pode demorar; mantenha esta página aberta)",
1198
+ 'btn.compacting': "Comprimindo…",
1084
1199
  'note.compacted': function (m) { return 'Compactado e excluído; revisão ' + m },
1085
1200
  'err.request': function (p) { return 'Sem resposta de ' + p },
1086
1201
  'cal.hint': 'Clique em dois dias para escolher um intervalo; clique de novo para limpar',
@@ -1160,7 +1275,20 @@ window.__ModuleLoader__.load({
1160
1275
  'help.injectGroup': 'Uma revisão tem quatro profundidades, cada uma carregando algo diferente: nível 3, a transcrição original; nível 2, o resumo da compactação; nível 1, o resumo do próprio modelo; nível 0, apenas palavras-chave como índice.\nA profundidade cai no segundo dia, no terceiro dia e a partir do vigésimo oitavo. Quando você aponta que o modelo lembra algo errado, o próprio modelo chama session_mem_read para reler a transcrição dessa revisão e então pondera e trava o conteúdo carregado. Uma revisão vazia em nível 1 ou 0 é normal: o plugin injeta um lembrete para o modelo chamar session_mem_write com resumo e palavras-chave. O cumprimento difere entre o canal de contexto e o do prompt do sistema, escolha conforme o caso.\nAtivar “Carga completa” não é recomendado; para marcos importantes use as ramificações do próprio DSH.',
1161
1276
  'opt.auto': 'Revisão automática',
1162
1277
  'opt.auto.desc': 'Quando ligado, o comportamento é o de sempre: uma revisão é criada a cada compactação e injetada no contexto e no prompt do sistema conforme as opções abaixo. Quando desligado, criação e injeção param e todas as opções abaixo ficam somente leitura.',
1163
- 'opt.auto.off': 'A revisão está desligada, então arquivos de revisão não são criados nem injetados. Se você não tem outro plugin de memória nem um fluxo de revisões, ligue esta opção.'
1278
+ 'opt.auto.off': 'A revisão está desligada, então arquivos de revisão não são criados nem injetados. Se você não tem outro plugin de memória nem um fluxo de revisões, ligue esta opção.',
1279
+ 'si.import': 'Importar',
1280
+ 'si.target': 'Workspace de destino',
1281
+ 'si.preview': function (id, cwd) { return 'Sessão no pacote: ' + id + '\nDiretório de trabalho: ' + cwd },
1282
+ 'si.previewTarget': function (title, path) { return 'Importar para: ' + (title || path) + ' (' + path + ')' },
1283
+ 'si.branchWarn': 'Este id já existe no workspace de destino: a importação usará um id novo e a pendurará como ramo dessa sessão, sem tocar na original.',
1284
+ 'si.renameWarn': 'Este id já está em outro workspace: a importação usa um id novo e não toca no original.',
1285
+ 'si.counts': function (m, f, s) { return 'O pacote tem ' + m + ' imagem(ns), ' + f + ' arquivo(s) e ' + s + ' sessão(ões) de subagente.' },
1286
+ 'si.confirm': 'Importar',
1287
+ 'si.cancel': 'Cancelar',
1288
+ 'si.done': function (id, m, f) { return 'Importado ' + id + '; ' + m + ' imagem(ns), ' + f + ' arquivo(s).' },
1289
+ 'si.doneRenamed': function (id, old) { return 'Importado com id novo ' + id + ' (antes ' + old + '); o original ficou intacto.' },
1290
+ 'si.noTarget': 'Nenhum workspace de destino: crie um no DSH primeiro.',
1291
+ 'si.noZstd': 'Este Node não tem zstdCompress; não dá para gravar logs de sessão, a importação está indisponível.'
1164
1292
  }
1165
1293
  }
1166
1294
 
@@ -1518,12 +1646,17 @@ window.__ModuleLoader__.load({
1518
1646
  // 回执(0.5.1):带上它属于哪个标签。以前是一条全页共享的字符串,而那一行
1519
1647
  // 渲染在标签内容区外面,所以在「选项」页存完设置、切到别的页也能看见「已保存」。
1520
1648
  var nt = React.useState(null); var note = nt[0], setNote = nt[1]
1521
- var err = React.useState(''); var setErr = err[1]
1649
+ // 报错只属于产生它的那一页(0.6.1):以前它是全页一条字符串、渲染在标签内容区外面,
1650
+ // 于是「会话」页的报错在四个页都显示。现在带上标签,切过去就看不见别人的错。
1651
+ var err = React.useState(null); var errState = err[0]
1652
+ function setErr(text) { err[1](text ? { tab: tab, text: String(text) } : null) }
1522
1653
  var ldi = React.useState(null); var loadInfo = ldi[0], setLoadInfo = ldi[1]
1523
1654
  var op = React.useState(false); var open = op[0], setOpen = op[1]
1524
1655
  var mp = React.useState(null); var memPick = mp[0], setMemPick = mp[1]
1525
1656
  var mc = React.useState(''); var memConfirm = mc[0], setMemConfirm = mc[1]
1526
1657
  var busy = React.useState(false); var isBusy = busy[0], setBusy = busy[1]
1658
+ // 0.5.3 本地修复:压缩要调模型、几十秒起步,界面上必须有「压缩中…」,否则看起来像没反应。
1659
+ var compactRun = React.useState(false); var isCompacting = compactRun[0], setCompactRun = compactRun[1]
1527
1660
  var confirm = React.useState(''); var confirming = confirm[0], setConfirming = confirm[1]
1528
1661
  // 已经请求过上下文的工作区。用它当守卫,不依赖服务器回传的 cwd,避免来回重试。
1529
1662
  var ctxCwd = React.useRef('')
@@ -1545,13 +1678,20 @@ window.__ModuleLoader__.load({
1545
1678
  var cca = React.useState(false); var clearArmed = cca[0], setClearArmed = cca[1]
1546
1679
  var ccn = React.useState(''); var cacheNote = ccn[0], setCacheNote = ccn[1]
1547
1680
  var fileInput = React.useRef(null)
1681
+ // 「会话导入」(0.6.1):会话页最左边那颗按钮。包、预演结果、目标工作区、回执。
1682
+ var sif = React.useState(null); var sessionFile = sif[0], setSessionFile = sif[1]
1683
+ var sip = React.useState(null); var sessionPlan = sip[0], setSessionPlan = sip[1]
1684
+ var sit = React.useState(''); var sessionTarget = sit[0], setSessionTarget = sit[1]
1685
+ var sin = React.useState(''); var sessionNote = sin[0], setSessionNote = sin[1]
1686
+ var sib = React.useState(false); var sessionBusy = sib[0], setSessionBusy = sib[1]
1687
+ var sessionFileInput = React.useRef(null)
1548
1688
 
1549
1689
  var load = React.useCallback(async function () {
1550
1690
  try {
1551
1691
  var res = await fetch(API + 'state')
1552
1692
  var json = await res.json()
1553
1693
  if (!res.ok) throw new Error((json.error && json.error.message) || ('HTTP ' + res.status))
1554
- setData({ loading: false, error: '', workspaces: json.workspaces || [], capabilities: json.capabilities || null })
1694
+ setData({ loading: false, error: '', workspaces: json.workspaces || [], targets: json.targets || [], capabilities: json.capabilities || null })
1555
1695
  if (json.options) setOptions(json.options)
1556
1696
  return json
1557
1697
  } catch (e) {
@@ -1563,6 +1703,7 @@ window.__ModuleLoader__.load({
1563
1703
  React.useEffect(function () { load() }, [])
1564
1704
 
1565
1705
  // 切标签就把上一页的回执和「举刀」状态收掉:它们只属于生成它们的那一页(0.5.1)。
1706
+ // 报错按页留着(0.6.1):切走看不见,切回来还在——它不是回执,是「这页哪一步坏了」。
1566
1707
  React.useEffect(function () { setNote(null); setClearArmed(false) }, [tab])
1567
1708
 
1568
1709
  var selectedWorkspace = selected
@@ -1700,6 +1841,96 @@ window.__ModuleLoader__.load({
1700
1841
  } finally { setBusy(false) }
1701
1842
  }
1702
1843
 
1844
+ /* ── 会话导入(0.6.1)──────────────────────────────────────
1845
+ 会话页最左边的「导入」:选一个 dsh-session-<id>.zip,先预演(不写盘),
1846
+ 确认之后才真装。目标工作区用 id 传,服务端只信 id、不信界面上的路径。 */
1847
+
1848
+ function importTargetsOf() { return Array.isArray(data.targets) ? data.targets : [] }
1849
+
1850
+ /** 默认目标:当前会话所在的工作区 > 第一个。 */
1851
+ function defaultImportTarget() {
1852
+ var list = importTargetsOf()
1853
+ if (list.length === 0) return ''
1854
+ var cur = currentWorkspace && currentWorkspace.cwd
1855
+ for (var i = 0; i < list.length; i++) if (list[i].path === cur) return list[i].id
1856
+ return list[0].id
1857
+ }
1858
+
1859
+ function sessionImportUrl(dryRun, target) {
1860
+ return API + 'session-import?workspaceId=' + encodeURIComponent(target || '') + (dryRun ? '&dryRun=1' : '')
1861
+ }
1862
+
1863
+ /** 预演:只报会碰到谁、要不要换 id,一个字节都不写。 */
1864
+ async function previewSessionImport(entry, target) {
1865
+ var res = await fetch(sessionImportUrl(true, target), {
1866
+ method: 'POST',
1867
+ headers: { 'Content-Type': 'application/zip' },
1868
+ body: entry.file
1869
+ })
1870
+ var json = await res.json()
1871
+ if (!res.ok) throw new Error((json.error && json.error.message) || ('HTTP ' + res.status))
1872
+ setSessionPlan(json)
1873
+ }
1874
+
1875
+ function pickSessionZip() {
1876
+ if (isBusy || sessionBusy) return
1877
+ setErr(''); setSessionNote(''); setSessionPlan(null); setSessionFile(null)
1878
+ var target = sessionTarget || defaultImportTarget()
1879
+ setSessionTarget(target)
1880
+ if (target === '') { setErr(tr('si.noTarget')); return }
1881
+ var el = sessionFileInput.current
1882
+ if (el) { el.value = ''; el.click() }
1883
+ }
1884
+
1885
+ async function onSessionZipChosen(ev) {
1886
+ var file = ev && ev.target && ev.target.files && ev.target.files[0]
1887
+ if (!file) return
1888
+ setSessionBusy(true); setErr(''); setSessionNote(''); setSessionPlan(null)
1889
+ var entry = { name: file.name, file: file }
1890
+ setSessionFile(entry)
1891
+ try { await previewSessionImport(entry, sessionTarget) }
1892
+ catch (e) { setSessionFile(null); setErr(String(e.message || e)) }
1893
+ finally { setSessionBusy(false) }
1894
+ }
1895
+
1896
+ /** 换目标工作区:撞号结果跟着目标变,重新预演一遍。 */
1897
+ async function onSessionTargetChange(id) {
1898
+ setSessionTarget(id)
1899
+ if (!sessionFile) return
1900
+ setSessionBusy(true); setErr('')
1901
+ try { await previewSessionImport(sessionFile, id) }
1902
+ catch (e) { setSessionPlan(null); setErr(String(e.message || e)) }
1903
+ finally { setSessionBusy(false) }
1904
+ }
1905
+
1906
+ async function confirmSessionImport() {
1907
+ if (sessionBusy || !sessionFile || !sessionPlan) return
1908
+ var plan = sessionPlan
1909
+ setSessionBusy(true); setErr(''); setSessionNote('')
1910
+ try {
1911
+ var res = await fetch(sessionImportUrl(false, sessionTarget), {
1912
+ method: 'POST',
1913
+ headers: { 'Content-Type': 'application/zip' },
1914
+ body: sessionFile.file
1915
+ })
1916
+ var json = await res.json()
1917
+ if (!res.ok) throw new Error((json.error && json.error.message) || ('HTTP ' + res.status))
1918
+ var got = json.session || {}
1919
+ setSessionNote(got.renamed
1920
+ ? tr('si.doneRenamed', got.id, got.originalId)
1921
+ : tr('si.done', got.id, (json.counts && json.counts.media) || 0, (json.counts && json.counts.files) || 0))
1922
+ setSessionPlan(null); setSessionFile(null)
1923
+ await load()
1924
+ if (got.id) setSelected({ id: got.id, cwd: got.cwd || plan.workspace.path })
1925
+ } catch (e) { setErr(String(e.message || e)) }
1926
+ finally { setSessionBusy(false) }
1927
+ }
1928
+
1929
+ function closeSessionDialog() {
1930
+ if (sessionBusy) return
1931
+ setSessionPlan(null); setSessionFile(null)
1932
+ }
1933
+
1703
1934
  /**
1704
1935
  * 导出:让宿主把 toolSequence.zip 直接写进当前会话所在的工作区文件夹。
1705
1936
  * 落点由宿主算(它拿得到真实路径),界面只负责把它念出来。
@@ -1811,6 +2042,53 @@ window.__ModuleLoader__.load({
1811
2042
  )
1812
2043
  }
1813
2044
 
2045
+ // Esc 关会话导入弹窗(0.6.1):和工具导入一样只认 Esc,不劫持遮罩点击。
2046
+ React.useEffect(function () {
2047
+ if (sessionPlan === null) return undefined
2048
+ if (typeof document === 'undefined' || typeof document.addEventListener !== 'function') return undefined
2049
+ function onKey(e) { if (e && e.key === 'Escape') closeSessionDialog() }
2050
+ document.addEventListener('keydown', onKey)
2051
+ return function () { document.removeEventListener('keydown', onKey) }
2052
+ }, [sessionPlan, sessionBusy])
2053
+
2054
+ /** 会话导入的确认弹窗(0.6.1):结构照工具导入那张,多一个目标工作区下拉。 */
2055
+ function sessionImportDialogView() {
2056
+ if (sessionPlan === null) return null
2057
+ var list = importTargetsOf()
2058
+ var plan = sessionPlan
2059
+ var busyNow = sessionBusy
2060
+ var options = list.map(function (w) { return [w.id, w.title || w.path] })
2061
+ return h('div', { style: S.modalOverlay, 'data-session-import-dialog': '1' },
2062
+ h('div', { style: S.modalBox, role: 'dialog', 'aria-modal': 'true' },
2063
+ h('p', { style: S.modalBody }, tr('si.preview', plan.session.originalId, plan.session.cwd)),
2064
+ list.length > 1
2065
+ ? h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' } },
2066
+ h('span', { style: S.optLabel }, tr('si.target')),
2067
+ h(Select, { value: sessionTarget, options: options, onChange: onSessionTargetChange }))
2068
+ : null,
2069
+ h('p', { style: S.modalBody }, tr('si.previewTarget', plan.workspace.title || '', plan.workspace.path)),
2070
+ plan.session.willBranch ? h('p', { style: S.modalBody }, tr('si.branchWarn')) : null,
2071
+ plan.session.willRename && !plan.session.willBranch ? h('p', { style: S.modalBody }, tr('si.renameWarn')) : null,
2072
+ h('p', { style: S.modalBody }, tr('si.counts', plan.counts.media, plan.counts.files, plan.counts.subagents)),
2073
+ h('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end', flexWrap: 'wrap' } },
2074
+ h('button', {
2075
+ type: 'button',
2076
+ style: busyNow ? S.btnOff : S.btnPrimary,
2077
+ disabled: busyNow,
2078
+ 'data-confirm-action': 'primary',
2079
+ onClick: confirmSessionImport
2080
+ }, tr('si.confirm')),
2081
+ h('button', {
2082
+ type: 'button',
2083
+ style: busyNow ? S.btnOff : S.btnGhost,
2084
+ disabled: busyNow,
2085
+ 'data-confirm-action': 'cancel',
2086
+ onClick: closeSessionDialog
2087
+ }, tr('si.cancel')))
2088
+ )
2089
+ )
2090
+ }
2091
+
1814
2092
  /**
1815
2093
  * 改一个或多个选项。落盘后把回顾页的预览与深度徽章全部作废重取:
1816
2094
  * 选项只改载入时的装配,不改载入文件里记下的深度,所以重取就能看到新内容。
@@ -1890,8 +2168,10 @@ window.__ModuleLoader__.load({
1890
2168
  setBusy(true); setErr(''); setNote(null); setConfirming('')
1891
2169
  var target = selected.id
1892
2170
  try {
1893
- await post('delete', { sessionId: target })
1894
- showNote(tr('note.deleted')); setSelected(null)
2171
+ var del = await post('delete', { sessionId: target })
2172
+ // 服务端带 warnings 时说明「删掉了,但引擎重启前可能还记着它」,别让提示骗人。
2173
+ showNote(del && Array.isArray(del.warnings) && del.warnings.length ? tr('note.deletedWarn') : tr('note.deleted'))
2174
+ setSelected(null)
1895
2175
  await load()
1896
2176
  } catch (e) {
1897
2177
  var fresh = await load()
@@ -1907,19 +2187,21 @@ window.__ModuleLoader__.load({
1907
2187
  if (!selected) return
1908
2188
  if (confirming !== 'compact') { setConfirming('compact'); showNote(tr('note.compactConfirm')); return }
1909
2189
  setBusy(true); setErr(''); setNote(null); setConfirming('')
2190
+ setCompactRun(true); showNote(tr('note.compacting'))
1910
2191
  var target = selected.id
1911
2192
  try {
1912
2193
  var res = await post('compact-delete', { sessionId: target })
1913
2194
  showNote(tr('note.compacted', res.memory)); setSelected(null)
1914
2195
  await load()
1915
2196
  } catch (e) {
2197
+ setNote(null)
1916
2198
  var fresh2 = await load()
1917
2199
  var alive2 = fresh2 !== null && (fresh2.workspaces || []).some(function (w) {
1918
2200
  return (w.sessions || []).some(function (x) { return x.id === target })
1919
2201
  })
1920
2202
  if (fresh2 !== null && !alive2) { showNote(tr('note.deletedLost')); setSelected(null) }
1921
2203
  else setErr(String(e.message || e))
1922
- } finally { setBusy(false) }
2204
+ } finally { setBusy(false); setCompactRun(false) }
1923
2205
  }
1924
2206
 
1925
2207
  /**
@@ -2256,18 +2538,34 @@ window.__ModuleLoader__.load({
2256
2538
  body)
2257
2539
  }
2258
2540
 
2541
+ // 「导入」在最左(0.6.1):删除 / 删除并回顾 这一行从左边加一颗按钮。
2542
+ // 宿主 Node 写不了 zstd 时这颗按钮明确变灰,并在会话页里说明原因。
2543
+ var canImport = !(data.capabilities && data.capabilities.table && data.capabilities.table['zstd.compress'] === false)
2259
2544
  var footer = tab === 'sessions' ? h('div', { style: S.footer },
2545
+ h('button', {
2546
+ style: (isBusy || sessionBusy || !canImport) ? S.btnOff : S.btn,
2547
+ disabled: isBusy || sessionBusy || !canImport,
2548
+ 'data-session-import': '1',
2549
+ onClick: pickSessionZip
2550
+ }, tr('si.import')),
2260
2551
  h('button', { style: !selected || isBusy ? S.btnOff : S.btnDanger, disabled: !selected || isBusy, onClick: doDelete },
2261
2552
  confirming === 'delete' ? tr('btn.confirm') : tr('btn.delete')),
2262
2553
  h('button', { style: !selected || isBusy ? S.btnOff : S.btn, disabled: !selected || isBusy, onClick: doCompactDelete },
2263
- confirming === 'compact' ? tr('btn.confirmCompact') : tr('btn.deleteCompact'))
2554
+ isCompacting ? tr('btn.compacting') : (confirming === 'compact' ? tr('btn.confirmCompact') : tr('btn.deleteCompact')))
2264
2555
  ) : null
2265
2556
 
2266
2557
  // 会话、回顾两页内容可能很长,仍走 .recall-scroll;选项页只四行,不要滚动框。
2267
2558
  // 0.4.3:自创工具页多了导入/导出一块,整页不再保证一屏装得下,跟着一起滚。
2559
+ // 会话页自己的回执、弹窗与能力说明都挂在页面里面:切到别页就一起消失。
2560
+ var pageInner = tab === 'sessions'
2561
+ ? h('div', null, body,
2562
+ canImport ? null : h('div', { style: S.note, 'data-session-import-off': '1' }, tr('si.noZstd')),
2563
+ sessionNote ? h('div', { style: S.note, 'data-session-import-note': '1' }, sessionNote) : null,
2564
+ sessionImportDialogView())
2565
+ : body
2268
2566
  var pageBox = tab === 'options'
2269
- ? h('div', { style: S.pageFlat }, body)
2270
- : h('div', { className: 'recall-scroll', style: S.page }, body)
2567
+ ? h('div', { style: S.pageFlat }, pageInner)
2568
+ : h('div', { className: 'recall-scroll', style: S.page }, pageInner)
2271
2569
 
2272
2570
  // E1:宿主能力不全时,在每页顶部都说清缺了什么、哪块被关了。
2273
2571
  var missingCaps = data.capabilities && data.capabilities.ok === false
@@ -2279,7 +2577,14 @@ window.__ModuleLoader__.load({
2279
2577
  return h('div', { style: S.wrap },
2280
2578
  head, tabs, capWarn, pageBox, footer,
2281
2579
  note && note.tab === tab ? h('div', { style: S.note }, note.text) : null,
2282
- err[0] ? h('div', { style: S.err }, err[0]) : null
2580
+ errState && errState.tab === tab ? h('div', { style: S.err }, errState.text) : null,
2581
+ h('input', {
2582
+ type: 'file',
2583
+ accept: '.zip,application/zip',
2584
+ style: { display: 'none' },
2585
+ ref: sessionFileInput,
2586
+ onChange: onSessionZipChosen
2587
+ })
2283
2588
  )
2284
2589
  }
2285
2590
 
package/lib/core/index.js CHANGED
@@ -475,7 +475,17 @@ export function apply(ctx, config = {}) {
475
475
  sessions: webCtx.get('sessions'),
476
476
  agents: webCtx.get('agents'),
477
477
  workspaceRegistry: webCtx.get('workspaceRegistry'),
478
- compaction: webCtx.get('compaction')
478
+ compaction: webCtx.get('compaction'),
479
+ // 0.5.3 本地修复:会话不在内存里时要 resume,宿主自己的组合入口才挂得上预设(含压缩)与模型。
480
+ sessionController: webCtx.get('sessionController'),
481
+ // 「删除并回顾」走 /compact 命令:压缩后端在预设隔离作用域里,只有命令处理器的 ctx 看得到。
482
+ commands: webCtx.get('commands'),
483
+ // 删完目录要让宿主索引忘掉它,否则设置页列表和搜索留幽灵。
484
+ sessionProjectionCache: webCtx.get('sessionProjectionCache'),
485
+ sessionQuery: webCtx.get('sessionQuery'),
486
+ // 导入落盘后要让主界面左侧列表出现这条会话:发宿主自己的列表新增事件
487
+ // (删除能刷新,是因为 session/disposed 自动发 api-session/removed;导入没有对应动作)。
488
+ notifySessionAdded: (summary) => webCtx.emit('api-session/added', summary)
479
489
  })
480
490
  // 0.4.1:选项一落盘就同步工具,赶在下一次 systemPrompt.assemble() 之前。
481
491
  // 0.4.6:切「清单词刷新时刻」那一下,把所有已记住的会话刷新成此刻的现词。
@@ -14,6 +14,7 @@
14
14
  */
15
15
 
16
16
  import { canDecodeZstd } from '../core/zstd.js'
17
+ import { canWriteZstd } from './import-session.js'
17
18
 
18
19
  const fn = (v) => typeof v === 'function'
19
20
 
@@ -93,6 +94,9 @@ export function probeCapabilities(ctx, { only } = {}) {
93
94
  // 探测函数单独留着,是为了让宿主能力表仍然是一个能查询的真值。
94
95
  const zstd = canDecodeZstd()
95
96
  need('zstd.decompress', 'zlib.zstdDecompressSync() or the built-in decoder', zstd)
97
+ // 会话导入要往盘里写 zstd(0.6.1):Node 22.15+ 才有;缺了只关掉导入那一个按钮。
98
+ optional['zstd.compress'] = canWriteZstd()
99
+ table['zstd.compress'] = optional['zstd.compress']
96
100
 
97
101
  if (Array.isArray(only)) {
98
102
  // 只报「这块此刻应该就绪」的条目:apply 刚进来时别把还没起来的服务当成缺失。