The idea is to open chat via composer.newAgentChat, write the prompt to the clipboard, then paste it with editor.action.clipboardPasteAction. The full code example is in post #4 of that thread.
For auto-submit after pasting, you can try running composer.startGeneration or workbench.action.chat.submit, but those aren’t official commands, and availability depends on the version. What Cursor version are you on?