"use strict";
// Task Contract — formal specification for a single agent task.
//
// Produced by buildTaskContract() before the loop starts.
// The contract is the measuring stick: it captures what is wanted,
// what is allowed, what must not be touched, and what counts as done.
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderTaskContractBlock = renderTaskContractBlock;
/**
 * Renders a TaskContract as a compact Markdown block to inject into the
 * system prompt so the model always sees the operating constraints.
 */
function renderTaskContractBlock(contract) {
    const lines = [];
    lines.push('## Task Contract');
    lines.push('');
    lines.push(`**Goal:** ${contract.goal}`);
    lines.push(`**Mode:** ${contract.mode}${contract.high_risk ? '  ⚠️ HIGH RISK' : ''}`);
    if (contract.constraints.length > 0) {
        lines.push('');
        lines.push('**Constraints:**');
        for (const c of contract.constraints) {
            lines.push(`- ${c}`);
        }
    }
    if (contract.blocked_paths.length > 0) {
        lines.push('');
        lines.push(`**Blocked paths:** ${contract.blocked_paths.join(', ')}`);
    }
    if (contract.validation.length > 0) {
        lines.push('');
        lines.push(`**Validation:** ${contract.validation.join(' && ')}`);
    }
    if (contract.success_criteria.length > 0) {
        lines.push('');
        lines.push('**Success when:**');
        for (const s of contract.success_criteria) {
            lines.push(`- ${s}`);
        }
    }
    if (contract.failure_triggers.length > 0) {
        lines.push('');
        lines.push('**Failure if:**');
        for (const f of contract.failure_triggers) {
            lines.push(`- ${f}`);
        }
    }
    lines.push('');
    lines.push(`**Max turns:** ${contract.max_turns}  **Approval required:** ${contract.approval_required ? 'Yes' : 'No'}`);
    return lines.join('\n');
}
//# sourceMappingURL=taskContract.js.map