blun-king-cli 9.1.414 → 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
@@ -483,6 +491,15 @@ Nutzerentscheidung. Auslöser und Bedingung bleiben bei Fortsetzung und Neustart
483
491
  erhalten, ohne Berechtigungen zu erteilen. Bereits gespeicherte ältere
484
492
  Checkpoints bleiben lesbar.
485
493
 
494
+ Ab BLUN King 9.1.415 übernimmt der sitzungsübergreifende Arbeitsfokus den
495
+ gespeicherten Auslöser vollständig. Die nächste Aktion und die Bedingung, unter
496
+ der sie ausgeführt werden darf, bleiben getrennt sichtbar. Dadurch erscheint
497
+ eine Wartephase nach einem Neustart oder Kontextwechsel nicht mehr als sofortiger
498
+ Arbeitsauftrag. Art und Bedingung des Auslösers verändern außerdem die Identität
499
+ des dauerhaften Fokuszustands; fehlerhafte oder zur Phase widersprüchliche
500
+ Auslöser werden verworfen. Ältere Checkpoints ohne ausdrücklichen Auslöser
501
+ behalten ihr bisheriges Verhalten.
502
+
486
503
  Der eigentliche Anhang und die vollständige Nutzernachricht bleiben für den Zug
487
504
  unverändert verfügbar. Die Begrenzung betrifft ausschließlich die kleine
488
505
  lexikalische Vorauswahl von höchstens zwei Werkzeugschemas; ToolSearch und alle
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.
@@ -489,6 +498,15 @@ Nutzerentscheidung. Auslöser und Bedingung bleiben bei Fortsetzung und Neustart
489
498
  erhalten, ohne Berechtigungen zu erteilen. Bereits gespeicherte ältere
490
499
  Checkpoints bleiben lesbar.
491
500
 
501
+ Ab BLUN King 9.1.415 übernimmt der sitzungsübergreifende Arbeitsfokus den
502
+ gespeicherten Auslöser vollständig. Die nächste Aktion und die Bedingung, unter
503
+ der sie ausgeführt werden darf, bleiben getrennt sichtbar. Dadurch erscheint
504
+ eine Wartephase nach einem Neustart oder Kontextwechsel nicht mehr als sofortiger
505
+ Arbeitsauftrag. Art und Bedingung des Auslösers verändern außerdem die Identität
506
+ des dauerhaften Fokuszustands; fehlerhafte oder zur Phase widersprüchliche
507
+ Auslöser werden verworfen. Ältere Checkpoints ohne ausdrücklichen Auslöser
508
+ behalten ihr bisheriges Verhalten.
509
+
492
510
  Der eigentliche Anhang und die vollständige Nutzernachricht bleiben für den Zug
493
511
  unverändert verfügbar. Die Begrenzung betrifft ausschließlich die kleine
494
512
  lexikalische Vorauswahl von höchstens zwei Werkzeugschemas; ToolSearch und alle
