pi-subagents 0.17.5 → 0.18.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 +16 -0
- package/README.md +19 -19
- package/agents/oracle-executor.md +1 -1
- package/agents/scout.md +1 -1
- package/async-execution.ts +22 -2
- package/async-job-tracker.ts +70 -7
- package/async-status.ts +37 -15
- package/chain-execution.ts +29 -4
- package/execution.ts +18 -30
- package/index.ts +118 -131
- package/install.mjs +2 -3
- package/intercom-bridge.ts +9 -0
- package/notify.ts +25 -6
- package/package.json +3 -6
- package/pi-args.ts +4 -0
- package/render.ts +15 -22
- package/result-watcher.ts +3 -5
- package/run-status.ts +134 -0
- package/schemas.ts +16 -12
- package/skills/pi-subagents/SKILL.md +21 -21
- package/slash-live-state.ts +0 -4
- package/subagent-control.ts +84 -42
- package/subagent-executor.ts +122 -11
- package/subagent-prompt-runtime.ts +6 -0
- package/subagent-runner.ts +118 -10
- package/subagents-status.ts +5 -1
- package/types.ts +29 -9
package/types.ts
CHANGED
|
@@ -40,22 +40,22 @@ export interface TokenUsage {
|
|
|
40
40
|
total: number;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export type ActivityState = "
|
|
44
|
-
export type
|
|
45
|
-
export type
|
|
43
|
+
export type ActivityState = "needs_attention";
|
|
44
|
+
export type ControlEventType = "needs_attention";
|
|
45
|
+
export type ControlNotificationChannel = "event" | "async" | "intercom";
|
|
46
46
|
|
|
47
47
|
export interface ControlConfig {
|
|
48
48
|
enabled?: boolean;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
needsAttentionAfterMs?: number;
|
|
50
|
+
notifyOn?: ControlEventType[];
|
|
51
|
+
notifyChannels?: ControlNotificationChannel[];
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export interface ResolvedControlConfig {
|
|
55
55
|
enabled: boolean;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
needsAttentionAfterMs: number;
|
|
57
|
+
notifyOn: ControlEventType[];
|
|
58
|
+
notifyChannels: ControlNotificationChannel[];
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export interface ControlEvent {
|
|
@@ -197,6 +197,9 @@ export interface AsyncStatus {
|
|
|
197
197
|
mode: "single" | "chain";
|
|
198
198
|
state: "queued" | "running" | "complete" | "failed" | "paused";
|
|
199
199
|
activityState?: ActivityState;
|
|
200
|
+
lastActivityAt?: number;
|
|
201
|
+
currentTool?: string;
|
|
202
|
+
currentToolStartedAt?: number;
|
|
200
203
|
startedAt: number;
|
|
201
204
|
endedAt?: number;
|
|
202
205
|
lastUpdate?: number;
|
|
@@ -207,6 +210,11 @@ export interface AsyncStatus {
|
|
|
207
210
|
agent: string;
|
|
208
211
|
status: string;
|
|
209
212
|
activityState?: ActivityState;
|
|
213
|
+
lastActivityAt?: number;
|
|
214
|
+
currentTool?: string;
|
|
215
|
+
currentToolStartedAt?: number;
|
|
216
|
+
startedAt?: number;
|
|
217
|
+
endedAt?: number;
|
|
210
218
|
durationMs?: number;
|
|
211
219
|
tokens?: TokenUsage;
|
|
212
220
|
skills?: string[];
|
|
@@ -226,6 +234,9 @@ export interface AsyncJobState {
|
|
|
226
234
|
asyncDir: string;
|
|
227
235
|
status: "queued" | "running" | "complete" | "failed" | "paused";
|
|
228
236
|
activityState?: ActivityState;
|
|
237
|
+
lastActivityAt?: number;
|
|
238
|
+
currentTool?: string;
|
|
239
|
+
currentToolStartedAt?: number;
|
|
229
240
|
mode?: "single" | "chain";
|
|
230
241
|
agents?: string[];
|
|
231
242
|
currentStep?: number;
|
|
@@ -236,6 +247,7 @@ export interface AsyncJobState {
|
|
|
236
247
|
outputFile?: string;
|
|
237
248
|
totalTokens?: TokenUsage;
|
|
238
249
|
sessionFile?: string;
|
|
250
|
+
controlEventCursor?: number;
|
|
239
251
|
}
|
|
240
252
|
|
|
241
253
|
export interface SubagentState {
|
|
@@ -250,6 +262,9 @@ export interface SubagentState {
|
|
|
250
262
|
currentAgent?: string;
|
|
251
263
|
currentIndex?: number;
|
|
252
264
|
currentActivityState?: ActivityState;
|
|
265
|
+
lastActivityAt?: number;
|
|
266
|
+
currentTool?: string;
|
|
267
|
+
currentToolStartedAt?: number;
|
|
253
268
|
interrupt?: () => boolean;
|
|
254
269
|
}>;
|
|
255
270
|
lastForegroundControlId: string | null;
|
|
@@ -291,6 +306,10 @@ export interface IntercomEventBus {
|
|
|
291
306
|
|
|
292
307
|
export const INTERCOM_DETACH_REQUEST_EVENT = "pi-intercom:detach-request";
|
|
293
308
|
export const INTERCOM_DETACH_RESPONSE_EVENT = "pi-intercom:detach-response";
|
|
309
|
+
export const SUBAGENT_ASYNC_STARTED_EVENT = "subagent:async-started";
|
|
310
|
+
export const SUBAGENT_ASYNC_COMPLETE_EVENT = "subagent:async-complete";
|
|
311
|
+
export const SUBAGENT_CONTROL_EVENT = "subagent:control-event";
|
|
312
|
+
export const SUBAGENT_CONTROL_INTERCOM_EVENT = "subagent:control-intercom";
|
|
294
313
|
|
|
295
314
|
// ============================================================================
|
|
296
315
|
// Execution Options
|
|
@@ -305,6 +324,7 @@ export interface RunSyncOptions {
|
|
|
305
324
|
onUpdate?: (r: import("@mariozechner/pi-agent-core").AgentToolResult<Details>) => void;
|
|
306
325
|
onControlEvent?: (event: ControlEvent) => void;
|
|
307
326
|
controlConfig?: ResolvedControlConfig;
|
|
327
|
+
intercomSessionName?: string;
|
|
308
328
|
maxOutput?: MaxOutputConfig;
|
|
309
329
|
artifactsDir?: string;
|
|
310
330
|
artifactConfig?: ArtifactConfig;
|