A woman has admitted killing her six-year-old son in a “terrible incident”, a court has heard.