@quangnv13/nonstop 1.0.10 → 1.0.12
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.
- package/README.md +6 -1
- package/README.vi.md +6 -1
- package/package.json +4 -2
- package/scripts/preinstall.js +35 -0
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* **🤖 Telegram PTY Terminal** — Execute and control real-time, interactive shell sessions (PowerShell, Bash, Codex, or Antigravity) remotely from Telegram.
|
|
38
38
|
* **⚙️ Inline Configuration Engine** — Modify environment settings dynamically through the new `/config` inline Telegram menu or directly in the CLI.
|
|
39
39
|
* **📂 Smart Workspaces** — Navigate and switch between different working directories on your machine with a few taps.
|
|
40
|
-
* **🔄 Optimized Output Stream** — Advanced batch-delivery mechanics with configurable output intervals, ensuring fluid terminal logs inside Telegram without hitting API limits.
|
|
40
|
+
* **🔄 Optimized Output Stream** — Advanced batch-delivery mechanics with configurable output intervals (`OUTPUT_INTERVAL`) and interaction-triggered flush delays (`ACTION_INTERVAL`), ensuring fluid terminal logs inside Telegram without hitting API limits.
|
|
41
41
|
* **🚀 Native OS Autostart** — Easy configuration to run as a background service on OS startup (supports Windows and Linux).
|
|
42
42
|
* **🌐 Bilingual Support** — Fully localized in English (`en`) and Vietnamese (`vi`).
|
|
43
43
|
* **🛡️ Hardened Security** — Hardened token validation and authorization checks, restricting control access strictly to the configured admin account.
|
|
@@ -126,6 +126,9 @@ Once the bot runtime is active, you can interact with it via the following Teleg
|
|
|
126
126
|
* **⛔ Esc** — Send the Escape key to interrupt/cancel processes.
|
|
127
127
|
* **⏎ Enter** — Send a carriage return.
|
|
128
128
|
* **▲ Up / ▼ Down** — Navigate command history.
|
|
129
|
+
* **🔄 Refresh** — Request an update of the terminal screen.
|
|
130
|
+
> [!NOTE]
|
|
131
|
+
> Pressing control keys (**Esc**, **Enter**, **Up**, **Down**) or clicking **Refresh** will trigger a quick output delivery after a short interactive delay (configured via `ACTION_INTERVAL`, default 5s) and bypass standard duplicate output filters to guarantee updates are delivered.
|
|
129
132
|
|
|
130
133
|
#### **📂 Directory Workspaces**
|
|
131
134
|
* Select **📁 Workspaces** from the main menu to view configured folders.
|
|
@@ -149,6 +152,8 @@ TELEGRAM_USERNAME=@your_telegram_username
|
|
|
149
152
|
CLIENT_NAME=nonstop-local
|
|
150
153
|
APP_LANGUAGE=en
|
|
151
154
|
STARTUP_MODE=disabled
|
|
155
|
+
OUTPUT_INTERVAL=20000
|
|
156
|
+
ACTION_INTERVAL=5000
|
|
152
157
|
```
|
|
153
158
|
|
|
154
159
|
---
|
package/README.vi.md
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* **🤖 Terminal PTY Qua Telegram** — Thực thi và điều khiển các phiên shell tương tác thời gian thực (PowerShell, Bash, Codex hoặc Antigravity) từ xa thông qua Telegram.
|
|
38
38
|
* **⚙️ Trình Cấu Hình Động Trực Tiếp** — Thay đổi các tham số môi trường động thông qua menu `/config` bằng các phím inline Telegram hoặc trực tiếp trên CLI.
|
|
39
39
|
* **📂 Quản Lý Workspace Linh Hoạt** — Điều hướng và chuyển đổi nhanh chóng giữa các thư mục làm việc khác nhau trên máy chủ cục bộ.
|
|
40
|
-
* **🔄 Luồng Đầu Ra Được Tối Ưu Hóa** — Cơ chế gom cụm
|
|
40
|
+
* **🔄 Luồng Đầu Ra Được Tối Ưu Hóa** — Cơ chế gom cụm đầu ra thông minh với khoảng giãn cách cấu hình được (`OUTPUT_INTERVAL`) và độ trễ flush kích hoạt bởi tương tác (`ACTION_INTERVAL`), giúp nhật ký terminal hiển thị mượt mà trên Telegram mà không vượt quá giới hạn API.
|
|
41
41
|
* **🚀 Khởi Động Cùng Hệ Điều Hành** — Dễ dàng cấu hình để chạy như một dịch vụ nền khi hệ thống khởi động (hỗ trợ Windows và Linux).
|
|
42
42
|
* **🌐 Hỗ Trợ Đa Ngôn Ngữ** — Bản dịch hoàn chỉnh cho tiếng Anh (`en`) và tiếng Việt (`vi`).
|
|
43
43
|
* **🛡️ Bảo Mật Nghiêm Ngặt** — Xác thực token và kiểm tra quyền hạn chặt chẽ, chỉ cho phép tài khoản Admin đã cấu hình điều khiển hệ thống.
|
|
@@ -126,6 +126,9 @@ Khi bot đang hoạt động, bạn có thể tương tác với nó thông qua
|
|
|
126
126
|
* **⛔ Esc** — Gửi phím Escape để hủy lệnh/tiến trình đang chạy.
|
|
127
127
|
* **⏎ Enter** — Gửi phím xuống dòng (chấp nhận lệnh).
|
|
128
128
|
* **▲ Up / ▼ Down** — Duyệt lại lịch sử các lệnh đã gõ.
|
|
129
|
+
* **🔄 Tải lại** — Yêu cầu cập nhật màn hình terminal ngay lập tức.
|
|
130
|
+
> [!NOTE]
|
|
131
|
+
> Việc nhấn các phím chức năng (**Esc**, **Enter**, **Up**, **Down**) hoặc nút **Tải lại** sẽ kích hoạt gửi kết quả terminal sau một khoảng trễ ngắn (cấu hình qua `ACTION_INTERVAL`, mặc định là 5 giây) và bỏ qua bộ lọc tin nhắn trùng lặp để đảm bảo bạn thấy kết quả mới nhất.
|
|
129
132
|
|
|
130
133
|
#### **📂 Thư Mục Làm Việc (Workspaces)**
|
|
131
134
|
* Chọn **📁 Workspaces** từ menu chính để xem danh sách các thư mục được cấu hình.
|
|
@@ -149,6 +152,8 @@ TELEGRAM_USERNAME=@your_telegram_username
|
|
|
149
152
|
CLIENT_NAME=nonstop-local
|
|
150
153
|
APP_LANGUAGE=en
|
|
151
154
|
STARTUP_MODE=disabled
|
|
155
|
+
OUTPUT_INTERVAL=20000
|
|
156
|
+
ACTION_INTERVAL=5000
|
|
152
157
|
```
|
|
153
158
|
|
|
154
159
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quangnv13/nonstop",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"preferGlobal": true,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"files": [
|
|
30
30
|
"dist",
|
|
31
31
|
"images",
|
|
32
|
+
"scripts",
|
|
32
33
|
"README.md",
|
|
33
34
|
"README.vi.md"
|
|
34
35
|
],
|
|
@@ -39,7 +40,8 @@
|
|
|
39
40
|
"dev": "tsx watch src/index.ts",
|
|
40
41
|
"build": "tsc -p tsconfig.json",
|
|
41
42
|
"start": "node dist/index.js",
|
|
42
|
-
"test": "node --import tsx --test src/*.test.ts"
|
|
43
|
+
"test": "node --import tsx --test src/*.test.ts",
|
|
44
|
+
"preinstall": "node scripts/preinstall.js"
|
|
43
45
|
},
|
|
44
46
|
"dependencies": {
|
|
45
47
|
"boxen": "^5.1.2",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { execSync } = require('child_process');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
|
|
5
|
+
function killOldProcesses() {
|
|
6
|
+
const platform = os.platform();
|
|
7
|
+
console.log(`[nonstop] Pre-install hook: Checking for running nonstop processes on ${platform}...`);
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
if (platform === 'win32') {
|
|
11
|
+
// Windows PowerShell command to find and kill node processes running nonstop background
|
|
12
|
+
const cmd = `powershell -NoProfile -Command "Get-CimInstance Win32_Process -Filter \\"name = 'node.exe'\\" | Where-Object { $_.CommandLine -like '*nonstop*' -and $_.CommandLine -like '*--background*' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force; Write-Host 'Killed nonstop background process PID' $_.ProcessId }"`;
|
|
13
|
+
const output = execSync(cmd, { encoding: 'utf8' });
|
|
14
|
+
if (output.trim()) {
|
|
15
|
+
console.log(output.trim());
|
|
16
|
+
} else {
|
|
17
|
+
console.log('[nonstop] No running nonstop background processes found on Windows.');
|
|
18
|
+
}
|
|
19
|
+
} else {
|
|
20
|
+
// Unix/Linux/macOS command
|
|
21
|
+
try {
|
|
22
|
+
const cmd = `pkill -9 -f "node.*nonstop.*--background"`;
|
|
23
|
+
execSync(cmd);
|
|
24
|
+
console.log('[nonstop] Killed running nonstop background processes on Unix.');
|
|
25
|
+
} catch (err) {
|
|
26
|
+
// pkill exits with 1 if no processes match
|
|
27
|
+
console.log('[nonstop] No running nonstop background processes found on Unix.');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.warn('[nonstop] Warning during pre-install check:', error.message);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
killOldProcesses();
|