@pi-unipi/subagents 0.1.6 → 0.1.8
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 +63 -10
- 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,7 +1,7 @@
|
|
|
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
|
|
|
@@ -99,13 +99,66 @@ export default function (pi: ExtensionAPI) {
|
|
|
99
99
|
{ id: "maxConcurrent", label: "Max Concurrent", show: true },
|
|
100
100
|
{ id: "activeCount", label: "Active Agents", show: true },
|
|
101
101
|
{ id: "enabled", label: "Enabled", show: true },
|
|
102
|
+
{ id: "types", label: "Available Types", show: true },
|
|
102
103
|
],
|
|
103
104
|
},
|
|
104
105
|
dataProvider: async () => {
|
|
106
|
+
// Get available agent types
|
|
107
|
+
const types = config.types || {};
|
|
108
|
+
const builtinTypes = ["explore", "work"];
|
|
109
|
+
|
|
110
|
+
// Check for custom agent types in filesystem
|
|
111
|
+
const customTypes: string[] = [];
|
|
112
|
+
try {
|
|
113
|
+
const fs = require("fs");
|
|
114
|
+
const path = require("path");
|
|
115
|
+
|
|
116
|
+
// Check global agents directory
|
|
117
|
+
if (fs.existsSync(globalAgents)) {
|
|
118
|
+
const files = fs.readdirSync(globalAgents);
|
|
119
|
+
for (const file of files) {
|
|
120
|
+
if (file.endsWith(".md")) {
|
|
121
|
+
customTypes.push(file.replace(".md", ""));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Check workspace agents directory
|
|
127
|
+
if (fs.existsSync(workspaceAgents)) {
|
|
128
|
+
const files = fs.readdirSync(workspaceAgents);
|
|
129
|
+
for (const file of files) {
|
|
130
|
+
if (file.endsWith(".md")) {
|
|
131
|
+
const name = file.replace(".md", "");
|
|
132
|
+
if (!customTypes.includes(name)) {
|
|
133
|
+
customTypes.push(name);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
} catch {
|
|
139
|
+
// Ignore errors
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Build available types list
|
|
143
|
+
const allTypes = [...new Set([...builtinTypes, ...Object.keys(types), ...customTypes])];
|
|
144
|
+
const typeList = allTypes.map(t => {
|
|
145
|
+
const isEnabled = types[t]?.enabled !== false;
|
|
146
|
+
const isBuiltin = builtinTypes.includes(t);
|
|
147
|
+
const scope = customTypes.includes(t) ? "project" : "global";
|
|
148
|
+
return `${t}(${scope})${isEnabled ? "" : " [disabled]"}`;
|
|
149
|
+
}).join(", ");
|
|
150
|
+
|
|
151
|
+
// Get active agents count
|
|
152
|
+
const activeAgents = manager.listAgents().filter(a => a.status === "running").length;
|
|
153
|
+
|
|
105
154
|
return {
|
|
106
155
|
maxConcurrent: { value: String(manager.getMaxConcurrent()) },
|
|
107
|
-
activeCount: { value:
|
|
156
|
+
activeCount: { value: String(activeAgents) },
|
|
108
157
|
enabled: { value: config.enabled ? "yes" : "no" },
|
|
158
|
+
types: {
|
|
159
|
+
value: allTypes.length > 0 ? allTypes[0] : "none",
|
|
160
|
+
detail: allTypes.length > 1 ? typeList : undefined,
|
|
161
|
+
},
|
|
109
162
|
};
|
|
110
163
|
},
|
|
111
164
|
});
|
|
@@ -183,8 +236,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
183
236
|
|
|
184
237
|
pi.registerTool(
|
|
185
238
|
defineTool({
|
|
186
|
-
name: "
|
|
187
|
-
label: "
|
|
239
|
+
name: "spawn_helper",
|
|
240
|
+
label: "Spawn Helper",
|
|
188
241
|
description: `Launch a sub-agent for parallel work.
|
|
189
242
|
|
|
190
243
|
Available agent types: ${builtinTypes}
|
|
@@ -210,7 +263,7 @@ Guidelines:
|
|
|
210
263
|
}),
|
|
211
264
|
run_in_background: Type.Optional(
|
|
212
265
|
Type.Boolean({
|
|
213
|
-
description: "Run in background. Returns
|
|
266
|
+
description: "Run in background. Returns helper ID immediately.",
|
|
214
267
|
}),
|
|
215
268
|
),
|
|
216
269
|
max_turns: Type.Optional(
|
|
@@ -339,16 +392,16 @@ Guidelines:
|
|
|
339
392
|
}),
|
|
340
393
|
);
|
|
341
394
|
|
|
342
|
-
// ----
|
|
395
|
+
// ---- get_helper_result tool ----
|
|
343
396
|
|
|
344
397
|
pi.registerTool(
|
|
345
398
|
defineTool({
|
|
346
|
-
name: "
|
|
347
|
-
label: "Get
|
|
399
|
+
name: "get_helper_result",
|
|
400
|
+
label: "Get Helper Result",
|
|
348
401
|
description: "Check status and retrieve results from a background agent.",
|
|
349
402
|
parameters: Type.Object({
|
|
350
403
|
agent_id: Type.String({
|
|
351
|
-
description: "The
|
|
404
|
+
description: "The helper ID to check.",
|
|
352
405
|
}),
|
|
353
406
|
wait: Type.Optional(
|
|
354
407
|
Type.Boolean({
|
|
@@ -359,7 +412,7 @@ Guidelines:
|
|
|
359
412
|
execute: async (_toolCallId, params) => {
|
|
360
413
|
const record = manager.getRecord(params.agent_id as string);
|
|
361
414
|
if (!record) {
|
|
362
|
-
return textResult(`
|
|
415
|
+
return textResult(`Helper not found: "${params.agent_id}". It may have been cleaned up.`);
|
|
363
416
|
}
|
|
364
417
|
|
|
365
418
|
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"
|