( agentDefinition: AgentDefinition, toolUseContext: Pick<ToolUseContext, 'options'>, resolvedAgentModel: string, additionalWorkingDirectories: string[], resolvedTools: readonly Tool[], )
| 904 | } |
| 905 | |
| 906 | async function getAgentSystemPrompt( |
| 907 | agentDefinition: AgentDefinition, |
| 908 | toolUseContext: Pick<ToolUseContext, 'options'>, |
| 909 | resolvedAgentModel: string, |
| 910 | additionalWorkingDirectories: string[], |
| 911 | resolvedTools: readonly Tool[], |
| 912 | ): Promise<string[]> { |
| 913 | const enabledToolNames = new Set(resolvedTools.map(t => t.name)) |
| 914 | try { |
| 915 | const agentPrompt = agentDefinition.getSystemPrompt({ toolUseContext }) |
| 916 | const prompts = [agentPrompt] |
| 917 | |
| 918 | return await enhanceSystemPromptWithEnvDetails( |
| 919 | prompts, |
| 920 | resolvedAgentModel, |
| 921 | additionalWorkingDirectories, |
| 922 | enabledToolNames, |
| 923 | ) |
| 924 | } catch (_error) { |
| 925 | return enhanceSystemPromptWithEnvDetails( |
| 926 | [DEFAULT_AGENT_PROMPT], |
| 927 | resolvedAgentModel, |
| 928 | additionalWorkingDirectories, |
| 929 | enabledToolNames, |
| 930 | ) |
| 931 | } |
| 932 | } |
| 933 | |
| 934 | /** |
| 935 | * Resolve a skill name from agent frontmatter to a registered command name. |
no test coverage detected