blun-king-cli 9.1.196 → 9.1.197
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/bin/mistake-relevance-policy.cjs +18 -0
- package/blun.mjs +3 -2
- package/package.json +1 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const {
|
|
4
|
+
isLowInformationPersonalMemoryQuery,
|
|
5
|
+
} = require('./personal-memory-performance-policy.cjs');
|
|
6
|
+
|
|
3
7
|
const DEFAULT_MAX_CHARS = 3_000;
|
|
4
8
|
const DEFAULT_MAX_SECTIONS = 5;
|
|
5
9
|
const RECENT_USER_MESSAGES = 4;
|
|
@@ -41,6 +45,19 @@ function recentUserText(history, limit = RECENT_USER_MESSAGES) {
|
|
|
41
45
|
.join('\n');
|
|
42
46
|
}
|
|
43
47
|
|
|
48
|
+
function isLowInformationMistakeTurn(history) {
|
|
49
|
+
if (!Array.isArray(history)) return false;
|
|
50
|
+
const message = history.findLast((entry) => entry?.role === 'user');
|
|
51
|
+
if (message === undefined) return false;
|
|
52
|
+
if (typeof message.content === 'string') {
|
|
53
|
+
return isLowInformationPersonalMemoryQuery(message.content);
|
|
54
|
+
}
|
|
55
|
+
if (!Array.isArray(message.content)) return false;
|
|
56
|
+
const hasAttachment = message.content.some((part) => part?.type !== 'text' && part?.type !== 'think');
|
|
57
|
+
if (hasAttachment) return false;
|
|
58
|
+
return isLowInformationPersonalMemoryQuery(textFromMessage(message));
|
|
59
|
+
}
|
|
60
|
+
|
|
44
61
|
function splitSections(source) {
|
|
45
62
|
const text = String(source || '').replace(/\r\n?/gu, '\n').trim();
|
|
46
63
|
if (!text) return [];
|
|
@@ -178,6 +195,7 @@ module.exports = {
|
|
|
178
195
|
DEFAULT_MAX_CHARS,
|
|
179
196
|
DEFAULT_MAX_SECTIONS,
|
|
180
197
|
RECENT_USER_MESSAGES,
|
|
198
|
+
isLowInformationMistakeTurn,
|
|
181
199
|
recentUserText,
|
|
182
200
|
selectRelevantMistakeContent,
|
|
183
201
|
selectRelevantMistakeSources,
|
package/blun.mjs
CHANGED
|
@@ -231476,11 +231476,11 @@ async function readProjectMistakeSources(agent) {
|
|
|
231476
231476
|
}
|
|
231477
231477
|
return sources;
|
|
231478
231478
|
}
|
|
231479
|
-
var MistakeMdInjector, recentUserText, selectRelevantMistakeSources;
|
|
231479
|
+
var MistakeMdInjector, isLowInformationMistakeTurn, recentUserText, selectRelevantMistakeSources;
|
|
231480
231480
|
var init_mistake_md = __esmMin((() => {
|
|
231481
231481
|
init_injector();
|
|
231482
231482
|
init_mistake_md_writer();
|
|
231483
|
-
({ recentUserText, selectRelevantMistakeSources } = createRequire(import.meta.url)("./bin/mistake-relevance-policy.cjs"));
|
|
231483
|
+
({ isLowInformationMistakeTurn, recentUserText, selectRelevantMistakeSources } = createRequire(import.meta.url)("./bin/mistake-relevance-policy.cjs"));
|
|
231484
231484
|
MistakeMdInjector = class extends DynamicInjector {
|
|
231485
231485
|
injectionVariant = "mistake_md";
|
|
231486
231486
|
reserveChecked = false;
|
|
@@ -231514,6 +231514,7 @@ var init_mistake_md = __esmMin((() => {
|
|
|
231514
231514
|
}
|
|
231515
231515
|
async getInjection() {
|
|
231516
231516
|
try {
|
|
231517
|
+
if (isLowInformationMistakeTurn(this.agent.context.history)) return void 0;
|
|
231517
231518
|
const sources = await readProjectMistakeSources(this.agent);
|
|
231518
231519
|
const sharedContent = await withMistakeLock(this.mistakeDir, async () => {
|
|
231519
231520
|
try {
|