Article
· Sep 25 1m read

Same old terminal but in web

We have Webterminal around for quite a while, but it was limited, not all features worked there. There was no shell support or the latest feature as embedded Python support. There are some issues with tools that require programmer mode. Basic Authorization, not as handy as simple login page, where you could have options to add own login page, in case if you would wish to change the way how to login to the application, such as using SSO.

With the original iris terminal, wrapped into a web form, using most used in the web world xterm.js, used in tools like VSCode as well, with some magic from Python, which helped with interprocess tty. We can get the the terminal in the web, in the full capacity.

iTerm

To test how does it work in the web, I've added term routine, which generates some formatting

iTerm

 

Ideas for future

  • Suggestions and Syntax highlighting You may remember one my previous projects, irissqlcli, which provided intellisense and syntax highlighting to a terminal specifically for SQL access. Mine idea is to add the same level of support to an ObjectScript terminal  And this is already as part of this project, as a tool named iterm, unfortunately not finished yet, it's quite tricky to catch the point between when terminal executes something and awaits for some command.
  • Small VSCode look like with terminal Another project, is irislab, which can inject new item in it

Please vote in the current contest if you like this project

Discussion (38)7
Log in or sign up to continue

Super, You brought my x^% back to work

!Edit: ?
Enter one of the following
.B   to break a line into two pieces
.C   to change all occurrences of a string
.D   to display s specific range of lines
.F   to file the routine
.FX  to file the routine and exit the editor
.G   to get lines that were put into in a buffer (see .P)
.I   to insert additional lines (or use the TAB key)
.J   to join a line with the next one
.M   to move lines within the routine
.P   to put lines into a buffer (see .G)
.R   to remove one or more lines
.S   to search for all occurrences of a string
tag OR tag+offset  to edit a line
+n   to move down n lines and edit
-n   to move up n lines and edit
""+n to edit the nth line of the program
^globalref  to edit a value stored in a global node
any line of Cache ObjectScript source code, to execute it
     (but if you call another routine before filing this one,
     it will wipe out any edits you have made).
"." use decimal point to move character by character on the current line
" " use space bar to move from space to space on the line
"e" to enter characters, use "." and " " to move to entry point,
    then press "e".  To get out of entry mode, press <RETURN>.
"d" to delete the characters to the end of the word the cursor is on
Backspace: Depending on your terminal settings, backspace will either move 
           back character by character, or delete the character at the cursor.
Edit: 

Setting this up on a 2024.2 Windows instance hasn't been easy, and even now I'm only getting a blank page like @Jeffrey Drumm reported elsewhere on this thread. His IRIS was 2024.2 but not on Windows.

Hurdles were:

  • zpm 0.7.2 was failing because 2024.2 on Windows doesn't bundle pip. I got a bit further by upgrading to 0.7.3 which shipped last week.
  • zpm 0.7.3 wouldn't install iterm until I'd gone through the Flexible Python Runtime setup steps and also worked out for myself the extra zpm steps (did I overlook documentation for these?):
zpm:%SYS>config set UseStandalonePip 1

zpm:%SYS>config set PipCaller "C:\Program Files\Python312\Scripts\pip.exe"

So now I have it installed in %SYS (thanks to the tip from @Evgeny Shvarov in this thread):

zpm:%SYS>list
zpm   0.7.3
iterm 0.1.0
zpm:%SYS>

But still the blank page. And I'm wondering why the iterm contest entry mentions WSGI but the /iterm app set up by the installer is a REST one rather than a WSGI one.

So far, no gain in return for the pain, and I'll continue to get along with Lite Terminal that's built in to the VS Code ObjectScript extension. It requires zero config and works on 2023.2+

Hi John,

Sorry the documentation didn't quite get updated in time but you are right, IPM 0.7.3 includes a fix to using flexible python runtime. I just added a wiki page on how to use it. 

I noticed that you were trying to run `config set UseStandalonePip 1` but missed the `set` word. That means UseStandalonePip is not properly set. But seeing that you successfully installed the package, I think it should fine. 

I would recommend trying to import the packages listed in requirements.txt of iterm in an interactive embedded Python shell 

do ##class(%SYS.Python).Shell()

and if that works, it means the python dependencies are properly installed and the problem lies somewhere else. 

If it doesn't work, maybe the section on incompatible python dependencies in the wiki page can provide some help.

Hey @Dmitry Maslennikov , awesome job!

Have you thought about using WebSockets with a simple HTML/JS setup for your terminal, as the VS Code extension does? If you've already tried that and moved on, I’d love to know why. If not, it’s a super easy approach, and I’m sure you’ll have it working in no time.

Just create a WebSocket connection:

const socket = new WebSocket("ws://localhost:8273/api/atelier/v8/%25SYS/terminal");

Then hook it into your terminal like this:

term.onData(data => socket.send(data)); // Send input to the server

I did some tests and got a working terminal. It’s not as smooth as VS Code Lite or yours, but it's close! Let me know if you want to dive deeper.

@Jeffrey Drumm I think your issue is likely to be that the app apparently assumes this OS-level command will lead directly to an IRIS shell prompt without requiring credentials. On Linux this means the %Service_Terminal service is accepting Operating System authentication. There must also be an IRIS user definition that matches the OS username under which IRIS runs, and that user must have sufficient rights. Enabling login-related audit messages may help you diagnose failures in this area:

/path/to/iris/bin/irisdb -s/path/to/iris/mgr

What about if you are logged into Linux as the userid which your IRIS runs as? On a default install it's typically irisusr, and on the containerized IRIS instances @Dmitry Maslennikov probably uses it's typically irisowner.

Here's what I find when I successfully connect to a Docker container created from a DC registry image, authenticating as SuperUser/SYS

Node: d2ba2ec8dbce, Instance: IRIS

USER>w $zv
IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2024.1 (Build 262U) Thu Mar 7 2024 15:36:40 EST
USER>w $username
SuperUser
USER>!whoami
irisowner

USER>