blun-king-cli 9.1.341 → 9.1.342
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.
|
@@ -7,6 +7,12 @@ const {
|
|
|
7
7
|
const DEFAULT_MAX_CHARS = 3_000;
|
|
8
8
|
const DEFAULT_MAX_SECTIONS = 5;
|
|
9
9
|
const RECENT_USER_MESSAGES = 4;
|
|
10
|
+
const NON_ACTIONABLE_USER_ORIGINS = new Set([
|
|
11
|
+
'background_task',
|
|
12
|
+
'compaction_summary',
|
|
13
|
+
'injection',
|
|
14
|
+
'skill_activation',
|
|
15
|
+
]);
|
|
10
16
|
const STOP_WORDS = new Set([
|
|
11
17
|
'aber', 'alle', 'alles', 'auch', 'eine', 'einem', 'einen', 'einer', 'eines',
|
|
12
18
|
'fuer', 'haben', 'hier', 'immer', 'jetzt', 'kann', 'machen', 'mehr', 'mich',
|
|
@@ -35,10 +41,16 @@ function textFromMessage(message) {
|
|
|
35
41
|
.join('\n');
|
|
36
42
|
}
|
|
37
43
|
|
|
44
|
+
function isActionableMistakeInput(message) {
|
|
45
|
+
if (message?.role !== 'user') return false;
|
|
46
|
+
const originKind = String(message?.origin?.kind || '').trim();
|
|
47
|
+
return !NON_ACTIONABLE_USER_ORIGINS.has(originKind);
|
|
48
|
+
}
|
|
49
|
+
|
|
38
50
|
function recentUserText(history, limit = RECENT_USER_MESSAGES) {
|
|
39
51
|
if (!Array.isArray(history)) return '';
|
|
40
52
|
return history
|
|
41
|
-
.filter(
|
|
53
|
+
.filter(isActionableMistakeInput)
|
|
42
54
|
.map(textFromMessage)
|
|
43
55
|
.filter(Boolean)
|
|
44
56
|
.slice(-Math.max(1, Number(limit) || RECENT_USER_MESSAGES))
|
|
@@ -47,7 +59,7 @@ function recentUserText(history, limit = RECENT_USER_MESSAGES) {
|
|
|
47
59
|
|
|
48
60
|
function isLowInformationMistakeTurn(history) {
|
|
49
61
|
if (!Array.isArray(history)) return false;
|
|
50
|
-
const message = history.findLast(
|
|
62
|
+
const message = history.findLast(isActionableMistakeInput);
|
|
51
63
|
if (message === undefined) return false;
|
|
52
64
|
if (typeof message.content === 'string') {
|
|
53
65
|
return isLowInformationPersonalMemoryQuery(message.content);
|