dsh-recall-plugin 2.4.14 → 2.4.16

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/index.js CHANGED
@@ -8,6 +8,7 @@ import { createSessionInfo, titleFromEvents, messageTextFromEvents } from "./ses
8
8
  import { createRoutesCore } from "./routes-core.js";
9
9
  import { createRoutesManage } from "./routes-manage.js";
10
10
  import { createIntentJournal } from "./intent-journal.js";
11
+ import { createEnsureRootReady } from "./root-ready.js";
11
12
  import * as dshSettings from "@deepseek-ai/dsh-settings";
12
13
  import * as E from "./errors.js";
13
14
  const name = "dsh-recall-plugin";
@@ -236,26 +237,7 @@ function apply(ctx, config) {
236
237
  },
237
238
  agentBusy: (root) => agentBusy(null, root)
238
239
  });
239
- const rootReady = /* @__PURE__ */ new Map();
240
- function ensureRootReady(root, sessionId) {
241
- const cached = rootReady.get(root);
242
- if (cached) return cached;
243
- const task = (async () => {
244
- let store = await rt.resolveStore(root);
245
- store = await rt.tryUpgradeToHome(root);
246
- await rt.ensureGit(root, store);
247
- await snaps.loadIndex(root, sessionId);
248
- await snaps.rebuildOrphans(root, sessionId || "");
249
- if (await snaps.guardStoreFormat(store)) await intentJournal.recover(store);
250
- rt.cleanupLegacy(root);
251
- return store;
252
- })();
253
- rootReady.set(root, task);
254
- task.catch(() => {
255
- rootReady.delete(root);
256
- });
257
- return task;
258
- }
240
+ const ensureRootReady = createEnsureRootReady({ rt, snaps, journal: intentJournal, cfg });
259
241
  const deps = {
260
242
  ctx,
261
243
  rt,
@@ -0,0 +1,27 @@
1
+ import { buildArtifactRootSegment } from "./exclude-patterns.js";
2
+ function createEnsureRootReady({ rt, snaps, journal, cfg }) {
3
+ const ready = /* @__PURE__ */ new Map();
4
+ return function ensureRootReady(root, sessionId) {
5
+ if (buildArtifactRootSegment(root, cfg.baseExcludes, rt.isWin)) return Promise.resolve(null);
6
+ const cached = ready.get(root);
7
+ if (cached) return cached;
8
+ const task = (async () => {
9
+ let store = await rt.resolveStore(root);
10
+ store = await rt.tryUpgradeToHome(root);
11
+ await rt.ensureGit(root, store);
12
+ await snaps.loadIndex(root, sessionId);
13
+ await snaps.rebuildOrphans(root, sessionId || "");
14
+ if (await snaps.guardStoreFormat(store)) await journal.recover(store);
15
+ rt.cleanupLegacy(root);
16
+ return store;
17
+ })();
18
+ ready.set(root, task);
19
+ task.catch(() => {
20
+ ready.delete(root);
21
+ });
22
+ return task;
23
+ };
24
+ }
25
+ export {
26
+ createEnsureRootReady
27
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-recall-plugin",
3
- "version": "2.4.14",
3
+ "version": "2.4.16",
4
4
  "description": "在 DSH 中撤回自己发过的消息:工作区文件与对话历史一起回到那条消息发出之前,消息的文本与附件自动放回输入框,改完即可重发。文件走独立影子 git 快照(不碰项目自身的 git),对话走官方 sessions.fork,原会话归档可找回。",
5
5
  "icon": "assets/icon.svg",
6
6
  "type": "module",