pi-subagents-j0k3r 1.1.1 → 1.1.2
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 +6 -0
- package/index.ts +26 -22
- package/package.json +1 -1
- package/src/tools.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Fixed manual task-mode background handoff so it frees the chat only when the user explicitly sends the running subagent to background.
|
|
7
|
+
- Fixed background completion delivery so notifications arrive while the main agent continues working without triggering an extra follow-up turn.
|
|
8
|
+
|
|
3
9
|
## 1.1.0 - 2026-06-27
|
|
4
10
|
|
|
5
11
|
### Added
|
package/index.ts
CHANGED
|
@@ -290,6 +290,31 @@ export function completionMessage(task: any): string {
|
|
|
290
290
|
].join('\n');
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
export function sendSubagentCompletionMessage(pi: any, task: any): void {
|
|
294
|
+
pi.sendMessage?.({
|
|
295
|
+
customType: 'subagent-completion',
|
|
296
|
+
content: completionMessage(task),
|
|
297
|
+
display: true,
|
|
298
|
+
details: {
|
|
299
|
+
full_result: task.result ?? task.error ?? task.output_preview,
|
|
300
|
+
task: {
|
|
301
|
+
id: task.id,
|
|
302
|
+
agent: task.agent,
|
|
303
|
+
status: task.status,
|
|
304
|
+
mode: task.mode,
|
|
305
|
+
model: task.model,
|
|
306
|
+
effort: task.effort,
|
|
307
|
+
usage: task.usage,
|
|
308
|
+
result: task.result,
|
|
309
|
+
error: task.error,
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
}, {
|
|
313
|
+
triggerTurn: false,
|
|
314
|
+
deliverAs: 'steer',
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
|
|
293
318
|
export function renderSubagentCompletionMessage(message: any, options: any, theme: any) {
|
|
294
319
|
const details = message.details ?? {};
|
|
295
320
|
const task = details.task ?? details;
|
|
@@ -336,28 +361,7 @@ export function renderSubagentCompletionMessage(message: any, options: any, them
|
|
|
336
361
|
export default function subagentsExtension(pi: any): void {
|
|
337
362
|
pi.registerMessageRenderer?.('subagent-completion', renderSubagentCompletionMessage);
|
|
338
363
|
const manager = new SubagentManager(undefined, undefined, (task) => {
|
|
339
|
-
pi
|
|
340
|
-
customType: 'subagent-completion',
|
|
341
|
-
content: completionMessage(task),
|
|
342
|
-
display: true,
|
|
343
|
-
details: {
|
|
344
|
-
full_result: task.result ?? task.error ?? task.output_preview,
|
|
345
|
-
task: {
|
|
346
|
-
id: task.id,
|
|
347
|
-
agent: task.agent,
|
|
348
|
-
status: task.status,
|
|
349
|
-
mode: task.mode,
|
|
350
|
-
model: task.model,
|
|
351
|
-
effort: task.effort,
|
|
352
|
-
usage: task.usage,
|
|
353
|
-
result: task.result,
|
|
354
|
-
error: task.error,
|
|
355
|
-
},
|
|
356
|
-
},
|
|
357
|
-
}, {
|
|
358
|
-
triggerTurn: true,
|
|
359
|
-
deliverAs: 'followUp',
|
|
360
|
-
});
|
|
364
|
+
sendSubagentCompletionMessage(pi, task);
|
|
361
365
|
});
|
|
362
366
|
registerSubagentTools(pi, manager);
|
|
363
367
|
|
package/package.json
CHANGED
package/src/tools.ts
CHANGED
|
@@ -357,7 +357,8 @@ export function registerSubagentTools(pi: any, manager: SubagentManager): void {
|
|
|
357
357
|
if (cancelledByDoubleEscape) throw new Error('Subagent run cancelled by double escape');
|
|
358
358
|
if (!('results' in result)) {
|
|
359
359
|
const details = compactResultDetails(result as any);
|
|
360
|
-
|
|
360
|
+
const response = ok(backgroundLaunchContent(result.task_ids, 'Sent'), details);
|
|
361
|
+
return isBackground ? response : { ...response, terminate: true };
|
|
361
362
|
}
|
|
362
363
|
const failedTasks = (result.results ?? []).filter((task) => task.status === 'failed' || task.status === 'cancelled');
|
|
363
364
|
const text = result.mode === 'background'
|