dsh-rewind-plugin 0.19.1 → 0.19.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/lib/client.js CHANGED
@@ -1576,7 +1576,7 @@ async function candidatesOverRpc(connection, sessionId) {
1576
1576
  }
1577
1577
 
1578
1578
  // src/client/build-info.ts
1579
- var PLUGIN_VERSION = true ? "0.19.1" : "dev";
1579
+ var PLUGIN_VERSION = true ? "0.19.2" : "dev";
1580
1580
  var PLUGIN_PACKAGE = "dsh-rewind-plugin";
1581
1581
  var BUILD_HASH = true ? "cc2bb5b8" : "dev";
1582
1582
 
package/lib/index.js CHANGED
@@ -420,10 +420,13 @@ function refToSource(raw, sessionDir) {
420
420
  if (typeof ref.text === "string") return textSourceOf(ref.text);
421
421
  return void 0;
422
422
  }
423
+ function sessionRelativeRef(sessionDir, file) {
424
+ return relative(sessionDir, file).split(sep).join("/");
425
+ }
423
426
  function sourceToRef(source, sessionDir, entryPath) {
424
427
  if (source === null) return null;
425
428
  if (source.kind === "blob") {
426
- const blob = relative(sessionDir, source.path);
429
+ const blob = sessionRelativeRef(sessionDir, source.path);
427
430
  if (!isSafeBackupRef(blob)) throw new Error(`unsafe backup ref ${blob} for ${entryPath}`);
428
431
  return { blob };
429
432
  }
@@ -766,7 +769,7 @@ var SnapshotStore = class _SnapshotStore {
766
769
  * the call id would produce a dangling reference.
767
770
  */
768
771
  refOfRead(sessionId, entry) {
769
- if (entry.file !== void 0) return relative(this.sessionDir(sessionId), entry.file);
772
+ if (entry.file !== void 0) return sessionRelativeRef(this.sessionDir(sessionId), entry.file);
770
773
  return this.entryRefOf(sessionId, entry.callId, entry.anchorSeq);
771
774
  }
772
775
  /** Drop every in-memory trace of one session (its directory is gone). */
@@ -1834,7 +1837,7 @@ var SnapshotStore = class _SnapshotStore {
1834
1837
  for (const action of journal.actions) {
1835
1838
  const source = action.before;
1836
1839
  if (source === null || source.kind !== "blob") continue;
1837
- const ref = relative(sessionDir, source.path);
1840
+ const ref = sessionRelativeRef(sessionDir, source.path);
1838
1841
  if (!isSafeBackupRef(ref)) continue;
1839
1842
  const anchor = refAnchorOf(ref);
1840
1843
  if (Number.isSafeInteger(anchor)) pinned.add(anchor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-rewind-plugin",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "In-window conversation rewind with workspace file restore · 同窗口内对话回退并可还原工作区文件",
5
5
  "icon": "./assets/icon.svg",
6
6
  "keywords": [