The terminal of the future

(jyn.dev)

88 points | by miguelraz 4 hours ago ago

39 comments

  • skydhash 2 hours ago

    I read the whole thing and at first glance, it seems like a whole NIH list of wishes. We already have alternatives to the terminal, but the article have no mentions of them:

    - Emacs (inherited from lisp machines?). A VM which is powered by lisp. The latter make it easy to redefine function, and commands are just annotated functions. As for output, we have the buffer, which can be displayed in windows, which are arranged in a tiling manner in a frame. And you can have several frames. As the buffer in a window as the same grid like basis as the terminal emulator, we can use cli as is, including like a terminal emulator (vterm, eat, ansi-term,...). You can eschew the terminal flow and use the REPL flow instead (shell-mode, eshell,...). There's support for graphics, but not a full 2d context.

    - Acme: Kinda similar to emacs, but the whole thing is mostly about interactive text. Meaning any text can be a command. We also have the tiling/and stacking windows things that displays those texts.

    I would add Smalltalk to that, but it's more of an IDE than a full computing environment. But to extend it to the latter would still be a lower effort than what is described in the article.

    • spudlyo an hour ago

      Emacs also has Org-mode and org-babel, which can work a lot like a Jupyter notebook, and can even talk to jupyter kernels. I do a lot in Emacs, especially now that I'm comfortable with GPTel.

      I open a poorly aligned, pixelated PDF scan of a 100+ year old Latin textbook in Emacs, mark a start page, end page, and Emacs lisp code shells out to qpdf to create a new smaller pdf from my page range to /tmp, and then adds the resulting PDF to my LLM context. Then my code calls gptel-request with a custom prompt and I get an async elisp callback with the OCR'd PDF now in Emacs' org-mode format, complete with italics, bold, nicely formatted tables, and with all the right macrons over the vowels, which I toss into a scratch buffer. Now that the chapter from my textbook in a markup format, I can select a word, immediately pop up a Latin-to-English dictionary entry or select a whole sentence to hand to an LLM to analyze with a full grammatical breakdown while I'm doing my homework exercises. This 1970s vintage text editor is also a futuristic language learning platform, it blows my mind.

    • jynelson 2 hours ago

      i would describe the main idea of the post as opening up the data model of the terminal. the list of wishes are an example of things you can build once you've done that, not the primary reason that opening the data model is useful.

  • kloud an hour ago

    Great thought provoking article! Indeed, typing commands on the command line feels primitive like typing code into interactive interpreters (python, irb, etc.). Those are primitive REPLs.

    With lisp REPLs one types in the IDE/editor having full highlighting, completions and code intelligence. Then code is sent to REPL process for evaluation. For example Clojure has great REPL tooling.

    A variation of REPL is the REBL (Read-Eval-Browse Loop) concept, where instead of the output being simply printed as text, it is treated as values that can be visualized and browsed using graphical viewers.

    Existing editors can already cover the runbooks use case pretty well. Those can be just markdown files with key bindings to send code blocks to shell process for evaluation. It works great with instructions in markdown READMEs.

    The main missing feature editor-centric command like workflow I can imagine is the history search. It could be interesting to see if it would be enough to add shell history as a completion source. Or perhaps have shell LSP server to provide history and other completions that could work across editors?

    • ellieh an hour ago

      > It could be interesting to see if it would be enough to add shell history as a completion source.

      Atuin runbooks (mentioned in the article) do this! Pretty much anywhere we allow users to start typing a shell command we feed shell history into the editor

  • skissane an hour ago

    My personal opinion-psuedoterminals should be enhanced to provide some mechanism for sending out-of-band data, like the existing TIOCPKT but on steroids. Maybe something like… if both ends support it, they can exchange JSON-RPC messages over this out-of-band channel, with it being possible to discover if the other side supports this or not. Possibly this is just a new TIOC* ioctl

    Why? Well one reason is escape sequences are really limited and messy. This would enable everyone to gradually and backward-compatibly transition to a more modern alternative. Once you have a JSON-RPC channel, the two ends can use it to negotiate what specific features they support. It would be leveraging patterns already popular with LSP, MCP, etc. And it would be mostly in userspace, only a small kernel enhancement would be required (the kernel doesn’t have to actually understand these JSON-RPC messages just offer a side channel to convey them).

    I suppose you could do it without any kernel change if you just put a Unix domain socket in an environment variable: but that would be more fragile, some process will end up with your pty but missing the environment variable or vice versa

    Actually I’d add this out-of-band JSON-RPC feature to pipes too, so if I run “foo | bar”, foo and bar can potentially engage in content/feature negotiation with each other

    • zzo38computer 39 minutes ago

      I think JSON would not be the good format for this; it is too limited and requires escaping. DER or SDSER might be a better format; numbers can be stored efficiently in binary, no escaping is needed, you can use any character set (not only Unicode), binary data can be stored directly (rather than needing to encode as hex or base64), etc.

      • skissane 28 minutes ago

        If one were adding this to the kernel, maybe rather than stipulating a specific protocol, assign them magic numbers; maybe JSON-RPC could be protocol 0x4a534f4e. An app could ask the kernel “which protocols does the pty master support?”, and get back a list of integers. And then it could ask to open a sidechannel for protocol 0x4a534f4e. So the kernel doesn’t even have to get in the business of mandating a specific protocol (whether JSON-RPC or CBOR or 0MQ or whatever), it just opens side channels with a meaningless (to the kernel) integer to identify its protocol.

        • zzo38computer 11 minutes ago

          I think that might work OK.

          Passing the process ID and user ID might be helpful to improve security of the terminal emulator, too. If the sidechannel is a UNIX socket then it will do this (with SCM_CREDENTIALS), as well as pass file descriptors (with SCM_RIGHTS).

  • art-w an hour ago

    Two interesting projects in that space:

    - https://arcan-fe.com/ which introduces a new protocol for TUI applications, which leads to better interactions across the different layers (hard to describe! but the website has nice videos and explanations of what is made possible)

    - Shelter, a shell with reproducible operations and git-like branches of the filesystem https://patrick.sirref.org/shelter/index.xml

  • zadjii 2 hours ago

    Y'know, I spent a week investigating doing something similar with the Windows Terminal about 18 months ago: https://github.com/microsoft/terminal/issues/16495#issuecomm...

    There's even more under the "Updates archive" expando in that post.

    It was a pretty compelling prototype. But after I played with Polyglot Notebooks[1], I pretty much just abandoned that experiment. There's a _lot_ of UI that needs to be written to build a notebook-like experience. But the Polyglot notebooks took care of that by just converting the commandline backend to a jupyter kernel.

    I've been writing more and more script-like experiments in those ever since. Just seems so much more natural to have a big-ol doc full of notes, that just so happens to also have play buttons to Do The Thing.

    [1]: https://marketplace.visualstudio.com/items?itemName=ms-dotne...

  • cb321 an hour ago

    Any article about this topic that does not at least mention https://arcan-fe.com/about/ feels incomplete. (Also, Arcan is already available.)

    • jynelson an hour ago

      whoa this looks fascinating, i've never heard of it before! thank you for the link :)

  • hamasho an hour ago

    I tried to find a terminal which can shows images, videos, and other media. I know it's not a UNIX way, but sometimes it can help. There are multiple options, but they didn't click in me.

    But just showing a browser like Jupyter would be very useful. It can handle a wide variety of media, can easily show JS heavy webpages unlike curl, and with text option to show text based result like w3m but can handle JS, it will be more useful.

      browser google.com/maps  # show google map and use interactively
      browser google.com/search?q=cat&udm=2  # show google image result
      browser --text jsheavy.com | grep -C 10 keyword   # show content around keyword but can handle JS
      vim =(browser --text news.ycombinator.com/item?id=45890186)  # show Hacker News article and can edit text result directly)
  • zzo38computer 42 minutes ago

    I had thought of a idea in a operating system design, which has many similarities to this but also many significant differences. The rest of the operating system would also be designed to support this, and the REPL would also be integrated with editors (like they show) and with a zoned spreadsheet. There would also be transactions (not the same as described there, but there is a similarity), and also capabilities (usable for security and many other things), and possibility to move objects between windows (this also allows it to work better with GUI; e.g. you can write a loop and use some combination of keys with mouse to drag a command button from a GUI window into your text in order to execute that command button within the loop; or you can copy data displayed in a table in another program in order to perform calculations on it or write a conversion to other format to then copy into another program, etc). However, tabs and panes would be handled by the window manager. However, it would use a binary format (a kind of TLV format), and it would not use CSS and HTML and Unicode. For rich text and other things there would also be a Reveal Codes function in order to reveal (and modify) the codes.

  • thatcherc 2 hours ago

    I appreciated the Pluto.jl mention! Going from Pluto notebooks that understand data flow to Jupyter notebooks where you have to tell the computer which order to run the cells in is always baffling to me. Why doesn't Jupyter know the run order and dependencies already? The way Pluto handles dependencies between code cells is really just so nice.

  • wrs 2 hours ago

    Re "stage 2: persistent sessions", iTerm2 already does this. The PTYs are owned by background processes independent of the GUI application. So iTerm2 can upgrade the application without interrupting the running terminal sessions.

    • jynelson 2 hours ago

      this is really cool omg! i didn't know that, i'll do some research.

      one of the strange things to me about the terminal landscape is how little knowledge sharing there is compared to other domains i'm familiar with. iTerm has a bunch of things no one else has; kitty influenced wezterm but otherwise no one else seems to have valued reflection; there's a whole bunch of extensions to ANSI escapes but most of them are non-standard and mutually incompatible. it's weird. if i compare to something like build systems, there's a lot more cross-pollination of ideas there.

  • xixixao 2 hours ago

    This might be useful (maybe) to the author: I am in a group (probably small, but I don’t think negligeble) that gave up on Warp because it doesn’t support standard or custom command completions [0]

    Some lesson must surely be drawn from this about incremental adoption.

    [0] https://github.com/warpdotdev/Warp/issues/1811

    • jynelson 2 hours ago

      yeah! so i somehow forgot to include this in the post, but one of the thing i would want as part of this is tab complete that integrates with the shell, essentially it would make an RPC call (in the step 3 sense). there’s things that work like this already today, they’re just extremely cursed ^^ but that’s never stopped me before. https://github.com/Aloxaf/fzf-tab?tab=readme-ov-file#differe...

  • thomasahle an hour ago

    I expected this to be about some "AI first" terminal. But the article doesn't mention AI at all, for better or worse...

  • shellkr 2 hours ago

    This I am afraid does not feel as the right thing to do. I think the KISS-principle is a good standard to follow and while terminals have to do more than one thing, it should not do everything. Complexity leads to instability. Terminals has to be nimble and not clumsy behemoths like web browsers.

    • Etheryte 2 hours ago

      Terminals are far from simple, that's the whole problem. We carry the weight of decades of technical constraints and arbitrary decisions on our shoulders every time we fire up a terminal emulator.

      • shellkr an hour ago

        I am all for removing old junk but not that it should be replaced with newer junk.

  • cpendery 2 hours ago

    interesting post! shell integration has gotten a lot better since the new ConPTY on windows doesn’t strip OSC sequences & send them ahead of the text

  • joshu an hour ago

    lots of terminals these days support imgcat and i rely on it heavily: https://iterm2.com/documentation-images.html

  • wredcoll 3 hours ago

    The terminal of the future is called a web browser.

    • shirro 3 hours ago

      It could have been. The platform got taken over by a very different culture and has tended to serve different purposes.

      The web solves problems that are almost impossible to properly solve with a terminal, particularly with rendering of more complicated languages and display and interaction with sophisticated visualisations.

      Pushing the terminal further while maintaining compatibility, performance and avoiding a terminal war with incompatible protocols is going to be a struggle.

    • mrandish an hour ago

      Yes, this was my first thought too. I haven't used a hardware text terminal since the 80s so maybe I don't get where the TFA is coming from? It starts out by stating "This post is part 6 of a multi-part series called 'the computer of the next 200 years'". Given that context, why is the focus on the evolution of 1980s VT100-type protocols? I'm at home and there are over a half dozen different devices within 25 ft which come standard with an HTML browser. Sure, modern browsers have some incompatibilities at the edges but if you're in need of a multi-decade, platform agnostic, lingua franca then W3C minimal baseline HTML/CSS + ECMAscript seems like the obvious winner (with no viable second place really).

      Don't get me wrong, I'd be quite interested in a vintage computing discussion on the evolution of VT-100/220 etc terminal protocols. There were some interesting things done into the 90s. That's actually what I clicked in expecting. Of course, those were all supplanted by either XWindows (which I never got to use much) or eventually HTML/CSS. And if we're talking more broadly about structured page description languages, there's no shortage of alternatives from NAPLPS to Display Postscript.

    • hastamelo 2 hours ago

      opened on the chatgpt page

    • add-sub-mul-div 3 hours ago

      That would be quite an own goal, to invite an extra middleman into the mix. Especially when so many people will go the path of least resistance and use a tech giant product as that middleman.

      • wredcoll 3 hours ago

        I mean, what is a terminal emulator? It's a program that displays the output of other programs "inside" it.

        Terminal emulators display grids of characters using all sorts of horrifying protocols.

        Web browsers display html generated by other programs.

        • unixplumber an hour ago

          > Terminal emulators display grids of characters using all sorts of horrifying protocols.

          What sort of "horrifying protocols"? The entire VT220 state machine diagram can be printed on a single letter- or A4-sized sheet of paper. That's the complete "protocol" of that particular terminal (and of any emulator of it). Implementing the VT220 with a few small extensions (e.g., 256 colors or 24-bit colors) wouldn't be too onerous. I implemented such a parser myself in probably a few hundred lines of code, plus a bit more to do all of the rendering (drawing glyphs directly to a bitmapped display, with no libraries) and handling user input from a keyboard. You'd have a difficult time properly parsing and rendering a significant subset of HTML in less than a few _thousand_ lines of code.

          Edit to add: terminal emulators often implement other terminals like VT420, but the VT220 is enough for the vast majority of terminal needs.

  • user3939382 35 minutes ago

    I designed this months ago and 10x more but I’m going to release it in a bundle

  • imiric an hour ago

    I dread reading these articles written by people who perceive the command-line interface / terminal / shell to be this archaic system, and propose "modernizing" it by cramming whatever UI/UX they're most familiar with.

    The last thing a command-line terminal needs is a Jupyter Notebook-like UI. It doesn't need to render HTML; it doesn't need rerun and undo/redo; and it definitely doesn't need structured RPC. Many of the mentioned features are already supported by various tooling, yet the author dismisses them because... bugs?

    Yes, terminal emulators and shells have a lot of historical baggage that we may consider weird or clunky by today's standards. But many design decisions made 40 years ago are directly related to why some software has stood the test of time, and why we still use it today.

    "Modernizing" this usually comes with very high maintenance or compatibility costs. So, let's say you want structured data exchange between programs ala PowerShell, Nushell, etc. Great, now you just need to build and maintain shims for every tool in existence, force your users to use your own custom tools that support these features, and ensure that everything interoperates smoothly. So now instead of creating an open standard that everyone can build within and around of, you've built a closed ecosystem that has to be maintained centrally. And yet the "archaic" unstructured data approach is what allows me to write a script with tools written decades ago interoperating seamlessly with tools written today, without either tool needing to directly support the other, or the shell and terminal needing to be aware of this. It all just works.

    I'm not saying that this ecosystem couldn't be improved. But it needs broad community discussion, planning, and support, and not a brain dump from someone who feels inspired by Jupyter Notebooks.

    • jynelson an hour ago

      > Great, now you just need to build and maintain shims for every tool in existence, force your users to use your own custom tools that support these features, and ensure that everything interoperates smoothly.

      Yes, this is the work. https://becca.ooo/blog/vertical-integration/

    • hombre_fatal an hour ago

      Nonsense. It's just some person brainstorming improvements. You shouldn't need "broad community discussion" every time you toy with some ideas.

  • zazaulola 2 hours ago

    What do you mean by “terminal”? Perhaps you are referring to something like a VT100.

    https://commons.wikimedia.org/wiki/File:DEC_VT100_terminal.j...

    I may disappoint you with the fact that IBM PC-compatible computers have replaced devices of that class. We can only observe certain terminal emulators in some operating systems. There have been many attempts to expand the functionality of these emulators. However, most features beyond the capabilities of VT100 have not caught on (except UTF-8 support). I do not believe that anything will change in the foreseeable future.