rterm-backend 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE.md +35 -0
  2. package/README.md +122 -0
  3. package/bin/gybackend.js +367260 -0
  4. package/package.json +60 -0
package/LICENSE.md ADDED
@@ -0,0 +1,35 @@
1
+ # License
2
+
3
+ **rterm-backend** is part of RTerm, by Hyperspace Technologies.
4
+
5
+ This project is licensed under **Creative Commons Attribution-NonCommercial 4.0
6
+ International (CC BY-NC 4.0)**.
7
+
8
+ You are free to share and adapt the material for **non-commercial** purposes,
9
+ with attribution. Commercial use requires a separate license from Hyperspace
10
+ Technologies.
11
+
12
+ Full legal text: https://creativecommons.org/licenses/by-nc/4.0/legalcode
13
+
14
+ ---
15
+
16
+ ## Third-party components
17
+
18
+ rterm-backend bundles and links third-party open-source libraries. Their
19
+ respective licenses (MIT, Apache-2.0, BSD, etc.) are retained by their owners.
20
+ Notable bundled/linked components include:
21
+
22
+ - **ssh2** (MIT) — SSH2 client
23
+ - **node-pty** (MIT) — pseudo-terminal bindings
24
+ - **better-sqlite3** (MIT) — SQLite bindings
25
+ - **ws** (MIT) — WebSocket library
26
+ - **@langchain/core, @langchain/langgraph** (MIT) — agent orchestration
27
+ - **@modelcontextprotocol/sdk** (MIT) — Model Context Protocol
28
+ - **web-tree-sitter, tree-sitter-bash** (MIT) — command parsing
29
+ - **serialport** (MIT) — serial port bindings (optional)
30
+ - **@xterm/headless** (MIT) — headless terminal model
31
+ - **zod** (MIT) — schema validation
32
+ - **socks** (MIT) — SOCKS proxy client
33
+ - **uuid, diff, remeda** (MIT) — utilities
34
+
35
+ Inspiration/references from [Tabby](https://github.com/Eugeny/tabby) (MIT).
package/README.md ADDED
@@ -0,0 +1,122 @@
1
+ # rterm-backend
2
+
3
+ **RTerm headless backend** — run RTerm-as-a-service, no desktop UI required. A
4
+ single near-self-contained Node bundle that boots RTerm's full backend and
5
+ exposes it over a **WebSocket JSON-RPC gateway**, so any program or agent can
6
+ drive it remotely.
7
+
8
+ ```
9
+ ┌──────────────┐ WebSocket JSON-RPC ┌──────────────────────────────────┐
10
+ │ your agent / │ ◄────────────────────► │ rterm-backend (gybackend) │
11
+ │ program / CI │ │ • AI agent (LLM + tools) │
12
+ └──────────────┘ │ • SSH / WinRM / Serial / local │
13
+ │ • fleet orchestration │
14
+ │ • scheduled automation (cron) │
15
+ │ • change management (MOP) │
16
+ └──────────────────────────────────┘
17
+ ```
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ npm install -g rterm-backend
23
+ ```
24
+
25
+ This installs the `gybackend` CLI plus the small set of native/runtime
26
+ dependencies (`better-sqlite3`, `node-pty`, `ssh2`, tree-sitter wasm, and
27
+ optional `serialport`). Everything else — the AI agent, MCP SDK, SSH/WinRM/
28
+ Serial handling, automation engine — is bundled into the single CLI file.
29
+
30
+ ## Run
31
+
32
+ ```bash
33
+ gybackend
34
+ ```
35
+
36
+ Or without a global install:
37
+
38
+ ```bash
39
+ npx rterm-backend
40
+ ```
41
+
42
+ On boot it prints the gateway endpoint:
43
+
44
+ ```
45
+ [gybackend] Started.
46
+ [gybackend] WebSocket RPC endpoint: ws://0.0.0.0:17888
47
+ [gybackend] Data directory: ./.gybackend-data
48
+ ```
49
+
50
+ ## Configure (environment variables)
51
+
52
+ | Var | Default | Meaning |
53
+ |---|---|---|
54
+ | `GYBACKEND_WS_ENABLE` | `1` | enable the WebSocket gateway |
55
+ | `GYBACKEND_WS_HOST` | `0.0.0.0` | bind host (`127.0.0.1` for local-only) |
56
+ | `GYBACKEND_WS_PORT` | `17888` | gateway port |
57
+ | `GYBACKEND_DATA_DIR` | `./.gybackend-data` | settings, ledgers, skills, sessions |
58
+ | `GYBACKEND_BOOTSTRAP_LOCAL_TERMINAL` | `true` | open a local shell tab on boot |
59
+ | `GYBACKEND_TERMINAL_ID` | `local-main` | id of the bootstrap terminal |
60
+ | `GYBACKEND_TERMINAL_TITLE` | `Local` | title of the bootstrap terminal |
61
+ | `GYBACKEND_TERMINAL_CWD` | — | cwd of the bootstrap terminal |
62
+ | `GYBACKEND_TERMINAL_SHELL` | — | shell of the bootstrap terminal |
63
+
64
+ ### Share settings with the desktop app
65
+
66
+ By default the daemon uses its **own** data dir (a blank slate). To reuse the
67
+ desktop RTerm app's settings, saved connections, and model keys, point it at
68
+ the app's settings directory:
69
+
70
+ ```bash
71
+ # macOS
72
+ GYBACKEND_DATA_DIR="$HOME/Library/Application Support/rterm" gybackend
73
+ # Linux
74
+ GYBACKEND_DATA_DIR="$HOME/.config/rterm" gybackend
75
+ # Windows
76
+ set GYBACKEND_DATA_DIR=%APPDATA%\rterm && gybackend
77
+ ```
78
+
79
+ ## Drive it remotely
80
+
81
+ The gateway is **WebSocket JSON-RPC**. Request `{ "id": "1", "method": "<name>",
82
+ "params": {...} }` → response `{ "type": "gateway:response", "id": "1", "ok":
83
+ true|false, "result"|"error" }`. Progress streams back as `gateway:event` /
84
+ `gateway:raw` messages. Localhost connections skip token auth by default.
85
+
86
+ Quick check with [`websocat`](https://github.com/vi/websocat):
87
+
88
+ ```bash
89
+ echo '{"id":"1","method":"gateway:ping"}' | websocat -n1 ws://127.0.0.1:17888
90
+ # -> {"type":"gateway:response","id":"1","ok":true,"result":{"pong":true,...}}
91
+ ```
92
+
93
+ Run an AI agent task on a server:
94
+
95
+ ```bash
96
+ websocat ws://127.0.0.1:17888
97
+ {"id":"1","method":"gateway:createSession"}
98
+ {"id":"2","method":"agent:startTaskAsync","params":{"sessionId":"<sid>","userInput":"Update AV signatures on the saved WinRM connection AWS-Windows-Server-1 and report the version"}}
99
+ ```
100
+
101
+ **Full RPC reference + client libraries** (Node CLI, Python, websocat examples):
102
+ see the [`rterm-gateway` skill](https://github.com/DrOlu/agent-skills/tree/main/skills/rterm-gateway).
103
+
104
+ ## What you can do with it
105
+
106
+ - **AI agent tasks** — `agent:startTask` / `agent:startTaskAsync` (multi-step, tool-using)
107
+ - **Terminals** — open/run SSH, WinRM, Serial, local tabs and send commands
108
+ - **Files** — read/write/transfer on any connected host (`filesystem:*`)
109
+ - **Fleet** — run a command across many servers, collect structured results
110
+ - **Automation** — playbooks, scheduled cron jobs, config templates
111
+ - **Change management (MOP)** — plan → approve → run with validation + automatic rollback
112
+ - **Settings/policy** — manage connections, command policy, skills, memory, models
113
+
114
+ ## Requirements
115
+
116
+ - **Node.js ≥ 18** on the host. Native deps (`better-sqlite3`, `node-pty`,
117
+ `ssh2` crypto, tree-sitter) install prebuilt binaries for common platforms;
118
+ on unusual platforms they build from source (needs a C/C++ toolchain).
119
+
120
+ ## License
121
+
122
+ See `LICENSE.md`. RTerm — Hyperspace Technologies — https://github.com/DrOlu/RTerm