rterm-backend 2.9.5 → 2.9.7

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/README.md +21 -270
  2. package/bin/gybackend.cjs +2037 -1383
  3. package/package.json +9 -5
  4. package/bin/gybackend.js +0 -387870
package/README.md CHANGED
@@ -1,280 +1,31 @@
1
- # <img src="./demo_imgs/icon.png" width="40" height="40" align="center" style="margin-right: 10px;"> RTerm
1
+ # gybackend
2
2
 
3
- > **The AI-Native Terminal that thinks, executes, and collaborates with you.**
3
+ Backend runtime bootstrap workspace for GyShell (internal/development entry).
4
4
 
5
- [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
6
- [![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux-blue)](#platforms)
7
- [![Shell](https://img.shields.io/badge/Shell-Zsh%20%7C%20Bash%20%7C%20PowerShell-orange)](#key-capabilities)
8
-
9
- English README | [中文 README](./README.zh-CN.md)
10
- Latest release notes: [`changelogs/v1.6.0.md`](./changelogs/v1.6.0.md)
11
-
12
- If you have any suggestions or questions, please feel free to submit them in [GitHub Discussions](https://github.com/MrOrangeJJ/RTerm/discussions).
13
-
14
- Usage guides:
15
- [`docs/mobile-web-usage.md`](./docs/mobile-web-usage.md) ·
16
- [`docs/tui-usage.md`](./docs/tui-usage.md) ·
17
- [`docs/gybackend-usage.md`](./docs/gybackend-usage.md)
18
-
19
- > [!WARNING]
20
- > **Active Development**: RTerm evolves quickly. If a version introduces history compatibility breaks, it will be called out explicitly in release notes.
21
-
22
- > [!NOTE]
23
- > **v1.4.0 upgrade note**: the first launch after upgrading from a pre-1.4.0 version may briefly block while RTerm migrates legacy JSON history into SQLite and writes timestamped backup files. v1.4.3 has no additional migration step.
24
-
25
- <p align="center">
26
- <img src="./demo_imgs/v1.6.0_dark.png" width="100%" alt="GyShell dark theme demo">
27
- </p>
28
- <p align="center">
29
- <img src="./demo_imgs/v1.6.0_light.png" width="100%" alt="GyShell light theme demo">
30
- </p>
31
- <p align="center">
32
- <video controls width="100%" src="https://github.com/user-attachments/assets/f9daf884-bda0-4a58-8a6d-934db0eddeb5"></video>
33
- </p>
34
-
35
- ---
36
-
37
- ## Why RTerm Is Different
38
-
39
- Most AI terminal tools either generate one-shot scripts, or run in isolated sandboxes detached from real shell workflows.
40
-
41
- RTerm is built for **persistent execution in your real terminal runtime**:
42
-
43
- - **Persistent execution loop**: observe output -> reason -> continue.
44
- - **Human-in-the-loop by design**: intervene anytime without breaking flow.
45
- - **Multi-tab orchestration**: compile, inspect logs, and run fixes in parallel tabs.
46
- - **Global tab inventory**: scan, reopen, drag, close, and create terminal/chat tabs from a dedicated list panel.
47
- - **Workspace persistence**: terminal tabs, panel layout, and saved layout slots can survive restarts and restore quickly.
48
- - **Detachable multi-window workspace**: peel panels into sub-windows and move tabs or whole panels across windows.
49
- - **Adaptive panel tab display**: keep full tab strips or switch to a compact selector for narrow panel headers.
50
- - **Reusable Agent setting profiles**: save and reapply complete operating profiles for models, tools, policies, memory, and workflow flags.
51
- - **Cross-chat context handoff**: reference previous conversations from the composer with `Pass Chat` mentions instead of manually copying history.
52
- - **Integrated file management**: browse, edit, copy, and transfer files across local and SSH sessions without leaving the workspace.
53
- - **Live resource visibility**: inspect CPU, memory, disks, network, processes, sockets, and GPU from local or SSH sessions.
54
- - **OpenClawd-style remote conversation control**: keep the runtime core on your own computer and steer it from anywhere through chat.
55
- - **Built-in mobile-web delivery**: desktop can publish the mobile-web companion directly over your LAN with copyable access links.
56
- - **Cross-surface runtime model**: desktop, TUI, and mobile-web share one gateway semantics.
57
- - **Profile lock safety**: busy sessions pin active model profile for consistency.
58
- - **Long-horizon context quality**: memory.md + compaction summaries + visible boundaries + deterministic fallback recovery keep long sessions understandable.
59
- - **Tooling-native workflow**: skills, MCP servers, and built-in tools are runtime primitives.
60
-
61
- ### At a Glance
62
-
63
- - **For shipping work**: not just planning, but iterative execution and correction.
64
- - **For long-running tasks**: preserves session continuity and state across steps.
65
- - **For real infrastructure**: shell, SSH, forwarding, file management, and multi-tab interactive terminal control.
66
- - **For multi-device flow**: desktop + TUI + mobile-web with shared gateway semantics.
67
- - **For multimodal workflows**: text and image inputs can be combined in one execution turn.
68
-
69
- ## v1.6.0 Key Highlights
70
-
71
- - **Global Tab List panel**
72
- - a new `TAB LIST` panel shows terminal and chat tabs as a vertical workspace inventory, with counts, status dots, latest-first ordering, drag/drop support, close actions, and quick creation for chat, local terminal, and saved-SSH terminal tabs
73
- - **Default workspace refresh**
74
- - new main layouts start with the list panel on the left, chat in the center, and terminal on the right, making tab-heavy sessions easier to scan immediately
75
- - **More predictable background terminal tabs**
76
- - local and SSH tabs created from the list panel can start in the background, stay visible in the global terminal inventory, bind to terminal panels when appropriate, and no longer unexpectedly take over linked filesystem or monitor panels
77
- - **Visible compaction boundaries**
78
- - long chats now persist and render a `[CTX COMPACTED]` marker at the actual retained-history cutoff across desktop, mobile-web, and TUI clients
79
- - **Deterministic compaction fallback**
80
- - when the compaction model fails or returns an empty summary, GyShell can recover with a local deterministic digest while preserving the protected tail and exporting exact older history for on-demand inspection when available
81
- - **Safer stream recovery**
82
- - empty non-tool provider stream finishes now retry through the normal path instead of silently ending a run with no answer, while valid empty tool-call finishes remain routable
83
- - **Terminal inventory stability**
84
- - terminal titles stay unique and stable across duplicate backend snapshots, concurrent terminal creation, explicit numeric suffixes, and detached-window terminal transfers
85
- - **Mobile-web runtime refresh**
86
- - Electron-packaged mobile-web assets were regenerated so desktop builds serve the updated client without requiring a separate mobile-web development server
87
-
88
- ---
89
-
90
- ## Key Capabilities
91
-
92
- ### AI-Native Runtime
93
-
94
- - Thinking-oriented execution for complex tasks.
95
- - Context-aware responses from terminal state and selected resources.
96
- - Per-profile model routing for `Global`, `Thinking`, `Action`, and `Compaction` roles.
97
- - Reusable Agent Setting profiles for model profile, security policy, tools, skills, memory, recursion, and experimental workflow flags.
98
- - Long-session context quality with dedicated compaction models, dynamic summaries, visible `[CTX COMPACTED]` boundary markers, and deterministic fallback recovery when model compaction is unavailable.
99
- - SQLite-backed conversation history with automatic one-time migration from legacy JSON storage.
100
- - AI-assisted terminal command drafting from recent tab context, with paste-before-run control.
101
- - Background (nowait) commands automatically notify the agent on completion, so the agent can close the loop without polling.
102
- - Terminal-targeting agent tools report runtime status and refuse stale operations on disconnected tabs until reconnect succeeds.
103
- - Reference previous conversations with `Pass Chat` mentions; GyShell exports the selected chat as private local Markdown and tells the agent how to read it only when needed.
104
- - Classic or Seamless chat activity display, depending on how much inline tool detail you want.
105
- - Persistent memory injection via `memory.md`, scoped to the active Agent Setting profile when one is applied.
106
- - Multimodal user input pipeline (text + images) for compatible models.
107
- - OpenAI-compatible model endpoint support, with automatic recovery from malformed empty tool-call stream finishes.
108
- - Optional experimental agent tools, including asynchronous cross-machine file transfer between terminal tabs with progress polling.
109
-
110
- ### Terminal + SSH + File Management
111
-
112
- - Shell support: Zsh, Bash, PowerShell.
113
- - Older Windows PowerShell environments now use more reliable sidecar-based command completion tracking for local and SSH sessions.
114
- - SSH support: password/key auth, proxy chaining, bastion workflows.
115
- - SSH sessions use protocol keepalive to reduce silent idle disconnects.
116
- - Port forwarding: local, remote, and dynamic SOCKS.
117
- - Agent can coordinate **multiple SSH/local terminal tabs** in parallel during one task.
118
- - Control-character operations for interactive terminal apps.
119
- - Draft a command for the current terminal tab from recent visible output, then paste it back without auto-running it.
120
- - Search within the active terminal buffer without leaving the panel.
121
- - Terminal tab restoration after backend restart, plus lossless output catch-up for renderer remount/reconnect within the same backend runtime.
122
- - Local terminal tabs auto-respawn their shell if it exits, so a local tab stays usable instead of going dead.
123
- - Disconnected SSH tabs can be reconnected in place from the tab right-click menu using their saved connection config.
124
- - **Integrated file browser panel**: browse, create, rename, delete, preview, sort, filter, and search files across local and SSH sessions.
125
- - **Cross-session file transfer** (copy/move) with real-time progress, cancellation, and adaptive SFTP tuning.
126
- - **Built-in file editor panel** for editing text files, plus inline preview of images (`png/jpg/gif/webp/bmp/ico/svg/avif`) and PDFs (with page navigation and zoom), all directly in the workspace.
127
- - **File row right-click menu** with Copy / Cut / Paste / Rename / Delete and **Copy Full Path(s)** to the system clipboard.
128
- - **Paste conflict resolution**: choose between **Overwrite** and **Keep Both** (auto-numbered names) when pasting into a folder with same-named items.
129
-
130
- ### Workspace + Monitoring
131
-
132
- - Detach panels into dedicated sub-windows and move tabs or whole panels across windows.
133
- - Use the global Tab List panel to scan terminal/chat inventory, restore unhosted tabs, drag tabs across layout targets, close tabs, and create new chat/local/SSH tabs without forcing a terminal panel to appear.
134
- - Save up to three workspace layout slots and restore them from the rail.
135
- - Optionally keep the computer awake while any chat session is running, with the system-sleep block released automatically when runs finish.
136
- - Chat tabs show a running indicator while a session is busy, mirroring terminal tab runtime-state dots.
137
- - Choose `Auto`, `Expanded`, or `Select` panel tab display modes based on how much header space your workspace has.
138
- - `Ctrl/Cmd+F` opens a panel-local find bar in terminal, current chat, file browser, and file editor.
139
- - Open a resource monitor panel for local and SSH terminals from the workspace rail.
140
- - Monitor panel surfaces CPU, memory, disk, network, process, socket, and GPU telemetry when available.
141
- - Monitor collection is shared across tabs that point at the same local or SSH target, with failover if the original source tab exits.
142
- - Monitor polling can be paused or resumed per local/SSH source, with the preference kept across restarts.
143
- - Compact monitor layouts now give GPU telemetry its own card with clearer VRAM usage details.
144
-
145
- ### Skills + MCP + Tools
146
-
147
- - Folder-based skills workflow compatible with agentskills-style structure.
148
- - Dynamic MCP server integration.
149
- - Precision editing tools for safe, targeted file updates.
150
- - Runtime tool toggles and summaries exposed to clients.
151
-
152
- ### Mobile-Web Companion
153
-
154
- - Mobile-first remote client for active session tracking and steering.
155
- - Desktop can serve the mobile-web companion directly and expose copyable access links from settings.
156
- - OpenClawd-style conversational control from anywhere while your core runtime stays on your own machine.
157
- - Session list with search and status hints.
158
- - Pending approval badge with jump-to-blocked-session behavior, plus task-completion toasts.
159
- - Conversation rollback and branch-from-message controls from mobile.
160
- - Swipe-to-delete session flow for faster mobile cleanup.
161
- - Read-only terminal output tails with unread indicators, local/saved-SSH terminal creation, and SSH reconnect.
162
- - Detailed turn event inspection from phone browser.
163
- - Tool, skill, Agent Setting profile, terminal, and settings access through gateway RPC.
164
- - Long chat timelines avoid full-list rerenders during composer input, keeping history-heavy mobile sessions responsive.
165
- - Gateway exposure can now be limited to localhost, LAN-only, custom CIDR ranges, or all interfaces.
166
-
167
- ---
168
-
169
- ## Platforms
170
-
171
- 1. **Electron desktop app** (`apps/electron`)
172
- 2. **Standalone backend runtime** (`apps/gybackend`)
173
- 3. **Deprecated TUI runtime** (`apps/tui` wrapper + `packages/tui` core)
174
- 4. **Mobile-web runtime** (`apps/mobile-web` wrapper + `packages/mobile-web` core)
175
-
176
- ### Which Surface Should You Use?
177
-
178
- - **Desktop app**: primary full-featured experience for daily development.
179
- - **TUI (`gyll`)**: deprecated and unsupported. Desktop packages no longer bundle or install `gyll`.
180
- - **Mobile-web**: OpenClawd-style remote conversational control from phone/browser.
181
-
182
- ---
183
-
184
- ## Quick Start
185
-
186
- ### Prerequisites
187
-
188
- - Node.js 18+
189
- - npm
190
-
191
- ### Development
192
-
193
- ```bash
194
- git clone https://github.com/MrOrangeJJ/RTerm.git
195
- cd RTerm
196
- npm install
197
- npm run dev
198
- ```
199
-
200
- ### One-line Mental Model
201
-
202
- `RTerm = persistent AI runtime + real terminal control + human override at any time.`
203
-
204
- ### Mobile-web development
5
+ ## Run
205
6
 
206
7
  ```bash
207
- npm run dev:mobile-web
8
+ npm --workspace @gyshell/gybackend run build
9
+ npm --workspace @gyshell/gybackend run start
208
10
  ```
209
11
 
210
- ---
211
-
212
- ## Deprecated CLI (`gyll`)
213
-
214
- After installing and launching RTerm desktop once, `gyll` is available from the desktop runtime setup.
215
-
216
- When an existing user updates from a version that installed desktop-managed `gyll` launchers, the updated app removes those legacy launchers on startup while leaving any shell profile PATH block untouched.
217
-
218
- ---
219
-
220
- ## Architecture Notes
221
-
222
- RTerm follows strict layering:
223
-
224
- - `packages/*`: implementation logic.
225
- - `apps/*`: composition/bootstrap/build wrappers.
226
- - Frontend logic does not belong in `packages/backend`.
227
-
228
- Core runtime chain (simplified):
229
-
230
- 1. `startElectronMain` (desktop composition root)
231
- 2. `GatewayService` (session runtime + transport-agnostic orchestration)
232
- 3. `WebSocketGatewayControlService` (policy-based ws gateway control)
233
- 4. `WebSocketGatewayAdapter` / `ElectronWindowTransport` (transport implementations)
234
- 5. Client controllers in TUI and mobile-web
235
-
236
- See:
237
-
238
- - `docs/monorepo-architecture.md`
239
- - `docs/build-commands.md`
240
-
241
- ## Privacy and Update Policy
242
-
243
- - Version checks query only this repository's GitHub `version.json`.
244
- - No third-party auto-update endpoint is used.
245
- - Version check is the only automatic background network request.
246
-
247
- ## Read More
248
-
249
- - Release notes: `changelogs/v1.6.0.md`
250
- - Build matrix and packaging: `docs/build-commands.md`
251
- - Monorepo boundaries and runtime flow: `docs/monorepo-architecture.md`
252
-
253
- ---
254
-
255
- ## Build and Packaging
256
-
257
- - `npm run build`
258
- - `npm run build:backend`
259
- - `npm run build:tui`
260
- - `npm run build:mobile-web`
261
- - `npm run dist`
262
- - `npm run dist:mac`
263
- - `npm run dist:win`
264
- - `npm run dist:linux`
265
- - `npm run dist:linux-arm64`
266
- - `./build.sh --help`
267
-
268
- For the full command matrix and packaging notes, see `docs/build-commands.md`.
269
-
270
- ---
271
-
272
- ## License
12
+ This workspace is mainly for repository development and runtime debugging. End users should use the desktop app. `gyll` / CLI TUI is deprecated and unsupported.
273
13
 
274
- This project is licensed under the **Apache License, Version 2.0** ([LICENSE](./LICENSE)).
14
+ ## Environment Variables
275
15
 
276
- Special acknowledgment: inspirations and references from [Tabby](https://github.com/Eugeny/tabby) (MIT).
16
+ - `GYBACKEND_WS_HOST` (default `0.0.0.0`)
17
+ - `GYBACKEND_WS_PORT` (default `17888`)
18
+ - `GYBACKEND_DATA_DIR` (default `./.gybackend-data` under current working directory)
19
+ - `GYBACKEND_BOOTSTRAP_LOCAL_TERMINAL` (default `true`)
20
+ - `GYBACKEND_TERMINAL_ID` (default `local-main`)
21
+ - `GYBACKEND_TERMINAL_TITLE` (default `Local`)
22
+ - `GYBACKEND_TERMINAL_CWD` (optional)
23
+ - `GYBACKEND_TERMINAL_SHELL` (optional)
24
+ - `GYBACKEND_MODEL` (optional bootstrap model name)
25
+ - `GYBACKEND_API_KEY` (optional bootstrap model API key)
26
+ - `GYBACKEND_BASE_URL` (optional bootstrap model base URL)
277
27
 
278
- ---
28
+ ## Notes
279
29
 
280
- **RTerm** - _The shell that thinks with you._
30
+ - gybackend delegates shared backend behavior to `packages/backend`.
31
+ - MCP runtime is active through the shared backend core.