sentinelayer-cli 0.31.2 → 0.31.3

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": "sentinelayer-cli",
3
- "version": "0.31.2",
3
+ "version": "0.31.3",
4
4
  "description": "Scaffold Sentinelayer spec/prompt/guide artifacts with secure browser auth and token bootstrap.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -641,6 +641,28 @@ function buildSessionActionEvents(sessionId, actions = []) {
641
641
  .filter(Boolean);
642
642
  }
643
643
 
644
+ function filterSessionActionEventsForTranscriptWindow(actionEvents = [], transcriptEvents = []) {
645
+ if (!Array.isArray(actionEvents) || actionEvents.length === 0) return [];
646
+ if (!Array.isArray(transcriptEvents) || transcriptEvents.length === 0) return [];
647
+ const targetSequences = new Set();
648
+ const targetCursors = new Set();
649
+ for (const event of transcriptEvents) {
650
+ const sequence = eventSequenceNumber(event);
651
+ if (sequence > 0) targetSequences.add(sequence);
652
+ const cursor = normalizeString(event?.cursor);
653
+ if (cursor) targetCursors.add(cursor);
654
+ }
655
+ return actionEvents.filter((event) => {
656
+ const payload = event?.payload || {};
657
+ const sequence = Number(payload.targetSequenceId || 0);
658
+ if (Number.isFinite(sequence) && sequence > 0 && targetSequences.has(Math.floor(sequence))) {
659
+ return true;
660
+ }
661
+ const cursor = normalizeString(payload.targetCursor);
662
+ return Boolean(cursor && targetCursors.has(cursor));
663
+ });
664
+ }
665
+
644
666
  function readProjectionUnacknowledgedHumanMessages(remoteActions = null) {
645
667
  const messages = remoteActions?.projection?.unacknowledgedHumanMessages;
646
668
  return Array.isArray(messages)
@@ -5530,7 +5552,7 @@ export function registerSessionCommand(program) {
5530
5552
  }
5531
5553
  }
5532
5554
  }
5533
- const actionEvents = remoteActions?.ok
5555
+ const rawActionEvents = remoteActions?.ok
5534
5556
  ? buildSessionActionEvents(normalizedSessionId, remoteActions.actions)
5535
5557
  : [];
5536
5558
  const unacknowledgedHumanMessages = remoteActions?.ok
@@ -5540,10 +5562,20 @@ export function registerSessionCommand(program) {
5540
5562
  ? readProjectionRecentHumanActivity(remoteActions)
5541
5563
  : [];
5542
5564
  const dedupedDisplayEvents = dedupeSessionEvents(displayEvents);
5565
+ const remoteWindowRead = Boolean(options.remote && beforeSequence);
5566
+ const remoteWindowEvents = remoteTail?.ok
5567
+ ? dedupeSessionEvents(Array.isArray(remoteTailAppendEvents) ? remoteTailAppendEvents : [])
5568
+ : [];
5569
+ const sourceEvents = remoteWindowRead && remoteTail?.ok
5570
+ ? remoteWindowEvents
5571
+ : dedupedDisplayEvents;
5543
5572
  const transcriptEvents = includeControlEvents
5544
- ? dedupedDisplayEvents
5545
- : dedupedDisplayEvents.filter((event) => !isSessionControlEvent(event));
5546
- const hiddenControlEventCount = dedupedDisplayEvents.length - transcriptEvents.length;
5573
+ ? sourceEvents
5574
+ : sourceEvents.filter((event) => !isSessionControlEvent(event));
5575
+ const hiddenControlEventCount = sourceEvents.length - transcriptEvents.length;
5576
+ const actionEvents = remoteWindowRead
5577
+ ? filterSessionActionEventsForTranscriptWindow(rawActionEvents, transcriptEvents)
5578
+ : rawActionEvents;
5547
5579
  const events = mergeSessionActionEvents(transcriptEvents, actionEvents).slice(-tail);
5548
5580
  const autoView = recordSessionReadViews(normalizedSessionId, events, {
5549
5581
  targetPath,