@lightupai/polaris 0.0.105 → 0.0.106

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightupai/polaris",
3
- "version": "0.0.105",
3
+ "version": "0.0.106",
4
4
  "description": "Record and stream Claude Code sessions to Slack. Like Gong for AI coding — capture every prompt, response, and tool call. Multiplayer collaboration across AI coding agents.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -402,6 +402,16 @@ async function backfill(mapping: SessionMapping, duration?: string, from?: strin
402
402
  }
403
403
  }
404
404
 
405
+ // Collect all CC session IDs that belong to this mapping (MCP UUID + any hook alias).
406
+ // Both the MCP client's UUID and the CC hook session_id (if they differ) must match.
407
+ const knownCcIds = new Set<string>();
408
+ knownCcIds.add(mapping.ccSessionId);
409
+ for (const [id, m] of sessions) {
410
+ if (m.project === mapping.project && m.session === mapping.session) {
411
+ knownCcIds.add(id);
412
+ }
413
+ }
414
+
405
415
  // Read daemon log files covering the time range
406
416
  const logEntries: Array<{ t: string; endpoint: string; payload: Record<string, unknown>; project?: string; session?: string; ccSessionId?: string; response?: unknown }> = [];
407
417
  const startDate = since.toISOString().slice(0, 10);
@@ -426,14 +436,16 @@ async function backfill(mapping: SessionMapping, duration?: string, from?: strin
426
436
  if (entry.endpoint !== "/events") continue;
427
437
  if (new Date(entry.t) <= since) continue;
428
438
  if (new Date(entry.t) > now) continue;
429
- // Filter by origin (added since v0.0.105). Old entries without these fields
430
- // pass through for backwards compatibility with pre-105 logs.
431
- if (entry.project !== undefined && entry.project !== mapping.project) continue;
432
- if (entry.session !== undefined && entry.session !== mapping.session) continue;
433
- if (entry.ccSessionId !== undefined && entry.ccSessionId !== mapping.ccSessionId) continue;
434
439
  // Skip error-response entries — they're duplicates of the primary entry
435
440
  // and would cause the same event to be replayed twice.
436
441
  if (entry.response !== undefined) continue;
442
+ // Filter by origin. New entries (v0.0.105+) have explicit context fields;
443
+ // old entries can be matched via payload.session_id. Both must belong to
444
+ // this mapping's known CC session IDs to prevent cross-session pollution.
445
+ const entrySessionId: string | undefined = entry.ccSessionId ?? entry.payload.session_id;
446
+ if (entrySessionId !== undefined && !knownCcIds.has(entrySessionId)) continue;
447
+ if (entry.project !== undefined && entry.project !== mapping.project) continue;
448
+ if (entry.session !== undefined && entry.session !== mapping.session) continue;
437
449
  logEntries.push(entry);
438
450
  } catch { /* skip malformed lines */ }
439
451
  }