@arhen/pi-core-subagent 1.1.4 → 1.1.5

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/package.json +1 -1
  2. package/src/index.ts +6 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arhen/pi-core-subagent",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "type": "module",
5
5
  "description": "pi extension: fast in-process subagents with single/parallel/chain, background runs, intercom and agent-to-agent mailbox. Leader defines agents inline.",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -540,20 +540,20 @@ class SubagentManager {
540
540
  this.ensureWidget(ctx);
541
541
  this.widgetTui?.requestRender();
542
542
  }
543
- onUpdate?.({ content: [{ type: "text", text: targets.flatMap(compactLines).join("\n") }] });
543
+ onUpdate?.({ content: [{ type: "text", text: compactLines(run ?? targets[0]!).join("\n") }] });
544
544
  }, WIDGET_THROTTLE_MS);
545
545
  }
546
- private flushWidget(ctx?: ExtensionContext, onUpdate?: (partial: any) => void): void {
546
+ private flushWidget(run: RunSnapshot | undefined, ctx?: ExtensionContext, onUpdate?: (partial: any) => void): void {
547
547
  if (this.widgetTimer) {
548
548
  clearTimeout(this.widgetTimer);
549
549
  this.widgetTimer = undefined;
550
550
  }
551
- if (this.widgetRuns.length === 0) return;
551
+ if (!run || this.widgetRuns.length === 0) return;
552
552
  if (ctx?.hasUI) {
553
553
  this.ensureWidget(ctx);
554
554
  this.widgetTui?.requestRender();
555
555
  }
556
- onUpdate?.({ content: [{ type: "text", text: this.widgetRuns.flatMap(compactLines).join("\n") }] });
556
+ onUpdate?.({ content: [{ type: "text", text: compactLines(run).join("\n") }] });
557
557
  }
558
558
  private ensureWidget(ctx: ExtensionContext): void {
559
559
  if (this.widgetTui !== null || !ctx.hasUI) return;
@@ -899,7 +899,7 @@ class SubagentManager {
899
899
  const aborted = run.tasks.some((t) => t.status === "aborted") || Boolean(signal?.aborted);
900
900
  run.status = aborted ? "aborted" : failed ? "failed" : "completed";
901
901
  run.endedAt = Date.now();
902
- this.flushWidget(ctx, onUpdate);
902
+ this.flushWidget(run, ctx, onUpdate);
903
903
  // Run done: keep the widget only while another run is still live.
904
904
  const live = this.listRuns().find((r) => !TERMINAL.includes(r.status));
905
905
  if (live) {
@@ -1113,7 +1113,7 @@ export default function (pi: ExtensionAPI) {
1113
1113
  promptSnippet: "Define and delegate work to specialized subagents.",
1114
1114
  promptGuidelines: [
1115
1115
  "Use subagent when independent review, testing, research, or parallel analysis improves quality.",
1116
- "Decompose parallelizable work: if the request has 2+ independent sub-tasks (separate files, separate concerns, independent research/review), delegate each to its own subagent in one parallel call instead of handling them inline.",
1116
+ "Decompose parallelizable work: if the request has 2+ independent sub-tasks (separate files, separate concerns, independent research/review), delegate each to its own subagent in ONE call with tasks[] (single shot), not multiple parallel subagent calls.",
1117
1117
  "If independent sub-tasks are sequential (each builds on the previous one's output), use chain mode with {previous}.",
1118
1118
  "Define each subagent yourself: an invented name, a focused system prompt (prompt:), and a toolset — read-only (default) or write (write:true).",
1119
1119
  "Prefer read-only subagents unless the task explicitly needs edits.",