dsh-tg-bridge 1.41.1 → 1.41.2
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/package.json +1 -1
- package/turn/progress.mjs +9 -1
package/package.json
CHANGED
package/turn/progress.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// file, rewritten between two other moves. Its inputs are the language, the
|
|
6
6
|
// topic and the task; everything Telegram-facing comes from `telegram.mjs`, and
|
|
7
7
|
// the layout from `panel.mjs` (a pure renderer, still untouched).
|
|
8
|
-
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
8
|
+
import { mkdirSync, readFileSync, statSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
9
9
|
import { join } from 'node:path';
|
|
10
10
|
import { config, log, state } from '../core/state.mjs';
|
|
11
11
|
import { THOUGHT_DIR } from '../core/paths.mjs';
|
|
@@ -418,6 +418,14 @@ export async function startProgress(chatId, threadId, lang = config.lang || 'en'
|
|
|
418
418
|
// worth more than an empty promise of a trail.
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
+
// A turn that wrote no note leaves an empty file behind, and every turn
|
|
422
|
+
// creates one: 269 of 285 files in one real folder were 0 bytes. The card
|
|
423
|
+
// is finished by the time this runs, so nothing reads it again.
|
|
424
|
+
if (thoughtFile && notes === thoughtFile) {
|
|
425
|
+
try {
|
|
426
|
+
if (statSync(notes).size === 0) unlinkSync(notes);
|
|
427
|
+
} catch {}
|
|
428
|
+
}
|
|
421
429
|
if (result?.stopped) {
|
|
422
430
|
// The person pressed Стоп. The card says so in their words, not with a
|
|
423
431
|
// ⚠️ and not with a retry button: nothing failed, and the session is
|