@hienlh/ppm 0.9.36 → 0.9.38

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,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.38] - 2026-04-06
4
+
5
+ ### Fixed
6
+ - **Stream hangs 3 minutes after AI finishes**: `done` event was received but the `for-await` loop didn't break — `break` inside `switch` only exits the switch, not the loop. Used labeled `break eventLoop` to properly terminate on `done`.
7
+
3
8
  ## [0.9.36] - 2026-04-06
4
9
 
5
10
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hienlh/ppm",
3
- "version": "0.9.36",
3
+ "version": "0.9.38",
4
4
  "description": "Personal Project Manager — mobile-first web IDE with AI assistance",
5
5
  "author": "hienlh",
6
6
  "license": "MIT",
@@ -149,8 +149,14 @@ export async function streamToTelegram(
149
149
  };
150
150
 
151
151
  // Process event stream with per-event timeout
152
+ let eventCount = 0;
152
153
  try {
153
- for await (const event of withEventTimeout(events, EVENT_TIMEOUT_MS)) {
154
+ eventLoop: for await (const event of withEventTimeout(events, EVENT_TIMEOUT_MS)) {
155
+ eventCount++;
156
+ // Debug: log each event type to help diagnose streaming issues
157
+ if (event.type !== "text") {
158
+ console.log(`[ppmbot-stream] event #${eventCount}: ${event.type}${event.type === "tool_use" ? ` (${(event as any).tool})` : ""}`);
159
+ }
154
160
  await refreshTyping();
155
161
 
156
162
  switch (event.type) {
@@ -201,7 +207,7 @@ export async function streamToTelegram(
201
207
  case "done": {
202
208
  result.contextWindowPct = event.contextWindowPct;
203
209
  result.resultSubtype = event.resultSubtype;
204
- break;
210
+ break eventLoop; // break the for-await, not just the switch
205
211
  }
206
212
 
207
213
  case "session_migrated": {
@@ -223,12 +229,15 @@ export async function streamToTelegram(
223
229
  }
224
230
  }
225
231
  } catch (err) {
232
+ console.error(`[ppmbot-stream] Stream ended with error after ${eventCount} events: ${(err as Error).message}`);
226
233
  appendHtml(
227
234
  segments,
228
235
  `\n\n❌ <b>Stream error:</b> ${escapeHtml((err as Error).message)}`,
229
236
  );
230
237
  }
231
238
 
239
+ console.log(`[ppmbot-stream] Complete: ${eventCount} events, ${segments.length} segments`);
240
+
232
241
  // Final edit with complete content
233
242
  if (currentMsgId && hasContent(segments)) {
234
243
  const html = renderSegments(segments);