blun-king-cli 9.1.244 → 9.1.246
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 +13 -2
- package/blun.mjs +11 -7
- package/package.json +1 -1
|
@@ -15,13 +15,22 @@ function usageTotal(usage) {
|
|
|
15
15
|
return usage.inputCacheRead + usage.inputCacheCreation + usage.inputOther + usage.output;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
function resolveCompletedStepUuid(openSteps, event) {
|
|
19
|
+
if (event.uuid !== undefined) return event.uuid;
|
|
20
|
+
let latest;
|
|
21
|
+
for (const uuid of openSteps.keys()) latest = uuid;
|
|
22
|
+
return latest;
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
function hasOwn(object, key) {
|
|
19
26
|
return Object.prototype.hasOwnProperty.call(object, key);
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
function projectLoopEventForRecord(event) {
|
|
23
30
|
if (event?.type === 'step.begin' && hasOwn(event, 'step')) {
|
|
24
|
-
const { step: _step, ...
|
|
31
|
+
const { step: _step, ...withoutStep } = event;
|
|
32
|
+
if (event.step <= 1 || !hasOwn(withoutStep, 'turnId')) return withoutStep;
|
|
33
|
+
const { turnId: _turnId, ...recordedEvent } = withoutStep;
|
|
25
34
|
return recordedEvent;
|
|
26
35
|
}
|
|
27
36
|
|
|
@@ -64,6 +73,7 @@ function projectLoopEventForRecord(event) {
|
|
|
64
73
|
if (
|
|
65
74
|
event?.type !== 'step.end' ||
|
|
66
75
|
(
|
|
76
|
+
!hasOwn(event, 'uuid') &&
|
|
67
77
|
!hasOwn(event, 'turnId') &&
|
|
68
78
|
!hasOwn(event, 'step') &&
|
|
69
79
|
!hasUsage &&
|
|
@@ -75,6 +85,7 @@ function projectLoopEventForRecord(event) {
|
|
|
75
85
|
}
|
|
76
86
|
|
|
77
87
|
const {
|
|
88
|
+
uuid: _uuid,
|
|
78
89
|
turnId: _turnId,
|
|
79
90
|
step: _step,
|
|
80
91
|
llmFirstTokenLatencyMs: _llmFirstTokenLatencyMs,
|
|
@@ -95,4 +106,4 @@ function projectLoopEventForRecord(event) {
|
|
|
95
106
|
return withoutRoutineFinishReason;
|
|
96
107
|
}
|
|
97
108
|
|
|
98
|
-
module.exports = { projectLoopEventForRecord };
|
|
109
|
+
module.exports = { projectLoopEventForRecord, resolveCompletedStepUuid };
|
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, 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, 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 } = createRequire(import.meta.url)("./bin/loop-event-record-policy.cjs"));
|
|
76004
|
+
({ projectLoopEventForRecord, resolveCompletedStepUuid } = 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,
|
|
@@ -79130,8 +79130,9 @@ var init_context$2 = __esmMin((() => {
|
|
|
79130
79130
|
return;
|
|
79131
79131
|
}
|
|
79132
79132
|
case "step.end": {
|
|
79133
|
-
const
|
|
79134
|
-
this.openSteps.
|
|
79133
|
+
const completedStepUuid = resolveCompletedStepUuid(this.openSteps, event);
|
|
79134
|
+
const openStep = this.openSteps.get(completedStepUuid);
|
|
79135
|
+
this.openSteps.delete(completedStepUuid);
|
|
79135
79136
|
if (event.usage !== void 0 || event.contextTokens !== void 0) {
|
|
79136
79137
|
const openStepIndex = openStep === void 0 ? -1 : this._history.indexOf(openStep);
|
|
79137
79138
|
const coveredCount = openStepIndex === -1 ? this._history.length : openStepIndex + 1;
|
|
@@ -324048,10 +324049,12 @@ function reduceWireRecords(records) {
|
|
|
324048
324049
|
openSteps.set(event.uuid, entry);
|
|
324049
324050
|
return;
|
|
324050
324051
|
}
|
|
324051
|
-
case "step.end":
|
|
324052
|
-
openSteps
|
|
324052
|
+
case "step.end": {
|
|
324053
|
+
const completedStepUuid = resolveCompletedStepUuid(openSteps, event);
|
|
324054
|
+
openSteps.delete(completedStepUuid);
|
|
324053
324055
|
flushDeferredIfToolExchangeClosed();
|
|
324054
324056
|
return;
|
|
324057
|
+
}
|
|
324055
324058
|
case "content.part":
|
|
324056
324059
|
openSteps.get(event.stepUuid)?.message.content.push(event.part);
|
|
324057
324060
|
return;
|
|
@@ -398972,7 +398975,8 @@ function projectContext(entries, mode = "model") {
|
|
|
398972
398975
|
const fill = ev.contextTokens ?? ev.usage.inputCacheRead + ev.usage.inputCacheCreation + ev.usage.inputOther + ev.usage.output;
|
|
398973
398976
|
if (fill > 0) contextTokens = fill;
|
|
398974
398977
|
}
|
|
398975
|
-
openSteps
|
|
398978
|
+
const completedStepUuid = resolveCompletedStepUuid(openSteps, ev);
|
|
398979
|
+
openSteps.delete(completedStepUuid);
|
|
398976
398980
|
} else if (ev.type === "tool.result") {
|
|
398977
398981
|
const toolMsg = {
|
|
398978
398982
|
role: "tool",
|