@gotgenes/pi-subagents 13.2.2 → 14.0.0
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
CHANGED
|
@@ -5,6 +5,17 @@ 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
|
+
## [14.0.0](https://github.com/gotgenes/pi-packages/compare/pi-subagents-v13.2.2...pi-subagents-v14.0.0) (2026-06-01)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### ⚠ BREAKING CHANGES
|
|
12
|
+
|
|
13
|
+
* **pi-subagents:** the subagents:child:session-created payload no longer includes sessionDir or agentName; it now carries sessionId (string) and parentSessionId (optional string). The subagents:child:disposed payload no longer includes sessionDir; it now carries sessionId (string). External subscribers reading sessionDir or agentName from these two events must update to use sessionId instead.
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **pi-subagents:** carry child session id on session-created/disposed lifecycle events ([af94672](https://github.com/gotgenes/pi-packages/commit/af946723df7a4c7b2e65aa2e732085abb0019c7e))
|
|
18
|
+
|
|
8
19
|
## [13.2.2](https://github.com/gotgenes/pi-packages/compare/pi-subagents-v13.2.1...pi-subagents-v13.2.2) (2026-06-01)
|
|
9
20
|
|
|
10
21
|
|
package/package.json
CHANGED
|
@@ -15,10 +15,10 @@ export const SUBAGENT_CHILD_SPAWNING = "subagents:child:spawning";
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Emitted after the child session is created, immediately before
|
|
18
|
-
* `bindExtensions()`. Carries the child
|
|
19
|
-
* the session
|
|
20
|
-
* before binding proceeds (see ADR 0002 /
|
|
21
|
-
* guarantee).
|
|
18
|
+
* `bindExtensions()`. Carries the child session id consumers need to register
|
|
19
|
+
* the session in `SubagentSessionRegistry`. Subscribers must register
|
|
20
|
+
* synchronously so the entry lands before binding proceeds (see ADR 0002 /
|
|
21
|
+
* the event-bus synchronous-dispatch guarantee).
|
|
22
22
|
*/
|
|
23
23
|
export const SUBAGENT_CHILD_SESSION_CREATED = "subagents:child:session-created";
|
|
24
24
|
|
|
@@ -36,9 +36,9 @@ export interface ChildSpawningEvent {
|
|
|
36
36
|
|
|
37
37
|
/** Payload for `subagents:child:session-created`. */
|
|
38
38
|
export interface ChildSessionCreatedEvent {
|
|
39
|
-
/** Child session
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
/** Child session id — the registry key. Unique per child; concurrent
|
|
40
|
+
* siblings of the same parent occupy distinct keys. */
|
|
41
|
+
sessionId: string;
|
|
42
42
|
parentSessionId?: string;
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -54,7 +54,8 @@ export interface ChildCompletedEvent {
|
|
|
54
54
|
|
|
55
55
|
/** Payload for `subagents:child:disposed`. */
|
|
56
56
|
export interface ChildDisposedEvent {
|
|
57
|
-
|
|
57
|
+
/** Child session id — the registry key. Must match `session-created`. */
|
|
58
|
+
sessionId: string;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
/** Narrow emit seam — injected, never imports the Pi SDK. */
|
|
@@ -51,6 +51,7 @@ export interface ResourceLoaderLike {
|
|
|
51
51
|
export interface SessionManagerLike {
|
|
52
52
|
newSession(opts: { parentSession?: string }): void;
|
|
53
53
|
getSessionFile(): string | undefined;
|
|
54
|
+
getSessionId(): string;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
/** Options passed to EnvironmentIO/SessionFactoryIO methods. */
|
|
@@ -196,6 +197,7 @@ export async function createSubagentSession(
|
|
|
196
197
|
const sessionDir = deps.io.deriveSessionDir(params.parentSession?.parentSessionFile, cfg.effectiveCwd);
|
|
197
198
|
const sessionManager = deps.io.createSessionManager(cfg.effectiveCwd, sessionDir);
|
|
198
199
|
sessionManager.newSession({ parentSession: params.parentSession?.parentSessionId });
|
|
200
|
+
const sessionId = sessionManager.getSessionId();
|
|
199
201
|
|
|
200
202
|
const { session } = await deps.io.createSession({
|
|
201
203
|
cwd: cfg.effectiveCwd,
|
|
@@ -211,6 +213,7 @@ export async function createSubagentSession(
|
|
|
211
213
|
|
|
212
214
|
const subagentSession = new SubagentSession(session, {
|
|
213
215
|
outputFile: sessionManager.getSessionFile(),
|
|
216
|
+
sessionId,
|
|
214
217
|
sessionDir,
|
|
215
218
|
agentName: type,
|
|
216
219
|
agentMaxTurns: cfg.agentMaxTurns,
|
|
@@ -223,7 +226,7 @@ export async function createSubagentSession(
|
|
|
223
226
|
// entry in place for the first permission check during child extension
|
|
224
227
|
// initialization. The event bus dispatches synchronously, so a synchronous
|
|
225
228
|
// subscriber completes before this returns.
|
|
226
|
-
deps.lifecycle.sessionCreated({
|
|
229
|
+
deps.lifecycle.sessionCreated({ sessionId, parentSessionId });
|
|
227
230
|
|
|
228
231
|
try {
|
|
229
232
|
// Bind extensions so that session_start fires and extensions can initialize.
|
|
@@ -44,7 +44,9 @@ export interface TurnLoopOptions {
|
|
|
44
44
|
export interface SubagentSessionMeta {
|
|
45
45
|
/** Path to the persisted session JSONL file, if the session was persisted. */
|
|
46
46
|
outputFile: string | undefined;
|
|
47
|
-
/** Child session
|
|
47
|
+
/** Child session id — the registry key carried on session-created/disposed events. */
|
|
48
|
+
sessionId: string;
|
|
49
|
+
/** Child session directory — carried on the completed event as transcript location. */
|
|
48
50
|
sessionDir: string;
|
|
49
51
|
agentName: string;
|
|
50
52
|
/** Per-agent max-turns from the resolved agent config — middle precedence. */
|
|
@@ -180,7 +182,7 @@ export class SubagentSession {
|
|
|
180
182
|
dispose(): void {
|
|
181
183
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- dispose may not exist on all session implementations
|
|
182
184
|
this._session.dispose?.();
|
|
183
|
-
this.meta.lifecycle.disposed({
|
|
185
|
+
this.meta.lifecycle.disposed({ sessionId: this.meta.sessionId });
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
|