@okx_ai/okx-trade-cli 1.3.1-beta.3 → 1.3.1-beta.4
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/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.js +6 -1
package/dist/index.js
CHANGED
|
@@ -922,8 +922,10 @@ function execDohBinary(domain, exclude = [], userAgent) {
|
|
|
922
922
|
);
|
|
923
923
|
});
|
|
924
924
|
}
|
|
925
|
-
|
|
926
|
-
|
|
925
|
+
function getDefaultCachePath() {
|
|
926
|
+
return process.env.OKX_DOH_CACHE_PATH || join2(homedir2(), ".okx", "doh-cache.json");
|
|
927
|
+
}
|
|
928
|
+
function readCache(hostname, cachePath = getDefaultCachePath()) {
|
|
927
929
|
try {
|
|
928
930
|
const raw = readFileSync(cachePath, "utf-8");
|
|
929
931
|
const file = JSON.parse(raw);
|
|
@@ -932,7 +934,7 @@ function readCache(hostname, cachePath = DOH_CACHE_PATH) {
|
|
|
932
934
|
return null;
|
|
933
935
|
}
|
|
934
936
|
}
|
|
935
|
-
function writeCache(hostname, entry, cachePath =
|
|
937
|
+
function writeCache(hostname, entry, cachePath = getDefaultCachePath()) {
|
|
936
938
|
try {
|
|
937
939
|
const dir = dirname(cachePath);
|
|
938
940
|
mkdirSync(dir, { recursive: true });
|
|
@@ -1573,9 +1575,17 @@ var OkxRestClient = class _OkxRestClient {
|
|
|
1573
1575
|
headers.set("User-Agent", conn.userAgent);
|
|
1574
1576
|
}
|
|
1575
1577
|
const t0 = Date.now();
|
|
1576
|
-
|
|
1578
|
+
let response;
|
|
1579
|
+
try {
|
|
1580
|
+
response = await this.fetchBinary(path42, endpoint, headers, bodyJson, t0);
|
|
1581
|
+
} catch (error) {
|
|
1582
|
+
this.doh.handleNetworkFailure().catch(() => {
|
|
1583
|
+
});
|
|
1584
|
+
throw error;
|
|
1585
|
+
}
|
|
1577
1586
|
const elapsed = Date.now() - t0;
|
|
1578
1587
|
const traceId = extractTraceId(response.headers);
|
|
1588
|
+
this.doh.cacheDirectIfNeeded();
|
|
1579
1589
|
if (!response.ok) {
|
|
1580
1590
|
const text = await response.text();
|
|
1581
1591
|
this.logResponse(response.status, text.length, elapsed, traceId, String(response.status));
|
|
@@ -9179,7 +9189,7 @@ async function cmdDiagnoseMcp(options = {}) {
|
|
|
9179
9189
|
|
|
9180
9190
|
// src/commands/diagnose.ts
|
|
9181
9191
|
var CLI_VERSION = readCliVersion();
|
|
9182
|
-
var GIT_HASH = true ? "
|
|
9192
|
+
var GIT_HASH = true ? "980de10" : "dev";
|
|
9183
9193
|
function maskKey2(key) {
|
|
9184
9194
|
if (!key) return "(not set)";
|
|
9185
9195
|
if (key.length <= 8) return "****";
|
|
@@ -13547,7 +13557,7 @@ function printSkillInstallResult(meta, json) {
|
|
|
13547
13557
|
// src/index.ts
|
|
13548
13558
|
var _require3 = createRequire3(import.meta.url);
|
|
13549
13559
|
var CLI_VERSION2 = _require3("../package.json").version;
|
|
13550
|
-
var GIT_HASH2 = true ? "
|
|
13560
|
+
var GIT_HASH2 = true ? "980de10" : "dev";
|
|
13551
13561
|
function handleConfigCommand(action, rest, json, lang, force) {
|
|
13552
13562
|
if (action === "init") return cmdConfigInit(lang === "zh" ? "zh" : "en");
|
|
13553
13563
|
if (action === "show") return cmdConfigShow(json);
|