@quangnv13/nonstop 1.0.7 → 1.0.9
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 +3 -0
- package/README.vi.md +3 -0
- package/dist/bot.js +1 -0
- package/dist/runtime.js +16 -3
- package/dist/store.js +4 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -97,6 +97,9 @@ nonstop
|
|
|
97
97
|
|
|
98
98
|
## 🕹️ Usage Guide
|
|
99
99
|
|
|
100
|
+
> [!IMPORTANT]
|
|
101
|
+
> **No workspaces are auto-generated on first launch.** To start working on any folder, you must first configure/create a workspace mapping to that folder (either via the local TUI Control Center or the Telegram Bot's `📁 Workspaces` menu).
|
|
102
|
+
|
|
100
103
|
### 1. Local TUI Control Center
|
|
101
104
|
Simply run `nonstop` in your terminal to open the management dashboard. From here, you can:
|
|
102
105
|
* **Start / Stop** the background bot runtime.
|
package/README.vi.md
CHANGED
|
@@ -97,6 +97,9 @@ nonstop
|
|
|
97
97
|
|
|
98
98
|
## 🕹️ Hướng Dẫn Sử Dụng
|
|
99
99
|
|
|
100
|
+
> [!IMPORTANT]
|
|
101
|
+
> **Không có workspace nào được tự động tạo sẵn trong lần chạy đầu tiên.** Để bắt đầu làm việc trên thư mục mong muốn, bạn phải tạo/cấu hình ít nhất một workspace liên kết với thư mục đó (thông qua Trung tâm điều khiển TUI cục bộ hoặc menu `📁 Workspaces` của Bot Telegram).
|
|
102
|
+
|
|
100
103
|
### 1. Trung Tâm Điều Khiển TUI Cục Bộ
|
|
101
104
|
Chỉ cần chạy lệnh `nonstop` trên terminal của bạn để mở giao diện bảng điều khiển. Từ đây bạn có thể:
|
|
102
105
|
* **Khởi động / Dừng (Start / Stop)** bot chạy ẩn.
|
package/dist/bot.js
CHANGED
package/dist/runtime.js
CHANGED
|
@@ -134,7 +134,8 @@ class NonstopRuntime {
|
|
|
134
134
|
sendInput: (data) => this.sendSessionInput(data),
|
|
135
135
|
sendKey: (key) => this.sendSessionKey(key),
|
|
136
136
|
setInputMode: (inputMode) => this.setSessionInputMode(inputMode),
|
|
137
|
-
setAutoEnter: (autoEnter) => this.setSessionAutoEnter(autoEnter)
|
|
137
|
+
setAutoEnter: (autoEnter) => this.setSessionAutoEnter(autoEnter),
|
|
138
|
+
flushSessionOutput: () => this.flushSessionOutput()
|
|
138
139
|
});
|
|
139
140
|
this.setSessionOutputPushCallback(async (chatId, text, options) => {
|
|
140
141
|
await this.bot?.pushSessionOutput(chatId, text, options);
|
|
@@ -184,6 +185,18 @@ class NonstopRuntime {
|
|
|
184
185
|
this.writeHeartbeat();
|
|
185
186
|
}
|
|
186
187
|
}
|
|
188
|
+
async flushSessionOutput() {
|
|
189
|
+
await this.flushOutput(true, true);
|
|
190
|
+
if (this.outputTicker) {
|
|
191
|
+
clearInterval(this.outputTicker);
|
|
192
|
+
this.outputTicker = null;
|
|
193
|
+
}
|
|
194
|
+
if (this.actionOutputTimeout) {
|
|
195
|
+
clearTimeout(this.actionOutputTimeout);
|
|
196
|
+
this.actionOutputTimeout = null;
|
|
197
|
+
}
|
|
198
|
+
this.ensureOutputTicker();
|
|
199
|
+
}
|
|
187
200
|
async startSession(chatId, workspace, preset) {
|
|
188
201
|
if (this.activeSession?.status === 'running') {
|
|
189
202
|
throw new Error(`Session "${this.activeSession.sessionId}" is already running.`);
|
|
@@ -345,7 +358,7 @@ class NonstopRuntime {
|
|
|
345
358
|
applyTerminalOutput(this.terminalState, chunk, this.config.maxRenderLines);
|
|
346
359
|
this.ensureOutputTicker();
|
|
347
360
|
}
|
|
348
|
-
async flushOutput(forceSnapshot = false) {
|
|
361
|
+
async flushOutput(forceSnapshot = false, ignoreDuplicate = false) {
|
|
349
362
|
const session = this.activeSession;
|
|
350
363
|
if (!session) {
|
|
351
364
|
this.outputBuffer.current = '';
|
|
@@ -366,7 +379,7 @@ class NonstopRuntime {
|
|
|
366
379
|
if (isSpinnerOrNoiseOutput(finalText)) {
|
|
367
380
|
return;
|
|
368
381
|
}
|
|
369
|
-
if ((0, session_delivery_js_1.shouldSkipSessionOutput)(session.lastSentFinalText, finalText)) {
|
|
382
|
+
if (!ignoreDuplicate && (0, session_delivery_js_1.shouldSkipSessionOutput)(session.lastSentFinalText, finalText)) {
|
|
370
383
|
return;
|
|
371
384
|
}
|
|
372
385
|
const messages = (0, session_output_js_1.buildSessionOutputMessages)({
|
package/dist/store.js
CHANGED
|
@@ -52,26 +52,22 @@ exports.workspacesFilePath = path.join(exports.DATA_DIR, 'workspaces.json');
|
|
|
52
52
|
function loadWorkspaces() {
|
|
53
53
|
ensureDataDir();
|
|
54
54
|
if (!fs.existsSync(exports.workspacesFilePath)) {
|
|
55
|
-
return
|
|
55
|
+
return [];
|
|
56
56
|
}
|
|
57
57
|
try {
|
|
58
58
|
const raw = fs.readFileSync(exports.workspacesFilePath, 'utf8');
|
|
59
59
|
const parsed = JSON.parse(raw);
|
|
60
60
|
if (!Array.isArray(parsed)) {
|
|
61
|
-
return
|
|
61
|
+
return [];
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
return parsed.filter(isWorkspaceRecord).map((workspace) => ({
|
|
64
64
|
id: workspace.id,
|
|
65
65
|
name: workspace.name,
|
|
66
66
|
path: workspace.path
|
|
67
67
|
}));
|
|
68
|
-
if (workspaces.length === 0) {
|
|
69
|
-
return regenerateDefaultWorkspaces();
|
|
70
|
-
}
|
|
71
|
-
return workspaces;
|
|
72
68
|
}
|
|
73
69
|
catch {
|
|
74
|
-
return
|
|
70
|
+
return [];
|
|
75
71
|
}
|
|
76
72
|
}
|
|
77
73
|
function saveWorkspaces(workspaces) {
|
|
@@ -90,25 +86,3 @@ function isWorkspaceRecord(value) {
|
|
|
90
86
|
typeof record.name === 'string' &&
|
|
91
87
|
typeof record.path === 'string');
|
|
92
88
|
}
|
|
93
|
-
function regenerateDefaultWorkspaces() {
|
|
94
|
-
const rootDir = path.resolve(exports.DATA_DIR, '..');
|
|
95
|
-
const defaultWorkspaces = [
|
|
96
|
-
{
|
|
97
|
-
id: 'ws_root',
|
|
98
|
-
name: 'Project Root',
|
|
99
|
-
path: rootDir.replace(/\\/g, '/')
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: 'ws_src',
|
|
103
|
-
name: 'Source',
|
|
104
|
-
path: path.join(rootDir, 'src').replace(/\\/g, '/')
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
id: 'ws_docs',
|
|
108
|
-
name: 'Docs',
|
|
109
|
-
path: path.join(rootDir, 'docs').replace(/\\/g, '/')
|
|
110
|
-
}
|
|
111
|
-
];
|
|
112
|
-
saveWorkspaces(defaultWorkspaces);
|
|
113
|
-
return defaultWorkspaces;
|
|
114
|
-
}
|