I've seen the following solution in Stack Exchange to add referenceable enumeration labels to a framed enumeration environment:

https://tex.stackexchange.com/questions/438588/context-and-metafun-framed-enumeration-with-counter-as-part-of-overlay

It uses \wrappedcurrentconstruction. However, it only prints the counter label and the counter name. What if I need the text enclosed by braces in the frame header too? E. g. \starttheorem[thm1]{Residue theorem} so the framed title includes "Residue theorem" also. Thank you in advance.