@tintinweb/pi-subagents 0.4.5 → 0.4.6
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/CHANGELOG.md +9 -0
- package/package.json +1 -1
- package/src/agent-manager.ts +25 -0
- package/src/index.ts +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.4.6] - 2026-03-16
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Graceful shutdown aborts agents instead of blocking** — `session_shutdown` now calls `abortAll()` instead of `waitForAll()`, so the process exits immediately instead of hanging until all background agents complete. Agent results are undeliverable after shutdown anyway.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- `abortAll()` method on `AgentManager` — stops all queued and running agents at once, returning the count of affected agents.
|
|
15
|
+
|
|
8
16
|
## [0.4.5] - 2026-03-16
|
|
9
17
|
|
|
10
18
|
### Changed
|
|
@@ -266,6 +274,7 @@ Initial release.
|
|
|
266
274
|
- **Thinking level** — per-agent extended thinking control
|
|
267
275
|
- **`/agent` and `/agents` commands**
|
|
268
276
|
|
|
277
|
+
[0.4.6]: https://github.com/tintinweb/pi-subagents/compare/v0.4.5...v0.4.6
|
|
269
278
|
[0.4.5]: https://github.com/tintinweb/pi-subagents/compare/v0.4.4...v0.4.5
|
|
270
279
|
[0.4.4]: https://github.com/tintinweb/pi-subagents/compare/v0.4.3...v0.4.4
|
|
271
280
|
[0.4.3]: https://github.com/tintinweb/pi-subagents/compare/v0.4.2...v0.4.3
|
package/package.json
CHANGED
package/src/agent-manager.ts
CHANGED
|
@@ -341,6 +341,31 @@ export class AgentManager {
|
|
|
341
341
|
);
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
+
/** Abort all running and queued agents immediately. */
|
|
345
|
+
abortAll(): number {
|
|
346
|
+
let count = 0;
|
|
347
|
+
// Clear queued agents first
|
|
348
|
+
for (const queued of this.queue) {
|
|
349
|
+
const record = this.agents.get(queued.id);
|
|
350
|
+
if (record) {
|
|
351
|
+
record.status = "stopped";
|
|
352
|
+
record.completedAt = Date.now();
|
|
353
|
+
count++;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
this.queue = [];
|
|
357
|
+
// Abort running agents
|
|
358
|
+
for (const record of this.agents.values()) {
|
|
359
|
+
if (record.status === "running") {
|
|
360
|
+
record.abortController?.abort();
|
|
361
|
+
record.status = "stopped";
|
|
362
|
+
record.completedAt = Date.now();
|
|
363
|
+
count++;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return count;
|
|
367
|
+
}
|
|
368
|
+
|
|
344
369
|
/** Wait for all running and queued agents to complete (including queued ones). */
|
|
345
370
|
async waitForAll(): Promise<void> {
|
|
346
371
|
// Loop because drainQueue respects the concurrency limit — as running
|
package/src/index.ts
CHANGED
|
@@ -288,10 +288,11 @@ export default function (pi: ExtensionAPI) {
|
|
|
288
288
|
pi.on("session_start", () => { manager.clearCompleted(); });
|
|
289
289
|
pi.on("session_switch", () => { manager.clearCompleted(); });
|
|
290
290
|
|
|
291
|
-
//
|
|
291
|
+
// On shutdown, abort all agents immediately and clean up.
|
|
292
|
+
// If the session is going down, there's nothing left to consume agent results.
|
|
292
293
|
pi.on("session_shutdown", async () => {
|
|
293
294
|
delete (globalThis as any)[MANAGER_KEY];
|
|
294
|
-
|
|
295
|
+
manager.abortAll();
|
|
295
296
|
manager.dispose();
|
|
296
297
|
});
|
|
297
298
|
|