@foliox/transparent-compact-pi 0.13.0 → 0.13.1
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.
|
@@ -65,6 +65,16 @@ function head(text: string, length: number): string {
|
|
|
65
65
|
if (end < text.length && /[\uD800-\uDBFF]/.test(text[end - 1]) && /[\uDC00-\uDFFF]/.test(text[end])) end--;
|
|
66
66
|
return text.slice(0, end);
|
|
67
67
|
}
|
|
68
|
+
// A quoted count, location or range must not join digits from a larger number.
|
|
69
|
+
function containsQuote(text: string, quote: string): boolean {
|
|
70
|
+
const numericStart = /^\d/.test(quote), numericEnd = /\d$/.test(quote);
|
|
71
|
+
for (let at = text.indexOf(quote); at >= 0; at = text.indexOf(quote, at + 1)) {
|
|
72
|
+
if ((numericStart && /\d/.test(text[at - 1] ?? "")) ||
|
|
73
|
+
(numericEnd && /\d/.test(text[at + quote.length] ?? ""))) continue;
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
68
78
|
function preview(entry: SessionEntry): string {
|
|
69
79
|
if (entry.type !== "message" || (entry.message.role !== "user" && entry.message.role !== "assistant")) return "";
|
|
70
80
|
const value = textContent(entry.message.content, "\n").trim();
|
|
@@ -110,7 +120,7 @@ export function expandTargets(entries: readonly SessionEntry[], targets: readonl
|
|
|
110
120
|
const matches: { target: ExpansionTarget; candidate: ExpansionCandidate }[] = [];
|
|
111
121
|
const seen = new Set<string>();
|
|
112
122
|
for (const target of targets) {
|
|
113
|
-
if (!target.text
|
|
123
|
+
if (!containsQuote(target.text, quote)) continue;
|
|
114
124
|
const adjacent = neighbours(entries, positions.get(target.source.entryId) ?? -1);
|
|
115
125
|
const selector = hash([quote, target.source]);
|
|
116
126
|
if (seen.has(selector)) continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foliox/transparent-compact-pi",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "Model-free, deterministic, and self-aware compaction; with session-backed subagent context recovery, and optional context pruning and fidelity controls.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|