blun-king-cli 9.1.415 → 9.1.416

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/LIESMICH.txt CHANGED
@@ -59,6 +59,14 @@ konkurrierenden Start zurückgewiesen und bleiben an der Spitze der
59
59
  FIFO-Warteschlange. Für diesen normalen Wartestatus erscheint kein
60
60
  `turn.agent_busy`-Fehler.
61
61
 
62
+ Ab BLUN King 9.1.416 bleiben alle Ergebnisse des jüngsten Werkzeugaufrufs bis
63
+ zur nächsten Assistentenantwort vollständig im Modellkontext. Das gilt auch für
64
+ große parallele Read-, Grep- und Bash-Aufrufe sowie für nachträglich
65
+ eingespielte Telegram- oder Steuerungsnachrichten. Offloader, historische
66
+ Bereinigung und Mikrokompaktierung verwenden dafür dieselbe semantische Grenze.
67
+ Erst nach der nachweislichen Auswertung darf ein Ergebnis archiviert oder
68
+ gekürzt werden.
69
+
62
70
  Zuverlässiger King-Start
63
71
  -----------------------
64
72
  Bei einer ausdrücklich als wiederholbar gekennzeichneten Serverüberlastung
package/README.md CHANGED
@@ -73,6 +73,15 @@ Telegram-Nachrichten, die bei bereits aktivem Kernzug eintreffen, werden ohne
73
73
  konkurrierenden Start zurückgewiesen und bleiben an der Spitze der
74
74
  FIFO-Warteschlange. Für diesen normalen Wartestatus erscheint kein
75
75
  `turn.agent_busy`-Fehler.
76
+
77
+ Ab BLUN King 9.1.416 bleiben alle Ergebnisse des jüngsten Werkzeugaufrufs bis
78
+ zur nächsten Assistentenantwort vollständig im Modellkontext. Das gilt auch für
79
+ große parallele Read-, Grep- und Bash-Aufrufe sowie für nachträglich
80
+ eingespielte Telegram- oder Steuerungsnachrichten. Offloader, historische
81
+ Bereinigung und Mikrokompaktierung verwenden dafür dieselbe semantische Grenze.
82
+ Erst nach der nachweislichen Auswertung darf ein Ergebnis archiviert oder
83
+ gekürzt werden.
84
+
76
85
  `Strg+C` und `Esc` brechen einen aktiven Zug zuverlässig ab, ohne den bereits
77
86
  geschriebenen Entwurf zu löschen. Das gilt auch bei Autovervollständigung,
78
87
  Geistervorschlägen, Bash-Eingabe und einer noch offenen Mehrzeileneingabe.
@@ -43,6 +43,32 @@ function isPersistedToolResultReference(content) {
43
43
  });
44
44
  }
45
45
 
