sentinelayer-cli 0.36.1 → 0.36.2
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/session/recap.js +45 -8
package/package.json
CHANGED
package/src/session/recap.js
CHANGED
|
@@ -484,6 +484,7 @@ function emptyWorkPlanSummary(sourceContext = {}) {
|
|
|
484
484
|
completed: 0,
|
|
485
485
|
currentSection: "",
|
|
486
486
|
recentOpen: [],
|
|
487
|
+
actionableOpen: [],
|
|
487
488
|
recent: [],
|
|
488
489
|
};
|
|
489
490
|
}
|
|
@@ -534,6 +535,41 @@ function shouldSuppressHistoricalWorkPlanDetails(summary = emptyWorkPlanSummary(
|
|
|
534
535
|
return completed / Math.max(1, total) >= HISTORICAL_WORK_PLAN_COMPLETED_RATIO;
|
|
535
536
|
}
|
|
536
537
|
|
|
538
|
+
function isActionableWorkPlanOpenRecord(record = {}) {
|
|
539
|
+
if (!record || typeof record !== "object" || record.status !== "open") {
|
|
540
|
+
return false;
|
|
541
|
+
}
|
|
542
|
+
const task = normalizeString(record.task);
|
|
543
|
+
if (!task) {
|
|
544
|
+
return false;
|
|
545
|
+
}
|
|
546
|
+
return !isGenericWorkPlanSection(record.section);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
function selectActionableWorkPlanOpenRecords(records = [], { limit = DEFAULT_WORK_PLAN_SUMMARY_LIMIT } = {}) {
|
|
550
|
+
const actionable = (Array.isArray(records) ? records : []).filter(isActionableWorkPlanOpenRecord);
|
|
551
|
+
if (actionable.length === 0) {
|
|
552
|
+
return [];
|
|
553
|
+
}
|
|
554
|
+
const latest = actionable[actionable.length - 1];
|
|
555
|
+
const latestSection = normalizeString(latest.section);
|
|
556
|
+
const selected = latestSection
|
|
557
|
+
? actionable.filter((record) => normalizeString(record.section) === latestSection)
|
|
558
|
+
: actionable;
|
|
559
|
+
return selected.slice(-Math.max(1, normalizePositiveInteger(limit, DEFAULT_WORK_PLAN_SUMMARY_LIMIT)));
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function formatWorkPlanOpenItems(items = []) {
|
|
563
|
+
return (Array.isArray(items) ? items : [])
|
|
564
|
+
.map((item) => {
|
|
565
|
+
const section = normalizeString(item.section);
|
|
566
|
+
const task = normalizeString(item.task);
|
|
567
|
+
return section ? `${section} - ${task}` : task;
|
|
568
|
+
})
|
|
569
|
+
.filter(Boolean)
|
|
570
|
+
.join("; ");
|
|
571
|
+
}
|
|
572
|
+
|
|
537
573
|
function summarizeWorkPlanMarkdown(
|
|
538
574
|
raw = "",
|
|
539
575
|
{ limit = DEFAULT_WORK_PLAN_SUMMARY_LIMIT, truncated = false, sourceContext = {} } = {}
|
|
@@ -582,6 +618,7 @@ function summarizeWorkPlanMarkdown(
|
|
|
582
618
|
summary.recentOpen = records
|
|
583
619
|
.filter((record) => record.status === "open")
|
|
584
620
|
.slice(-normalizedLimit);
|
|
621
|
+
summary.actionableOpen = selectActionableWorkPlanOpenRecords(records, { limit: normalizedLimit });
|
|
585
622
|
summary.recent = records.slice(-normalizedLimit);
|
|
586
623
|
if (!summary.detailSuppressed && shouldSuppressHistoricalWorkPlanDetails(summary)) {
|
|
587
624
|
summary.detailSuppressed = true;
|
|
@@ -869,10 +906,17 @@ function buildWorkPlanText(workPlan = emptyWorkPlanSummary()) {
|
|
|
869
906
|
const sourceWindowText = workPlan.truncated
|
|
870
907
|
? `recent ${sourceText} window`
|
|
871
908
|
: sourceText;
|
|
909
|
+
const actionableText = formatWorkPlanOpenItems(workPlan.actionableOpen);
|
|
872
910
|
const suppressionText =
|
|
873
911
|
suppressionReason === "historical_generic_plan_section"
|
|
874
912
|
? "Current/next items suppressed because this generic plan is mostly historical completed work."
|
|
875
913
|
: "Current/next items suppressed because the plan file is large.";
|
|
914
|
+
if (actionableText) {
|
|
915
|
+
const limitText = workPlan.truncated
|
|
916
|
+
? "Full current/next scan suppressed because the plan file is large."
|
|
917
|
+
: suppressionText;
|
|
918
|
+
return `Workspace plan: ${open} open / ${completed} done in ${sourceWindowText}${sourceReasonText}. Recent open: ${actionableText}. ${limitText}`;
|
|
919
|
+
}
|
|
876
920
|
return `Workspace plan: ${open} open / ${completed} done in ${sourceWindowText}${sourceReasonText}. ${suppressionText}`;
|
|
877
921
|
}
|
|
878
922
|
const currentSection = normalizeString(workPlan.currentSection);
|
|
@@ -880,14 +924,7 @@ function buildWorkPlanText(workPlan = emptyWorkPlanSummary()) {
|
|
|
880
924
|
const recentOpen = Array.isArray(workPlan.recentOpen) ? workPlan.recentOpen : [];
|
|
881
925
|
const nextText =
|
|
882
926
|
recentOpen.length > 0
|
|
883
|
-
? ` Next: ${recentOpen
|
|
884
|
-
.map((item) => {
|
|
885
|
-
const section = normalizeString(item.section);
|
|
886
|
-
const task = normalizeString(item.task);
|
|
887
|
-
return section ? `${section} - ${task}` : task;
|
|
888
|
-
})
|
|
889
|
-
.filter(Boolean)
|
|
890
|
-
.join("; ")}.`
|
|
927
|
+
? ` Next: ${formatWorkPlanOpenItems(recentOpen)}.`
|
|
891
928
|
: "";
|
|
892
929
|
const truncatedText = workPlan.truncated ? " Recent window only." : "";
|
|
893
930
|
return `Workspace plan: ${open} open / ${completed} done in ${sourceText}${sourceReasonText}.${currentText}${nextText}${truncatedText}`;
|