blun-king-cli 9.1.324 → 9.1.325

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,72 @@
1
+ 'use strict';
2
+
3
+ const PERSONAL_MEMORY_MUTATION_TOOLS = new Set([
4
+ 'mcp__personal-memory__memory_settings_update',
5
+ 'mcp__personal-memory__memory_remember',
6
+ ]);
7
+
8
+ function normalizeText(input) {
9
+ return String(input ?? '')
10
+ .normalize('NFKD')
11
+ .replaceAll(/\p{M}/gu, '')
12
+ .toLocaleLowerCase()
13
+ .replaceAll(/[\u2018\u2019]/g, "'")
14
+ .replaceAll(/\s+/g, ' ')
15
+ .trim();
16
+ }
17
+
18
+ function personalMemoryMutationDecision(permissionMode, toolName) {
19
+ if (!PERSONAL_MEMORY_MUTATION_TOOLS.has(String(toolName).toLowerCase())) {
20
+ return undefined;
21
+ }
22
+ return permissionMode === 'yolo' ? 'approve' : 'ask';
23
+ }
24
+
25
+ function isNegatedRememberRequest(input) {
26
+ return /^(?:please\s+)?(?:do\s+not|don't|never)\s+(?:remember|save|keep)\b/.test(input)
27
+ || /^(?:bitte\s+)?(?:nicht|nie)\s+(?:merken|speichern)\b/.test(input)
28
+ || /^(?:bitte\s+)?merk(?:e)?\s+dir\b.*\b(?:nicht|nie)\b/.test(input)
29
+ || /^(?:por\s+favor\s+)?no\s+(?:recuerdes|guardes)\b/.test(input)
30
+ || /^ne\s+(?:memorise|te\s+souviens)\b.*\bpas\b/.test(input)
31
+ || /^(?:snalla\s+)?(?:kom\s+inte\s+ihag|spara\s+inte)\b/.test(input)
32
+ || /^(?:prosim\s+)?(?:nezapamatuj|neukladej)\b/.test(input);
33
+ }
34
+
35
+ function isExplicitRememberRequest(input, allowEmbedded) {
36
+ const normalized = normalizeText(input);
37
+ if (normalized.length === 0 || isNegatedRememberRequest(normalized)) return false;
38
+
39
+ const anchored = [
40
+ /^(?:please\s+)?remember\s+(?:this|that|my|the\s+following|that\b)/,
41
+ /^(?:please\s+)?(?:save|keep)\s+(?:this|that)\s+(?:in\s+(?:your\s+)?memory|for\s+later)\b/,
42
+ /^(?:bitte\s+)?merk(?:e)?\s+dir(?:\s*[:,]|\s+(?:das|dies|dass|mein(?:e|en)?|folgendes)\b)/,
43
+ /^(?:kannst\s+du\s+dir\s+(?:bitte\s+)?|bitte\s+)merken\s*[,]?\s+dass\b/,
44
+ /^(?:bitte\s+)?speicher(?:e)?\s+(?:dir\s+)?(?:das|dies|folgendes)\b/,
45
+ /^(?:por\s+favor\s+)?recuerda(?:\s*[:,]|\s+(?:esto|eso|que|mi)\b)/,
46
+ /^(?:por\s+favor\s+)?guarda\s+(?:esto|eso)\s+en\s+(?:la\s+)?memoria\b/,
47
+ /^(?:s'il\s+te\s+plait\s*[,]?\s+)?memorise(?:\s*[:,]|\s+(?:ceci|cela|que|mon|ma|mes)\b)/,
48
+ /^(?:s'il\s+te\s+plait\s*[,]?\s+)?souviens-toi(?:\s*[:,]|\s+(?:de|que|ceci|cela)\b)/,
49
+ /^(?:snalla\s+)?kom\s+ihag(?:\s*[:,]|\s+(?:detta|det|att|min|mitt|mina)\b)/,
50
+ /^(?:snalla\s+)?spara\s+(?:det\s+har|detta)\s+i\s+minnet\b/,
51
+ /^(?:prosim\s+)?zapamatuj\s+si(?:\s*[:,]|\s+(?:to|ze|moje|muj|mou)\b)/,
52
+ /^(?:prosim\s+)?uloz\s+si\s+(?:to|toto)\s+do\s+pameti\b/,
53
+ ];
54
+ if (anchored.some((pattern) => pattern.test(normalized))) return true;
55
+ if (!allowEmbedded) return false;
56
+
57
+ return [
58
+ /\b(?:please\s+)?remember\s+(?:this|that|my|the\s+following)\b/,
59
+ /\b(?:bitte\s+)?merk(?:e)?\s+dir\s+(?:das|dies|dass|folgendes)\b/,
60
+ /\bspeicher(?:e)?\s+(?:dir\s+)?(?:das|dies|folgendes)\b/,
61
+ ].some((pattern) => pattern.test(normalized));
62
+ }
63
+
64
+ function shouldArmPersonalMemoryRememberIntent(input, options = {}) {
65
+ if (options.permissionMode === 'yolo') return true;
66
+ return isExplicitRememberRequest(input, options.channel === true);
67
+ }
68
+
69
+ module.exports = {
70
+ personalMemoryMutationDecision,
71
+ shouldArmPersonalMemoryRememberIntent,
72
+ };
@@ -610,6 +610,7 @@ function writeCoreInstallSuccess(
610
610
  fromVersion,
611
611
  version,
612
612
  releaseNotes,
613
+ initiatedBy,
613
614
  now = Date.now(),
614
615
  ) {
615
616
  if (!parseSemver(fromVersion) || !parseSemver(version)) {
@@ -631,6 +632,7 @@ function writeCoreInstallSuccess(
631
632
  version,
632
633
  fromVersion,
633
634
  ...(releaseNotes === undefined ? {} : { releaseNotes }),
635
+ initiatedBy,
634
636
  installedAt: new Date(now).toISOString(),
635
637
  notifiedAt: null,
636
638
  },
@@ -1597,6 +1599,11 @@ async function runUpdateFlow(options, explicitUpdate) {
1597
1599
  currentVersion,
1598
1600
  release.version,
1599
1601
  release.releaseNotes,
1602
+ explicitUpdate || queuedForRelease
1603
+ ? 'manual'
1604
+ : automaticPreparedRuntimeReady
1605
+ ? 'automatic'
1606
+ : 'startup_prompt',
1600
1607
  (options.now || Date.now)(),
1601
1608
  );
1602
1609
  } catch {
package/blun.mjs CHANGED
@@ -233640,14 +233640,20 @@ var init_plan_mode_tool_approve = __esmMin((() => {
233640
233640
  function isPersonalMemoryMutationTool(toolName) {
233641
233641
  return PERSONAL_MEMORY_MUTATION_TOOLS.has(toolName.toLowerCase());
233642
233642
  }
233643
+ var personalMemoryConsentPolicy = createRequire(import.meta.url)("./bin/personal-memory-consent-policy.cjs");
233643
233644
  var PERSONAL_MEMORY_MUTATION_TOOLS, PersonalMemoryMutationAlwaysAskPermissionPolicy;
233644
233645
  var init_personal_memory_mutation_always_ask = __esmMin((() => {
233645
233646
  PERSONAL_MEMORY_MUTATION_TOOLS = new Set(["mcp__personal-memory__memory_settings_update", "mcp__personal-memory__memory_remember"]);
233646
233647
  PersonalMemoryMutationAlwaysAskPermissionPolicy = class {
233648
+ agent;
233647
233649
  name = "personal-memory-mutation-always-ask";
233650
+ constructor(agent) {
233651
+ this.agent = agent;
233652
+ }
233648
233653
  evaluate(context) {
233649
- if (!isPersonalMemoryMutationTool(context.toolCall.name)) return;
233650
- return { kind: "ask" };
233654
+ const decision = personalMemoryConsentPolicy.personalMemoryMutationDecision(this.agent.permission.mode, context.toolCall.name);
233655
+ if (decision === void 0) return;
233656
+ return { kind: decision };
233651
233657
  }
233652
233658
  };
233653
233659
  }));
@@ -233860,7 +233866,7 @@ function createPermissionDecisionPolicies(agent) {
233860
233866
  new AutoModeAskUserQuestionDenyPermissionPolicy(agent),
233861
233867
  new PlanModeGuardDenyPermissionPolicy(agent),
233862
233868
  new UserConfiguredDenyPermissionPolicy(agent),
233863
- new PersonalMemoryMutationAlwaysAskPermissionPolicy(),
233869
+ new PersonalMemoryMutationAlwaysAskPermissionPolicy(agent),
233864
233870
  new DesktopControlAlwaysAskPermissionPolicy(agent),
233865
233871
  new AutoModeApprovePermissionPolicy(agent),
233866
233872
  new SessionApprovalHistoryPermissionPolicy(agent),
@@ -505125,9 +505131,9 @@ function isRecord$2(value) {
505125
505131
  //#region src/personal-memory/remember-intent.ts
505126
505132
  const activeIntents = /* @__PURE__ */ new Map();
505127
505133
  /** Arm an attestation only for an explicit request submitted by the trusted host. */
505128
- function armPersonalMemoryRememberIntent(sessionId, input) {
505134
+ function armPersonalMemoryRememberIntent(sessionId, input, options = {}) {
505129
505135
  activeIntents.delete(sessionId);
505130
- if (!isExplicitPersonalMemoryRememberRequest(input)) return;
505136
+ if (!personalMemoryConsentPolicy.shouldArmPersonalMemoryRememberIntent(input, options)) return;
505131
505137
  activeIntents.set(sessionId, { consumed: false });
505132
505138
  }
505133
505139
  /** Bind the pending attestation to the exact turn allocated for that prompt. */
@@ -517238,6 +517244,10 @@ var BlunTUI = class {
517238
517244
  });
517239
517245
  }
517240
517246
  sendChannelMessageInternal(session, modelInput, displayText, origin, channelChatId, channelImagePath, contextOnly = false, transcriptRendered = false, acknowledge, channelAttention = false, queueKey, channelDirect = false, channelDirectResume = false) {
517247
+ armPersonalMemoryRememberIntent(session.id, displayText, {
517248
+ permissionMode: this.state.appState.permissionMode,
517249
+ channel: true
517250
+ });
517241
517251
  if (!transcriptRendered) this.appendTranscriptEntry({
517242
517252
  id: nextTranscriptId(),
517243
517253
  kind: "user",
@@ -517608,7 +517618,10 @@ var BlunTUI = class {
517608
517618
  this.sessionEventHandler.requestQueuedGoalPromotion();
517609
517619
  }
517610
517620
  sendMessageInternal(session, input, options) {
517611
- armPersonalMemoryRememberIntent(session.id, input);
517621
+ armPersonalMemoryRememberIntent(session.id, input, {
517622
+ permissionMode: this.state.appState.permissionMode,
517623
+ channel: false
517624
+ });
517612
517625
  const imageAttachmentIds = options?.imageAttachmentIds !== void 0 && options.imageAttachmentIds.length > 0 ? options.imageAttachmentIds : void 0;
517613
517626
  this.appendTranscriptEntry({
517614
517627
  id: nextTranscriptId(),
@@ -519592,6 +519605,7 @@ const UpdateInstallStateSchema = object({
519592
519605
  version: string().min(1),
519593
519606
  fromVersion: string().min(1).optional(),
519594
519607
  releaseNotes: ReleaseNotesSchema.optional(),
519608
+ initiatedBy: _enum(["automatic", "startup_prompt", "manual", "unknown"]).optional(),
519595
519609
  installedAt: string().min(1),
519596
519610
  notifiedAt: string().min(1).nullable()
519597
519611
  }).strict().nullable()
@@ -520319,6 +520333,7 @@ async function runUpdatePreflight(currentVersion, options = {}) {
520319
520333
  version: userVisibleTarget.version,
520320
520334
  fromVersion: currentVersion,
520321
520335
  releaseNotes: userVisibleTarget.releaseNotes,
520336
+ initiatedBy: "startup_prompt",
520322
520337
  installedAt: nowIso(),
520323
520338
  notifiedAt: null
520324
520339
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.324",
3
+ "version": "9.1.325",
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": {