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)
79 lines
2.1 KiB
TypeScript
79 lines
2.1 KiB
TypeScript
import type { AgentConfig } from "@opencode-ai/sdk"
|
|
|
|
export type AgentFactory = (model?: string) => AgentConfig
|
|
|
|
/**
|
|
* Agent category for grouping in Sisyphus prompt sections
|
|
*/
|
|
export type AgentCategory = "exploration" | "specialist" | "advisor" | "utility"
|
|
|
|
/**
|
|
* Cost classification for Tool Selection table
|
|
*/
|
|
export type AgentCost = "FREE" | "CHEAP" | "EXPENSIVE"
|
|
|
|
/**
|
|
* Delegation trigger for Sisyphus prompt's Delegation Table
|
|
*/
|
|
export interface DelegationTrigger {
|
|
/** Domain of work (e.g., "Frontend UI/UX") */
|
|
domain: string
|
|
/** When to delegate (e.g., "Visual changes only...") */
|
|
trigger: string
|
|
}
|
|
|
|
/**
|
|
* Metadata for generating Sisyphus prompt sections dynamically
|
|
* This allows adding/removing agents without manually updating the Sisyphus prompt
|
|
*/
|
|
export interface AgentPromptMetadata {
|
|
/** Category for grouping in prompt sections */
|
|
category: AgentCategory
|
|
|
|
/** Cost classification for Tool Selection table */
|
|
cost: AgentCost
|
|
|
|
/** Domain triggers for Delegation Table */
|
|
triggers: DelegationTrigger[]
|
|
|
|
/** When to use this agent (for detailed sections) */
|
|
useWhen?: string[]
|
|
|
|
/** When NOT to use this agent */
|
|
avoidWhen?: string[]
|
|
|
|
/** Optional dedicated prompt section (markdown) - for agents like Oracle that have special sections */
|
|
dedicatedSection?: string
|
|
|
|
/** Nickname/alias used in prompt (e.g., "Oracle" instead of "oracle") */
|
|
promptAlias?: string
|
|
|
|
/** Key triggers that should appear in Phase 0 (e.g., "External library mentioned → fire librarian") */
|
|
keyTrigger?: string
|
|
}
|
|
|
|
export function isGptModel(model: string): boolean {
|
|
return model.startsWith("openai/") || model.startsWith("github-copilot/gpt-")
|
|
}
|
|
|
|
export type BuiltinAgentName =
|
|
| "Sisyphus"
|
|
| "oracle"
|
|
| "librarian"
|
|
| "explore"
|
|
| "frontend-ui-ux-engineer"
|
|
| "document-writer"
|
|
| "multimodal-looker"
|
|
|
|
export type OverridableAgentName =
|
|
| "build"
|
|
| BuiltinAgentName
|
|
|
|
export type AgentName = BuiltinAgentName
|
|
|
|
export type AgentOverrideConfig = Partial<AgentConfig> & {
|
|
prompt_append?: string
|
|
}
|
|
|
|
export type AgentOverrides = Partial<Record<OverridableAgentName, AgentOverrideConfig>>
|