import { loadTemplate } from '../shared/prompts/index.js';
function shouldWrapAgentDefinition(options) {
    return options.personaPath !== undefined || options.workflowMeta?.processSafety !== undefined;
}
export function buildWrappedSystemPrompt(agentDefinition, options) {
    if (!shouldWrapAgentDefinition(options)) {
        return agentDefinition;
    }
    const templateVars = { agentDefinition };
    if (options.workflowMeta) {
        templateVars.workflowName = options.workflowMeta.workflowName;
        templateVars.workflowDescription = options.workflowMeta.workflowDescription ?? '';
        templateVars.currentStep = options.workflowMeta.currentStep;
        templateVars.stepsList = options.workflowMeta.stepsList
            .map((step, index) => `${index + 1}. ${step.name}${step.description ? ` - ${step.description}` : ''}`)
            .join('\n');
        templateVars.currentPosition = options.workflowMeta.currentPosition;
        templateVars.hasProcessSafety = options.workflowMeta.processSafety !== undefined;
        if (options.workflowMeta.processSafety) {
            templateVars.protectedParentRunPid = String(options.workflowMeta.processSafety.protectedParentRunPid);
        }
    }
    return loadTemplate('perform_agent_system_prompt', options.language ?? 'en', templateVars);
}
//# sourceMappingURL=runner-prompt.js.map