pi-resume 1.3.1 → 1.3.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/README.md CHANGED
@@ -55,6 +55,10 @@ pi --r 2 # same, numeric form
55
55
  Same ranking as `/r1`/`/r2`. Invalid values show an error and start a normal
56
56
  new session. Interactive mode only (ignored with `-p`).
57
57
 
58
+ Under the hood the flag waits for the provider/model refresh to finish and then
59
+ dispatches `/rN` as a command (session switching is only available to commands,
60
+ and switching mid-refresh would abort it).
61
+
58
62
  ### `/rn` / `/rp` — Step Navigation
59
63
 
60
64
  Walk the mtime-sorted session list relative to the **current** session:
@@ -188,7 +188,19 @@ export default function (pi: ExtensionAPI) {
188
188
  if (event.reason !== "startup") return;
189
189
  void migrateForksInBackground(ctx).catch(() => {});
190
190
  const rank = startupRank(ctx);
191
- if (rank !== undefined) await resumeRank(rank, ctx);
191
+ if (rank === undefined) return;
192
+ if (!ctx.hasUI) {
193
+ ctx.ui.notify("--r/--rn: session resume needs interactive mode", "error");
194
+ return;
195
+ }
196
+ // session_start only gets a plain ExtensionContext (no switchSession);
197
+ // dispatch our own slash command so it runs with a command context.
198
+ // Switching while a provider refresh is in flight aborts it and crashes
199
+ // pi (uncaught AbortError from the provider), so wait for it to settle.
200
+ try {
201
+ await ctx.modelRegistry.refresh();
202
+ } catch {}
203
+ pi.sendUserMessage(`/r${rank}`, { expandPromptTemplates: true });
192
204
  });
193
205
 
194
206
  // Fires on switch (followed by session_start) and on exit.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-resume",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Fast session resume for pi coding agent — /r1,/r2 ranked resume, /rn and /rp step navigation, pi --r1/--rn startup flags, /rs paginated picker, /rds subagent session cleanup; skips sessions open in other pi instances, tidies legacy subagent forks",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,8 +34,8 @@
34
34
  "@earendil-works/pi-tui": "*"
35
35
  },
36
36
  "devDependencies": {
37
- "@earendil-works/pi-coding-agent": "*",
38
- "@earendil-works/pi-tui": "*",
37
+ "@earendil-works/pi-coding-agent": "^0.84.4",
38
+ "@earendil-works/pi-tui": "^0.84.4",
39
39
  "typescript": "^5.0.0"
40
40
  },
41
41
  "scripts": {