- Create server/src/onboarding-assets/general/ with 4 files (AGENTS.md, SOUL.md, HEARTBEAT.md, TOOLS.md) - Add general role to DEFAULT_AGENT_BUNDLE_FILES with full 4-file bundle - Add resolveDefaultAgentInstructionsBundleRole branch for general role - Rename AGENT_ROLE_LABELS general from 'General' to 'Generalist'
34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
import fs from "node:fs/promises";
|
|
|
|
const DEFAULT_AGENT_BUNDLE_FILES = {
|
|
default: ["AGENTS.md"],
|
|
ceo: ["AGENTS.md", "HEARTBEAT.md", "SOUL.md", "TOOLS.md"],
|
|
pm: ["AGENTS.md", "HEARTBEAT.md", "SOUL.md", "TOOLS.md"], // [nexus]
|
|
engineer: ["AGENTS.md", "HEARTBEAT.md", "SOUL.md", "TOOLS.md"], // [nexus]
|
|
general: ["AGENTS.md", "HEARTBEAT.md", "SOUL.md", "TOOLS.md"], // [nexus]
|
|
} as const;
|
|
|
|
type DefaultAgentBundleRole = keyof typeof DEFAULT_AGENT_BUNDLE_FILES;
|
|
|
|
function resolveDefaultAgentBundleUrl(role: DefaultAgentBundleRole, fileName: string) {
|
|
return new URL(`../onboarding-assets/${role}/${fileName}`, import.meta.url);
|
|
}
|
|
|
|
export async function loadDefaultAgentInstructionsBundle(role: DefaultAgentBundleRole): Promise<Record<string, string>> {
|
|
const fileNames = DEFAULT_AGENT_BUNDLE_FILES[role];
|
|
const entries = await Promise.all(
|
|
fileNames.map(async (fileName) => {
|
|
const content = await fs.readFile(resolveDefaultAgentBundleUrl(role, fileName), "utf8");
|
|
return [fileName, content] as const;
|
|
}),
|
|
);
|
|
return Object.fromEntries(entries);
|
|
}
|
|
|
|
export function resolveDefaultAgentInstructionsBundleRole(role: string): DefaultAgentBundleRole {
|
|
if (role === "ceo") return "ceo";
|
|
if (role === "pm") return "pm"; // [nexus]
|
|
if (role === "engineer") return "engineer"; // [nexus]
|
|
if (role === "general") return "general"; // [nexus]
|
|
return "default";
|
|
}
|