/**
 * config/parallelization.mjs — FRAMEWORK-BUG-033 capability gap (AC10).
 *
 * Single helper exporting the `parallelization.max_tasks` cap consumed by
 * the `/apt:fan-out` SKILL body. Default 4 when the key is absent. D-07:
 * no paternalism cap — autonomy-3 power users can set arbitrarily high
 * values via `.aperant/config.json:parallelization.max_tasks`.
 */

/**
 * @param {unknown} config — merged project config blob (or null/undefined).
 * @returns {number} the configured max_tasks, or 4 when absent/invalid.
 */
export function getMaxTasks(config) {
	const raw = config?.parallelization?.max_tasks
	if (typeof raw === 'number' && Number.isFinite(raw) && raw > 0) return raw
	return 4
}
