@dyyz1993/pi-coding-agent 0.74.36 → 0.74.39
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 +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +14 -12
- package/dist/core/agent-session.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
|
@@ -2528,18 +2528,20 @@ export class AgentSession {
|
|
|
2528
2528
|
// Non-user message: leaf = selected node
|
|
2529
2529
|
newLeafId = targetId;
|
|
2530
2530
|
}
|
|
2531
|
-
// Safety guard: reject navigation that would eliminate ALL user messages
|
|
2532
|
-
//
|
|
2533
|
-
//
|
|
2534
|
-
//
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2531
|
+
// Safety guard: reject navigation that would eliminate ALL user messages
|
|
2532
|
+
// ONLY when file rollback is involved (skipFiles !== true).
|
|
2533
|
+
// When skipFiles=true (message-only rollback), going back to empty is valid —
|
|
2534
|
+
// the user wants to undo their mistaken message.
|
|
2535
|
+
if (options.skipFiles !== true) {
|
|
2536
|
+
const effectiveLeafId = summaryText ? newLeafId : newLeafId;
|
|
2537
|
+
const userMsgCount = this.sessionManager.countUserMessagesOnPath(effectiveLeafId);
|
|
2538
|
+
if (userMsgCount === 0) {
|
|
2539
|
+
return {
|
|
2540
|
+
cancelled: true,
|
|
2541
|
+
editorText: undefined,
|
|
2542
|
+
reason: `Navigation to "${targetId}" would remove all user messages and restore files to their pre-session state. Use message-only rollback (skipFiles: true) to undo without file changes.`,
|
|
2543
|
+
};
|
|
2544
|
+
}
|
|
2543
2545
|
}
|
|
2544
2546
|
// Switch leaf (with or without summary)
|
|
2545
2547
|
// Summary is attached at the navigation target position (newLeafId), not the old branch
|