@pi-unipi/subagents 0.1.7 → 0.1.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 +1 -1
- package/src/index.ts +19 -9
- package/src/skills/explore/SKILL.md +2 -2
- package/src/skills/work/SKILL.md +2 -2
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @pi-unipi/subagents — Extension entry
|
|
3
3
|
*
|
|
4
|
-
* Tools:
|
|
4
|
+
* Tools: spawn_helper, get_helper_result
|
|
5
5
|
* ESC propagation: all children abort on parent ESC
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { defineTool, type ExtensionAPI, type ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
9
9
|
import { Text } from "@mariozechner/pi-tui";
|
|
10
10
|
import { Type } from "@sinclair/typebox";
|
|
11
|
+
import { emitEvent, MODULES } from "@pi-unipi/core";
|
|
12
|
+
import { UNIPI_EVENTS } from "@pi-unipi/core";
|
|
11
13
|
|
|
12
14
|
// Get info registry from global
|
|
13
15
|
function getInfoRegistry() {
|
|
@@ -172,6 +174,14 @@ export default function (pi: ExtensionAPI) {
|
|
|
172
174
|
`• Workspace agents: ${workspaceAgents}`,
|
|
173
175
|
"info",
|
|
174
176
|
);
|
|
177
|
+
|
|
178
|
+
// Emit module ready event
|
|
179
|
+
emitEvent(pi, UNIPI_EVENTS.MODULE_READY, {
|
|
180
|
+
name: MODULES.SUBAGENTS || "subagents",
|
|
181
|
+
version: "0.1.8",
|
|
182
|
+
commands: [],
|
|
183
|
+
tools: ["spawn_helper", "get_helper_result"],
|
|
184
|
+
});
|
|
175
185
|
});
|
|
176
186
|
|
|
177
187
|
// ESC propagation: abort all agents on session shutdown
|
|
@@ -236,8 +246,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
236
246
|
|
|
237
247
|
pi.registerTool(
|
|
238
248
|
defineTool({
|
|
239
|
-
name: "
|
|
240
|
-
label: "
|
|
249
|
+
name: "spawn_helper",
|
|
250
|
+
label: "Spawn Helper",
|
|
241
251
|
description: `Launch a sub-agent for parallel work.
|
|
242
252
|
|
|
243
253
|
Available agent types: ${builtinTypes}
|
|
@@ -263,7 +273,7 @@ Guidelines:
|
|
|
263
273
|
}),
|
|
264
274
|
run_in_background: Type.Optional(
|
|
265
275
|
Type.Boolean({
|
|
266
|
-
description: "Run in background. Returns
|
|
276
|
+
description: "Run in background. Returns helper ID immediately.",
|
|
267
277
|
}),
|
|
268
278
|
),
|
|
269
279
|
max_turns: Type.Optional(
|
|
@@ -392,16 +402,16 @@ Guidelines:
|
|
|
392
402
|
}),
|
|
393
403
|
);
|
|
394
404
|
|
|
395
|
-
// ----
|
|
405
|
+
// ---- get_helper_result tool ----
|
|
396
406
|
|
|
397
407
|
pi.registerTool(
|
|
398
408
|
defineTool({
|
|
399
|
-
name: "
|
|
400
|
-
label: "Get
|
|
409
|
+
name: "get_helper_result",
|
|
410
|
+
label: "Get Helper Result",
|
|
401
411
|
description: "Check status and retrieve results from a background agent.",
|
|
402
412
|
parameters: Type.Object({
|
|
403
413
|
agent_id: Type.String({
|
|
404
|
-
description: "The
|
|
414
|
+
description: "The helper ID to check.",
|
|
405
415
|
}),
|
|
406
416
|
wait: Type.Optional(
|
|
407
417
|
Type.Boolean({
|
|
@@ -412,7 +422,7 @@ Guidelines:
|
|
|
412
422
|
execute: async (_toolCallId, params) => {
|
|
413
423
|
const record = manager.getRecord(params.agent_id as string);
|
|
414
424
|
if (!record) {
|
|
415
|
-
return textResult(`
|
|
425
|
+
return textResult(`Helper not found: "${params.agent_id}". It may have been cleaned up.`);
|
|
416
426
|
}
|
|
417
427
|
|
|
418
428
|
if (params.wait && record.status === "running" && record.promise) {
|
|
@@ -3,7 +3,7 @@ name: explore
|
|
|
3
3
|
description: "Fast parallel codebase exploration"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Explore
|
|
6
|
+
# Explore Helper
|
|
7
7
|
|
|
8
8
|
Read-only agent for fast parallel codebase exploration.
|
|
9
9
|
|
|
@@ -24,7 +24,7 @@ Read-only agent for fast parallel codebase exploration.
|
|
|
24
24
|
Spawn multiple explore agents to read different parts of the codebase in parallel.
|
|
25
25
|
|
|
26
26
|
```
|
|
27
|
-
|
|
27
|
+
spawn_helper({
|
|
28
28
|
type: "explore",
|
|
29
29
|
prompt: "Find all files related to authentication",
|
|
30
30
|
description: "Find auth files"
|
package/src/skills/work/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: work
|
|
|
3
3
|
description: "Parallel file writes with transparent locking"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Work
|
|
6
|
+
# Work Helper
|
|
7
7
|
|
|
8
8
|
Read-write agent for parallel file modifications.
|
|
9
9
|
|
|
@@ -32,7 +32,7 @@ When writing a file, the lock is acquired automatically. If another agent holds
|
|
|
32
32
|
Spawn work agents to modify different files in parallel.
|
|
33
33
|
|
|
34
34
|
```
|
|
35
|
-
|
|
35
|
+
spawn_helper({
|
|
36
36
|
type: "work",
|
|
37
37
|
prompt: "Refactor src/auth.ts to use async/await",
|
|
38
38
|
description: "Refactor auth module"
|