import { PORTED_COMMANDS, executeCommand } from './commands.js';
import { PORTED_TOOLS, executeTool } from './tools.js';
export class MirroredCommand {
    name;
    sourceHint;
    constructor(name, sourceHint) {
        this.name = name;
        this.sourceHint = sourceHint;
    }
    execute(prompt) {
        return executeCommand(this.name, prompt).message;
    }
}
export class MirroredTool {
    name;
    sourceHint;
    constructor(name, sourceHint) {
        this.name = name;
        this.sourceHint = sourceHint;
    }
    async execute(payload) {
        const result = await executeTool(this.name, payload);
        return result.message;
    }
}
export class ExecutionRegistry {
    commands;
    tools;
    constructor(commands, tools) {
        this.commands = commands;
        this.tools = tools;
    }
    command(name) {
        const lowered = name.toLowerCase();
        return this.commands.find(c => c.name.toLowerCase() === lowered);
    }
    tool(name) {
        const lowered = name.toLowerCase();
        return this.tools.find(t => t.name.toLowerCase() === lowered);
    }
}
export function buildExecutionRegistry() {
    return new ExecutionRegistry(PORTED_COMMANDS.map(m => new MirroredCommand(m.name, m.sourceHint)), PORTED_TOOLS.map(m => new MirroredTool(m.name, m.sourceHint)));
}
