@mindexec/cli 0.2.17 → 0.2.18

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.17",
3
+ "version": "0.2.18",
4
4
  "description": "MindExec local runtime and bridge CLI",
5
5
  "main": "server.js",
6
6
  "type": "module",
package/remote-hub.js CHANGED
@@ -915,6 +915,10 @@ export function createRemoteHub(options = {}) {
915
915
  return null;
916
916
  }
917
917
 
918
+ if (device.pendingTaskCommands.get(commandId) !== task) {
919
+ return null;
920
+ }
921
+
918
922
  const now = device.lastSeenAt || new Date().toISOString();
919
923
  const status = error
920
924
  ? 'failed'
@@ -287,6 +287,24 @@ try {
287
287
  assert.equal(timeoutTaskDevice.counters.taskResultsReceived, 4);
288
288
  assert.equal(timeoutTaskDevice.counters.taskResultsFailed, 1);
289
289
  assert.equal(timeoutTaskDevice.counters.taskResultsTimedOut, 1);
290
+ writeJsonLine(socket, {
291
+ type: 'command.result',
292
+ commandId: timeoutTaskCommand.commandId,
293
+ result: {
294
+ kind: 'agent.task',
295
+ taskId: timeoutTaskCommand.taskId,
296
+ status: 'completed',
297
+ summary: 'This late timeout result must be ignored.',
298
+ completedAt: new Date().toISOString()
299
+ }
300
+ });
301
+ await wait(100);
302
+ const lateTimeoutDevice = hub.listDevices()[0];
303
+ assert.equal(lateTimeoutDevice.latestTask.taskId, timeoutTaskCommand.taskId);
304
+ assert.equal(lateTimeoutDevice.latestTask.status, 'failed');
305
+ assert.equal(lateTimeoutDevice.latestTask.error, 'task-timeout');
306
+ assert.equal(lateTimeoutDevice.latestTask.resultSummary, 'task-timeout');
307
+ assert.equal(lateTimeoutDevice.counters.taskResultsReceived, 4);
290
308
 
291
309
  socket.destroy();
292
310
  await waitFor(() => hub.listDevices()[0]?.connected === false);