@bacnh85/pi-subagent 0.1.0 → 0.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/agents/reviewer.md +1 -1
- package/agents/scout.md +1 -1
- package/agents/worker.md +1 -1
- package/index.ts +74 -1
- package/package.json +1 -1
package/agents/reviewer.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: reviewer
|
|
3
3
|
description: Code review specialist. Use for reviewing changes, finding bugs, suggesting improvements.
|
|
4
4
|
tools: read, grep, find, ls, bash
|
|
5
|
-
model:
|
|
5
|
+
model: openai-codex/gpt-5.5
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
You are a senior code reviewer. Review code changes and provide specific, actionable feedback.
|
package/agents/scout.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: scout
|
|
3
3
|
description: Fast codebase recon that returns compressed context for handoff. Use for finding files, understanding structure, locating symbols.
|
|
4
4
|
tools: read, grep, find, ls
|
|
5
|
-
model:
|
|
5
|
+
model: opencode-go/deepseek-v4-flash
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
You are a scout. Quickly investigate a codebase and return structured findings that another agent can use without re-reading everything.
|
package/agents/worker.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: worker
|
|
3
3
|
description: General-purpose coding agent with full tool access. Use for implementation, refactoring, debugging, and complex multi-step tasks.
|
|
4
|
-
model:
|
|
4
|
+
model: opencode-go/deepseek-v4-pro
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
You are a skilled software engineer. Implement the requested task with care and precision.
|
package/index.ts
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
import { Container, Markdown, Spacer, Text } from "@earendil-works/pi-tui";
|
|
29
29
|
import { Type } from "typebox";
|
|
30
30
|
|
|
31
|
-
import { type AgentConfig, type AgentScope, discoverAgents, invalidateAgentCache } from "./agents.ts";
|
|
31
|
+
import { type AgentConfig, type AgentScope, discoverAgents, formatAgentList, invalidateAgentCache } from "./agents.ts";
|
|
32
32
|
import {
|
|
33
33
|
type SubAgentResult,
|
|
34
34
|
getFinalOutput,
|
|
@@ -149,6 +149,79 @@ export default function (pi: ExtensionAPI) {
|
|
|
149
149
|
// Resolve bundled agents directory relative to this extension file
|
|
150
150
|
const bundledAgentsDir = path.resolve(__dirname, "agents");
|
|
151
151
|
|
|
152
|
+
// /subagent command — list available agents
|
|
153
|
+
pi.registerCommand("subagent", {
|
|
154
|
+
description: "List available sub-agents, reload agent definitions, or show agent details",
|
|
155
|
+
handler: async (args, ctx) => {
|
|
156
|
+
const cmd = args.trim().toLowerCase();
|
|
157
|
+
const discovery = discoverAgents(ctx.cwd, "both", bundledAgentsDir);
|
|
158
|
+
|
|
159
|
+
if (cmd === "reload" || cmd === "refresh") {
|
|
160
|
+
invalidateAgentCache();
|
|
161
|
+
const fresh = discoverAgents(ctx.cwd, "both", bundledAgentsDir);
|
|
162
|
+
const list = formatAgentList(fresh.agents, 20);
|
|
163
|
+
const extra = list.remaining > 0 ? `\n ... +${list.remaining} more` : "";
|
|
164
|
+
const dirs = fresh.projectAgentsDir ? `project: ${fresh.projectAgentsDir}` : "no project agents dir";
|
|
165
|
+
pi.sendMessage({
|
|
166
|
+
customType: "pi-subagent",
|
|
167
|
+
content: `Agent definitions reloaded.\n\nAvailable agents (${fresh.agents.length}):\n ${list.text}${extra}\n\nDirectories searched:\n user: ${path.join(getAgentDir(), "agents")}\n ${dirs}\n bundled: ${bundledAgentsDir}`,
|
|
168
|
+
display: true,
|
|
169
|
+
});
|
|
170
|
+
ctx.ui.notify("Agent definitions reloaded", "info");
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Handle listing keywords before agent lookup
|
|
175
|
+
if (cmd === "all" || cmd === "list" || cmd === "agents") {
|
|
176
|
+
const list = formatAgentList(discovery.agents, 20);
|
|
177
|
+
const extra = list.remaining > 0 ? `\n ... +${list.remaining} more` : "";
|
|
178
|
+
const dirs = discovery.projectAgentsDir ? `\n project: ${discovery.projectAgentsDir}` : "";
|
|
179
|
+
pi.sendMessage({
|
|
180
|
+
customType: "pi-subagent",
|
|
181
|
+
content: `Available agents (${discovery.agents.length}):\n ${list.text}${extra}\n\nScopes searched:\n user: ${path.join(getAgentDir(), "agents")}${dirs}\n bundled: ${bundledAgentsDir}\n\nUse /subagent <name> for agent details, /subagent reload to refresh.`,
|
|
182
|
+
display: true,
|
|
183
|
+
});
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (cmd) {
|
|
188
|
+
// Show details for a specific agent
|
|
189
|
+
const agent = discovery.agents.find(
|
|
190
|
+
(a) => a.name.toLowerCase() === cmd,
|
|
191
|
+
);
|
|
192
|
+
if (!agent) {
|
|
193
|
+
ctx.ui.notify(`Unknown agent: "${args.trim()}". Use /subagent to list all.`, "error");
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
pi.sendMessage({
|
|
197
|
+
customType: "pi-subagent",
|
|
198
|
+
content: [
|
|
199
|
+
`Agent: ${agent.name} (${agent.source})`,
|
|
200
|
+
`Description: ${agent.description}`,
|
|
201
|
+
`Model: ${agent.model || "inherits from parent"}`,
|
|
202
|
+
`Tools: ${agent.tools?.join(", ") || "all default"}`,
|
|
203
|
+
`Source file: ${agent.filePath}`,
|
|
204
|
+
"",
|
|
205
|
+
"--- System Prompt ---",
|
|
206
|
+
agent.systemPrompt,
|
|
207
|
+
].join("\n"),
|
|
208
|
+
display: true,
|
|
209
|
+
});
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// List all agents
|
|
214
|
+
const list = formatAgentList(discovery.agents, 20);
|
|
215
|
+
const extra = list.remaining > 0 ? `\n ... +${list.remaining} more` : "";
|
|
216
|
+
const dirs = discovery.projectAgentsDir ? `\n project: ${discovery.projectAgentsDir}` : "";
|
|
217
|
+
pi.sendMessage({
|
|
218
|
+
customType: "pi-subagent",
|
|
219
|
+
content: `Available agents (${discovery.agents.length}):\n ${list.text}${extra}\n\nScopes searched:\n user: ${path.join(getAgentDir(), "agents")}${dirs}\n bundled: ${bundledAgentsDir}\n\nUse /subagent <name> for agent details, /subagent reload to refresh.`,
|
|
220
|
+
display: true,
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
|
|
152
225
|
pi.registerTool({
|
|
153
226
|
name: "subagent",
|
|
154
227
|
label: "Subagent",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bacnh85/pi-subagent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Minimal-overhead sub-agent extension for pi. Delegate tasks to specialized agents with isolated context using the pi SDK in-process.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|