@mindexec/cli 0.2.420 → 0.2.422

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindexec/cli",
3
- "version": "0.2.420",
3
+ "version": "0.2.422",
4
4
  "description": "MindExec local runtime and bridge CLI",
5
5
  "main": "server.js",
6
6
  "type": "module",
package/server.js CHANGED
@@ -699,6 +699,7 @@ async function writeStableAuthSessionPayload(content) {
699
699
  }
700
700
 
701
701
  await writePrivateTextFile(stablePath, payload);
702
+ clearRemoteRegistryAuthRefreshBackoff('auth-session-write');
702
703
  return stablePath;
703
704
  }
704
705
 
@@ -3677,6 +3678,15 @@ const REMOTE_REGISTRY_FOLLOWER_FAST_RETRY_MS = Math.max(500, Number(process.env.
3677
3678
  const REMOTE_REGISTRY_FOLLOWER_MISSING_SESSION_FAST_RETRY_COUNT = Math.max(
3678
3679
  1,
3679
3680
  Number(process.env.MINDEXEC_REMOTE_REGISTRY_MISSING_SESSION_FAST_RETRY_COUNT || 5) || 5);
3681
+ const REMOTE_REGISTRY_AUTH_REFRESH_BACKOFF_BASE_MS = Math.max(
3682
+ 5000,
3683
+ Number(process.env.MINDEXEC_REMOTE_REGISTRY_AUTH_REFRESH_BACKOFF_BASE_MS || 30000) || 30000);
3684
+ const REMOTE_REGISTRY_AUTH_REFRESH_BACKOFF_MAX_MS = Math.max(
3685
+ REMOTE_REGISTRY_AUTH_REFRESH_BACKOFF_BASE_MS,
3686
+ Number(process.env.MINDEXEC_REMOTE_REGISTRY_AUTH_REFRESH_BACKOFF_MAX_MS || 300000) || 300000);
3687
+ const REMOTE_REGISTRY_AUTH_REFRESH_LOG_REPEAT_MS = Math.max(
3688
+ 10000,
3689
+ Number(process.env.MINDEXEC_REMOTE_REGISTRY_AUTH_REFRESH_LOG_REPEAT_MS || 60000) || 60000);
3680
3690
  const REMOTE_REGISTRY_FOLLOWER_INACTIVE_STOP_COUNT = Math.max(2, Number(process.env.MINDEXEC_REMOTE_REGISTRY_INACTIVE_STOP_COUNT || 8) || 8);
3681
3691
  const REMOTE_REGISTRY_FOLLOWER_INACTIVE_GRACE_MS = Math.max(500, Number(process.env.MINDEXEC_REMOTE_REGISTRY_INACTIVE_GRACE_MS || 60000) || 60000);
3682
3692
  const REMOTE_REGISTRY_INACTIVE_TARGET_RECOVERY_MS = Math.max(
@@ -3724,6 +3734,13 @@ let remoteRegistryFollowerConsecutiveMissingSession = 0;
3724
3734
  let remoteRegistryFollowerConsecutiveInactiveTarget = 0;
3725
3735
  let remoteRegistryFollowerInactiveTargetFirstAt = 0;
3726
3736
  let remoteRegistrySessionRefreshPromise = null;
3737
+ let remoteRegistryAuthRefreshBackoff = {
3738
+ key: '',
3739
+ until: 0,
3740
+ failureCount: 0,
3741
+ lastError: '',
3742
+ lastLogAt: 0
3743
+ };
3727
3744
  let remoteRegistryRealtimeSocket = null;
3728
3745
  let remoteRegistryRealtimeSessionKey = '';
3729
3746
  let remoteRegistryRealtimeTopic = '';
@@ -4527,12 +4544,13 @@ function scheduleRemoteAgentRecentSuccessfulManagersSave() {
4527
4544
  .catch(err => {
4528
4545
  logWarn('remote', `managed RemoteAgent recent manager cache save failed: ${err?.message || err}`);
4529
4546
  });
4547
+ return remoteAgentRecentSuccessfulManagersSavePromise;
4530
4548
  }
4531
4549
 
4532
- function rememberRemoteAgentSuccessfulManager(manager, leaseId = '') {
4550
+ async function rememberRemoteAgentSuccessfulManager(manager, leaseId = '') {
4533
4551
  const endpoint = normalizeRemoteManagerEndpoint(manager);
4534
4552
  if (!endpoint) {
4535
- return;
4553
+ return false;
4536
4554
  }
4537
4555
 
4538
4556
  loadRemoteAgentRecentSuccessfulManagers();
@@ -4542,7 +4560,8 @@ function rememberRemoteAgentSuccessfulManager(manager, leaseId = '') {
4542
4560
  };
4543
4561
  remoteAgentRecentSuccessfulManagers.set(getRemoteAgentRecentManagerKey(leaseId), entry);
4544
4562
  remoteAgentRecentSuccessfulManagers.set(REMOTE_AGENT_RECENT_MANAGER_DEFAULT_KEY, entry);
4545
- scheduleRemoteAgentRecentSuccessfulManagersSave();
4563
+ await scheduleRemoteAgentRecentSuccessfulManagersSave();
4564
+ return true;
4546
4565
  }
4547
4566
 
4548
4567
  function prioritizeRemoteAgentManagers(managers, leaseId = '') {
@@ -5373,7 +5392,7 @@ async function startRemoteAgentConnectionRace(options = {}) {
5373
5392
  remoteAgentState.needsReconnect = false;
5374
5393
  remoteAgentState.reconnectReason = '';
5375
5394
  remoteAgentState.updatedAt = new Date().toISOString();
5376
- rememberRemoteAgentSuccessfulManager(winner.manager, leaseId);
5395
+ await rememberRemoteAgentSuccessfulManager(winner.manager, leaseId);
5377
5396
  emitBridgeEvent('RemoteAgentStarted', serializeRemoteAgentState());
5378
5397
  logEvent(
5379
5398
  'remote',
@@ -6268,6 +6287,98 @@ function parseSupabaseSessionForRegistry(content) {
6268
6287
  };
6269
6288
  }
6270
6289
 
6290
+ function getRemoteRegistryAuthRefreshKey(session) {
6291
+ const refreshToken = String(session?.refreshToken || '').trim();
6292
+ if (!refreshToken) {
6293
+ return '';
6294
+ }
6295
+
6296
+ const digest = crypto.createHash('sha256').update(refreshToken).digest('hex').slice(0, 24);
6297
+ return `${safeRemoteAgentField(session?.userId || '', 80)}|${digest}|${Number(session?.expiresAtMs || 0)}`;
6298
+ }
6299
+
6300
+ function clearRemoteRegistryAuthRefreshBackoff(reason = 'cleared') {
6301
+ if (!remoteRegistryAuthRefreshBackoff?.key) {
6302
+ return false;
6303
+ }
6304
+
6305
+ remoteRegistryAuthRefreshBackoff = {
6306
+ key: '',
6307
+ until: 0,
6308
+ failureCount: 0,
6309
+ lastError: '',
6310
+ lastLogAt: 0
6311
+ };
6312
+ if (VERBOSE_REMOTE_AGENT_LOGS) {
6313
+ logEvent('remote', `registry auth refresh backoff cleared ${formatKeyValue('reason', reason)}`, 'remote');
6314
+ }
6315
+ return true;
6316
+ }
6317
+
6318
+ function getRemoteRegistryAuthRefreshBackoff(session) {
6319
+ const key = getRemoteRegistryAuthRefreshKey(session);
6320
+ if (!key) {
6321
+ return { blocked: false, key: '' };
6322
+ }
6323
+
6324
+ if (remoteRegistryAuthRefreshBackoff.key !== key) {
6325
+ return { blocked: false, key };
6326
+ }
6327
+
6328
+ const now = Date.now();
6329
+ const until = Number(remoteRegistryAuthRefreshBackoff.until || 0);
6330
+ if (until > now) {
6331
+ return {
6332
+ blocked: true,
6333
+ key,
6334
+ retryInMs: Math.max(0, until - now),
6335
+ error: remoteRegistryAuthRefreshBackoff.lastError || 'auth-refresh-backoff',
6336
+ failureCount: Number(remoteRegistryAuthRefreshBackoff.failureCount || 0)
6337
+ };
6338
+ }
6339
+
6340
+ return { blocked: false, key };
6341
+ }
6342
+
6343
+ function recordRemoteRegistryAuthRefreshFailure(session, error, reason = 'registry') {
6344
+ const key = getRemoteRegistryAuthRefreshKey(session);
6345
+ const now = Date.now();
6346
+ const previousCount = remoteRegistryAuthRefreshBackoff.key === key
6347
+ ? Number(remoteRegistryAuthRefreshBackoff.failureCount || 0)
6348
+ : 0;
6349
+ const failureCount = previousCount + 1;
6350
+ const backoffMs = Math.min(
6351
+ REMOTE_REGISTRY_AUTH_REFRESH_BACKOFF_MAX_MS,
6352
+ REMOTE_REGISTRY_AUTH_REFRESH_BACKOFF_BASE_MS * Math.max(1, Math.pow(2, Math.min(4, failureCount - 1))));
6353
+ const message = error?.message || String(error || 'auth-refresh-failed');
6354
+ const lastLogAt = remoteRegistryAuthRefreshBackoff.key === key
6355
+ ? Number(remoteRegistryAuthRefreshBackoff.lastLogAt || 0)
6356
+ : 0;
6357
+ const shouldLog = lastLogAt <= 0 ||
6358
+ now - lastLogAt >= REMOTE_REGISTRY_AUTH_REFRESH_LOG_REPEAT_MS ||
6359
+ remoteRegistryAuthRefreshBackoff.lastError !== message;
6360
+
6361
+ remoteRegistryAuthRefreshBackoff = {
6362
+ key,
6363
+ until: now + backoffMs,
6364
+ failureCount,
6365
+ lastError: message,
6366
+ lastLogAt: shouldLog ? now : lastLogAt
6367
+ };
6368
+
6369
+ if (shouldLog) {
6370
+ logWarn(
6371
+ 'remote',
6372
+ `registry auth refresh failed ${formatKeyValue('reason', reason || 'registry')} ${formatKeyValue('error', message)} ${formatKeyValue('retryInMs', backoffMs)}`);
6373
+ }
6374
+
6375
+ return {
6376
+ retryInMs: backoffMs,
6377
+ failureCount,
6378
+ error: message
6379
+ };
6380
+ }
6381
+
6271
6382
  async function refreshSupabaseSessionForRegistry(config, sessionPayload, reason = 'registry') {
6272
6383
  const currentSession = parseSupabaseSessionForRegistry(sessionPayload?.content);
6273
6384
  if (!currentSession?.refreshToken) {
@@ -6281,6 +6392,14 @@ async function refreshSupabaseSessionForRegistry(config, sessionPayload, reason
6281
6392
  return await remoteRegistrySessionRefreshPromise;
6282
6393
  }
6283
6394
 
6395
+ const backoff = getRemoteRegistryAuthRefreshBackoff(currentSession);
6396
+ if (backoff.blocked === true) {
6397
+ return {
6398
+ ok: false,
6399
+ reason: `auth-refresh-backoff:${Math.ceil(Number(backoff.retryInMs || 0) / 1000)}s`
6400
+ };
6401
+ }
6402
+
6284
6403
  remoteRegistrySessionRefreshPromise = (async () => {
6285
6404
  const url = new URL('/auth/v1/token', config.url);
6286
6405
  url.searchParams.set('grant_type', 'refresh_token');
@@ -6319,6 +6438,7 @@ async function refreshSupabaseSessionForRegistry(config, sessionPayload, reason
6319
6438
  `registry auth refreshed ${formatKeyValue('reason', reason || 'registry')} ${formatKeyValue('expiresInMs', Math.max(0, session.expiresAtMs - Date.now()))}`,
6320
6439
  'remote');
6321
6440
 
6441
+ clearRemoteRegistryAuthRefreshBackoff('auth-refresh-success');
6322
6442
  return {
6323
6443
  ok: true,
6324
6444
  reason: 'refreshed',
@@ -6385,16 +6505,14 @@ async function readFreshSupabaseSessionForRegistry(config, reason = 'registry')
6385
6505
  refreshError: refreshed.reason || 'auth-refresh-skipped'
6386
6506
  };
6387
6507
  } catch (error) {
6388
- logWarn(
6389
- 'remote',
6390
- `registry auth refresh failed ${formatKeyValue('reason', reason || 'registry')} ${formatKeyValue('error', error?.message || String(error || ''))}`);
6508
+ const failure = recordRemoteRegistryAuthRefreshFailure(session, error, reason);
6391
6509
  return {
6392
6510
  found: true,
6393
6511
  payload: sessionPayload,
6394
6512
  session,
6395
6513
  refreshed: false,
6396
6514
  expired: session.expiresAtMs > 0 && session.expiresAtMs <= Date.now(),
6397
- refreshError: error?.message || String(error || '')
6515
+ refreshError: failure.error
6398
6516
  };
6399
6517
  }
6400
6518
  }
@@ -5,7 +5,7 @@
5
5
  const DEBUG = false;
6
6
  const FPS_DEBUG = false;
7
7
  const FRAME_PERF_DEBUG = false;
8
- const MINDMAP_CORE_BUILD_ID = '20260629-wheel-zoom-visibility-v854';
8
+ const MINDMAP_CORE_BUILD_ID = '20260629-wheel-zoom-immediate-lite-v855';
9
9
  const CanvasPhase = Object.freeze({
10
10
  Booting: 'booting',
11
11
  BoardFileLoading: 'board-file-loading',
@@ -4116,7 +4116,13 @@ ${summaryLines.map(line => `<div>${escapeNodeFrameDebugHtml(line)}</div>`).join(
4116
4116
  }
4117
4117
  }
4118
4118
 
4119
- applyImmediateCameraNavigationFeedback(reason = 'camera-navigation-input') {
4119
+ applyImmediateCameraNavigationFeedback(reason = 'camera-navigation-input', options = {}) {
4120
+ const immediateOptions = options && typeof options === 'object' ? options : {};
4121
+ const shouldRenderImmediateCss3d = immediateOptions.renderCss3d !== false;
4122
+ const shouldRenderImmediateWebgl = immediateOptions.renderWebgl !== false;
4123
+ const shouldSyncImmediateMotionGrid = immediateOptions.syncMotionGrid !== false;
4124
+ const shouldSyncImmediateLocalSnapGrid = immediateOptions.syncLocalSnapGrid !== false;
4125
+ const shouldSyncImmediateAutomationEdges = immediateOptions.syncAutomationEdges !== false;
4120
4126
  const now = typeof performance !== 'undefined' && typeof performance.now === 'function'
4121
4127
  ? performance.now()
4122
4128
  : Date.now();
@@ -4129,6 +4135,14 @@ ${summaryLines.map(line => `<div>${escapeNodeFrameDebugHtml(line)}</div>`).join(
4129
4135
  localSnapGrid: false,
4130
4136
  webgl: false,
4131
4137
  skippedReason: '',
4138
+ webglSkippedReason: '',
4139
+ options: {
4140
+ renderCss3d: shouldRenderImmediateCss3d,
4141
+ renderWebgl: shouldRenderImmediateWebgl,
4142
+ syncMotionGrid: shouldSyncImmediateMotionGrid,
4143
+ syncLocalSnapGrid: shouldSyncImmediateLocalSnapGrid,
4144
+ syncAutomationEdges: shouldSyncImmediateAutomationEdges
4145
+ },
4132
4146
  count: Number(this._immediateCameraFeedbackCount || 0),
4133
4147
  updatedAt: now
4134
4148
  };
@@ -4192,6 +4206,7 @@ ${summaryLines.map(line => `<div>${escapeNodeFrameDebugHtml(line)}</div>`).join(
4192
4206
  (this._cssTransformDirtyIds?.size || 0) > 0
4193
4207
  );
4194
4208
  const canRenderCss3dCamera = !!(
4209
+ shouldRenderImmediateCss3d === true &&
4195
4210
  this.cssRenderer &&
4196
4211
  typeof this.cssRenderer.renderCamera === 'function' &&
4197
4212
  isCss3dEnabled === true &&
@@ -4211,6 +4226,7 @@ ${summaryLines.map(line => `<div>${escapeNodeFrameDebugHtml(line)}</div>`).join(
4211
4226
  }
4212
4227
 
4213
4228
  const canRenderWebglCamera = !!(
4229
+ shouldRenderImmediateWebgl === true &&
4214
4230
  this.renderer &&
4215
4231
  this.scene &&
4216
4232
  flags.enableWebglRender !== false &&
@@ -4226,15 +4242,21 @@ ${summaryLines.map(line => `<div>${escapeNodeFrameDebugHtml(line)}</div>`).join(
4226
4242
  } catch (err) {
4227
4243
  status.webglError = err?.message || String(err || 'unknown');
4228
4244
  }
4245
+ } else if (shouldRenderImmediateWebgl !== true) {
4246
+ status.webglSkippedReason = 'feedback-option';
4229
4247
  }
4230
4248
 
4231
- if (this._shouldTouchMotionGridLayerForCameraNavigation?.() === true) {
4249
+ if (shouldSyncImmediateMotionGrid === true &&
4250
+ this._shouldTouchMotionGridLayerForCameraNavigation?.() === true) {
4232
4251
  status.motionGrid = this._syncMotionGridLayerForCameraNavigation?.() === true;
4233
4252
  }
4234
4253
 
4235
- status.localSnapGrid = syncLocalSnapGridForCameraNavigation(this, true) === true;
4254
+ if (shouldSyncImmediateLocalSnapGrid === true) {
4255
+ status.localSnapGrid = syncLocalSnapGridForCameraNavigation(this, true) === true;
4256
+ }
4236
4257
 
4237
- if (syncBusinessAutomationEdgesForCameraNavigation(this, true, false) === true) {
4258
+ if (shouldSyncImmediateAutomationEdges === true &&
4259
+ syncBusinessAutomationEdgesForCameraNavigation(this, true, false) === true) {
4238
4260
  this._immediateCameraFeedbackEdgeCount = Number(this._immediateCameraFeedbackEdgeCount || 0) + 1;
4239
4261
  status.automationEdges = true;
4240
4262
  status.edgeCount = this._immediateCameraFeedbackEdgeCount;
@@ -599,19 +599,6 @@ window.MindMapInteractions = (function () {
599
599
  window.MindMapTextOverlayV2?.invalidateView?.(module);
600
600
  }
601
601
 
602
- function requestPanLiveRefreshFrames(module) {
603
- if (!module) {
604
- return;
605
- }
606
- wakeCameraNavigationAnimation(module, 'pan-input');
607
- }
608
-
609
- function applyImmediateCameraNavigationFeedback(module, reason = 'camera-navigation-input') {
610
- if (module && typeof module.applyImmediateCameraNavigationFeedback === 'function') {
611
- module.applyImmediateCameraNavigationFeedback(reason);
612
- }
613
- }
614
-
615
602
  function markCameraNavigationForceFrames(module, frames = 2) {
616
603
  if (!module) {
617
604
  return;
@@ -626,10 +613,23 @@ window.MindMapInteractions = (function () {
626
613
  module._panLiveRefreshForceFrames = Math.max(Number(module._panLiveRefreshForceFrames || 0), safeFrames);
627
614
  }
628
615
 
616
+ function requestPanLiveRefreshFrames(module) {
617
+ if (!module) {
618
+ return;
619
+ }
620
+ wakeCameraNavigationAnimation(module, 'pan-input');
621
+ }
622
+
623
+ function applyImmediateCameraNavigationFeedback(module, reason = 'camera-navigation-input', options = {}) {
624
+ if (module && typeof module.applyImmediateCameraNavigationFeedback === 'function') {
625
+ module.applyImmediateCameraNavigationFeedback(reason, options);
626
+ }
627
+ }
628
+
629
629
  function wakeCameraNavigationAnimation(module, reason = 'camera-navigation-input', options = {}) {
630
630
  markCameraNavigationForceFrames(module, options?.forceFrames ?? 0);
631
631
  if (options?.immediate === true) {
632
- applyImmediateCameraNavigationFeedback(module, reason);
632
+ applyImmediateCameraNavigationFeedback(module, reason, options);
633
633
  }
634
634
  if (module && typeof module.requestAnimationWake === 'function') {
635
635
  module.requestAnimationWake(reason);
@@ -6527,7 +6527,12 @@ window.MindMapInteractions = (function () {
6527
6527
  const newY = worldMouseY - (worldMouseY - module.targetY) * zoomRatio;
6528
6528
  module.targetX = newX;
6529
6529
  module.targetY = newY;
6530
- applyImmediateCameraNavigationFeedback(module, 'wheel-zoom-input');
6530
+ applyImmediateCameraNavigationFeedback(module, 'wheel-zoom-input', {
6531
+ renderWebgl: false,
6532
+ syncAutomationEdges: false,
6533
+ syncLocalSnapGrid: false,
6534
+ syncMotionGrid: false
6535
+ });
6531
6536
  const settleFrames = 2;
6532
6537
  wakeCameraNavigationAnimation(module, 'wheel-zoom-input', { forceFrames: settleFrames });
6533
6538
  // ▲▲▲ [Changed] ▲▲▲
@@ -579,7 +579,7 @@
579
579
  }
580
580
 
581
581
  const base = '_content/MindExecution.Shared/js/';
582
- const scriptVersion = '20260629-wheel-zoom-visibility-v854';
582
+ const scriptVersion = '20260629-wheel-zoom-immediate-lite-v855';
583
583
  const scriptUrl = (script) => `${base}${script}?v=${scriptVersion}`;
584
584
  console.log(`[Script Loader] Shared JS version: ${scriptVersion}`);
585
585
  const criticalScripts = [
@@ -1,5 +1,5 @@
1
1
  self.assetsManifest = {
2
- "version": "RmQr/JkA",
2
+ "version": "XIia70hb",
3
3
  "assets": [
4
4
  {
5
5
  "hash": "sha256-+CSYMcqLNTsq3VnH11jgYyOCCdxvHzL74CBmo4sCmMU=",
@@ -78,7 +78,7 @@
78
78
  "url": "_content/MindExecution.Shared/js/marked.min.js"
79
79
  },
80
80
  {
81
- "hash": "sha256-Ftz81/kfYoUDfDiVEpTIW2nUzTzLn8Mnk64bdZ/v36E=",
81
+ "hash": "sha256-FKkF+iWJTl4+KZtgZCm4uV2PHTxXp0TFkSwuZhGupX8=",
82
82
  "url": "_content/MindExecution.Shared/js/mind-map-core.js"
83
83
  },
84
84
  {
@@ -106,7 +106,7 @@
106
106
  "url": "_content/MindExecution.Shared/js/mind-map-glow-shader.js"
107
107
  },
108
108
  {
109
- "hash": "sha256-y74nQ/F+1hw4X2DRen7ZinLYutmoXXQbutQLGHnvi2o=",
109
+ "hash": "sha256-cI3+GC8kPJOqszjmSBOS+rFPyXPheKohJfZZaDcOWV8=",
110
110
  "url": "_content/MindExecution.Shared/js/mind-map-interactions.js"
111
111
  },
112
112
  {
@@ -826,7 +826,7 @@
826
826
  "url": "icon-512.png"
827
827
  },
828
828
  {
829
- "hash": "sha256-+V+Q7oUCAdugMul36QESNyu21inYe2gzRdH6N92tpIQ=",
829
+ "hash": "sha256-c7bd5qxUiH3yqT95Xt6vckY20uqzasgvEGQnonVsO1M=",
830
830
  "url": "index.html"
831
831
  },
832
832
  {
@@ -1,4 +1,4 @@
1
- /* Manifest version: RmQr/JkA */
1
+ /* Manifest version: XIia70hb */
2
2
  // Hosted deployments should prefer the network over stale offline caches.
3
3
  // This service worker immediately clears old Blazor offline caches and unregisters itself.
4
4