blun-king-cli 9.1.246 → 9.1.248
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/loop-event-record-policy.cjs +33 -7
- package/blun.mjs +12 -10
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ const STEP_END_LIVE_ONLY_FIELDS = [
|
|
|
8
8
|
'llmServerDecodeMs',
|
|
9
9
|
'llmClientConsumeMs',
|
|
10
10
|
'messageId',
|
|
11
|
+
'reasoningFieldState',
|
|
11
12
|
];
|
|
12
13
|
const STEP_END_ROUTINE_FINISH_REASONS = new Set(['tool_use', 'end_turn']);
|
|
13
14
|
|
|
@@ -22,6 +23,13 @@ function resolveCompletedStepUuid(openSteps, event) {
|
|
|
22
23
|
return latest;
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
function resolveStepEventUuid(openSteps, event) {
|
|
27
|
+
if (event.stepUuid !== undefined) return event.stepUuid;
|
|
28
|
+
let latest;
|
|
29
|
+
for (const uuid of openSteps.keys()) latest = uuid;
|
|
30
|
+
return latest;
|
|
31
|
+
}
|
|
32
|
+
|
|
25
33
|
function hasOwn(object, key) {
|
|
26
34
|
return Object.prototype.hasOwnProperty.call(object, key);
|
|
27
35
|
}
|
|
@@ -36,19 +44,31 @@ function projectLoopEventForRecord(event) {
|
|
|
36
44
|
|
|
37
45
|
if (
|
|
38
46
|
event?.type === 'content.part' &&
|
|
39
|
-
(
|
|
47
|
+
(
|
|
48
|
+
hasOwn(event, 'uuid') ||
|
|
49
|
+
hasOwn(event, 'turnId') ||
|
|
50
|
+
hasOwn(event, 'step') ||
|
|
51
|
+
hasOwn(event, 'stepUuid')
|
|
52
|
+
)
|
|
40
53
|
) {
|
|
41
|
-
const {
|
|
54
|
+
const {
|
|
55
|
+
uuid: _uuid,
|
|
56
|
+
turnId: _turnId,
|
|
57
|
+
step: _step,
|
|
58
|
+
stepUuid: _stepUuid,
|
|
59
|
+
...recordedEvent
|
|
60
|
+
} = event;
|
|
42
61
|
return recordedEvent;
|
|
43
62
|
}
|
|
44
63
|
|
|
45
64
|
if (
|
|
46
65
|
event?.type === 'tool.call' &&
|
|
47
66
|
(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
67
|
+
hasOwn(event, 'uuid') ||
|
|
68
|
+
hasOwn(event, 'turnId') ||
|
|
69
|
+
hasOwn(event, 'step') ||
|
|
70
|
+
hasOwn(event, 'stepUuid') ||
|
|
71
|
+
hasOwn(event, 'display') ||
|
|
52
72
|
hasOwn(event, 'description')
|
|
53
73
|
)
|
|
54
74
|
) {
|
|
@@ -56,6 +76,7 @@ function projectLoopEventForRecord(event) {
|
|
|
56
76
|
uuid: _uuid,
|
|
57
77
|
turnId: _turnId,
|
|
58
78
|
step: _step,
|
|
79
|
+
stepUuid: _stepUuid,
|
|
59
80
|
display: _display,
|
|
60
81
|
description: _description,
|
|
61
82
|
...recordedEvent
|
|
@@ -95,6 +116,7 @@ function projectLoopEventForRecord(event) {
|
|
|
95
116
|
llmServerDecodeMs: _llmServerDecodeMs,
|
|
96
117
|
llmClientConsumeMs: _llmClientConsumeMs,
|
|
97
118
|
messageId: _messageId,
|
|
119
|
+
reasoningFieldState: _reasoningFieldState,
|
|
98
120
|
usage: _usage,
|
|
99
121
|
...recordedEvent
|
|
100
122
|
} = event;
|
|
@@ -106,4 +128,8 @@ function projectLoopEventForRecord(event) {
|
|
|
106
128
|
return withoutRoutineFinishReason;
|
|
107
129
|
}
|
|
108
130
|
|
|
109
|
-
module.exports = {
|
|
131
|
+
module.exports = {
|
|
132
|
+
projectLoopEventForRecord,
|
|
133
|
+
resolveCompletedStepUuid,
|
|
134
|
+
resolveStepEventUuid,
|
|
135
|
+
};
|
package/blun.mjs
CHANGED
|
@@ -75992,7 +75992,7 @@ var init_full = __esmMin((() => {
|
|
|
75992
75992
|
}));
|
|
75993
75993
|
//#endregion
|
|
75994
75994
|
//#region ../../packages/agent-core/src/agent/compaction/micro.ts
|
|
75995
|
-
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, resolveCompletedStepUuid, DEFAULT_CONFIG, MicroCompaction;
|
|
75995
|
+
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, resolveCompletedStepUuid, resolveStepEventUuid, DEFAULT_CONFIG, MicroCompaction;
|
|
75996
75996
|
var init_micro = __esmMin((() => {
|
|
75997
75997
|
({ 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"));
|
|
75998
75998
|
({ isPersistedToolResultReference } = createRequire(import.meta.url)("./bin/tool-result-offload-policy.cjs"));
|
|
@@ -76001,7 +76001,7 @@ var init_micro = __esmMin((() => {
|
|
|
76001
76001
|
({ projectRepeatedAssistantResponses } = createRequire(import.meta.url)("./bin/repeated-assistant-response-policy.cjs"));
|
|
76002
76002
|
({ compactHistoricalSkillActivations } = createRequire(import.meta.url)("./bin/skill-activation-performance-policy.cjs"));
|
|
76003
76003
|
({ dedupeRecurringCronWakeups, dedupeRepeatedInjections } = createRequire(import.meta.url)("./bin/repeated-injection-projection.cjs"));
|
|
76004
|
-
({ projectLoopEventForRecord, resolveCompletedStepUuid } = createRequire(import.meta.url)("./bin/loop-event-record-policy.cjs"));
|
|
76004
|
+
({ projectLoopEventForRecord, resolveCompletedStepUuid, resolveStepEventUuid } = createRequire(import.meta.url)("./bin/loop-event-record-policy.cjs"));
|
|
76005
76005
|
init_tokens();
|
|
76006
76006
|
DEFAULT_CONFIG = {
|
|
76007
76007
|
keepRecentMessages: MICRO_COMPACTION_RECENT_MESSAGES,
|
|
@@ -79149,15 +79149,17 @@ var init_context$2 = __esmMin((() => {
|
|
|
79149
79149
|
return;
|
|
79150
79150
|
}
|
|
79151
79151
|
case "content.part": {
|
|
79152
|
-
const
|
|
79153
|
-
|
|
79152
|
+
const stepEventUuid = resolveStepEventUuid(this.openSteps, event);
|
|
79153
|
+
const openStep = this.openSteps.get(stepEventUuid);
|
|
79154
|
+
if (openStep === void 0) throw new Error(`Received content_part for unknown step_uuid '${stepEventUuid}' (no open step_begin)`);
|
|
79154
79155
|
openStep.content.push(event.part);
|
|
79155
79156
|
this.markPendingTokenEstimateDirty();
|
|
79156
79157
|
return;
|
|
79157
79158
|
}
|
|
79158
79159
|
case "tool.call": {
|
|
79159
|
-
const
|
|
79160
|
-
|
|
79160
|
+
const stepEventUuid = resolveStepEventUuid(this.openSteps, event);
|
|
79161
|
+
const openStep = this.openSteps.get(stepEventUuid);
|
|
79162
|
+
if (openStep === void 0) throw new Error(`Received tool_call for unknown step_uuid '${stepEventUuid}' (no open step_begin)`);
|
|
79161
79163
|
openStep.toolCalls.push({
|
|
79162
79164
|
type: "function",
|
|
79163
79165
|
id: event.toolCallId,
|
|
@@ -324056,10 +324058,10 @@ function reduceWireRecords(records) {
|
|
|
324056
324058
|
return;
|
|
324057
324059
|
}
|
|
324058
324060
|
case "content.part":
|
|
324059
|
-
openSteps.get(event
|
|
324061
|
+
openSteps.get(resolveStepEventUuid(openSteps, event))?.message.content.push(event.part);
|
|
324060
324062
|
return;
|
|
324061
324063
|
case "tool.call": {
|
|
324062
|
-
const openStep = openSteps.get(event
|
|
324064
|
+
const openStep = openSteps.get(resolveStepEventUuid(openSteps, event));
|
|
324063
324065
|
if (openStep === void 0) return;
|
|
324064
324066
|
openStep.message.toolCalls.push({
|
|
324065
324067
|
type: "function",
|
|
@@ -398957,10 +398959,10 @@ function projectContext(entries, mode = "model") {
|
|
|
398957
398959
|
messages.push(projected);
|
|
398958
398960
|
openSteps.set(ev.uuid, projected);
|
|
398959
398961
|
} else if (ev.type === "content.part") {
|
|
398960
|
-
const projected = openSteps.get(ev
|
|
398962
|
+
const projected = openSteps.get(resolveStepEventUuid(openSteps, ev));
|
|
398961
398963
|
if (projected !== void 0) projected.message.content.push(ev.part);
|
|
398962
398964
|
} else if (ev.type === "tool.call") {
|
|
398963
|
-
const projected = openSteps.get(ev
|
|
398965
|
+
const projected = openSteps.get(resolveStepEventUuid(openSteps, ev));
|
|
398964
398966
|
if (projected !== void 0) {
|
|
398965
398967
|
const args = typeof ev.args === "string" ? ev.args : ev.args === void 0 ? null : JSON.stringify(ev.args);
|
|
398966
398968
|
projected.message.toolCalls.push({
|