@henryqw/pi-undo 2.0.2 → 2.0.4

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/README.md CHANGED
@@ -10,7 +10,7 @@ pi install npm:@henryqw/pi-undo
10
10
 
11
11
  ## Use
12
12
 
13
- Run `/undo` with no arguments. It stops active work, waits for it to finish stopping, and returns to your latest user message so you can edit or submit it again. If there is no user message in the session, Pi displays `Nothing to undo.`
13
+ Run `/undo` with no arguments. It stops active work, waits for it to finish stopping, and returns to the latest user prompt on the current branch so you can edit or submit it again. It does not select prompts on other branches. If the current branch has no user message, Pi displays `Nothing to undo.`
14
14
 
15
15
  ## Limits and recovery
16
16
 
@@ -8,9 +8,8 @@ export default function undoExtension(pi: ExtensionAPI): void {
8
8
 
9
9
  ctx.abort();
10
10
  await ctx.waitForIdle();
11
- const turn = [...ctx.sessionManager.getBranch()]
12
- .reverse()
13
- .find((entry) => entry.type === "message" && entry.message.role === "user");
11
+ const turn = ctx.sessionManager.getBranch()
12
+ .findLast((entry) => entry.type === "message" && entry.message.role === "user");
14
13
  if (!turn) {
15
14
  ctx.ui.notify("Nothing to undo.", "info");
16
15
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-undo",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "Rewind Pi conversation context to the latest user prompt.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -20,11 +20,11 @@
20
20
  ],
21
21
  "scripts": {
22
22
  "test": "node --test test/*.test.ts",
23
- "typecheck": "tsc --noEmit --allowImportingTsExtensions --target ES2022 --module NodeNext --moduleResolution NodeNext --skipLibCheck extensions/undo.ts test/undo.test.ts",
23
+ "typecheck": "tsc --noEmit --allowImportingTsExtensions --target ES2023 --module NodeNext --moduleResolution NodeNext --skipLibCheck extensions/undo.ts test/undo.test.ts",
24
24
  "pack:check": "npm pack --dry-run"
25
25
  },
26
26
  "peerDependencies": {
27
- "@earendil-works/pi-coding-agent": ">=0.86.0 <0.88.0"
27
+ "@earendil-works/pi-coding-agent": ">=0.86.0 <0.100.0"
28
28
  },
29
29
  "repository": {
30
30
  "type": "git",
@@ -43,6 +43,6 @@
43
43
  ]
44
44
  },
45
45
  "devDependencies": {
46
- "@earendil-works/pi-coding-agent": "0.87.0"
46
+ "@earendil-works/pi-coding-agent": "0.99.1"
47
47
  }
48
48
  }