@ian-pascoe/pi-minimal-subagents 0.2.2 → 0.3.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/README.md +18 -8
- package/package.json +1 -1
- package/src/minimal-subagents-capabilities.ts +3 -8
- package/src/minimal-subagents-context.ts +72 -1
- package/src/minimal-subagents-coordinator.ts +133 -61
- package/src/minimal-subagents-extension.ts +67 -66
- package/src/minimal-subagents-fork-lifecycle.ts +4 -11
- package/src/minimal-subagents-registry-wire.ts +0 -1
- package/src/minimal-subagents-registry.ts +1 -9
- package/src/minimal-subagents-render-contract.ts +20 -10
- package/src/minimal-subagents-rendering.ts +55 -19
- package/src/minimal-subagents-sessions.ts +66 -46
- package/src/minimal-subagents-tools.ts +2 -2
- package/src/minimal-subagents-types.ts +29 -10
- package/src/minimal-subagents-ui.ts +4 -3
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { AgentMessage, ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
2
2
|
import type { Usage } from "@earendil-works/pi-ai";
|
|
3
3
|
|
|
4
|
-
/** Stable identity for one prompt and its complete assistant/tool loop. */
|
|
5
|
-
export type TurnId = string & { readonly __turnId: unique symbol };
|
|
6
|
-
|
|
7
4
|
/** Controls how much committed caller conversation enters a new child session. */
|
|
8
5
|
export type SessionContextMode = "inherit" | "compact" | "omit";
|
|
9
6
|
/** Controls whether child resource discovery includes project instructions, skills, and prompts. */
|
|
@@ -81,8 +78,19 @@ export interface WaitTurnResult extends TurnResult {
|
|
|
81
78
|
messages?: WaitMessageResult[];
|
|
82
79
|
}
|
|
83
80
|
|
|
84
|
-
/** Reports
|
|
85
|
-
export
|
|
81
|
+
/** Reports an observational wait timeout with the current detailed child status. */
|
|
82
|
+
export interface WaitTimeoutResult {
|
|
83
|
+
event: "timeout";
|
|
84
|
+
agent_id: string;
|
|
85
|
+
turn_id: string;
|
|
86
|
+
/** Requested timeout duration that expired. */
|
|
87
|
+
timeout_ms: number;
|
|
88
|
+
/** Detailed child status captured when the timeout callback won. */
|
|
89
|
+
agent: AgentDetail;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Reports one message, terminal turn, or timeout returned by subagent_wait. */
|
|
93
|
+
export type WaitResult = WaitMessageResult | WaitTurnResult | WaitTimeoutResult;
|
|
86
94
|
|
|
87
95
|
/** Provides bounded hierarchy, usage, and best-known Runtime Profile data for one persistent agent. */
|
|
88
96
|
export interface AgentSummary extends RuntimeProfile {
|
|
@@ -94,7 +102,6 @@ export interface AgentSummary extends RuntimeProfile {
|
|
|
94
102
|
latest_turn?: Pick<TurnResult, "turn_id" | "status">;
|
|
95
103
|
tools: string[];
|
|
96
104
|
elapsed_ms?: number;
|
|
97
|
-
latest_activity?: string;
|
|
98
105
|
latest_activity_at?: string;
|
|
99
106
|
task?: string;
|
|
100
107
|
child_count: number;
|
|
@@ -108,13 +115,22 @@ export interface RecentAgentMessage {
|
|
|
108
115
|
content: string;
|
|
109
116
|
}
|
|
110
117
|
|
|
111
|
-
/**
|
|
118
|
+
/** Reports one labeled, bounded child activity item without image data. */
|
|
119
|
+
export interface RecentAgentActivity {
|
|
120
|
+
label: string;
|
|
121
|
+
content: string;
|
|
122
|
+
truncated: boolean;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Extends summary status with launch, dependency, recent-message, and recent-work diagnostics. */
|
|
112
126
|
export interface AgentDetail extends AgentSummary {
|
|
113
127
|
session_file?: string;
|
|
114
128
|
launch_contract: LaunchContract;
|
|
115
129
|
capability_ceiling: string[];
|
|
116
130
|
spawn_entry_id: string;
|
|
117
131
|
recent_messages: RecentAgentMessage[];
|
|
132
|
+
/** The 12 most recent work items, each capped at 20 lines and 2 KiB. */
|
|
133
|
+
recent_activity: RecentAgentActivity[];
|
|
118
134
|
latest_result?: TurnResult;
|
|
119
135
|
missing_dependencies: string[];
|
|
120
136
|
unavailable_reason?: string;
|
|
@@ -142,7 +158,6 @@ export interface DeleteResult {
|
|
|
142
158
|
agent_id: string;
|
|
143
159
|
recursive: boolean;
|
|
144
160
|
deleted_agent_ids: string[];
|
|
145
|
-
tombstoned_agent_ids: string[];
|
|
146
161
|
trashed_session_files: string[];
|
|
147
162
|
failures: Array<{ agent_id: string; error: string }>;
|
|
148
163
|
}
|
|
@@ -163,7 +178,6 @@ export interface CallerSnapshot {
|
|
|
163
178
|
thinkingLevel: ThinkingLevel;
|
|
164
179
|
ordinaryTools: string[];
|
|
165
180
|
capabilityCeiling: string[];
|
|
166
|
-
availableTools: string[];
|
|
167
181
|
spawnEntryId: string;
|
|
168
182
|
}
|
|
169
183
|
|
|
@@ -188,6 +202,7 @@ export interface CoordinatorMessage {
|
|
|
188
202
|
status?: TurnStatus;
|
|
189
203
|
elapsed_ms?: number;
|
|
190
204
|
usage?: Usage;
|
|
205
|
+
messages?: Array<{ delivery_id?: string; message_id?: string }>;
|
|
191
206
|
};
|
|
192
207
|
}
|
|
193
208
|
|
|
@@ -208,7 +223,10 @@ export interface ChildAgentRuntime {
|
|
|
208
223
|
dispose(): void;
|
|
209
224
|
/** Return the live Runtime Profile, or undefined when the SDK session has no model. */
|
|
210
225
|
getRuntimeProfile(): RuntimeProfile | undefined;
|
|
226
|
+
/** Clone committed child transcript messages while excluding the streaming assistant tail. */
|
|
211
227
|
snapshotCommittedMessages(): AgentMessage[];
|
|
228
|
+
/** Clone child transcript messages including the current streaming assistant tail. */
|
|
229
|
+
snapshotActivityMessages(): AgentMessage[];
|
|
212
230
|
hasDeliveryEvidence(sourceAgentId: string, sourceTurnId: string, deliveryId?: string): boolean;
|
|
213
231
|
getUsage(): Usage | undefined;
|
|
214
232
|
}
|
|
@@ -248,6 +266,8 @@ export interface AgentSessionFactory {
|
|
|
248
266
|
export interface RootConversationEndpoint {
|
|
249
267
|
/** Queue one typed coordinator message into the root conversation. */
|
|
250
268
|
queueCoordinatorMessage(message: CoordinatorMessage): Promise<void>;
|
|
269
|
+
/** Whether a coordinator message can start immediately instead of joining Pi's steer queue. */
|
|
270
|
+
isIdle(): boolean;
|
|
251
271
|
hasDeliveryEvidence(sourceAgentId: string, sourceTurnId: string, deliveryId?: string): boolean;
|
|
252
272
|
}
|
|
253
273
|
|
|
@@ -273,7 +293,6 @@ export interface PersistedAgent {
|
|
|
273
293
|
missing_dependencies: string[];
|
|
274
294
|
unavailable_reason?: string;
|
|
275
295
|
recent_messages: RecentAgentMessage[];
|
|
276
|
-
deleted?: boolean;
|
|
277
296
|
}
|
|
278
297
|
|
|
279
298
|
/** Records which conversation path owns one successful terminal result. */
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
formatSubagentDuration,
|
|
16
16
|
renderSubagentStatusLabel,
|
|
17
17
|
renderSubagentStatusSymbol,
|
|
18
|
+
subagentStatusLadder,
|
|
18
19
|
} from "./minimal-subagents-rendering.js";
|
|
19
20
|
import type {
|
|
20
21
|
AgentSummary,
|
|
@@ -65,9 +66,9 @@ function flattenAgentHierarchy(agents: readonly AgentSummary[]): FlattenedAgentS
|
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
function agentTerminalStatus(agent: AgentSummary): TurnStatus | "idle" | "unavailable" {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return
|
|
69
|
+
const status = subagentStatusLadder(agent);
|
|
70
|
+
// SAFETY: the shared ladder emits exactly the unavailable/running/TurnStatus/idle vocabulary.
|
|
71
|
+
return status as TurnStatus | "idle" | "unavailable";
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
function terminalTimestamp(agent: AgentSummary): number {
|