blun-king-cli 9.1.187 → 9.1.188
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,6 +4,7 @@ const MIN_RESPONSE_CHARS = 160;
|
|
|
4
4
|
const MAX_RECENT_ASSISTANT_RESPONSES = 8;
|
|
5
5
|
const REQUIRED_MATCHING_RESPONSES = 3;
|
|
6
6
|
const RESPONSE_SIMILARITY_THRESHOLD = 0.78;
|
|
7
|
+
const REPEATED_RESPONSE_PLACEHOLDER = '[Historical repeated assistant response omitted; newer user corrections and instructions supersede it.]';
|
|
7
8
|
|
|
8
9
|
function isUserPrompt(message) {
|
|
9
10
|
if (message?.role !== 'user') return false;
|
|
@@ -94,16 +95,33 @@ function detectRepeatedAssistantResponse(history) {
|
|
|
94
95
|
|
|
95
96
|
return {
|
|
96
97
|
count: matches.length,
|
|
98
|
+
indexes: matches.map((match) => match.index),
|
|
97
99
|
minimumSimilarity: Math.min(...matches.slice(1).map((match) => match.similarity)),
|
|
98
100
|
};
|
|
99
101
|
}
|
|
100
102
|
|
|
103
|
+
function projectRepeatedAssistantResponses(history) {
|
|
104
|
+
const detection = detectRepeatedAssistantResponse(history);
|
|
105
|
+
if (detection === null) return history;
|
|
106
|
+
|
|
107
|
+
const repeatedIndexes = new Set(detection.indexes);
|
|
108
|
+
return history.map((message, index) => {
|
|
109
|
+
if (!repeatedIndexes.has(index)) return message;
|
|
110
|
+
return {
|
|
111
|
+
...message,
|
|
112
|
+
content: [{ type: 'text', text: REPEATED_RESPONSE_PLACEHOLDER }],
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
101
117
|
module.exports = {
|
|
102
118
|
MAX_RECENT_ASSISTANT_RESPONSES,
|
|
103
119
|
MIN_RESPONSE_CHARS,
|
|
104
120
|
REQUIRED_MATCHING_RESPONSES,
|
|
121
|
+
REPEATED_RESPONSE_PLACEHOLDER,
|
|
105
122
|
RESPONSE_SIMILARITY_THRESHOLD,
|
|
106
123
|
assistantResponseText,
|
|
107
124
|
detectRepeatedAssistantResponse,
|
|
125
|
+
projectRepeatedAssistantResponses,
|
|
108
126
|
responseSimilarity,
|
|
109
127
|
};
|
package/blun.mjs
CHANGED
|
@@ -75985,12 +75985,13 @@ var init_full = __esmMin((() => {
|
|
|
75985
75985
|
}));
|
|
75986
75986
|
//#endregion
|
|
75987
75987
|
//#region ../../packages/agent-core/src/agent/compaction/micro.ts
|
|
75988
|
-
var selectMicroCompactionCutoff, MICRO_COMPACTION_RECENT_MESSAGES, MICRO_COMPACTION_TOOL_ARGUMENTS_ENABLED, MICRO_COMPACTION_TOOL_ARGUMENT_MIN_TOKENS, isPersistedToolResultReference, projectHistoricalUnaddressedTelegramMessages, dedupeRepeatedUserMessages, compactHistoricalSkillActivations, dedupeRecurringCronWakeups, dedupeRepeatedInjections, DEFAULT_CONFIG, MicroCompaction;
|
|
75988
|
+
var selectMicroCompactionCutoff, MICRO_COMPACTION_RECENT_MESSAGES, MICRO_COMPACTION_TOOL_ARGUMENTS_ENABLED, MICRO_COMPACTION_TOOL_ARGUMENT_MIN_TOKENS, isPersistedToolResultReference, projectHistoricalUnaddressedTelegramMessages, dedupeRepeatedUserMessages, projectRepeatedAssistantResponses, compactHistoricalSkillActivations, dedupeRecurringCronWakeups, dedupeRepeatedInjections, DEFAULT_CONFIG, MicroCompaction;
|
|
75989
75989
|
var init_micro = __esmMin((() => {
|
|
75990
75990
|
({ selectMicroCompactionCutoff, MICRO_COMPACTION_RECENT_MESSAGES, MICRO_COMPACTION_TOOL_ARGUMENTS_ENABLED, MICRO_COMPACTION_TOOL_ARGUMENT_MIN_TOKENS } = createRequire(import.meta.url)("./bin/micro-compaction-policy.cjs"));
|
|
75991
75991
|
({ isPersistedToolResultReference } = createRequire(import.meta.url)("./bin/tool-result-offload-policy.cjs"));
|
|
75992
75992
|
({ projectHistoricalUnaddressedTelegramMessages } = createRequire(import.meta.url)("./bin/telegram-context-projection-policy.cjs"));
|
|
75993
75993
|
({ dedupeRepeatedUserMessages } = createRequire(import.meta.url)("./bin/repeated-user-message-projection.cjs"));
|
|
75994
|
+
({ projectRepeatedAssistantResponses } = createRequire(import.meta.url)("./bin/repeated-assistant-response-policy.cjs"));
|
|
75994
75995
|
({ compactHistoricalSkillActivations } = createRequire(import.meta.url)("./bin/skill-activation-performance-policy.cjs"));
|
|
75995
75996
|
({ dedupeRecurringCronWakeups, dedupeRepeatedInjections } = createRequire(import.meta.url)("./bin/repeated-injection-projection.cjs"));
|
|
75996
75997
|
init_tokens();
|
|
@@ -78970,7 +78971,8 @@ var init_context$2 = __esmMin((() => {
|
|
|
78970
78971
|
const historicalUserReferencesProjected = compactHistoricalPersistedUserMessageReferences(userOffloaded);
|
|
78971
78972
|
const duplicateUserMessagesProjected = dedupeRepeatedUserMessages(historicalUserReferencesProjected);
|
|
78972
78973
|
const historicalTelegramProjected = projectHistoricalUnaddressedTelegramMessages(duplicateUserMessagesProjected);
|
|
78973
|
-
const
|
|
78974
|
+
const repeatedAssistantProjected = projectRepeatedAssistantResponses(historicalTelegramProjected);
|
|
78975
|
+
const result = project(this.agent.assistantMessageOffload.compact(this.agent.microCompaction.compact(compactHistoricalSuccessfulToolResults(this.agent.toolResultBatchOffload.compact(dedupeRecurringCronWakeups(dedupeRepeatedInjections(compactHistoricalSkillActivations(compactBaselineSkillInjections(repeatedAssistantProjected)))))))), {
|
|
78974
78976
|
...options,
|
|
78975
78977
|
onAnomaly: (anomaly) => {
|
|
78976
78978
|
anomalies.push(anomaly);
|