dsh-tg-bridge 1.7.5 → 1.7.6

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.
Files changed (2) hide show
  1. package/control.mjs +16 -1
  2. package/package.json +1 -1
package/control.mjs CHANGED
@@ -368,6 +368,21 @@ function recentSessions(cwd, limit, lang = 'ru') { const root = join(DSH_HOME,
368
368
  .map((row) => ({ ...row, title: titles.get(bareId(row.id))?.title || t(lang, 'ctrl.sessions.untitled') }));
369
369
  }
370
370
 
371
+ /**
372
+ * A session's title, read from DSH's own projection cache. `/sessions` already
373
+ * shows these, and the status card is a worse place to lose one: the card is
374
+ * what a person screenshots. Empty when the session was never titled.
375
+ */
376
+ function sessionTitle(id) {
377
+ const record = readJson(join(DSH_HOME, 'storages', 'session_projcache', 'sessions', `session-${bareId(id)}.json`));
378
+ const rows = record?.record?.rows ?? record?.rows ?? {};
379
+ const title = rows.title?.val;
380
+ if (typeof title === 'string' && title.trim()) return title.trim();
381
+ const first = rows.titleInput?.val?.first?.text;
382
+ if (typeof first === 'string' && first.trim()) return first.trim().split('\n')[0].slice(0, 80);
383
+ return '';
384
+ }
385
+
371
386
  /** Skills directory listing. */
372
387
  function skillsOf() {
373
388
  const dir = join(DSH_HOME, 'skills');
@@ -494,7 +509,7 @@ export async function handleControl(ctx) {
494
509
  // ("how much context is left", "how big is this session").
495
510
  const sessionId = state.sessions[key] || '';
496
511
  const stats = sessionId ? sessionStats(sessionFile(join(DSH_HOME, 'sessions'), sessionId)) : null;
497
- const title = sessionId ? state.titles?.[key] : '';
512
+ const title = sessionId ? (state.titles?.[key] || sessionTitle(sessionId)) : '';
498
513
  const lines = [t(lang, 'ctrl.status.head')];
499
514
  lines.push(t(lang, 'ctrl.status.session', { id: sessionId || t(lang, 'ctrl.session.none') }));
500
515
  if (title) lines.push(t(lang, 'ctrl.status.title', { title }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tg-bridge",
3
- "version": "1.7.5",
3
+ "version": "1.7.6",
4
4
  "description": "Telegram bridge for DeepSeek Harness: text, voice, photos and project-per-topic sessions without opening the desktop app",
5
5
  "type": "module",
6
6
  "main": "plugin-bridge.mjs",