import { DEFAULT_CAPABILITIES } from '../constants/agent/index.js';
export function defineAgent(options) {
    const abortController = new AbortController();
    const metadata = {
        type: options.type,
        id: options.id,
        name: options.name,
        version: options.version,
        category: options.category,
        description: options.description,
        capabilities: { ...DEFAULT_CAPABILITIES, ...options.capabilities },
    };
    return {
        type: options.type,
        metadata,
        async run(input, config, listener) {
            return options.run(input, config, listener);
        },
        async cancel() {
            abortController.abort();
            if (options.cancel) {
                await options.cancel();
            }
        },
        getCapabilities() {
            return metadata.capabilities;
        },
    };
}
//# sourceMappingURL=defineAgent.js.map