blun-king-cli 9.1.223 → 9.1.225
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/system-prompt-context-policy.cjs +11 -0
- package/blun.mjs +10 -2
- package/package.json +1 -1
|
@@ -103,6 +103,16 @@ function refreshedSystemPromptContext(previousFingerprint, context) {
|
|
|
103
103
|
return { fingerprint, reminder };
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
function resolveStableSystemPromptTimestamp(value, fallback = new Date()) {
|
|
107
|
+
const candidate = value instanceof Date ? value : new Date(value);
|
|
108
|
+
if (Number.isFinite(candidate.getTime())) return new Date(candidate.getTime());
|
|
109
|
+
|
|
110
|
+
const fallbackDate = fallback instanceof Date ? fallback : new Date(fallback);
|
|
111
|
+
return Number.isFinite(fallbackDate.getTime())
|
|
112
|
+
? new Date(fallbackDate.getTime())
|
|
113
|
+
: new Date();
|
|
114
|
+
}
|
|
115
|
+
|
|
106
116
|
module.exports = {
|
|
107
117
|
SYSTEM_PROMPT_DIRECTORY_MAX_CHARS,
|
|
108
118
|
SYSTEM_PROMPT_DIRECTORY_TRUNCATED_MARKER,
|
|
@@ -110,4 +120,5 @@ module.exports = {
|
|
|
110
120
|
compactRepeatedConductSections,
|
|
111
121
|
fingerprintSystemPromptContext,
|
|
112
122
|
refreshedSystemPromptContext,
|
|
123
|
+
resolveStableSystemPromptTimestamp,
|
|
113
124
|
};
|
package/blun.mjs
CHANGED
|
@@ -21437,7 +21437,7 @@ var init_list_directory = __esmMin((() => {
|
|
|
21437
21437
|
}));
|
|
21438
21438
|
//#endregion
|
|
21439
21439
|
//#region ../../packages/agent-core/src/profile/context.ts
|
|
21440
|
-
var { boundSystemPromptDirectoryListing, compactRepeatedConductSections, fingerprintSystemPromptContext, refreshedSystemPromptContext } = createRequire(import.meta.url)("./bin/system-prompt-context-policy.cjs");
|
|
21440
|
+
var { boundSystemPromptDirectoryListing, compactRepeatedConductSections, fingerprintSystemPromptContext, refreshedSystemPromptContext, resolveStableSystemPromptTimestamp } = createRequire(import.meta.url)("./bin/system-prompt-context-policy.cjs");
|
|
21441
21441
|
async function prepareSystemPromptContext(kaos, brandHome, options) {
|
|
21442
21442
|
const additionalDirs = normalizeAdditionalDirs(options?.additionalDirs ?? []);
|
|
21443
21443
|
const [cwdListing, agentsMdResult, additionalDirsInfo] = await Promise.all([
|
|
@@ -261015,6 +261015,10 @@ function blunThinkingIntentInput(input) {
|
|
|
261015
261015
|
function blunTurnHasAttachment(input) {
|
|
261016
261016
|
return input.some((part) => part.type !== "text") || BLUN_ATTACHMENT_MARKER_RE.test(blunExtractText(input));
|
|
261017
261017
|
}
|
|
261018
|
+
function blunTurnNeedsInitialMcp(input, origin) {
|
|
261019
|
+
if (blunTurnNeedsTools(input, origin)) return true;
|
|
261020
|
+
return BLUN_TELEGRAM_CHANNEL_RE.test(blunExtractText(input)) || blunTurnHasAttachment(input);
|
|
261021
|
+
}
|
|
261018
261022
|
function blunMessageTextChars(message) {
|
|
261019
261023
|
return message.content.reduce((total, part) => total + (part.type === "text" ? part.text.length : 0), 0);
|
|
261020
261024
|
}
|
|
@@ -261912,7 +261916,7 @@ var init_turn = __esmMin((() => {
|
|
|
261912
261916
|
let stopHookContinuationUsed = false;
|
|
261913
261917
|
let goalOutcomeMessageContinuationUsed = false;
|
|
261914
261918
|
const deduper = new ToolCallDeduplicator({ telemetry: this.agent.telemetry });
|
|
261915
|
-
await this.agent.mcp?.waitForInitialLoad(signal);
|
|
261919
|
+
if (blunTurnNeedsInitialMcp(input, origin)) await this.agent.mcp?.waitForInitialLoad(signal);
|
|
261916
261920
|
const personalMemoryRecall = await this.agent.injection.injectPersonalMemoryForTurn(turnId, input, origin, signal);
|
|
261917
261921
|
await this.agent.injection.injectGoal();
|
|
261918
261922
|
this.setActiveSteerAcceptance(turnId, true);
|
|
@@ -264969,6 +264973,9 @@ var init_agent = __esmMin((() => {
|
|
|
264969
264973
|
setRuntimeSystemPromptAppend(value) {
|
|
264970
264974
|
this.runtimeSystemPromptAppend = normalizeRuntimeSystemPromptAppend(value);
|
|
264971
264975
|
}
|
|
264976
|
+
setSystemPromptTimestamp(value) {
|
|
264977
|
+
this.systemPromptTimestamp = resolveStableSystemPromptTimestamp(value, this.systemPromptTimestamp);
|
|
264978
|
+
}
|
|
264972
264979
|
setActiveResponderModel(modelAlias) {
|
|
264973
264980
|
if (this._activeResponderModel === modelAlias) return;
|
|
264974
264981
|
this._activeResponderModel = modelAlias;
|
|
@@ -297359,6 +297366,7 @@ var init_session$1 = __esmMin((() => {
|
|
|
297359
297366
|
additionalDirs: parentAgent?.getAdditionalDirs() ?? this.additionalDirs,
|
|
297360
297367
|
systemPromptContextProvider: () => prepareSystemPromptContext(this.systemContextKaos(agent.kaos.getcwd()), this.options.blunHomeDir, { additionalDirs: agent.getAdditionalDirs() })
|
|
297361
297368
|
});
|
|
297369
|
+
agent.setSystemPromptTimestamp(this.metadata.createdAt);
|
|
297362
297370
|
agent.setRuntimeSystemPromptAppend(this.accountMemoryContext);
|
|
297363
297371
|
return agent;
|
|
297364
297372
|
}
|