Terminal
The Terminal is used to expose an interface to work using cryptic commands with a direct connection to host. It is able to support multi-GDS.
The Terminal is implemented by the @orion/terminals package which exposes its functionalities via terminalsHelper that depends on the terminalsManager. This kernel exposes:
-
A Component to render Terminals by using POSComponent with the componentName: Terminal.
-
selectors to retrieve data related with Terminals by using selectorsHelper.
-
actions to modify data related with Terminals by using dispatchersHelper.
-
some methods are exposed by the TerminalsHelper.
The Terminal uses an internal JSON-based language named TAST to en-rich content with interactive features.

POSWebPluginMain.js
import React from 'react';
export default class Plugin {
constructor({ diHelper }) {
this._diHelper = diHelper;
diHelper.useValues({
terminalId: '1',
});
}
onInit() {
this._diHelper.invoke(this._createTerminal);
this._diHelper.invoke(this._putComponents);
}
_createTerminal = ({ dispatchersHelper, terminalId }) => {
dispatchersHelper.dispatch('createTerminal', {
terminal: { id: terminalId },
});
};
_putComponents = ({ uiHelper, terminalId }) => {
const { putComponent, POSComponent } = uiHelper;
putComponent('Example', () => (
<div style={{ lineHeight: 1.1 }}>
<POSComponent componentName="Terminal" terminalId={terminalId} />
</div>
));
};
}
index.js
import POSWebPluginMain from './POSWebPluginMain.js';
export default POSWebPluginMain;
package.json
{
"name": "plugin-test",
"version": "1.0.0",
"orion": {
"dispatchersHelper": {
"actionCreators": {
"consumes": {
"@orion/terminals": [
"createTerminal"
]
}
}
}
}
}
Sections
Section |
Description |
---|---|
Basic | How to create a terminal |
Commands | What a terminal command is and how to use it |
Content | How to add content to the terminal |
Cryptic Transformers | How to create and use cryptic transformers |
Current | What is the current function for the terminal |
How to handle the terminal's cursor |
|
Decorators | How to transform the terminal's text with a decorator |
Dimensions | How to define the dimensions of the terminal |
Entries | How to deal with the terminal's entries |
Focus | What is the focus functionality |
History | How to get the terminal's history |
Host | How to retrieve host properties |
Inlines | What is an inline and how enrich terminal's text |
Keyboard Mappings | Using and creating keyboard mappings for the terminal |
Mode | How to switch terminal's cursor mode |
Native Terminals | What a native terminal is and how to use it |
Selection | How to get a range of content in the terminal |
Shortcuts | How to create a shortcut to launch a command |
TAST | What is TAST |
Test Utils | How to use the test utilities for terminal |
Themes | How configure a theme for the terminal |
Viewport | What a viewport is and how to manage it |
Definitions Summary
This module produces definitions by default to be consumed by the plugins.
Action Creators
"orion": {
"dispatchersHelper": {
"actionCreators": {
"produces": [
"appendTerminalTAST",
"blurTerminal",
"clearTerminal",
"createTerminal",
"createTerminalsKeyboardMapping",
"createTerminalsShortcuts",
"createTerminalsTheme",
"deleteTerminal",
"deleteTerminalRange",
"deleteTerminalsShortcut",
"dequeueTerminalEntry",
"focusTerminal",
"hideTerminalInline",
"moveTerminalCursor",
"moveTerminalSelectionFocus",
"queueTerminalEntry",
"receiveTerminalResponse",
"replaceCurrentTerminalId",
"replaceIsTerminalNative",
"replaceTerminalHostConnectionId",
"replaceTerminalKeyboardMappingId",
"replaceTerminalThemeId",
"replaceTerminalsMode",
"replaceTerminalsShortcut",
"scrollTerminalViewport",
"sendTerminalEntry",
"setTerminalInline",
"setTerminalPadding",
"setTerminalSelection",
"setTerminalViewport",
"setTerminalsInlineTypes",
"showTerminalInline",
"spliceTerminalTAST",
"toggleTerminalInlineVisibility",
"toggleTerminalsMode",
"writeTerminalChars",
"writeTerminalTAST"
],
}
}
}
Selectors
"orion": {
"selectorsHelper": {
"selectorFactories": {
"produces": [
"findTerminalLastVisibleRange",
"findTerminalPreviousSOM",
"findTerminalRawRange"
"findTerminalVisibleRange",
"getCurrentTerminalId",
"getFocusedTerminalId",
"getTerminalClient",
"getTerminalCryptic",
"getTerminalCursorPosition",
"getTerminalDimensions",
"getTerminalEntriesHistoryList",
"getTerminalEntriesQueues",
"getTerminalHostConnectionId",
"getTerminalHostProperty",
"getTerminalInlineAction",
"getTerminalInlineActions",
"getTerminalInlineRef",
"getTerminalInlineStyle",
"getTerminalInlineTooltip",
"getTerminalKeyboardMappingId",
"getTerminalPadding",
"getTerminalRawTAST",
"getTerminalRawText",
"getTerminalResponsesHistoryList",
"getTerminalScopeInlines",
"getTerminalSelection",
"getTerminalSelectionRange",
"getTerminalSelectionText",
"getTerminalSOM",
"getTerminalTabStops",
"getTerminalThemeId",
"getTerminalViewport",
"getTerminalVisibleTAST",
"getTerminalVisibleText",
"getTerminalsEntriesHistoryList",
"getTerminalsIds",
"getTerminalsInlineTypes",
"getTerminalsKeyboardMapping",
"getTerminalsKeyboardMappings",
"getTerminalsKeyboardMappingsIds",
"getTerminalsMode",
"getTerminalsResponsesHistoryList",
"getTerminalsShortcuts",
"getTerminalsTheme",
"getTerminalsThemesIds",
"hasTerminalSelection",
"isTerminalBusy",
"isTerminalCreated",
"isTerminalFocused",
"isTerminalInlineTabStop",
"isTerminalInlineVisible",
"isTerminalNative",
],
}
}
}
Example
To consume any of those definitions you should specify them on your plugin's metadata.
{
"name": "my-plugin",
"version": "1.0.0",
"orion": {
"selectorsHelper": {
"selectorFactories": {
"consumes": { "@orion/terminals": ["getCurrentTerminalId", "isTerminalBusy"] }
}
},
"dispatchersHelper": {
"actionCreators": {
"consumes": { "@orion/terminals": ["createTerminal", "writeTerminalChars"] }
}
}
}
}