Inserting commands into history

Is there any way to programmatically add commands to the history pane? I am working on a package that will execute selected code in a wrapper, but I would like to make the code executed in the wrapper still available in the history, as if it had been run in the console.

Thanks

.Rapp.history is a plaintext file, usually in your home directory. I tried

past <- history()

but got a NULL

To capture a "wrapped" R session, I would try

savehistory(file = ".my_history")

in the wrapped code