@hienlh/ppm 0.9.44 → 0.9.45

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.45] - 2026-04-06
4
+
5
+ ### Fixed
6
+ - **Identity lost on server restart**: Identity save ran AFTER `streamToTelegram()` — if streaming timed out, the save was skipped. Moved identity persistence to before streaming so it writes to SQLite immediately.
7
+
8
+ ### Added
9
+ - **Restart notification includes version**: `/restart` now sends "PPM v0.9.45 restarted successfully" instead of generic message.
10
+
3
11
  ## [0.9.42] - 2026-04-06
4
12
 
5
13
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hienlh/ppm",
3
- "version": "0.9.44",
3
+ "version": "0.9.45",
4
4
  "description": "Personal Project Manager — mobile-first web IDE with AI assistance",
5
5
  "author": "hienlh",
6
6
  "license": "MIT",
@@ -407,8 +407,16 @@ class PPMBotService {
407
407
  // Only notify if restart was recent (< 60s)
408
408
  if (Date.now() - data.ts > 60_000) return;
409
409
 
410
+ // Read version from package.json
411
+ let version = "";
412
+ try {
413
+ const pkgPath = join(import.meta.dir, "../../../package.json");
414
+ const pkg = await Bun.file(pkgPath).json();
415
+ version = pkg.version ? ` v${pkg.version}` : "";
416
+ } catch {}
417
+
410
418
  for (const cid of data.chatIds) {
411
- await this.telegram?.sendMessage(Number(cid), "✅ PPM restarted successfully.");
419
+ await this.telegram?.sendMessage(Number(cid), `✅ PPM${version} restarted successfully.`);
412
420
  }
413
421
  } catch {}
414
422
  }
@@ -500,6 +508,20 @@ class PPMBotService {
500
508
  fullMessage = `<system-context>\n${systemPrompt}\n</system-context>\n\n${text}`;
501
509
  }
502
510
 
511
+ // Save identity BEFORE streaming — must persist even if streaming times out
512
+ if (this.identityPending.has(chatId)) {
513
+ this.identityPending.delete(chatId);
514
+ this.memory.saveOne("_global", `User identity: ${text}`, "preference", session.sessionId);
515
+ console.log("[ppmbot] Saved identity memory from onboarding");
516
+ } else if (!this.hasCheckedIdentity.has(chatId)) {
517
+ this.hasCheckedIdentity.add(chatId);
518
+ const globalMems = this.memory.getSummary("_global", 50);
519
+ if (!globalMems.some((m) => m.category === "preference" && /identity/i.test(m.content))) {
520
+ this.memory.saveOne("_global", `User identity: ${text}`, "preference", session.sessionId);
521
+ console.log("[ppmbot] Saved identity memory (first message, no identity found)");
522
+ }
523
+ }
524
+
503
525
  const events = chatService.sendMessage(
504
526
  session.providerId,
505
527
  session.sessionId,
@@ -518,21 +540,6 @@ class PPMBotService {
518
540
  },
519
541
  );
520
542
 
521
- // Capture identity: save when onboarding was shown OR when no identity exists
522
- // (handles server restarts losing the in-memory flag)
523
- if (this.identityPending.has(chatId)) {
524
- this.identityPending.delete(chatId);
525
- this.memory.saveOne("_global", `User identity: ${text}`, "preference", session.sessionId);
526
- console.log("[ppmbot] Saved identity memory from onboarding");
527
- } else if (!this.hasCheckedIdentity.has(chatId)) {
528
- this.hasCheckedIdentity.add(chatId);
529
- const globalMems = this.memory.getSummary("_global", 50);
530
- if (!globalMems.some((m) => m.category === "preference" && /identity/i.test(m.content))) {
531
- this.memory.saveOne("_global", `User identity: ${text}`, "preference", session.sessionId);
532
- console.log("[ppmbot] Saved identity memory (first message, no identity found)");
533
- }
534
- }
535
-
536
543
  // Periodic memory extraction — fire-and-forget every N messages
537
544
  const count = (this.messageCount.get(session.sessionId) ?? 0) + 1;
538
545
  this.messageCount.set(session.sessionId, count);