@michengai/dsh-archive-manager 0.1.7 → 0.1.8

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.
Files changed (2) hide show
  1. package/lib/workspace.js +9 -5
  2. package/package.json +1 -1
package/lib/workspace.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { rm } from "node:fs/promises";
2
2
  import { dirname } from "node:path";
3
3
  import {
4
- WorkspaceRegistry,
5
- WorkspaceUnknownSessionError
4
+ WorkspaceRegistry
6
5
  } from "@deepseek-ai/dsh-workspace";
7
6
  import { bindTypertRemote, Remote } from "@deepseek-ai/dsh-typert-protocol";
8
7
  import { sessionDir } from "@deepseek-ai/dsh-spill-local";
@@ -38,7 +37,7 @@ function markRemoteMethod(instance, method) {
38
37
  Remote(method)(void 0, context);
39
38
  }
40
39
  function unknownSessionMessage(sessionId) {
41
- return `cannot delete session "${sessionId}": unknown (UNKNOWN_SESSION)`;
40
+ return `unknown session "${sessionId}" (UNKNOWN_SESSION)`;
42
41
  }
43
42
  var ArchiveUnknownSessionError = class extends Error {
44
43
  sessionId;
@@ -160,7 +159,7 @@ var ArchiveWorkspaceRegistry = class extends WorkspaceRegistry {
160
159
  */
161
160
  async unarchiveSession(sessionId) {
162
161
  return this.enqueueOperation(async () => {
163
- if (!await this.sessionKnown(sessionId)) throw new WorkspaceUnknownSessionError(sessionId);
162
+ if (!await this.sessionKnown(sessionId)) throw new ArchiveUnknownSessionError(sessionId);
164
163
  const state = this.requireState();
165
164
  if (!state.archivedSessionIds.includes(sessionId)) return { archivedSessionIds: [...state.archivedSessionIds] };
166
165
  const next = {
@@ -223,6 +222,11 @@ var ArchiveWorkspaceRegistry = class extends WorkspaceRegistry {
223
222
  * 从父类内存索引中遗忘已删除会话,并阻止后续 indexHeaders 把它加回。
224
223
  * 实时会话以同 id 重新出现时(自定义 id 复用)会撤掉墓碑。
225
224
  */
225
+ clearTombstone(sessionId) {
226
+ this.deletedSessionIds.delete(sessionId);
227
+ const idx = this.deletedSessionOrder.indexOf(sessionId);
228
+ if (idx !== -1) this.deletedSessionOrder.splice(idx, 1);
229
+ }
226
230
  forgetIndexedSession(sessionId) {
227
231
  if (!this.deletedSessionIds.has(sessionId)) {
228
232
  this.deletedSessionIds.add(sessionId);
@@ -242,7 +246,7 @@ var ArchiveWorkspaceRegistry = class extends WorkspaceRegistry {
242
246
  */
243
247
  async sessionKnown(id) {
244
248
  if (this.ctx.get("sessions")?.get(id) !== void 0) {
245
- this.deletedSessionIds.delete(id);
249
+ this.clearTombstone(id);
246
250
  return true;
247
251
  }
248
252
  if (this.deletedSessionIds.has(id)) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-archive-manager",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "NPM-installable DSH Web plugin for managing archived sessions.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.21.0",