@quangnv13/nonstop 1.0.8 → 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/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/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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quangnv13/nonstop",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "preferGlobal": true,
5
5
  "publishConfig": {
6
6
  "access": "public"