import { applyRunKill } from '../runs/run-kill.js';
export function createGatewayCancelAdapter() {
    return {
        async cancelRun(runId, reason) {
            try {
                const result = await applyRunKill(runId, reason);
                return {
                    success: result.applied,
                    reason: result.idempotent
                        ? 'Run already terminal'
                        : result.applied
                            ? 'Run killed in store'
                            : 'Run kill not applied',
                    timestamp: Date.now(),
                };
            }
            catch (error) {
                const message = error instanceof Error ? error.message : String(error);
                return {
                    success: false,
                    reason: message,
                    timestamp: Date.now(),
                };
            }
        },
    };
}
//# sourceMappingURL=gateway-cancel-adapter.js.map