46
+ function freshToolResultIds(messages) {
47
+ if (!Array.isArray(messages) || messages.length === 0) return new Set();
48
+
49
+ let assistantIndex = -1;
50
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
51
+ if (messages[index]?.role !== 'assistant') continue;
52
+ assistantIndex = index;
53
+ break;
54
+ }
55
+ if (assistantIndex < 0 || !Array.isArray(messages[assistantIndex].toolCalls)) return new Set();
56
+
57
+ const requestedIds = new Set(messages[assistantIndex].toolCalls
58
+ .map((call) => call?.id ?? call?.toolCallId)
59
+ .filter((id) => typeof id === 'string' && id.length > 0));
60
+ if (requestedIds.size === 0) return new Set();
61
+
62
+ const resultIds = new Set();
63
+ for (let index = assistantIndex + 1; index < messages.length; index += 1) {
64
+ const message = messages[index];
65
+ if (message?.role === 'tool' && requestedIds.has(message.toolCallId)) {
66
+ resultIds.add(message.toolCallId);
67
+ }
68
+ }
69
+ return resultIds;
70
+ }
71
+
46
72
  function compactPersistedToolResultReference(content) {
47
73
  if (!isPersistedToolResultReference(content)) return content;
48
74
 
@@ -84,11 +110,13 @@ function compactHistoricalSuccessfulToolResults(messages) {
84
110
  if (!Array.isArray(messages) || messages.length === 0) return messages;
85
111
 
86
112
  const recentStart = Math.max(0, messages.length - TOOL_RESULT_SUCCESS_KEEP_RECENT_MESSAGES);
113
+ const freshIds = freshToolResultIds(messages);
87
114
  let changed = false;
88
115
  const projected = messages.map((message, index) => {
89
116
  if (
90
117
  index >= recentStart
91
118
  || message?.role !== 'tool'
119
+ || freshIds.has(message.toolCallId)
92
120
  || message.isError === true
93
121
  || !Array.isArray(message.content)
94
122
  || isPersistedToolResultReference(message.content)
@@ -268,6 +296,7 @@ module.exports = {
268
296
  compactPersistedToolResultReference,
269
297
  createToolResultPreview,
270
298
  dedupeRepeatedSuccessfulToolResults,
299
+ freshToolResultIds,
271
300
  isPersistedToolResultReference,
272
301
  selectHistoricalToolResultOffloads,
273
302
  selectToolResultBatchOffloads,
package/blun.mjs CHANGED
@@ -75994,10 +75994,10 @@ var init_full = __esmMin((() => {
75994
75994
  }));
75995
75995
  //#endregion
75996
75996
  //#region ../../packages/agent-core/src/agent/compaction/micro.ts
75997
- var selectMicroCompactionCutoff, MICRO_COMPACTION_RECENT_MESSAGES, MICRO_COMPACTION_TOOL_ARGUMENTS_ENABLED, MICRO_COMPACTION_TOOL_ARGUMENT_MIN_TOKENS, isPersistedToolResultReference, projectHistoricalUnaddressedTelegramMessages, dedupeRepeatedUserMessages, projectRepeatedAssistantResponses, compactHistoricalSkillActivations, dedupeRecurringCronWakeups, dedupeRepeatedInjections, projectLoopEventForRecord, projectUsageModelForRecord, projectUsageForRecord, resolveCompletedStepUuid, resolveStepEventUuid, restoreUsageFromRecord, restoreUsageModelFromRecord, DEFAULT_CONFIG, MicroCompaction;
75997
+ var selectMicroCompactionCutoff, MICRO_COMPACTION_RECENT_MESSAGES, MICRO_COMPACTION_TOOL_ARGUMENTS_ENABLED, MICRO_COMPACTION_TOOL_ARGUMENT_MIN_TOKENS, isPersistedToolResultReference, freshToolResultIds, projectHistoricalUnaddressedTelegramMessages, dedupeRepeatedUserMessages, projectRepeatedAssistantResponses, compactHistoricalSkillActivations, dedupeRecurringCronWakeups, dedupeRepeatedInjections, projectLoopEventForRecord, projectUsageModelForRecord, projectUsageForRecord, resolveCompletedStepUuid, resolveStepEventUuid, restoreUsageFromRecord, restoreUsageModelFromRecord, DEFAULT_CONFIG, MicroCompaction;
75998
75998
  var init_micro = __esmMin((() => {
75999
75999
  ({ 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"));
76000
- ({ isPersistedToolResultReference } = createRequire(import.meta.url)("./bin/tool-result-offload-policy.cjs"));
76000
+ ({ isPersistedToolResultReference, freshToolResultIds } = createRequire(import.meta.url)("./bin/tool-result-offload-policy.cjs"));
76001
76001
  ({ projectHistoricalUnaddressedTelegramMessages } = createRequire(import.meta.url)("./bin/telegram-context-projection-policy.cjs"));
76002
76002
  ({ dedupeRepeatedUserMessages } = createRequire(import.meta.url)("./bin/repeated-user-message-projection.cjs"));
76003
76003
  ({ projectRepeatedAssistantResponses } = createRequire(import.meta.url)("./bin/repeated-assistant-response-policy.cjs"));
@@ -76093,11 +76093,12 @@ var init_micro = __esmMin((() => {
76093
76093
  const config = this.config;
76094
76094
  const historicalArgumentCutoff = Math.max(this.cutoff, messages.length - config.keepRecentMessages);
76095
76095
  const completedToolCallIds = new Set(messages.filter((message) => message?.role === "tool" && message.toolCallId !== void 0).map((message) => message.toolCallId));
76096
+ const protectedToolResultIds = freshToolResultIds(messages);
76096
76097
  const serializedArgumentsMarker = JSON.stringify({ _blun_compacted: config.truncatedArgumentsMarker });
76097
76098
  const result = [];
76098
76099
  let i = 0;
76099
76100
  for (const msg of messages) {
76100
- if (i < this.cutoff && msg.role === "tool" && msg.toolCallId !== void 0 && !isPersistedToolResultReference(msg.content) && estimateTokensForContentParts(msg.content) >= config.minContentTokens) result.push({
76101
+ if (i < this.cutoff && msg.role === "tool" && msg.toolCallId !== void 0 && !protectedToolResultIds.has(msg.toolCallId) && !isPersistedToolResultReference(msg.content) && estimateTokensForContentParts(msg.content) >= config.minContentTokens) result.push({
76101
76102
  ...msg,
76102
76103
  content: [{
76103
76104
  type: "text",
@@ -76139,10 +76140,11 @@ var init_micro = __esmMin((() => {
76139
76140
  let truncatedToolArgumentTokensBefore = 0;
76140
76141
  let truncatedToolArgumentTokensAfter = 0;
76141
76142
  const completedToolCallIds = new Set(messages.filter((message) => message?.role === "tool" && message.toolCallId !== void 0).map((message) => message.toolCallId));
76143
+ const protectedToolResultIds = freshToolResultIds(messages);
76142
76144
  const serializedArgumentsMarker = JSON.stringify({ _blun_compacted: this.config.truncatedArgumentsMarker });
76143
76145
  for (let i = 0; i < messages.length && i < cutoff; i++) {
76144
76146
  const message = messages[i];
76145
- if (message?.role === "tool" && message.toolCallId !== void 0 && !isPersistedToolResultReference(message.content)) {
76147
+ if (message?.role === "tool" && message.toolCallId !== void 0 && !protectedToolResultIds.has(message.toolCallId) && !isPersistedToolResultReference(message.content)) {
76146
76148
  const contentTokens = estimateTokensForContentParts(message.content);
76147
76149
  if (contentTokens >= this.config.minContentTokens) {
76148
76150
  markerTokenCount ??= estimateTokensForContentParts([{
@@ -260827,6 +260829,7 @@ var init_tool_result_budget = __esmMin((() => {
260827
260829
  compactPersistedToolResultReference = toolResultOffloadPolicy.compactPersistedToolResultReference;
260828
260830
  compactHistoricalSuccessfulToolResults = toolResultOffloadPolicy.compactHistoricalSuccessfulToolResults;
260829
260831
  dedupeRepeatedSuccessfulToolResults = toolResultOffloadPolicy.dedupeRepeatedSuccessfulToolResults;
260832
+ freshToolResultIds = toolResultOffloadPolicy.freshToolResultIds;
260830
260833
  selectToolResultBatchOffloads = toolResultOffloadPolicy.selectToolResultBatchOffloads;
260831
260834
  selectHistoricalToolResultOffloads = toolResultOffloadPolicy.selectHistoricalToolResultOffloads;
260832
260835
  }));
@@ -260840,13 +260843,7 @@ var ToolResultBatchOffload = class {
260840
260843
  }
260841
260844
  async detect() {
260842
260845
  const history = this.agent.context.history;
260843
- const tail = [];
260844
- for (let index = history.length - 1; index >= 0; index -= 1) {
260845
- const message = history[index];
260846
- if (message?.role !== "tool") break;
260847
- tail.unshift(message);
260848
- }
260849
- const tailIds = new Set(tail.map((message) => message.toolCallId).filter((id) => id !== void 0));
260846
+ const tailIds = freshToolResultIds(history);
260850
260847
  const recentStart = Math.max(0, history.length - TOOL_RESULT_HISTORICAL_KEEP_RECENT_MESSAGES);
260851
260848
  const historical = history.slice(0, recentStart).filter((message) => message?.role === "tool" && !tailIds.has(message.toolCallId));
260852
260849
  const candidateBatches = [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.415",
3
+ "version": "9.1.416",
4
4
  "description": "BLUN CLI - your own AI agent with a Telegram channel. Get it done. With BLUN.",
5
5
  "license": "MIT",
6
6
  "bin": {