Currently, there isn't a mechanism to timeout VS code sessions natively with directives in Posit configuration files. However, we do have a feature request to enable this feature in a future release.
That said, in the interim, you can set a timeout on the heartbeat file to automatically close sessions after some inactivity. The following GitHub issue contains more information:
More information on the heartbeat file itself can be found here:
In addition, the following GitHub issues track session timeouts within code-server. It's worth noting that these issues are not monitored or tracked by Posit, however, they provide potental alternatives for setting VS Code session timeouts: