sentinelayer-cli 0.31.1 → 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 +1 -1
- package/src/commands/session.js +36 -4
- package/src/session/recap.js +13 -0
package/package.json
CHANGED
package/src/commands/session.js
CHANGED
|
@@ -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
|
|
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
|
-
?
|
|
5545
|
-
:
|
|
5546
|
-
const hiddenControlEventCount =
|
|
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,
|
package/src/session/recap.js
CHANGED
|
@@ -407,6 +407,8 @@ function emptyWorkPlanSummary() {
|
|
|
407
407
|
path: WORK_PLAN_RELATIVE_PATH,
|
|
408
408
|
exists: false,
|
|
409
409
|
truncated: false,
|
|
410
|
+
detailSuppressed: false,
|
|
411
|
+
detailSuppressionReason: "",
|
|
410
412
|
total: 0,
|
|
411
413
|
open: 0,
|
|
412
414
|
completed: 0,
|
|
@@ -431,6 +433,10 @@ function summarizeWorkPlanMarkdown(raw = "", { limit = DEFAULT_WORK_PLAN_SUMMARY
|
|
|
431
433
|
const summary = emptyWorkPlanSummary();
|
|
432
434
|
summary.exists = true;
|
|
433
435
|
summary.truncated = Boolean(truncated);
|
|
436
|
+
if (summary.truncated) {
|
|
437
|
+
summary.detailSuppressed = true;
|
|
438
|
+
summary.detailSuppressionReason = "large_plan_recent_window";
|
|
439
|
+
}
|
|
434
440
|
|
|
435
441
|
const records = [];
|
|
436
442
|
let section = "";
|
|
@@ -469,6 +475,10 @@ function summarizeWorkPlanMarkdown(raw = "", { limit = DEFAULT_WORK_PLAN_SUMMARY
|
|
|
469
475
|
.filter((record) => record.status === "open")
|
|
470
476
|
.slice(-normalizedLimit);
|
|
471
477
|
summary.recent = records.slice(-normalizedLimit);
|
|
478
|
+
if (summary.detailSuppressed) {
|
|
479
|
+
summary.currentSection = "";
|
|
480
|
+
summary.recentOpen = [];
|
|
481
|
+
}
|
|
472
482
|
return summary;
|
|
473
483
|
}
|
|
474
484
|
|
|
@@ -707,6 +717,9 @@ function buildWorkPlanText(workPlan = emptyWorkPlanSummary()) {
|
|
|
707
717
|
const open = Number(workPlan.open || 0);
|
|
708
718
|
const completed = Number(workPlan.completed || 0);
|
|
709
719
|
const pathText = normalizeString(workPlan.path) || WORK_PLAN_RELATIVE_PATH;
|
|
720
|
+
if (workPlan.detailSuppressed || workPlan.truncated) {
|
|
721
|
+
return `Plan: ${open} open / ${completed} done in recent ${pathText} window. Current/next items suppressed because the plan file is large.`;
|
|
722
|
+
}
|
|
710
723
|
const currentSection = normalizeString(workPlan.currentSection);
|
|
711
724
|
const currentText = currentSection ? ` Current: ${currentSection}.` : "";
|
|
712
725
|
const recentOpen = Array.isArray(workPlan.recentOpen) ? workPlan.recentOpen : [];
|