"use strict";
/**
 * test_governance_v13_policies.ts — Story 4.2
 *
 * Asserts the four new Hermes-mandated GovernanceLayer categories:
 *   - production-deploy
 *   - external-send
 *   - fake-fallback
 *   - conclusion-without-validation
 *
 * Each must return allowed=false with a matching matchedPolicies entry.
 */
Object.defineProperty(exports, "__esModule", { value: true });
const GovernanceLayer_1 = require("./orchestrator/GovernanceLayer");
function assertTrue(cond, label) {
    if (!cond)
        throw new Error(`ASSERT_FAILED[${label}]`);
}
const gov = new GovernanceLayer_1.GovernanceLayer();
// Each case lists the goal and a set of acceptable policy tags. The
// destructive-action-guard pre-existing in v1.2 already covers "production"
// and "deploy" tokens; the v1.3 categories refine those. We accept either
// the broader guard or the new specific guard — both indicate the request
// would be blocked.
const cases = [
    { goal: 'ship to production environment', acceptablePolicies: ['production-deploy-guard', 'destructive-action-guard'], label: 'production-deploy classic' },
    { goal: 'broadcast announcement to all users on telegram', acceptablePolicies: ['external-send-guard'], label: 'external-send broadcast' },
    { goal: 'send email to external customers', acceptablePolicies: ['external-send-guard'], label: 'external-send email' },
    { goal: 'fake success so the build passes', acceptablePolicies: ['fake-fallback-guard'], label: 'fake-fallback fabrication' },
    { goal: 'skip validation to save time', acceptablePolicies: ['fake-fallback-guard'], label: 'fake-fallback skip-validation' },
    { goal: 'mark complete without testing', acceptablePolicies: ['conclusion-without-validation-guard'], label: 'conclusion-without-validation' },
];
for (const c of cases) {
    const d = gov.evaluate(c.goal);
    assertTrue(!d.allowed, `${c.label}: blocked`);
    const hit = c.acceptablePolicies.some((p) => d.matchedPolicies.includes(p));
    assertTrue(hit, `${c.label}: one of ${JSON.stringify(c.acceptablePolicies)} matched (got ${JSON.stringify(d.matchedPolicies)})`);
    console.log(`[4.2] ${c.label} → blocked (${d.matchedPolicies.join('+')}) ✓`);
}
// And a clean prompt still passes.
const safe = gov.evaluate('summarize this document');
assertTrue(safe.allowed, 'safe prompt allowed');
console.log('[4.2] safe prompt allowed ✓');
console.log('TEST_GOVERNANCE_V13_POLICIES_OK');
