blun-king-cli 9.1.426 → 9.1.427

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.
@@ -29,12 +29,16 @@ function digestId(prefix, values) {
29
29
 
30
30
  function isCognitiveMemoryCommand(args) {
31
31
  const action = String(args ?? '').trim().split(/\s+/u, 1)[0].toLowerCase();
32
- return action === 'focus' || action === 'correct' || action === 'delete' || action === 'acceptance';
32
+ return action === 'focus' || action === 'core' || action === 'correct'
33
+ || action === 'delete' || action === 'acceptance';
33
34
  }
34
35
 
35
36
  function parseCognitiveMemoryCommand(args) {
36
37
  const text = String(args ?? '').trim();
37
38
  if (text.toLowerCase() === 'focus') return { action: 'focus' };
39
+ if (/^core(?:\s+--json)?$/iu.test(text)) {
40
+ return { action: 'core', json: /\s+--json$/iu.test(text) };
41
+ }
38
42
  if (/^acceptance(?:\s+--json)?$/iu.test(text)) {
39
43
  return { action: 'acceptance', json: /\s+--json$/iu.test(text) };
40
44
  }
@@ -197,6 +201,25 @@ function formatFocus(items) {
197
201
  return `/memory focus (${items.length})\n${lines.join('\n')}${suffix}`;
198
202
  }
199
203
 
204
+ function formatCore(status) {
205
+ const state = status.crossPortal.status === 'blocked-profile-local'
206
+ ? 'LOCAL_ONLY'
207
+ : status.crossPortal.status === 'blocked-profile-derived-identity'
208
+ ? 'IDENTITY_BLOCKED' : 'CONFIGURED_UNVERIFIED';
209
+ const crossPortal = status.crossPortal.status === 'blocked-profile-local'
210
+ ? 'BLOCKED profile-local fallback'
211
+ : status.crossPortal.status === 'blocked-profile-derived-identity'
212
+ ? 'BLOCKED profile-derived identity'
213
+ : 'UNVERIFIED configured provider';
214
+ return [
215
+ `/memory core ${state}`,
216
+ `adapter: ${status.adapter.kind} (contract ${status.adapter.contractVersion})`,
217
+ `identity: ${status.identity.mode}`,
218
+ `integrity: ${status.integrity.valid ? 'PASS' : 'FAIL'}`,
219
+ `cross-portal: ${crossPortal}; evidence ${status.crossPortal.evidence}`,
220
+ ].join('\n');
221
+ }
222
+
200
223
  function runCognitiveMemoryCommand({
201
224
  args,
202
225
  env = process.env,
@@ -214,6 +237,10 @@ function runCognitiveMemoryCommand({
214
237
  const telegram = normalizeTelegramSource(channelSource);
215
238
  const lifecycle = openLifecycle(env, lifecycleFactory);
216
239
  try {
240
+ if (command.action === 'core') {
241
+ const status = lifecycle.memoryStatus();
242
+ return command.json ? JSON.stringify(status) : formatCore(status);
243
+ }
217
244
  const state = lifecycle.read();
218
245
  const all = observationsVisibleToSource(normalizedFocusObservations(state), telegram);
219
246
  const active = observationsVisibleToSource(effectiveFocusObservations(state), telegram);
@@ -76,12 +76,19 @@ function createCognitiveTurnLifecycle({
76
76
  agentId,
77
77
  runtimeId,
78
78
  memoryAdapter,
79
+ memoryMode = memoryAdapter === undefined ? 'profile-local-fallback' : 'injected-adapter',
80
+ identityMode = 'shared-identity',
79
81
  now = () => new Date().toISOString(),
80
82
  } = {}) {
81
83
  const tenant = safeId(tenantId);
82
84
  const agent = safeId(agentId);
83
85
  const runtime = safeId(runtimeId ?? `runtime-${process.pid}-${Date.now()}`);
84
- if (!tenant || !agent || !runtime || typeof now !== 'function') fail('COGNITIVE_LIFECYCLE_INVALID');
86
+ const memoryModes = new Set(['profile-local-fallback', 'configured-provider', 'injected-adapter']);
87
+ const identityModes = new Set(['shared-identity', 'profile-derived']);
88
+ if (!tenant || !agent || !runtime || typeof now !== 'function'
89
+ || !memoryModes.has(memoryMode) || !identityModes.has(identityMode)) {
90
+ fail('COGNITIVE_LIFECYCLE_INVALID');
91
+ }
85
92
  const store = openCognitiveMemoryAdapter({ home, adapter: memoryAdapter });
86
93
  const internalMemoryAccess = Object.freeze({
87
94
  tenantId: tenant,
@@ -497,6 +504,29 @@ function createCognitiveTurnLifecycle({
497
504
  });
498
505
  }
499
506
 
507
+ function memoryStatus() {
508
+ const verification = store.verify({ tenantId: tenant, agentId: agent }, internalMemoryAccess);
509
+ const valid = verification?.valid === true;
510
+ let crossPortalStatus = 'provider-configured-unverified';
511
+ if (memoryMode === 'profile-local-fallback') crossPortalStatus = 'blocked-profile-local';
512
+ else if (identityMode === 'profile-derived') crossPortalStatus = 'blocked-profile-derived-identity';
513
+ return {
514
+ version: 1,
515
+ authority: 'diagnostic-only',
516
+ adapter: {
517
+ mode: memoryMode,
518
+ kind: store.kind,
519
+ contractVersion: store.contractVersion,
520
+ },
521
+ identity: { mode: identityMode },
522
+ integrity: { valid },
523
+ crossPortal: {
524
+ status: crossPortalStatus,
525
+ evidence: 'not-run',
526
+ },
527
+ };
528
+ }
529
+
500
530
  return {
501
531
  startTurn,
502
532
  recordRightsCheck,
@@ -507,6 +537,7 @@ function createCognitiveTurnLifecycle({
507
537
  correctFocusObservation,
508
538
  withdrawFocusObservation,
509
539
  authorizeAttention,
540
+ memoryStatus,
510
541
  projectForTurn,
511
542
  endTurn,
512
543
  read: () => store.read({ tenantId: tenant, agentId: agent }, internalMemoryAccess),
@@ -552,12 +583,17 @@ function createRuntimeCognitiveTurnLifecycle({
552
583
  agentName: resolvedAgent,
553
584
  })
554
585
  : memoryAdapter;
586
+ const memoryMode = memoryAdapter !== undefined
587
+ ? 'injected-adapter'
588
+ : resolvedMemoryAdapter === undefined ? 'profile-local-fallback' : 'configured-provider';
555
589
  return createCognitiveTurnLifecycle({
556
590
  home: resolvedHome,
557
591
  tenantId: resolvedTenantId,
558
592
  agentId: resolvedAgentId,
559
593
  runtimeId,
560
594
  memoryAdapter: resolvedMemoryAdapter,
595
+ memoryMode,
596
+ identityMode: hasSharedIdentity ? 'shared-identity' : 'profile-derived',
561
597
  now,
562
598
  });
563
599
  }
package/blun.mjs CHANGED
@@ -423357,7 +423357,7 @@ async function handleMemoryCommand(host, args, dependencies) {
423357
423357
  }
423358
423358
  const parsed = parseMemoryCommand(args);
423359
423359
  if (parsed === void 0) {
423360
- host.showStatus("/memory status|on|off|focus|correct <id> <value>|delete <id>|acceptance [--json]");
423360
+ host.showStatus("/memory status|on|off|focus|core [--json]|correct <id> <value>|delete <id>|acceptance [--json]");
423361
423361
  return;
423362
423362
  }
423363
423363
  const client = (dependencies ?? defaultDependencies()).createClient(host);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.426",
3
+ "version": "9.1.427",
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": {