Consider this list of dates as timestamptz:
I grouped the dates by hand using colors: every group is separated from the next by a gap of at least 2
This would do it:
SELECT done, count(*) FILTER (WHERE step) OVER (ORDER BY done) AS grp
FROM (
SELECT done
, (lag(done) OVER (ORDER BY done) <= done - interval '2 min') AS step
FROM tbl
) sub
ORDER BY done;
The subquery sub records step as true if the previous row is at least 2 min away - sorted by the timestamp column done itself in this case.
The outer query adds a rolling count of steps, effectively the group number (grp) - combining the aggregate FILTER clause with another window function.
db<>fiddle here
Related:
About the aggregate FILTER clause: