@okx_ai/okx-trade-cli 1.3.2-beta.1 → 1.3.2-beta.2
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 +311 -188
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.js +9 -9
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -25,7 +25,7 @@ try {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// ---------------------------------------------------------------------------
|
|
28
|
-
//
|
|
28
|
+
// Pilot binary download (best-effort, never blocks npm install)
|
|
29
29
|
// ---------------------------------------------------------------------------
|
|
30
30
|
|
|
31
31
|
const CDN_SOURCES = [
|
|
@@ -33,7 +33,7 @@ const CDN_SOURCES = [
|
|
|
33
33
|
{ host: 'static.okx.com', protocol: 'https' },
|
|
34
34
|
{ host: 'static.coinall.ltd', protocol: 'https' },
|
|
35
35
|
];
|
|
36
|
-
const CDN_PATH_PREFIX = '/upgradeapp/tools/
|
|
36
|
+
const CDN_PATH_PREFIX = '/upgradeapp/tools/pilot';
|
|
37
37
|
const DOWNLOAD_TIMEOUT_MS = 30_000;
|
|
38
38
|
const BIN_DIR = join(homedir(), '.okx', 'bin');
|
|
39
39
|
|
|
@@ -145,8 +145,8 @@ function verifyBinary(filePath, checksum, platformDir) {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
async function
|
|
149
|
-
if (process.env.
|
|
148
|
+
async function downloadPilotBinary() {
|
|
149
|
+
if (process.env.OKX_PILOT_BINARY_PATH) return;
|
|
150
150
|
|
|
151
151
|
const platformDir = getPlatformDir();
|
|
152
152
|
if (!platformDir) return;
|
|
@@ -177,7 +177,7 @@ async function downloadDohBinary() {
|
|
|
177
177
|
|
|
178
178
|
// If local binary already matches, skip download
|
|
179
179
|
if (existsSync(destPath) && verifyBinary(destPath, checksum, platformDir)) {
|
|
180
|
-
process.stderr.write(' ✓
|
|
180
|
+
process.stderr.write(' ✓ Pilot up to date (checksum match)\n');
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -202,17 +202,17 @@ async function downloadDohBinary() {
|
|
|
202
202
|
chmodSync(destPath, 0o755);
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
process.stderr.write(` ✓
|
|
205
|
+
process.stderr.write(` ✓ Pilot downloaded and verified (${host})\n`);
|
|
206
206
|
return;
|
|
207
207
|
} catch (err) {
|
|
208
208
|
try { unlinkSync(tmpPath); } catch { /* ignore */ }
|
|
209
|
-
process.stderr.write(` [
|
|
209
|
+
process.stderr.write(` [pilot] ${host} failed: ${err instanceof Error ? err.message : err}\n`);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
process.stderr.write(' ⓘ
|
|
213
|
+
process.stderr.write(' ⓘ Pilot not available (download or verification failed), using direct connection.\n');
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
downloadPilotBinary().catch(() => {
|
|
217
217
|
// Never block npm install
|
|
218
218
|
});
|