"use strict";
/**
 * test_deep_research_capability.ts — Story 3.4
 *
 * Asserts the bundled `.catalog/capabilities/deep-research/` pack exists,
 * parses cleanly via CapabilityPackParser, and exposes the 5 skills + 1
 * squad + 1 workflow promised by the Hermes brief.
 *
 * This is a seed-asset regression: if anyone moves/breaks the deep-research
 * pack, this test fails fast.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const CapabilityPackParser_1 = require("./orchestrator/capability/CapabilityPackParser");
function assertTrue(cond, label) {
    if (!cond)
        throw new Error(`ASSERT_FAILED[${label}]`);
}
const packDir = path.join(process.cwd(), '.catalog', 'capabilities', 'deep-research');
assertTrue(fs.existsSync(packDir), `pack dir exists at ${packDir}`);
const manifestPath = path.join(packDir, 'capability.yaml');
assertTrue(fs.existsSync(manifestPath), 'capability.yaml present');
console.log('[3.4] manifest present ✓');
const r = (0, CapabilityPackParser_1.parseCapabilityPackFile)(manifestPath);
assertTrue(r.ok, `manifest parses cleanly (errors=${JSON.stringify(r.errors)})`);
const pack = r.pack;
assertTrue(pack.id === 'deep-research', 'id matches');
assertTrue(pack.status === 'draft', 'status starts at draft');
console.log('[3.4] manifest parses ✓');
// Hermes brief asks for: 5 skills + 1 squad + 1 workflow.
const skillIds = new Set((pack.skills || []).map((s) => s.id));
const expectedSkills = ['source-credibility-scoring', 'evidence-synthesis', 'contradiction-analysis', 'advanced-query-planning', 'executive-briefing'];
for (const s of expectedSkills) {
    assertTrue(skillIds.has(s), `skill '${s}' present`);
}
console.log(`[3.4] ${expectedSkills.length}/5 expected skills present ✓`);
const squadIds = new Set((pack.squads || []).map((s) => s.id));
assertTrue(squadIds.has('research-squad'), 'research-squad present');
console.log('[3.4] research-squad present ✓');
const workflowIds = new Set((pack.workflows || []).map((s) => s.id));
assertTrue(workflowIds.has('deep-research-flow'), 'deep-research-flow present');
console.log('[3.4] deep-research-flow present ✓');
// All embedded refs must have corresponding files.
for (const s of expectedSkills) {
    assertTrue(fs.existsSync(path.join(packDir, 'skills', `${s}.md`)), `skill file ${s}.md exists`);
}
assertTrue(fs.existsSync(path.join(packDir, 'squads', 'research-squad', 'SQUAD.md')), 'research-squad SQUAD.md exists');
assertTrue(fs.existsSync(path.join(packDir, 'workflows', 'deep-research-flow.yaml')), 'deep-research-flow.yaml exists');
console.log('[3.4] all embedded files present ✓');
// INDEX.md
assertTrue(fs.existsSync(path.join(packDir, 'INDEX.md')), 'INDEX.md present');
console.log('[3.4] INDEX.md present ✓');
console.log('TEST_DEEP_RESEARCH_CAPABILITY_OK');