@@ -53,7 +53,7 @@ function buildCognitiveFocusProjection(state, { focusScopes, maxItems = 6, maxCh
53
53
  state.observations.forEach((item, index) => {
54
54
  const domain = String(item?.domain ?? '');
55
55
  const key = clean(item?.key, 128);
56
- const value = clean(item?.value, 512);
56
+ const value = clean(item?.value, 640);
57
57
  const scope = clean(item?.scope, 128);
58
58
  const observationId = clean(item?.observation_id, 128);
59
59
  const supersedes = item?.supersedes === null || item?.supersedes === undefined
@@ -7,6 +7,10 @@ const STATUSES = new Set(['active', 'paused', 'blocked']);
7
7
  const EPISTEMIC_STATES = new Set([
8
8
  'verified', 'credible_unverified', 'hypothesis', 'uncertain_memory', 'stale', 'unknown', 'legacy_unknown',
9
9
  ]);
10
+ const TRIGGER_KINDS = new Set([
11
+ 'immediate', 'external_event', 'time', 'dependency', 'user_decision',
12
+ ]);
13
+ const TRIGGER_KEYS = new Set(['kind', 'condition']);
10
14
  const NEXT_TRIGGER = new Map([
11
15
  ['active', 'Continue the active goal from its last verified state.'],
12
16
  ['paused', 'Wait until the goal is explicitly resumed.'],
@@ -40,6 +44,23 @@ function buildCognitiveWorkFocus(goal) {
40
44
  const nextAction = bounded(checkpoint?.nextAction);
41
45
  const checkpointEvidence = bounded(checkpoint?.expectedEvidence);
42
46
  const checkpointEpistemicState = bounded(checkpoint?.epistemicState, 32);
47
+ const rawNextTrigger = checkpoint?.nextTrigger;
48
+ let triggerKind = '';
49
+ let triggerCondition = '';
50
+ if (rawNextTrigger !== undefined) {
51
+ if (!rawNextTrigger || typeof rawNextTrigger !== 'object' || Array.isArray(rawNextTrigger)
52
+ || Object.keys(rawNextTrigger).length !== TRIGGER_KEYS.size
53
+ || Object.keys(rawNextTrigger).some((key) => !TRIGGER_KEYS.has(key))) return null;
54
+ triggerKind = String(rawNextTrigger.kind ?? '').trim();
55
+ triggerCondition = bounded(rawNextTrigger.condition);
56
+ if (!TRIGGER_KINDS.has(triggerKind) || !triggerCondition
57
+ || checkpointPhase === 'wait' && triggerKind === 'immediate'
58
+ || checkpointPhase !== 'wait' && triggerKind !== 'immediate') return null;
59
+ }
60
+ const hasExplicitTrigger = Boolean(triggerKind && triggerCondition);
61
+ const triggerValue = hasExplicitTrigger
62
+ ? `${triggerKind.replaceAll('_', ' ')} - ${triggerCondition}`
63
+ : nextAction;
43
64
  const problemFrame = checkpoint?.problemFrame && typeof checkpoint.problemFrame === 'object'
44
65
  && !Array.isArray(checkpoint.problemFrame) ? checkpoint.problemFrame : null;
45
66
  const frameMissingKnowledge = Array.isArray(problemFrame?.missingKnowledge)
@@ -69,6 +90,8 @@ function buildCognitiveWorkFocus(goal) {
69
90
  hasCheckpoint ? lastVerified : '',
70
91
  hasCheckpoint ? nextAction : '',
71
92
  hasCheckpoint ? checkpointEvidence : '',
93
+ hasExplicitTrigger ? triggerKind : '',
94
+ hasExplicitTrigger ? triggerCondition : '',
72
95
  epistemicState,
73
96
  hasProblemFrame ? frameSuccessCriterion : '',
74
97
  hasProblemFrame ? frameMissingKnowledge.join('\0') : '',
@@ -91,6 +114,7 @@ function buildCognitiveWorkFocus(goal) {
91
114
  value: bounded(hasCheckpoint
92
115
  ? [
93
116
  `Goal is ${status}. Phase ${checkpointPhase}. Last verified: ${lastVerified}`,
117
+ `Next action: ${nextAction}`,
94
118
  hasProblemFrame ? `Missing knowledge: ${frameMissingKnowledge.join(' | ')}` : '',
95
119
  hasProblemFrame ? `Risk: ${frameRisk}` : '',
96
120
  hasProblemFrame ? `Selected action: ${frameSelectedAction}` : '',
@@ -100,7 +124,7 @@ function buildCognitiveWorkFocus(goal) {
100
124
  },
101
125
  {
102
126
  domain: 'next_trigger', key: `${keyRoot}:next`,
103
- value: status === 'active' && hasCheckpoint ? nextAction : NEXT_TRIGGER.get(status),
127
+ value: status === 'active' && hasCheckpoint ? triggerValue : NEXT_TRIGGER.get(status),
104
128
  confidence: 1, epistemicState, scope: focusScope,
105
129
  },
106
130
  {
@@ -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.414",
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": {