blun-king-cli 9.1.318 → 9.1.319

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.
@@ -5,6 +5,7 @@ const os = require('node:os');
5
5
  const path = require('node:path');
6
6
 
7
7
  const MAX_PERSONA_BYTES = 64 * 1024;
8
+ const INVALID_PERSONALITY_CHOICE = Symbol('invalid-personality-choice');
8
9
 
9
10
  function resolvedHome(env) {
10
11
  const configured = String(env.BLUN_SHARED_HOME ?? env.BLUN_HOME ?? '').trim();
@@ -15,21 +16,27 @@ function persistedPersonalityChoice(env) {
15
16
  const personaPath = path.join(resolvedHome(env), 'persona.json');
16
17
  try {
17
18
  const stat = fs.lstatSync(personaPath);
18
- if (!stat.isFile() || stat.isSymbolicLink() || stat.size > MAX_PERSONA_BYTES) return undefined;
19
+ if (!stat.isFile() || stat.isSymbolicLink() || stat.size > MAX_PERSONA_BYTES) return INVALID_PERSONALITY_CHOICE;
19
20
  const persona = JSON.parse(fs.readFileSync(personaPath, 'utf8'));
20
- return typeof persona?.personalityEnabled === 'boolean' ? persona.personalityEnabled : undefined;
21
- } catch {
22
- return undefined;
21
+ if (!persona || typeof persona !== 'object' || Array.isArray(persona)) return INVALID_PERSONALITY_CHOICE;
22
+ if (!Object.prototype.hasOwnProperty.call(persona, 'personalityEnabled')) return undefined;
23
+ return typeof persona.personalityEnabled === 'boolean'
24
+ ? persona.personalityEnabled
25
+ : INVALID_PERSONALITY_CHOICE;
26
+ } catch (error) {
27
+ return error?.code === 'ENOENT' ? undefined : INVALID_PERSONALITY_CHOICE;
23
28
  }
24
29
  }
25
30
 
26
31
  function personalityContextEnabled(env = process.env) {
27
32
  const persisted = persistedPersonalityChoice(env);
33
+ if (persisted === INVALID_PERSONALITY_CHOICE) return false;
28
34
  if (persisted !== undefined) return persisted;
29
- return /^(?:1|true)$/iu.test(String(env.BLUN_IDENTITY_CONTEXT ?? '').trim());
35
+ const configured = String(env.BLUN_IDENTITY_CONTEXT ?? '').trim();
36
+ if (/^(?:0|false|off)$/iu.test(configured)) return false;
37
+ return true;
30
38
  }
31
39
 
32
40
  module.exports = {
33
41
  personalityContextEnabled,
34
42
  };
35
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.318",
3
+ "version": "9.1.319",
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": {