// engine/errors/error-result.ts — SPEC-902: Convert StructuredError to ToolResult
export function structuredErrorToResult(err) {
    const lines = [`❌ **${err.what}**`];
    lines.push(`📋 **Why:** ${err.why}`);
    const na = err.nextAction;
    lines.push(`🔧 **Next:** \`${na.tool}\`${na.rationale ? ` — ${na.rationale}` : ''}`);
    if (err.citations && err.citations.length > 0) {
        lines.push(`📍 ${err.citations.join(', ')}`);
    }
    return {
        content: [{ type: 'text', text: lines.join('\n') }],
        isError: true,
        structuredContent: { error: err },
    };
}
//# sourceMappingURL=error-result.js.map