oira666_pi-subagent 0.2.7 → 0.2.8

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.
Files changed (2) hide show
  1. package/index.ts +10 -6
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -596,8 +596,17 @@ export default function (pi: ExtensionAPI) {
596
596
 
597
597
  // Auto-discover agents on session start
598
598
  pi.on("session_start", async (event, ctx) => {
599
- if (!canDelegate) return;
600
599
  try {
600
+ // Always repair sessions left on the synthetic resume model, even in
601
+ // nested subagents that can no longer delegate. Those leaf processes
602
+ // still need the real model to continue their own work.
603
+ const restorableModel = getRestorableModel(ctx);
604
+ if (ctx.model?.provider === RESUME_PROVIDER && restorableModel) {
605
+ await pi.setModel(restorableModel);
606
+ }
607
+
608
+ if (!canDelegate) return;
609
+
601
610
  const discovery = discoverAgents(ctx.cwd, "both");
602
611
  discoveredAgents = discovery.agents;
603
612
  currentSessionId = ctx.sessionManager.getSessionId?.() ?? "ephemeral";
@@ -613,11 +622,6 @@ export default function (pi: ExtensionAPI) {
613
622
  );
614
623
  }
615
624
 
616
- const restorableModel = getRestorableModel(ctx);
617
- if (ctx.model?.provider === RESUME_PROVIDER && restorableModel) {
618
- await pi.setModel(restorableModel);
619
- }
620
-
621
625
  const resumeDisabled = parseBooleanEnv(process.env[SUBAGENT_RESUME_DISABLE_ENV]) === true;
622
626
  if (resumeDisabled || (event.reason !== "resume" && event.reason !== "startup")) return;
623
627
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oira666_pi-subagent",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Subagent extension for Pi coding agent. Delegate tasks to specialized agents.",
5
5
  "type": "module",
6
6
  "main": "index.ts",