Automatically Start a server running displaying output in a teminal

Ok, Im a complete newbie to jupyter/jupyterlab so Im rather lost.
Im hoping someone can point me in the right direction.

Now what Im trying to create an jupyter-ai service for our users running under
OpenOnDemand.
I can build jupyterlab/jupyter-ai ok. And run it against an Ollama without problems.
My issue is how can I get the jupyter system to start ollama.
I could start ollama from the script that invokes jupyterlab. But I would like the
output to be visible in a jupyter terminal.

What I want to do is when the user start jupyter lab. It starts a terminal and executes “ollama serve” in it. Ideally this would automatically start on login. But its ok if they have to press a button.

Now I found the following post which seems relevant.

And someone answered saying use terminal-extensions.
But I dont understand the answer. So I hoping someone can explain in a bit more detail.
So I believe I need to write a jupyter-lab extension. I think jupyterlab extensions are different to jupyter extensions

But Im not clear on how you do that. Where do I put my code. The doco just says extensions can be installed using pip. Which doesnt help for a homebrew extension
I found terminal-extensions under site-packages/jupyterlab/schemas/@jupyterlab/

but I dont want to poke around in there.

I just found the extension developer doco. So that covers the basic stuff.
But I still dont understand the answer about

define a name for your new terminal session (pass it in startNew) and then invoke terminal:open command provided by terminal-extension: