@michengai/dsh-archive-manager 1.1.1 → 1.1.2

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/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@
4
4
 
5
5
  Published release notes are retained below; new versions are added without removing earlier entries.
6
6
 
7
+ ## 1.1.2 - 2026-10-18
8
+
9
+ - Synchronously remove official projection cache records (`session_projcache/sessions/<id>.json`) when permanently deleting a session, preventing orphaned files from lingering on disk and re-importing as blank ghost entries upon host launch (#65).
10
+ - Automatically prune orphaned projection entries when cleaning up corrupt or missing archived session records.
11
+
7
12
  ## 1.1.1 - 2026-10-18
8
13
 
9
14
  - In the sidebar session menu, "Delete session" confirmation is now a neat floating card anchored right next to that session row instead of a full-screen overlay, matching the native translucent dark blur and lighting of host dropdown menus (#60).
@@ -4,6 +4,11 @@
4
4
 
5
5
  以下发布说明会持续保留;新增版本时不再删除较早记录。
6
6
 
7
+ ## 1.1.2 - 2026-10-18
8
+
9
+ - 彻底删除会话时同步清理官方原生投影缓存记录(`session_projcache/sessions/<id>.json`),防止磁盘残留孤儿文件并在宿主启动时被重新迁入造成空白幽灵会话(#65)。
10
+ - 在修剪确认已不存在的损坏或陈旧归档时,一并清理对应的孤儿投影条目。
11
+
7
12
  ## 1.1.1 - 2026-10-18
8
13
 
9
14
  - 侧边栏右键菜单里的「删除会话」确认框改为贴在当前会话旁的小卡片,不再用全屏居中大弹窗遮挡界面,质感与原生下拉菜单保持一致的暗色毛玻璃与微光阴影(#60)。
package/lib/projcache.js CHANGED
@@ -241,12 +241,18 @@ var ArchiveProjectionCache = class extends CacheBase {
241
241
  }
242
242
  /**
243
243
  * 永久移除一个会话的缓存投影行。
244
+ * 同时清理当前表与底层原生表(如官方 session_projcache 域),防止残留孤儿文件。
244
245
  * @param id - 要删除缓存行的会话。
245
246
  * @returns 行删除完成后的 resolution。
246
247
  */
247
248
  async delete(id) {
248
249
  trackTombstone(this.deletedSessionIds, this.deletedSessionOrder, id, this.deletedSessionTombstoneLimit);
249
- await this.requireTable().delete(id);
250
+ const tasks = [this.requireTable().delete(id)];
251
+ const secondary = this.secondaryTable;
252
+ if (secondary !== void 0 && typeof secondary.delete === "function") {
253
+ tasks.push(secondary.delete(id).catch(() => false));
254
+ }
255
+ await Promise.all(tasks);
250
256
  }
251
257
  /** 撤销墓碑(供测试与同 id 新生命周期复用路径使用)。 */
252
258
  clearTombstone(id) {
@@ -256,12 +262,13 @@ var ArchiveProjectionCache = class extends CacheBase {
256
262
  }
257
263
  };
258
264
  const projectionGuards = /* @__PURE__ */ new WeakMap();
259
- function installArchiveProjectionCacheGuards(cache, table) {
265
+ function installArchiveProjectionCacheGuards(cache, table, secondaryTable) {
260
266
  const target = Reflect.get(cache, symbols.original) ?? cache;
261
267
  const existing = projectionGuards.get(target);
262
268
  if (existing) return existing;
263
269
  const fields = {
264
270
  table: table ?? target.table,
271
+ secondaryTable: secondaryTable !== (table ?? target.table) ? secondaryTable : void 0,
265
272
  deletedSessionIds: /* @__PURE__ */ new Set(),
266
273
  deletedSessionOrder: [],
267
274
  deletedSessionTombstoneLimit: 4096,
@@ -322,7 +329,7 @@ async function installArchiveProjectionCache(cache) {
322
329
  try {
323
330
  const table = new SafeSessionTable(domain.table("sessions"));
324
331
  await importPreviousProjectionCache(target.ctx, table, previousTable);
325
- uninstallGuards = installArchiveProjectionCacheGuards(cache, table);
332
+ uninstallGuards = installArchiveProjectionCacheGuards(cache, table, previousTable);
326
333
  target.table = table;
327
334
  target[projectionOverlay] = true;
328
335
  installed = true;
package/lib/workspace.js CHANGED
@@ -637,6 +637,14 @@ var ArchiveWorkspaceRegistry = class extends WorkspaceRegistry {
637
637
  const header = this.headers.get(sessionId);
638
638
  this.forgetIndexedSession(sessionId);
639
639
  if (header !== void 0) this.deletedIdentities.set(sessionId, headerIdentity(header));
640
+ const projCache = this.ctx.get("sessionProjectionCache");
641
+ if (projCache !== void 0 && typeof projCache.delete === "function") {
642
+ try {
643
+ await projCache.delete(sessionId);
644
+ } catch (e) {
645
+ this.ctx.logger.warn(`archive-manager: cleanup projection cache for missing session "${sessionId}" failed: ${String(e)}`);
646
+ }
647
+ }
640
648
  continue;
641
649
  }
642
650
  kept.push(sessionId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-archive-manager",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "归档、恢复、收藏和永久删除会话,并诊断损坏的会话日志。 · Archive, restore, favorite, and permanently delete sessions, and diagnose damaged session logs.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.22.0",