chore: checkpoint pi lab rust integration work

This commit is contained in:
Agent Board
2026-07-11 20:39:18 +08:00
parent d47f6447fd
commit d16eccfe10
39 changed files with 4843 additions and 455 deletions
@@ -5,6 +5,7 @@
import * as fs from "node:fs";
import * as os from "node:os";
import * as path from "node:path";
import { fileURLToPath } from "node:url";
import { parseFrontmatter } from "@mariozechner/pi-coding-agent";
export type AgentScope = "user" | "project" | "both";
@@ -97,9 +98,20 @@ function findNearestProjectAgentsDir(cwd: string): string | null {
export function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryResult {
const userDir = path.join(os.homedir(), ".pi", "agent", "agents");
const bundledDir = path.join(path.dirname(fileURLToPath(import.meta.url)), "agents");
const projectAgentsDir = findNearestProjectAgentsDir(cwd);
const bundledAgents = loadAgentsFromDir(bundledDir, "user").map((agent) => ({
...agent,
model: undefined,
}));
const userAgents = scope === "project" ? [] : loadAgentsFromDir(userDir, "user");
const userAgents =
scope === "project"
? []
: [
...bundledAgents,
...loadAgentsFromDir(userDir, "user"),
];
const projectAgents = scope === "user" || !projectAgentsDir ? [] : loadAgentsFromDir(projectAgentsDir, "project");
const agentMap = new Map<string, AgentConfig>();