refactor: load subagents from user config (~/.pi/subagents/)

- Discover prompts from ~/.pi/subagents/*.md instead of bundled prompts/
- Only register the subagent tool when at least one subagent exists
- Remove directory path from tool description (agents listed dynamically)
This commit is contained in:
2026-05-12 16:35:37 -04:00
parent 5c5cdb3aec
commit 84bcff94a0
4 changed files with 18 additions and 10 deletions

View File

@@ -1,10 +1,11 @@
import * as path from "node:path";
import { fileURLToPath } from "node:url";
import { homedir } from "node:os";
const SRC_DIR = path.dirname(fileURLToPath(import.meta.url));
export const EXTENSION_DIR = path.dirname(SRC_DIR);
export const EXTENSION_ENTRY = path.join(EXTENSION_DIR, "index.ts");
export const PROMPTS_DIR = path.join(EXTENSION_DIR, "prompts");
export const SUBAGENTS_DIR = path.join(homedir(), ".pi", "subagents");
export const FINALIZE_TOOL_NAME = "subagent_finalize";
export const MAX_FINALIZE_RETRIES = 2;