It is not possible to achieve this as a strict snap as I can’t see any interface that would allow for listing currently installed deb packages and snap packages.
have you taken a look at the system-files interface, i imagine having read access to /var/lib/dpkg and shipping the dpkg/dpkg-query binaries inside the snap might work with strict confinement …
You should be able to see the system package database as /var/lib/snapd/hostfs/var/lib/dpkg/status. Running dpkg --root /var/lib/snapd/hostfs ... would likely be enough to get a listing.
I’m not looking in to if this is possible for snaps too using a similar approach. Are you aware of a way to do this? Unfortunately snap list does not accept any argument or option like dpkg-query does with --admindir.
Also, is it possible to request auto connect for the system-backup interface?
all your local snap information should be in /var/lib/snapd/state.json
to properly get the track info you’d rather use the snapd API through the snapd-control interface, but this will prevent you from uploading your snap to the global store since this interface is pretty exclusively reserved for brand stores (it allows completely owning the device after all)