@quangnv13/nonstop 1.0.8 → 1.0.10

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/dist/bot.js CHANGED
@@ -592,6 +592,7 @@ function createBotRuntime(deps) {
592
592
  await showSessionsMenu(ctx);
593
593
  return;
594
594
  case 'refresh':
595
+ await deps.flushSessionOutput();
595
596
  break;
596
597
  default:
597
598
  await ctx.reply(t('bot.sessionControls.unsupportedAction', { action }));
package/dist/config.js CHANGED
@@ -51,6 +51,7 @@ const DEFAULTS = {
51
51
  language: 'en',
52
52
  startupMode: 'disabled',
53
53
  outputInterval: 20000,
54
+ actionInterval: 5000,
54
55
  maxOutputLines: 50,
55
56
  maxRenderLines: 200,
56
57
  codexCmd: 'codex',
@@ -74,7 +75,8 @@ function parseConfigFromEnv(env) {
74
75
  codexCmd: env.CODEX_CMD?.trim() || DEFAULTS.codexCmd,
75
76
  codexArgs: env.CODEX_ARGS?.trim() || DEFAULTS.codexArgs,
76
77
  antigravityCmd: env.ANTIGRAVITY_CMD?.trim() || DEFAULTS.antigravityCmd,
77
- antigravityArgs: env.ANTIGRAVITY_ARGS?.trim() || DEFAULTS.antigravityArgs
78
+ antigravityArgs: env.ANTIGRAVITY_ARGS?.trim() || DEFAULTS.antigravityArgs,
79
+ actionInterval: parseInteger(env.ACTION_INTERVAL, DEFAULTS.actionInterval)
78
80
  };
79
81
  }
80
82
  function getMissingConfigFields(config) {
@@ -96,6 +98,7 @@ function serializeConfigToEnv(config) {
96
98
  `APP_LANGUAGE=${config.language}`,
97
99
  `STARTUP_MODE=${config.startupMode}`,
98
100
  `OUTPUT_INTERVAL=${config.outputInterval}`,
101
+ `ACTION_INTERVAL=${config.actionInterval}`,
99
102
  `MAX_OUTPUT_LINES=${config.maxOutputLines}`,
100
103
  `MAX_RENDER_LINES=${config.maxRenderLines}`,
101
104
  '',
@@ -145,6 +148,7 @@ function applyConfigToProcessEnv(config) {
145
148
  process.env.APP_LANGUAGE = config.language;
146
149
  process.env.STARTUP_MODE = config.startupMode;
147
150
  process.env.OUTPUT_INTERVAL = String(config.outputInterval);
151
+ process.env.ACTION_INTERVAL = String(config.actionInterval);
148
152
  process.env.MAX_OUTPUT_LINES = String(config.maxOutputLines);
149
153
  process.env.MAX_RENDER_LINES = String(config.maxRenderLines);
150
154
  process.env.CODEX_CMD = config.codexCmd;
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,24 @@ class NonstopRuntime {
184
185
  this.writeHeartbeat();
185
186
  }
186
187
  }
188
+ async flushSessionOutput() {
189
+ this.triggerActionOutputTimeout();
190
+ }
191
+ triggerActionOutputTimeout() {
192
+ if (this.outputTicker) {
193
+ clearInterval(this.outputTicker);
194
+ this.outputTicker = null;
195
+ }
196
+ if (this.actionOutputTimeout) {
197
+ clearTimeout(this.actionOutputTimeout);
198
+ this.actionOutputTimeout = null;
199
+ }
200
+ this.actionOutputTimeout = setTimeout(async () => {
201
+ this.actionOutputTimeout = null;
202
+ await this.flushOutput(true, true);
203
+ this.ensureOutputTicker();
204
+ }, this.config.actionInterval);
205
+ }
187
206
  async startSession(chatId, workspace, preset) {
188
207
  if (this.activeSession?.status === 'running') {
189
208
  throw new Error(`Session "${this.activeSession.sessionId}" is already running.`);
@@ -262,6 +281,9 @@ class NonstopRuntime {
262
281
  return;
263
282
  }
264
283
  driver.write(data);
284
+ if (data.includes('\r') || data.includes('\n')) {
285
+ this.triggerActionOutputTimeout();
286
+ }
265
287
  }
266
288
  sendSessionKey(key) {
267
289
  const driver = this.activeDriverRef.current;
@@ -280,19 +302,7 @@ class NonstopRuntime {
280
302
  }
281
303
  driver.write(input);
282
304
  if (['send_escape', 'send_enter', 'send_up', 'send_down'].includes(key)) {
283
- if (this.outputTicker) {
284
- clearInterval(this.outputTicker);
285
- this.outputTicker = null;
286
- }
287
- if (this.actionOutputTimeout) {
288
- clearTimeout(this.actionOutputTimeout);
289
- this.actionOutputTimeout = null;
290
- }
291
- this.actionOutputTimeout = setTimeout(async () => {
292
- this.actionOutputTimeout = null;
293
- await this.flushOutput(true);
294
- this.ensureOutputTicker();
295
- }, 5000);
305
+ this.triggerActionOutputTimeout();
296
306
  }
297
307
  }
298
308
  resolveWorkspaceById(workspaceId) {
@@ -345,7 +355,7 @@ class NonstopRuntime {
345
355
  applyTerminalOutput(this.terminalState, chunk, this.config.maxRenderLines);
346
356
  this.ensureOutputTicker();
347
357
  }
348
- async flushOutput(forceSnapshot = false) {
358
+ async flushOutput(forceSnapshot = false, ignoreDuplicate = false) {
349
359
  const session = this.activeSession;
350
360
  if (!session) {
351
361
  this.outputBuffer.current = '';
@@ -366,7 +376,7 @@ class NonstopRuntime {
366
376
  if (isSpinnerOrNoiseOutput(finalText)) {
367
377
  return;
368
378
  }
369
- if ((0, session_delivery_js_1.shouldSkipSessionOutput)(session.lastSentFinalText, finalText)) {
379
+ if (!ignoreDuplicate && (0, session_delivery_js_1.shouldSkipSessionOutput)(session.lastSentFinalText, finalText)) {
370
380
  return;
371
381
  }
372
382
  const messages = (0, session_output_js_1.buildSessionOutputMessages)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quangnv13/nonstop",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "preferGlobal": true,
5
5
  "publishConfig": {
6
6
  "access": "public"