observal-pi 1.4.3 → 1.5.0

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.
@@ -348,19 +348,30 @@ export default function (pi: ExtensionAPI) {
348
348
  .filter((l) => l.trim());
349
349
 
350
350
  if (lines.length > 0) {
351
- const payload = JSON.stringify({
352
- session_id: sessionId,
353
- ide: "pi",
354
- agent_id: s.config?.agent_id ?? null,
355
- agent_version: s.config?.agent_version ?? null,
356
- lines,
357
- start_offset: entry.line_count,
358
- hook_event: "CrashRecovery",
359
- final: true,
360
- total_line_count: entry.line_count + lines.length,
361
- total_offset: fileStat.size,
362
- });
363
- await postWithTimeout(s.config!, "/api/v1/ingest/session", payload);
351
+ let pushOk = true;
352
+ for (let offset = 0; offset < lines.length; offset += MAX_LINES_PER_CHUNK) {
353
+ const chunk = lines.slice(offset, offset + MAX_LINES_PER_CHUNK);
354
+ const isLastChunk = offset + MAX_LINES_PER_CHUNK >= lines.length;
355
+ const payload = JSON.stringify({
356
+ session_id: sessionId,
357
+ ide: "pi",
358
+ agent_id: s.config?.agent_id ?? null,
359
+ agent_version: s.config?.agent_version ?? null,
360
+ lines: chunk,
361
+ start_offset: entry.line_count + offset,
362
+ hook_event: "CrashRecovery",
363
+ final: isLastChunk,
364
+ ...(isLastChunk
365
+ ? {
366
+ total_line_count: entry.line_count + lines.length,
367
+ total_offset: fileStat.size,
368
+ }
369
+ : {}),
370
+ });
371
+ const ok = await postWithTimeout(s.config!, "/api/v1/ingest/session", payload);
372
+ if (!ok) { pushOk = false; break; }
373
+ }
374
+ if (!pushOk) continue; // skip finalization, retry next startup
364
375
  }
365
376
 
366
377
  writeCursor(sessionId, fileStat.size, entry.line_count + lines.length, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "observal-pi",
3
- "version": "1.4.3",
3
+ "version": "1.5.0",
4
4
  "description": "Observal session telemetry for Pi — zero-dependency extension that pushes session traces to your Observal server",
5
5
  "keywords": [
6
6
  "pi-package",