blun-king-cli 9.1.235 → 9.1.236
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.
|
@@ -4,7 +4,21 @@ const {
|
|
|
4
4
|
compactLegacyErrorMemoryReminder,
|
|
5
5
|
} = require('./error-memory-performance-policy.cjs');
|
|
6
6
|
|
|
7
|
-
const LATEST_ONLY_INJECTION_VARIANTS = new Set([
|
|
7
|
+
const LATEST_ONLY_INJECTION_VARIANTS = new Set([
|
|
8
|
+
'action_style',
|
|
9
|
+
'error-memory',
|
|
10
|
+
'mistake_md',
|
|
11
|
+
'tool-awareness',
|
|
12
|
+
]);
|
|
13
|
+
const LATEST_ONLY_INJECTION_FAMILIES = new Map([
|
|
14
|
+
['swarm_mode', 'swarm-mode-state'],
|
|
15
|
+
['swarm_mode_exit', 'swarm-mode-state'],
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
function latestOnlyInjectionFamily(variant) {
|
|
19
|
+
if (LATEST_ONLY_INJECTION_VARIANTS.has(variant)) return `variant:${variant}`;
|
|
20
|
+
return LATEST_ONLY_INJECTION_FAMILIES.get(variant) ?? null;
|
|
21
|
+
}
|
|
8
22
|
|
|
9
23
|
function repeatedInjectionKey(message) {
|
|
10
24
|
if (message?.role !== 'user') return null;
|
|
@@ -21,6 +35,7 @@ function repeatedInjectionKey(message) {
|
|
|
21
35
|
function dedupeRepeatedInjections(history) {
|
|
22
36
|
if (!Array.isArray(history) || history.length < 2) return history;
|
|
23
37
|
const seenByVariant = new Map();
|
|
38
|
+
const seenLatestOnlyFamilies = new Set();
|
|
24
39
|
const kept = [];
|
|
25
40
|
|
|
26
41
|
for (let index = history.length - 1; index >= 0; index -= 1) {
|
|
@@ -30,7 +45,11 @@ function dedupeRepeatedInjections(history) {
|
|
|
30
45
|
kept.push(message);
|
|
31
46
|
continue;
|
|
32
47
|
}
|
|
33
|
-
|
|
48
|
+
const latestOnlyFamily = latestOnlyInjectionFamily(key.variant);
|
|
49
|
+
if (latestOnlyFamily !== null) {
|
|
50
|
+
if (seenLatestOnlyFamilies.has(latestOnlyFamily)) continue;
|
|
51
|
+
seenLatestOnlyFamilies.add(latestOnlyFamily);
|
|
52
|
+
}
|
|
34
53
|
let seenTexts = seenByVariant.get(key.variant);
|
|
35
54
|
if (seenTexts === undefined) {
|
|
36
55
|
seenTexts = new Set();
|