blun-king-cli 9.1.187 → 9.1.189
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
|
};
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
const EXPLICIT_THINKING_INTENT = /\b(?:analy[sz](?:e|ing|is)|root\s+cause|investigat(?:e|ion)|debug(?:ging)?|architect(?:ure|ural)|plan(?:ning)?|review|audit|threat\s+model|refactor|optim(?:ize|ise|ization)|migration|complex|thorough|deep(?:ly)?|untersuch(?:e|ung)|analysier(?:e|en)?|ursachenanalyse|architektur|plan(?:e|ung)|pruef(?:e|ung)|sicherheit|migration|komplex|gruendlich|analiz(?:a|iraj)|istrazi|arhitektur|planiraj|sigurnost|duboko)\b/iu;
|
|
4
4
|
const ACTIONABLE_PROMPT = /\b(?:aender|analys|apply|bau|build|check|commit|cop(?:y|ier)|create|debug|delete|deploy|edit|entfern|erstelle|find|fix|implement|install|lad|loesch|merge|mess|move|napravi|oeffne|open|patch|pruef|publish|push|read|reparier|restart|run|schreib|search|starte?|stop|such|test|update|verschieb|write|zieh)\w*\b/iu;
|
|
5
5
|
const STANDALONE_CHAT = /^(?:hi|hallo|hey|hello|hoi|moin|servus|yo|danke|thanks|thx|bye|tschau|ciao)[.!?]*$/iu;
|
|
6
|
-
const
|
|
6
|
+
const BOSNIAN_STANDALONE_CHAT = /^(?:zdravo|pozdrav|hvala|ćao|cao)[.!?]*$/iu;
|
|
7
|
+
const IDENTITY_CHAT = /^(?:wer bist du|who are you|wie geht(?: es dir)?|how are you|na|kako si|kako je king|ko si ti|ko stoji iza tebe)[.!?]*$/iu;
|
|
7
8
|
const STATUS_ONLY_CHECK_IN = /(?:\bstandabfrage\b|\bstatusabfrage\b|\bkurzes?\s+update\b|\bwo\s+stehst\s+du\b|\bwie\s+weit\s+bist\s+du\b|\bwhere\s+are\s+you\b|\bquick\s+status\b)/iu;
|
|
8
9
|
const STATUS_FOLLOW_UP_ACTION = /\b(?:aendere|arbeite|baue|build|change|delete|deploy|deploye|fahr|fix|fixe|implement|implementiere|install|installiere|loesche|mach|patch|pruefe|repariere|run|schreibe|setze|start|starte|stop|stoppe|test|teste|write)\b/iu;
|
|
9
10
|
const LIGHTWEIGHT_STEER = /\b(?:cool|danke|dankeschoen|gute arbeit|passt|perfekt|stolz|super|freut mich)\b/iu;
|
|
11
|
+
const STANDALONE_CHAT_COMPLETION_TOKENS = 1024;
|
|
10
12
|
const ADAPTIVE_LOW_COMPLETION_TOKENS = 8192;
|
|
11
13
|
const STANDARD_TURN_MAX_COMPLETION_TOKENS = 24_576;
|
|
12
14
|
|
|
@@ -17,7 +19,8 @@ function selectThinkingEffortForTurn(text, originKind) {
|
|
|
17
19
|
if (!normalized) return "low";
|
|
18
20
|
|
|
19
21
|
const lower = normalized.toLowerCase();
|
|
20
|
-
if (
|
|
22
|
+
if (IDENTITY_CHAT.test(lower) || BOSNIAN_STANDALONE_CHAT.test(lower)) return "off";
|
|
23
|
+
if (STANDALONE_CHAT.test(lower)) return "low";
|
|
21
24
|
if (
|
|
22
25
|
STATUS_ONLY_CHECK_IN.test(normalized)
|
|
23
26
|
&& !STATUS_FOLLOW_UP_ACTION.test(normalized)
|
|
@@ -42,13 +45,16 @@ function selectThinkingEffortForWorkStep(stepNumber, previousToolOutcome) {
|
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
function capCompletionBudgetForAdaptiveEffort(budget, thinkingEffort) {
|
|
45
|
-
if (thinkingEffort !== "low" || budget === undefined) return budget;
|
|
48
|
+
if ((thinkingEffort !== "off" && thinkingEffort !== "low") || budget === undefined) return budget;
|
|
46
49
|
const configuredCap = budget.hardCap ?? budget.fallback;
|
|
50
|
+
const adaptiveCap = thinkingEffort === "off"
|
|
51
|
+
? STANDALONE_CHAT_COMPLETION_TOKENS
|
|
52
|
+
: ADAPTIVE_LOW_COMPLETION_TOKENS;
|
|
47
53
|
return {
|
|
48
54
|
...budget,
|
|
49
55
|
hardCap: Math.min(
|
|
50
|
-
configuredCap ??
|
|
51
|
-
|
|
56
|
+
configuredCap ?? adaptiveCap,
|
|
57
|
+
adaptiveCap,
|
|
52
58
|
),
|
|
53
59
|
};
|
|
54
60
|
}
|
|
@@ -81,6 +87,7 @@ module.exports = {
|
|
|
81
87
|
ACTIONABLE_PROMPT,
|
|
82
88
|
ADAPTIVE_LOW_COMPLETION_TOKENS,
|
|
83
89
|
EXPLICIT_THINKING_INTENT,
|
|
90
|
+
STANDALONE_CHAT_COMPLETION_TOKENS,
|
|
84
91
|
STANDARD_TURN_MAX_COMPLETION_TOKENS,
|
|
85
92
|
capCompletionBudgetForAdaptiveEffort,
|
|
86
93
|
capTurnCompletionTokens,
|
package/blun.mjs
CHANGED
|
@@ -28236,9 +28236,10 @@ function personaSystemBlock(env = process.env) {
|
|
|
28236
28236
|
}
|
|
28237
28237
|
}
|
|
28238
28238
|
if (language !== void 0 && language.length > 0) {
|
|
28239
|
+
const requestedLanguage = language === "Bosnian" ? "Bosnian (bosanski; not Slovenian or slovenski)" : language;
|
|
28239
28240
|
if (lines.length > 0) lines.push("");
|
|
28240
|
-
lines.push(`## Language — HARD OVERRIDE (${
|
|
28241
|
-
lines.push(`Write EVERYTHING you output in ${
|
|
28241
|
+
lines.push(`## Language — HARD OVERRIDE (${requestedLanguage})`, "");
|
|
28242
|
+
lines.push(`Write EVERYTHING you output in ${requestedLanguage}: your reasoning and thinking, your progress notes, and every reply to the user. This rule is ABSOLUTE and OVERRIDES the "# Language" section elsewhere in this prompt and any instinct to mirror the user's language. Even when the user writes to you in English or any other language, you still think and answer in ${requestedLanguage}. The only things that stay verbatim are code, shell commands, file paths, and identifiers. Do not switch away from ${requestedLanguage} unless the user explicitly changes the language with a command.`);
|
|
28242
28243
|
}
|
|
28243
28244
|
return lines.join("\n");
|
|
28244
28245
|
}
|
|
@@ -75985,12 +75986,13 @@ var init_full = __esmMin((() => {
|
|
|
75985
75986
|
}));
|
|
75986
75987
|
//#endregion
|
|
75987
75988
|
//#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;
|
|
75989
|
+
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
75990
|
var init_micro = __esmMin((() => {
|
|
75990
75991
|
({ 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
75992
|
({ isPersistedToolResultReference } = createRequire(import.meta.url)("./bin/tool-result-offload-policy.cjs"));
|
|
75992
75993
|
({ projectHistoricalUnaddressedTelegramMessages } = createRequire(import.meta.url)("./bin/telegram-context-projection-policy.cjs"));
|
|
75993
75994
|
({ dedupeRepeatedUserMessages } = createRequire(import.meta.url)("./bin/repeated-user-message-projection.cjs"));
|
|
75995
|
+
({ projectRepeatedAssistantResponses } = createRequire(import.meta.url)("./bin/repeated-assistant-response-policy.cjs"));
|
|
75994
75996
|
({ compactHistoricalSkillActivations } = createRequire(import.meta.url)("./bin/skill-activation-performance-policy.cjs"));
|
|
75995
75997
|
({ dedupeRecurringCronWakeups, dedupeRepeatedInjections } = createRequire(import.meta.url)("./bin/repeated-injection-projection.cjs"));
|
|
75996
75998
|
init_tokens();
|
|
@@ -78970,7 +78972,8 @@ var init_context$2 = __esmMin((() => {
|
|
|
78970
78972
|
const historicalUserReferencesProjected = compactHistoricalPersistedUserMessageReferences(userOffloaded);
|
|
78971
78973
|
const duplicateUserMessagesProjected = dedupeRepeatedUserMessages(historicalUserReferencesProjected);
|
|
78972
78974
|
const historicalTelegramProjected = projectHistoricalUnaddressedTelegramMessages(duplicateUserMessagesProjected);
|
|
78973
|
-
const
|
|
78975
|
+
const repeatedAssistantProjected = projectRepeatedAssistantResponses(historicalTelegramProjected);
|
|
78976
|
+
const result = project(this.agent.assistantMessageOffload.compact(this.agent.microCompaction.compact(compactHistoricalSuccessfulToolResults(this.agent.toolResultBatchOffload.compact(dedupeRecurringCronWakeups(dedupeRepeatedInjections(compactHistoricalSkillActivations(compactBaselineSkillInjections(repeatedAssistantProjected)))))))), {
|
|
78974
78977
|
...options,
|
|
78975
78978
|
onAnomaly: (anomaly) => {
|
|
78976
78979
|
anomalies.push(anomaly);
|