feat(agents): implement dynamic Sisyphus prompt system with agent metadata
Introduce a new dynamic prompt generation system for Sisyphus orchestrator that leverages agent metadata for intelligent delegation. This revives the dynamic-sisyphus-agent-prompt branch with comprehensive refactoring. Changes: - Add AgentPromptMetadata, AgentCategory, AgentCost, DelegationTrigger types - Create sisyphus-prompt-builder with dynamic prompt generation logic - Add AGENT_PROMPT_METADATA exports to all agent modules (oracle, librarian, explore, frontend-ui-ux-engineer, document-writer, multimodal-looker) - Refactor sisyphus.ts to use buildDynamicSisyphusPrompt() - Add AvailableAgent type export for type safety This enables Sisyphus to make intelligent agent selection decisions based on agent capabilities, costs, and delegation triggers, improving orchestration efficiency. 🤖 Generated with assistance of OhMyOpenCode (https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
31
src/index.ts
31
src/index.ts
@@ -85,6 +85,12 @@ const AGENT_NAME_MAP: Record<string, string> = {
|
||||
"multimodal-looker": "multimodal-looker",
|
||||
};
|
||||
|
||||
// Migration map: old hook names → new hook names (for backward compatibility)
|
||||
const HOOK_NAME_MAP: Record<string, string> = {
|
||||
// Legacy names (backward compatibility)
|
||||
"anthropic-auto-compact": "anthropic-context-window-limit-recovery",
|
||||
};
|
||||
|
||||
function migrateAgentNames(agents: Record<string, unknown>): { migrated: Record<string, unknown>; changed: boolean } {
|
||||
const migrated: Record<string, unknown> = {};
|
||||
let changed = false;
|
||||
@@ -100,6 +106,21 @@ function migrateAgentNames(agents: Record<string, unknown>): { migrated: Record<
|
||||
return { migrated, changed };
|
||||
}
|
||||
|
||||
function migrateHookNames(hooks: string[]): { migrated: string[]; changed: boolean } {
|
||||
const migrated: string[] = [];
|
||||
let changed = false;
|
||||
|
||||
for (const hook of hooks) {
|
||||
const newHook = HOOK_NAME_MAP[hook] ?? hook;
|
||||
if (newHook !== hook) {
|
||||
changed = true;
|
||||
}
|
||||
migrated.push(newHook);
|
||||
}
|
||||
|
||||
return { migrated, changed };
|
||||
}
|
||||
|
||||
function migrateConfigFile(configPath: string, rawConfig: Record<string, unknown>): boolean {
|
||||
let needsWrite = false;
|
||||
|
||||
@@ -117,10 +138,18 @@ function migrateConfigFile(configPath: string, rawConfig: Record<string, unknown
|
||||
needsWrite = true;
|
||||
}
|
||||
|
||||
if (rawConfig.disabled_hooks && Array.isArray(rawConfig.disabled_hooks)) {
|
||||
const { migrated, changed } = migrateHookNames(rawConfig.disabled_hooks as string[]);
|
||||
if (changed) {
|
||||
rawConfig.disabled_hooks = migrated;
|
||||
needsWrite = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needsWrite) {
|
||||
try {
|
||||
fs.writeFileSync(configPath, JSON.stringify(rawConfig, null, 2) + "\n", "utf-8");
|
||||
log(`Migrated config file: ${configPath} (OmO → Sisyphus)`);
|
||||
log(`Migrated config file: ${configPath}`);
|
||||
} catch (err) {
|
||||
log(`Failed to write migrated config to ${configPath}:`, err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user