@arhen/pi-core-subagent 1.0.2 → 1.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/package.json +1 -1
- package/src/index.ts +16 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arhen/pi-core-subagent",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
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
|
@@ -389,7 +389,15 @@ class SubagentManager {
|
|
|
389
389
|
|
|
390
390
|
constructor(private readonly pi: ExtensionAPI) {}
|
|
391
391
|
|
|
392
|
-
/**
|
|
392
|
+
/** Any run still has queued/running tasks? */
|
|
393
|
+
hasActiveRun(): boolean {
|
|
394
|
+
for (const run of this.runs.values()) {
|
|
395
|
+
if (run.tasks.some((t) => !TERMINAL.includes(t.status))) return true;
|
|
396
|
+
}
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/** Hide the widget. */
|
|
393
401
|
clearWidget(ctx: ExtensionContext): void {
|
|
394
402
|
this.widgetRun = undefined;
|
|
395
403
|
this.widgetTui = null;
|
|
@@ -875,6 +883,13 @@ class SubagentManager {
|
|
|
875
883
|
run.status = aborted ? "aborted" : failed ? "failed" : "completed";
|
|
876
884
|
run.endedAt = Date.now();
|
|
877
885
|
this.flushWidget(ctx, onUpdate);
|
|
886
|
+
// Run done: keep the widget only while another run is still live.
|
|
887
|
+
const live = this.listRuns().find((r) => !TERMINAL.includes(r.status));
|
|
888
|
+
if (live) {
|
|
889
|
+
this.scheduleWidget(live, ctx, onUpdate);
|
|
890
|
+
} else {
|
|
891
|
+
this.clearWidget(ctx);
|
|
892
|
+
}
|
|
878
893
|
this.emit("subagent:run-completed", { runId: run.id, status: run.status, run: cloneRun(run), aggregateUsage: run.aggregateUsage });
|
|
879
894
|
this.settleRun(run.id, run);
|
|
880
895
|
this.runControllers.delete(run.id);
|