@onekeyfe/hd-core 1.2.0-alpha.165 → 1.2.0-alpha.166

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAoClC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAsB1C,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAYxD,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,UAAU,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAmD,MAAM,WAAW,CAAC;AAI9F,OAAO,KAAK,EACV,6BAA6B,EAG9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAWpD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAmE7D,eAAO,MAAM,OAAO,YAAmB,WAAW,WAAW,WAAW,iBAoFvE,CAAC;AAqqBF,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,WAWpF;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,WAW/E;AAED,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,WAQlF;AAiVD,eAAO,MAAM,MAAM,YAAa,WAAW,cAAc,MAAM,SAoG9D,CAAC;AAmGF,eAAO,MAAM,qBAAqB,gFAejC,CAAC;AAiLF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IAC5C,OAAO,CAAC,cAAc,CAAoB;IAE1C,SAAgB,aAAa,EAAE,MAAM,CAAC;IAEtC,OAAO,CAAC,YAAY,CAAsB;IAE1C,OAAO,CAAC,c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E,KAAK,EAAE,OAAO,WAQlF;AAwVD,eAAO,MAAM,MAAM,YAAa,WAAW,cAAc,MAAM,SAoG9D,CAAC;AAmGF,eAAO,MAAM,qBAAqB,gFAejC,CAAC;AAiLF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IAC5C,OAAO,CAAC,cAAc,CAAoB;IAE1C,SAAgB,aAAa,EAAE,MAAM,CAAC;IAEtC,OAAO,CAAC,YAAY,CAAsB;IAE1C,OAAO,CAAC,cAAc,CAAC,CAAgB;IAGvC,OAAO,CAAC,sBAAsB,CAAoC;IAElE,OAAO,CAAC,iBAAiB,CAAoB;;IAS7C,OAAO,CAAC,cAAc;IA6BhB,aAAa,CAAC,OAAO,EAAE,WAAW;IAuExC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAOV,gBAAgB;CAiC/B;AAED,eAAO,MAAM,QAAQ,YAIpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAYzB,CAAC;AAMF,eAAO,MAAM,IAAI,aACL,eAAe,aACd,GAAG,WACL,6BAA6B,8BAiBvC,CAAC;AAEF,eAAO,MAAM,eAAe;SAKrB,eAAe,CAAC,KAAK,CAAC;eAChB,GAAG;;UASf,CAAC"}
package/dist/index.js CHANGED
@@ -65068,6 +65068,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
65068
65068
  if ((_g = method.payload) === null || _g === void 0 ? void 0 : _g.onlyConnectBleDevice) {
65069
65069
  preWarmCallbackTask === null || preWarmCallbackTask === void 0 ? void 0 : preWarmCallbackTask.resolve();
65070
65070
  Log.debug('Call API - only connect ble device: ', device === null || device === void 0 ? void 0 : device.mainId);
65071
+ completeMethodRequestContext(method);
65071
65072
  requestQueue.releaseTask(method.responseID);
65072
65073
  return createResponseMessage(method.responseID, true, null);
65073
65074
  }
@@ -65499,6 +65500,7 @@ function connectDeviceForBle(method, device, abortSignal, retryCount = 0) {
65499
65500
  }), abortSignal);
65500
65501
  }
65501
65502
  catch (err) {
65503
+ device.beginConnectionAttempt();
65502
65504
  if (err.errorCode === hdShared.HardwareErrorCode.BleTimeoutError &&
65503
65505
  device.mainId &&
65504
65506
  device.deviceConnector) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.2.0-alpha.165",
3
+ "version": "1.2.0-alpha.166",
4
4
  "description": "Core processes and APIs for communicating with OneKey hardware devices.",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -25,8 +25,8 @@
25
25
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@onekeyfe/hd-shared": "1.2.0-alpha.165",
29
- "@onekeyfe/hd-transport": "1.2.0-alpha.165",
28
+ "@onekeyfe/hd-shared": "1.2.0-alpha.166",
29
+ "@onekeyfe/hd-transport": "1.2.0-alpha.166",
30
30
  "axios": "1.15.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "buffer": "^6.0.3",
@@ -46,5 +46,5 @@
46
46
  "@types/w3c-web-usb": "^1.0.10",
47
47
  "@types/web-bluetooth": "^0.0.21"
48
48
  },
49
- "gitHead": "dc82ee336f9dc638352195bebd22ee606fa3ef5c"
49
+ "gitHead": "3dd1b964d8503ee800f44466b8c08e3d59be67e8"
50
50
  }
package/src/core/index.ts CHANGED
@@ -415,9 +415,12 @@ const onCallDevice = async (
415
415
  if (method.payload?.onlyConnectBleDevice) {
416
416
  preWarmCallbackTask?.resolve();
417
417
  Log.debug('Call API - only connect ble device: ', device?.mainId);
418
- // This early return bypasses the normal-path releaseTask at the end of the
419
- // call; without it the task leaks and haunts every later queue snapshot
420
- // and cancel sweep (field log: a completed task lingered for 6 minutes).
418
+ // This early return bypasses the normal-path bookkeeping at the end of the
419
+ // call. Without it the task leaks and haunts every later queue snapshot
420
+ // and cancel sweep (field log: a completed task lingered for 6 minutes),
421
+ // and the request stays in the active maps, so repeated preconnects pile
422
+ // up phantom work in diagnostics.
423
+ completeMethodRequestContext(method);
421
424
  requestQueue.releaseTask(method.responseID);
422
425
  return createResponseMessage(method.responseID, true, null);
423
426
  }
@@ -1048,9 +1051,16 @@ async function connectDeviceForBle(
1048
1051
  abortSignal
1049
1052
  );
1050
1053
  } catch (err) {
1051
- // A deadline hit means the transport is wedged mid-acquire; drop the
1052
- // link before the retry so it cold-connects instead of stacking a
1053
- // second connect onto the half-open one.
1054
+ // The abandoned acquire keeps running: raceBleAcquire only rejects
1055
+ // its own wrapper. Supersede it so that, if it settles later, the
1056
+ // generation guard in Device.acquire drops the link it built instead
1057
+ // of committing mainId/commands over the newer attempt.
1058
+ device.beginConnectionAttempt();
1059
+ // A deadline hit also means the transport is wedged mid-acquire; drop
1060
+ // the link we know about before the retry so it cold-connects instead
1061
+ // of stacking a second connect onto the half-open one. `mainId` is
1062
+ // unset while the first acquire is still pending, which is exactly
1063
+ // the case the generation bump above covers.
1054
1064
  if (
1055
1065
  err.errorCode === HardwareErrorCode.BleTimeoutError &&
1056
1066
  device.mainId &&