@mindexec/cli 0.2.395 → 0.2.396

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.395",
3
+ "version": "0.2.396",
4
4
  "description": "MindExec local runtime and bridge CLI",
5
5
  "main": "server.js",
6
6
  "type": "module",
@@ -162,6 +162,7 @@ async function connectManagedAgent(clientBridge, managerEndpoint, staleEndpoint)
162
162
  const result = await fetchJson(`${clientBridge.baseUrl}/api/remote/agent/connect`, {
163
163
  method: 'POST',
164
164
  body: JSON.stringify({
165
+ manager: managerEndpoint,
165
166
  managerCandidates: [staleEndpoint, managerEndpoint],
166
167
  pairToken: PAIR_TOKEN,
167
168
  leaseId: LEASE_ID,
@@ -216,9 +217,9 @@ async function main() {
216
217
  assert.equal(firstAgent.ready, true, JSON.stringify(firstAgent));
217
218
  assert.equal(firstAgent.usingNpx, false, JSON.stringify(firstAgent));
218
219
  assert.match(String(firstAgent.launcher || ''), /mindexec-remote-fast/i);
219
- assert.ok(
220
- firstConnectMs < 4500,
221
- `managed RemoteAgent must race slow endpoint candidates instead of waiting sequentially, got ${firstConnectMs}ms`);
220
+ assert.equal(firstAgent.manager, managerEndpoint, JSON.stringify(firstAgent));
221
+ assert.equal(firstAgent.managerCandidates?.[0], managerEndpoint, JSON.stringify(firstAgent.managerCandidates));
222
+ assert.ok(firstConnectMs < 4500, `managed RemoteAgent selected manager should connect promptly, got ${firstConnectMs}ms`);
222
223
 
223
224
  const connectedDevice = await waitFor(async () => {
224
225
  const result = await fetchJson(`${hostBridge.baseUrl}/api/remote/devices`);
@@ -248,7 +249,7 @@ async function main() {
248
249
  assert.equal(secondAgent.usingNpx, false, JSON.stringify(secondAgent));
249
250
  assert.match(String(secondAgent.launcher || ''), /mindexec-remote-fast/i);
250
251
  assert.equal(secondAgent.managerCandidates?.[0], managerEndpoint, JSON.stringify(secondAgent.managerCandidates));
251
- assert.equal(secondAgent.managerCandidates?.[1], staleEndpoint, JSON.stringify(secondAgent.managerCandidates));
252
+ assert.equal(secondAgent.managerCandidates?.length, 1, JSON.stringify(secondAgent.managerCandidates));
252
253
 
253
254
  const staleReport = await fetchJson(`${clientBridge.baseUrl}/api/remote/agent/sync-report`, {
254
255
  method: 'POST',
@@ -584,7 +584,8 @@ async function main() {
584
584
  assert.equal(firstAgent.usingNpx, false, JSON.stringify(firstAgent));
585
585
  assert.match(String(firstAgent.launcher || ''), /mindexec-remote-fast/i);
586
586
  assert.equal(firstAgent.manager, hostAEndpoint);
587
- assert.equal(firstAgent.managerCandidates?.[0], staleEndpoint, JSON.stringify(firstAgent.managerCandidates));
587
+ assert.equal(firstAgent.managerCandidates?.[0], hostAEndpoint, JSON.stringify(firstAgent.managerCandidates));
588
+ assert.equal(firstAgent.managerCandidates?.length, 1, JSON.stringify(firstAgent.managerCandidates));
588
589
  assert.ok(
589
590
  fakeSupabase.requests.some(request =>
590
591
  request.method === 'POST'
package/server.js CHANGED
@@ -3635,7 +3635,9 @@ const REMOTE_AGENT_DEFAULT_ENGINE = 'auto';
3635
3635
  const REMOTE_AGENT_SYNC_REPORT_LOG_REPEAT_MS = 30000;
3636
3636
  const REMOTE_AGENT_SYNC_REPORT_WAKE_MS = Math.max(500, Number(process.env.MINDEXEC_REMOTE_AGENT_SYNC_REPORT_WAKE_MS || 1500) || 1500);
3637
3637
  const REMOTE_AGENT_RACE_START_STAGGER_MS = Math.max(0, Number(process.env.MINDEXEC_REMOTE_AGENT_RACE_STAGGER_MS ?? 0) || 0);
3638
- const REMOTE_AGENT_MAX_PARALLEL_CANDIDATES = 6;
3638
+ const REMOTE_AGENT_MAX_PARALLEL_CANDIDATES = Math.max(
3639
+ 1,
3640
+ Math.min(6, Number(process.env.MINDEXEC_REMOTE_AGENT_MAX_PARALLEL_CANDIDATES || 1) || 1));
3639
3641
  const REMOTE_AGENT_RECENT_MANAGER_CACHE_TTL_MS = 30 * 24 * 60 * 60 * 1000;
3640
3642
  const REMOTE_AGENT_RECENT_MANAGER_CACHE_LIMIT = 64;
3641
3643
  const REMOTE_AGENT_RECENT_MANAGER_DEFAULT_KEY = 'default';
@@ -7407,7 +7409,7 @@ async function runRemoteRegistryFollowerOnce(trigger = 'timer') {
7407
7409
  }
7408
7410
 
7409
7411
  const connect = await startRemoteAgentConnection({
7410
- manager: target.endpointCandidates[0],
7412
+ manager: target.endpoint,
7411
7413
  managerCandidates: target.endpointCandidates,
7412
7414
  pairToken: target.pairToken,
7413
7415
  leaseId: target.leaseId,