oira666_pi-subagent 0.2.9 → 0.2.10

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 +15 -1
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -373,6 +373,7 @@ const RESUME_PROVIDER = "pi-subagent-resume";
373
373
  const RESUME_MODEL_ID = "synthetic-tool-call";
374
374
  const RESUME_STATE_KEY = "__piSubagentResumeState";
375
375
  const SUBAGENT_FALLBACK_MODEL_ENV = "PI_SUBAGENT_FALLBACK_MODEL";
376
+ const RESUME_INTERACTIVE_DELAY_MS = 250;
376
377
 
377
378
  type SyntheticResumeState = {
378
379
  plan: ResumableSubagentCall | null;
@@ -684,7 +685,20 @@ export default function (pi: ExtensionAPI) {
684
685
  if (hasCliInitialPrompt(process.argv)) {
685
686
  if (ctx.hasUI) ctx.ui.notify(`Resuming ${plan.tasks.length} subagents...`, "info");
686
687
  } else {
687
- pi.sendUserMessage(`Resuming ${plan.tasks.length} subagents...`);
688
+ // Do not start the synthetic resume turn synchronously from
689
+ // session_start. In interactive mode Pi may still be rebuilding the
690
+ // resumed chat UI; if the tool starts before that finishes, later
691
+ // renderSessionContext() can clear the live pending tool component and
692
+ // all real-time tool updates disappear. A short macrotask delay lets
693
+ // the normal "Resumed session" render settle first.
694
+ setTimeout(() => {
695
+ try {
696
+ pi.sendUserMessage(`Resuming ${plan.tasks.length} subagents...`);
697
+ } catch (err) {
698
+ console.error("[pi-subagent] Failed to start deferred resume turn:", err);
699
+ void restoreModelAfterResumeFailure(ctx);
700
+ }
701
+ }, RESUME_INTERACTIVE_DELAY_MS);
688
702
  }
689
703
  } catch (err) {
690
704
  console.error("[pi-subagent] Error in session_start:", err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oira666_pi-subagent",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Subagent extension for Pi coding agent. Delegate tasks to specialized agents.",
5
5
  "type": "module",
6
6
  "main": "index.ts",