/**
 * Admin adapter — control.
 *
 * Thin facade over operator-grade runtime actions: license management and
 * memory export/import. Exposes what already exists in the engines as a
 * library call so hosts can trigger it without going through MCP JSON-RPC.
 */
import { getSharedLicenseManager, syncLicense } from '../../licensing/index.js';
function requireMemory(memory) {
    if (!memory) {
        throw new Error('admin.control.memory: ctx.memory required — pass a MemoryEngine instance to createAdmin()');
    }
}
export function createControlAdmin(_repoRoot, memory) {
    return {
        license: {
            status() {
                return getSharedLicenseManager().getStatus();
            },
            activate(token) {
                return getSharedLicenseManager().activate(token);
            },
            deactivate() {
                getSharedLicenseManager().deactivate();
            },
            sync() {
                return syncLicense();
            },
        },
        memory: {
            export(options = {}) {
                requireMemory(memory);
                return memory.exportBundle(options);
            },
            async import(input) {
                requireMemory(memory);
                return memory.importBundle(input);
            },
        },
    };
}
