pi-subagents-lite 1.4.7 → 1.4.9
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-subagents-lite",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"description": "Lightweight sub-agents for pi — spawn specialized agents with isolated sessions, tools, and models.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"url": "https://github.com/AlexParamonov/pi-subagents-lite/issues"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@earendil-works/pi-ai": "^0.80.
|
|
32
|
-
"@earendil-works/pi-coding-agent": "^0.80.
|
|
33
|
-
"@earendil-works/pi-tui": "^0.80.
|
|
31
|
+
"@earendil-works/pi-ai": "^0.80.10",
|
|
32
|
+
"@earendil-works/pi-coding-agent": "^0.80.10",
|
|
33
|
+
"@earendil-works/pi-tui": "^0.80.10"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@earendil-works/pi-agent-core": "^0.80.
|
|
36
|
+
"@earendil-works/pi-agent-core": "^0.80.10",
|
|
37
37
|
"@sinclair/typebox": "^0.34.49"
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
@@ -503,6 +503,10 @@ export class AgentManager {
|
|
|
503
503
|
for (const [id, record] of this.agents) {
|
|
504
504
|
if (!isTerminalStatus(record.lifecycle.status)) continue;
|
|
505
505
|
if ((record.lifecycle.completedAt ?? 0) >= cutoff) continue;
|
|
506
|
+
// Keep the record until the LLM has read the result (foreground return or
|
|
507
|
+
// background nudge). Otherwise a completed background agent can be wiped
|
|
508
|
+
// before its nudge is emitted.
|
|
509
|
+
if (!record.lifecycle.resultConsumed) continue;
|
|
506
510
|
this.removeRecord(id, record);
|
|
507
511
|
}
|
|
508
512
|
}
|
|
@@ -399,7 +399,7 @@ async function initSession(
|
|
|
399
399
|
cwd, agentDir,
|
|
400
400
|
sessionManager: SessionManager.inMemory(cwd),
|
|
401
401
|
settingsManager: SettingsManager.create(cwd, agentDir),
|
|
402
|
-
|
|
402
|
+
model,
|
|
403
403
|
tools: getToolNamesForType(type), resourceLoader: loader,
|
|
404
404
|
};
|
|
405
405
|
if (thinkingLevel) sessionOpts.thinkingLevel = thinkingLevel;
|
|
@@ -122,6 +122,10 @@ export class SpawnCoordinator {
|
|
|
122
122
|
// Foreground: await completion
|
|
123
123
|
await record.execution.promise;
|
|
124
124
|
|
|
125
|
+
// Foreground tool handler reads the result inline on return — mark it
|
|
126
|
+
// consumed so the cleanup timer may evict the record once it ages out.
|
|
127
|
+
record.lifecycle.resultConsumed = true;
|
|
128
|
+
|
|
125
129
|
// Clean up live view (foreground completion handled inline)
|
|
126
130
|
this.liveViews.delete(agentId);
|
|
127
131
|
}
|
|
@@ -244,6 +248,10 @@ export class SpawnCoordinator {
|
|
|
244
248
|
triggerTurn: true,
|
|
245
249
|
},
|
|
246
250
|
);
|
|
251
|
+
|
|
252
|
+
// Full result delivered to the LLM — record is now safe for the cleanup
|
|
253
|
+
// timer to evict once it ages out.
|
|
254
|
+
record.lifecycle.resultConsumed = true;
|
|
247
255
|
} catch (error) {
|
|
248
256
|
// sendMessage failed (shared runtime overwritten by subagent bindCore).
|
|
249
257
|
// Fall back to UI notification using the captured spawning-session context.
|
package/src/types.ts
CHANGED
|
@@ -107,6 +107,12 @@ export interface AgentLifecycle {
|
|
|
107
107
|
startedAt: number;
|
|
108
108
|
completedAt?: number;
|
|
109
109
|
stoppedBy?: StopInitiator;
|
|
110
|
+
/**
|
|
111
|
+
* Whether the result has been read by the LLM (foreground return or background nudge).
|
|
112
|
+
* cleanup() preserves terminal records until this is set, so a completed background
|
|
113
|
+
* agent whose nudge hasn't fired yet isn't evicted before the LLM reads the result.
|
|
114
|
+
*/
|
|
115
|
+
resultConsumed?: boolean;
|
|
110
116
|
}
|
|
111
117
|
|
|
112
118
|
/**
|