blun-king-cli 9.1.114 → 9.1.115

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.
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ const SYSTEM_PROMPT_DIRECTORY_MAX_CHARS = 4_000;
4
+ const SYSTEM_PROMPT_DIRECTORY_TRUNCATED_MARKER =
5
+ '... [directory overview shortened; use Glob, Grep, or Read for complete contents]';
6
+
7
+ function boundSystemPromptDirectoryListing(value) {
8
+ const listing = String(value ?? '');
9
+ if (listing.length <= SYSTEM_PROMPT_DIRECTORY_MAX_CHARS) return listing;
10
+
11
+ const contentBudget = Math.max(
12
+ 0,
13
+ SYSTEM_PROMPT_DIRECTORY_MAX_CHARS
14
+ - SYSTEM_PROMPT_DIRECTORY_TRUNCATED_MARKER.length
15
+ - 1,
16
+ );
17
+ const lines = listing.split(/\r?\n/u);
18
+ const kept = [];
19
+ let used = 0;
20
+ for (const line of lines) {
21
+ const added = line.length + (kept.length > 0 ? 1 : 0);
22
+ if (used + added > contentBudget) break;
23
+ kept.push(line);
24
+ used += added;
25
+ }
26
+
27
+ return `${kept.join('\n')}\n${SYSTEM_PROMPT_DIRECTORY_TRUNCATED_MARKER}`;
28
+ }
29
+
30
+ module.exports = {
31
+ SYSTEM_PROMPT_DIRECTORY_MAX_CHARS,
32
+ SYSTEM_PROMPT_DIRECTORY_TRUNCATED_MARKER,
33
+ boundSystemPromptDirectoryListing,
34
+ };
package/blun.mjs CHANGED
@@ -21437,10 +21437,11 @@ var init_list_directory = __esmMin((() => {
21437
21437
  }));
21438
21438
  //#endregion
21439
21439
  //#region ../../packages/agent-core/src/profile/context.ts
21440
+ var { boundSystemPromptDirectoryListing } = createRequire(import.meta.url)("./bin/system-prompt-context-policy.cjs");
21440
21441
  async function prepareSystemPromptContext(kaos, brandHome, options) {
21441
21442
  const additionalDirs = normalizeAdditionalDirs(options?.additionalDirs ?? []);
21442
21443
  const [cwdListing, agentsMdResult, additionalDirsInfo] = await Promise.all([
21443
- listDirectory(kaos, void 0, { collapseHiddenDirs: true }),
21444
+ listDirectory(kaos, void 0, { collapseHiddenDirs: true }).then(boundSystemPromptDirectoryListing),
21444
21445
  loadAgentsMdForRoots(kaos, brandHome, [kaos.getcwd()]),
21445
21446
  loadAdditionalDirsInfo(kaos, additionalDirs)
21446
21447
  ]);
@@ -264501,10 +264502,12 @@ var init_agent = __esmMin((() => {
264501
264502
  agentsMd: context?.agentsMd,
264502
264503
  additionalDirsInfo: context?.additionalDirsInfo
264503
264504
  });
264505
+ if (systemPrompt === this.config.systemPrompt) return false;
264504
264506
  this.config.update({
264505
264507
  profileName: profile.name,
264506
264508
  systemPrompt
264507
264509
  });
264510
+ return true;
264508
264511
  }
264509
264512
  async resume(options) {
264510
264513
  const result = await this.records.replay(options);
@@ -296910,11 +296913,8 @@ var init_session$1 = __esmMin((() => {
296910
296913
  if (agent.config.systemPrompt === "") return;
296911
296914
  const profile = this.resolvePersistedProfile(agent, meta, parentAgent);
296912
296915
  if (profile === void 0) return;
296913
- if (hasLegacyLocalMemorySystemBlock(agent.config.systemPrompt)) {
296914
- await this.bootstrapAgentProfile(agent, profile);
296915
- return;
296916
- }
296917
296916
  agent.setActiveProfile(profile, this.options.blunHomeDir);
296917
+ await agent.refreshSystemPrompt();
296918
296918
  }
296919
296919
  ensureBaselineSkill(agent) {
296920
296920
  if (agent.skills?.ensureBaseline(BASELINE_SKILL_NAME) !== true) this.log.warn("baseline skill is unavailable", { skill: BASELINE_SKILL_NAME });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.114",
3
+ "version": "9.1.115",
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": {