Sorry, I'm not sure if the script will work on Sonoma.
While you are seeing the "Software Update" window, you might try:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "AppKit"
use scripting additions
use framework "Foundation"
tell application id "com.apple.systemevents"
set paths to (POSIX path of file of processes whose name contains "updater")
set bid to bundle identifier of processes whose name contains "updater"
end tell
set AppleScript's text item delimiters to {linefeed}
return (paths as text) & linefeed & linefeed & bid as text
If it turns up nothing, I'm guessing the script won't work.
Having said that:
That you have a "toftware Update" window makes me think it is GUI scriptable.
The macro in the link in the first reply is designed to help with that and works well.