blun-king-cli 9.1.201 → 9.1.202

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.
@@ -2,31 +2,41 @@
2
2
 
3
3
  const { createHash } = require('node:crypto');
4
4
 
5
- const SYSTEM_PROMPT_DIRECTORY_MAX_CHARS = 2_000;
5
+ const SYSTEM_PROMPT_DIRECTORY_MAX_CHARS = 1_000;
6
6
  const SYSTEM_PROMPT_DIRECTORY_TRUNCATED_MARKER =
7
7
  '... [directory overview shortened; use Glob, Grep, or Read for complete contents]';
8
+ const SYSTEM_PROMPT_DIRECTORY_TOP_LEVEL_MARKER =
9
+ '[top-level entries shown; nested contents omitted]';
8
10
 
9
11
  function boundSystemPromptDirectoryListing(value) {
10
12
  const listing = String(value ?? '');
11
13
  if (listing.length <= SYSTEM_PROMPT_DIRECTORY_MAX_CHARS) return listing;
12
14
 
15
+ const lines = listing.split(/\r?\n/u);
16
+ const hasNestedEntries = lines.some((line) => /^(?:│ | )+[├└]── /u.test(line));
17
+ const topLevelLines = lines.filter((line) => /^[├└]── /u.test(line));
18
+ const preferTopLevel = hasNestedEntries && topLevelLines.length > 0;
19
+ const candidateLines = preferTopLevel ? topLevelLines : lines;
20
+ const projectionMarker = preferTopLevel
21
+ ? `${SYSTEM_PROMPT_DIRECTORY_TOP_LEVEL_MARKER}\n`
22
+ : '';
13
23
  const contentBudget = Math.max(
14
24
  0,
15
25
  SYSTEM_PROMPT_DIRECTORY_MAX_CHARS
16
26
  - SYSTEM_PROMPT_DIRECTORY_TRUNCATED_MARKER.length
27
+ - projectionMarker.length
17
28
  - 1,
18
29
  );
19
- const lines = listing.split(/\r?\n/u);
20
30
  const kept = [];
21
31
  let used = 0;
22
- for (const line of lines) {
32
+ for (const line of candidateLines) {
23
33
  const added = line.length + (kept.length > 0 ? 1 : 0);
24
34
  if (used + added > contentBudget) break;
25
35
  kept.push(line);
26
36
  used += added;
27
37
  }
28
38
 
29
- return `${kept.join('\n')}\n${SYSTEM_PROMPT_DIRECTORY_TRUNCATED_MARKER}`;
39
+ return `${kept.join('\n')}\n${projectionMarker}${SYSTEM_PROMPT_DIRECTORY_TRUNCATED_MARKER}`;
30
40
  }
31
41
 
32
42
  function removeMarkdownSection(markdown, heading) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.201",
3
+ "version": "9.1.202",
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": {