blun-king-cli 9.1.250 → 9.1.252
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 +11 -0
- package/bin/update-notice.js +30 -3
- package/blun.mjs +7 -6
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ const STEP_END_LIVE_ONLY_FIELDS = [
|
|
|
11
11
|
'reasoningFieldState',
|
|
12
12
|
];
|
|
13
13
|
const STEP_END_ROUTINE_FINISH_REASONS = new Set(['tool_use', 'end_turn']);
|
|
14
|
+
const DEFAULT_USAGE_MODEL = 'blun/king';
|
|
14
15
|
|
|
15
16
|
function usageTotal(usage) {
|
|
16
17
|
return usage.inputCacheRead + usage.inputCacheCreation + usage.inputOther + usage.output;
|
|
@@ -34,6 +35,14 @@ function hasOwn(object, key) {
|
|
|
34
35
|
return Object.prototype.hasOwnProperty.call(object, key);
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
function projectUsageModelForRecord(model) {
|
|
39
|
+
return model === DEFAULT_USAGE_MODEL ? undefined : model;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function restoreUsageModelFromRecord(model) {
|
|
43
|
+
return model === undefined ? DEFAULT_USAGE_MODEL : model;
|
|
44
|
+
}
|
|
45
|
+
|
|
37
46
|
function projectUsageForRecord(usage) {
|
|
38
47
|
if (!usage || typeof usage !== 'object') return usage;
|
|
39
48
|
const omitCacheRead = usage.inputCacheRead === 0;
|
|
@@ -156,8 +165,10 @@ function projectLoopEventForRecord(event) {
|
|
|
156
165
|
|
|
157
166
|
module.exports = {
|
|
158
167
|
projectLoopEventForRecord,
|
|
168
|
+
projectUsageModelForRecord,
|
|
159
169
|
projectUsageForRecord,
|
|
160
170
|
resolveCompletedStepUuid,
|
|
161
171
|
resolveStepEventUuid,
|
|
162
172
|
restoreUsageFromRecord,
|
|
173
|
+
restoreUsageModelFromRecord,
|
|
163
174
|
};
|
package/bin/update-notice.js
CHANGED
|
@@ -982,6 +982,14 @@ function pathIsWithin(root, candidate) {
|
|
|
982
982
|
&& !path.isAbsolute(relative));
|
|
983
983
|
}
|
|
984
984
|
|
|
985
|
+
function isManagedReleasePackageRoot(blunDir, packageRoot) {
|
|
986
|
+
if (typeof blunDir !== 'string' || typeof packageRoot !== 'string') return false;
|
|
987
|
+
return pathIsWithin(
|
|
988
|
+
path.join(path.resolve(blunDir), UPDATE_DIRECTORY, 'releases'),
|
|
989
|
+
path.resolve(packageRoot),
|
|
990
|
+
);
|
|
991
|
+
}
|
|
992
|
+
|
|
985
993
|
function resolveInstallTempRoot(options) {
|
|
986
994
|
if (typeof options.blunDir !== 'string' || options.blunDir.trim().length === 0) {
|
|
987
995
|
throw new Error('INVALID_UPDATE_BLUN_HOME');
|
|
@@ -1533,7 +1541,11 @@ async function runUpdateFlow(options, explicitUpdate) {
|
|
|
1533
1541
|
}
|
|
1534
1542
|
if (installResult?.code === 0 && installResult?.verified === true) {
|
|
1535
1543
|
updateProgress(4, 'Installation geprüft');
|
|
1536
|
-
|
|
1544
|
+
if (explicitUpdate && installResult.preparedRuntime === true) {
|
|
1545
|
+
writePendingUpdate(blunDir, release.version);
|
|
1546
|
+
} else {
|
|
1547
|
+
clearPendingUpdate(blunDir);
|
|
1548
|
+
}
|
|
1537
1549
|
try {
|
|
1538
1550
|
writeCoreInstallSuccess(
|
|
1539
1551
|
blunDir,
|
|
@@ -1584,8 +1596,23 @@ async function runUpdateFlow(options, explicitUpdate) {
|
|
|
1584
1596
|
}
|
|
1585
1597
|
}
|
|
1586
1598
|
|
|
1587
|
-
function runExplicitUpdate(options) {
|
|
1588
|
-
|
|
1599
|
+
async function runExplicitUpdate(options) {
|
|
1600
|
+
let preparedRuntime = options.preparedRuntime;
|
|
1601
|
+
if (preparedRuntime === undefined
|
|
1602
|
+
&& isManagedReleasePackageRoot(options.blunDir, options.packageRoot)) {
|
|
1603
|
+
const runningUpdate = options.prepareRunningUpdate && options.stageRuntime
|
|
1604
|
+
? undefined
|
|
1605
|
+
: require('./running-update.cjs');
|
|
1606
|
+
preparedRuntime = await (options.prepareRunningUpdate || runningUpdate.prepareRunningUpdate)({
|
|
1607
|
+
currentVersion: options.currentVersion,
|
|
1608
|
+
sharedHome: options.blunDir,
|
|
1609
|
+
env: options.env,
|
|
1610
|
+
});
|
|
1611
|
+
if (preparedRuntime !== null) {
|
|
1612
|
+
(options.stageRuntime || runningUpdate.stageRuntime)(options.blunDir, preparedRuntime);
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
return runUpdateFlow({ ...options, preparedRuntime }, true);
|
|
1589
1616
|
}
|
|
1590
1617
|
|
|
1591
1618
|
function runUpdateNotice(options) {
|
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, projectUsageForRecord, resolveCompletedStepUuid, resolveStepEventUuid, restoreUsageFromRecord, 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, projectUsageModelForRecord, projectUsageForRecord, resolveCompletedStepUuid, resolveStepEventUuid, restoreUsageFromRecord, restoreUsageModelFromRecord, 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, projectUsageForRecord, resolveCompletedStepUuid, resolveStepEventUuid, restoreUsageFromRecord } = createRequire(import.meta.url)("./bin/loop-event-record-policy.cjs"));
|
|
76004
|
+
({ projectLoopEventForRecord, projectUsageModelForRecord, projectUsageForRecord, resolveCompletedStepUuid, resolveStepEventUuid, restoreUsageFromRecord, restoreUsageModelFromRecord } = 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,
|
|
@@ -235036,7 +235036,7 @@ function restoreAgentRecord(agent, input) {
|
|
|
235036
235036
|
agent.permission.recordApprovalResult(input);
|
|
235037
235037
|
return;
|
|
235038
235038
|
case "usage.record":
|
|
235039
|
-
agent.usage.record(input.model, restoreUsageFromRecord(input.usage), "session");
|
|
235039
|
+
agent.usage.record(restoreUsageModelFromRecord(input.model), restoreUsageFromRecord(input.usage), "session");
|
|
235040
235040
|
return;
|
|
235041
235041
|
case "full_compaction.begin":
|
|
235042
235042
|
agent.fullCompaction.begin(input);
|
|
@@ -264637,7 +264637,7 @@ var init_usage = __esmMin((() => {
|
|
|
264637
264637
|
record(model, usage, scope = "session") {
|
|
264638
264638
|
this.agent?.records.logRecord({
|
|
264639
264639
|
type: "usage.record",
|
|
264640
|
-
model,
|
|
264640
|
+
model: projectUsageModelForRecord(model),
|
|
264641
264641
|
usage: projectUsageForRecord(usage),
|
|
264642
264642
|
usageScope: scope
|
|
264643
264643
|
});
|
|
@@ -399116,10 +399116,11 @@ function projectContext(entries, mode = "model") {
|
|
|
399116
399116
|
}
|
|
399117
399117
|
case "usage.record": {
|
|
399118
399118
|
const scope = rec.usageScope ?? "session";
|
|
399119
|
+
const restoredModel = restoreUsageModelFromRecord(rec.model);
|
|
399119
399120
|
const restoredUsage = restoreUsageFromRecord(rec.usage);
|
|
399120
399121
|
addUsage(usage.byScope[scope], restoredUsage);
|
|
399121
|
-
if (!usage.byModel[
|
|
399122
|
-
addUsage(usage.byModel[
|
|
399122
|
+
if (!usage.byModel[restoredModel]) usage.byModel[restoredModel] = { ...ZERO };
|
|
399123
|
+
addUsage(usage.byModel[restoredModel], restoredUsage);
|
|
399123
399124
|
break;
|
|
399124
399125
|
}
|
|
399125
399126
|
case "config.update": {
|