deepseek-tui 0.8.31 → 0.8.33
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 +2 -2
- package/scripts/artifacts.js +9 -2
- package/scripts/install.js +7 -1
- package/test/artifacts.test.js +66 -0
- package/test/install.test.js +1 -0
- package/test/postinstall.test.js +39 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepseek-tui",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"deepseekBinaryVersion": "0.8.
|
|
3
|
+
"version": "0.8.33",
|
|
4
|
+
"deepseekBinaryVersion": "0.8.33",
|
|
5
5
|
"description": "Install and run deepseek and deepseek-tui binaries from GitHub release artifacts.",
|
|
6
6
|
"author": "Hmbown",
|
|
7
7
|
"license": "MIT",
|
package/scripts/artifacts.js
CHANGED
|
@@ -17,14 +17,21 @@ const ASSET_MATRIX = {
|
|
|
17
17
|
},
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
// HarmonyPC (openharmony) is an x86_64 Linux-compatible environment; map it to
|
|
21
|
+
// the linux binary family so npm install succeeds without a separate build target.
|
|
22
|
+
const PLATFORM_ALIASES = {
|
|
23
|
+
openharmony: "linux",
|
|
24
|
+
};
|
|
25
|
+
|
|
20
26
|
function detectBinaryNames() {
|
|
21
|
-
const
|
|
27
|
+
const rawPlatform = os.platform();
|
|
28
|
+
const platform = PLATFORM_ALIASES[rawPlatform] || rawPlatform;
|
|
22
29
|
const arch = os.arch();
|
|
23
30
|
const defaults = ASSET_MATRIX[platform];
|
|
24
31
|
if (!defaults) {
|
|
25
32
|
const supported = Object.keys(ASSET_MATRIX).map(p => `'${p}'`).join(', ');
|
|
26
33
|
throw new Error(
|
|
27
|
-
`Unsupported platform: ${
|
|
34
|
+
`Unsupported platform: ${rawPlatform}. Supported platforms: ${supported}.\n\n` +
|
|
28
35
|
unsupportedBuildHint(),
|
|
29
36
|
);
|
|
30
37
|
}
|
package/scripts/install.js
CHANGED
|
@@ -195,7 +195,7 @@ function installFailureHint(error) {
|
|
|
195
195
|
" If GitHub is unavailable on this network, mirror the release assets and set:",
|
|
196
196
|
" DEEPSEEK_TUI_RELEASE_BASE_URL=https://<mirror>/<release-asset-directory>/",
|
|
197
197
|
" The directory must contain deepseek-artifacts-sha256.txt and the platform binaries.",
|
|
198
|
-
" See docs/INSTALL.md#npm-download-
|
|
198
|
+
" See docs/INSTALL.md#npm-binary-download-times-out.",
|
|
199
199
|
].join("\n");
|
|
200
200
|
}
|
|
201
201
|
|
|
@@ -790,6 +790,12 @@ async function withRetry(label, fn, context = "runtime") {
|
|
|
790
790
|
logInfo(
|
|
791
791
|
`${label} failed (attempt ${attempt}/${attemptLimit}): ${err.message}; retrying in ${wait} ms`,
|
|
792
792
|
);
|
|
793
|
+
if (attempt === 1) {
|
|
794
|
+
const hint = installFailureHint(err);
|
|
795
|
+
if (hint) {
|
|
796
|
+
process.stderr.write(`${hint}\n`);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
793
799
|
await sleep(wait);
|
|
794
800
|
}
|
|
795
801
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const assert = require("node:assert/strict");
|
|
2
|
+
const path = require("node:path");
|
|
3
|
+
const test = require("node:test");
|
|
4
|
+
const os = require("os");
|
|
5
|
+
|
|
6
|
+
const ARTIFACTS_PATH = path.join(__dirname, "..", "scripts", "artifacts.js");
|
|
7
|
+
|
|
8
|
+
function withMockedOs(platform, arch, fn) {
|
|
9
|
+
const origPlatform = os.platform;
|
|
10
|
+
const origArch = os.arch;
|
|
11
|
+
os.platform = () => platform;
|
|
12
|
+
os.arch = () => arch;
|
|
13
|
+
delete require.cache[ARTIFACTS_PATH];
|
|
14
|
+
try {
|
|
15
|
+
return fn();
|
|
16
|
+
} finally {
|
|
17
|
+
os.platform = origPlatform;
|
|
18
|
+
os.arch = origArch;
|
|
19
|
+
delete require.cache[ARTIFACTS_PATH];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
test("openharmony x64 resolves to linux x64 binaries", () => {
|
|
24
|
+
withMockedOs("openharmony", "x64", () => {
|
|
25
|
+
const { detectBinaryNames } = require(ARTIFACTS_PATH);
|
|
26
|
+
const result = detectBinaryNames();
|
|
27
|
+
assert.equal(result.deepseek, "deepseek-linux-x64");
|
|
28
|
+
assert.equal(result.tui, "deepseek-tui-linux-x64");
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test("openharmony arm64 resolves to linux arm64 binaries", () => {
|
|
33
|
+
withMockedOs("openharmony", "arm64", () => {
|
|
34
|
+
const { detectBinaryNames } = require(ARTIFACTS_PATH);
|
|
35
|
+
const result = detectBinaryNames();
|
|
36
|
+
assert.equal(result.deepseek, "deepseek-linux-arm64");
|
|
37
|
+
assert.equal(result.tui, "deepseek-tui-linux-arm64");
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("genuinely unsupported platform throws with raw platform name", () => {
|
|
42
|
+
withMockedOs("freebsd", "x64", () => {
|
|
43
|
+
const { detectBinaryNames } = require(ARTIFACTS_PATH);
|
|
44
|
+
assert.throws(
|
|
45
|
+
() => detectBinaryNames(),
|
|
46
|
+
(err) => {
|
|
47
|
+
assert.match(err.message, /Unsupported platform: freebsd/);
|
|
48
|
+
return true;
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("known platforms are unaffected by alias map", () => {
|
|
55
|
+
for (const [platform, arch, expectedDeepseek] of [
|
|
56
|
+
["linux", "x64", "deepseek-linux-x64"],
|
|
57
|
+
["darwin", "arm64", "deepseek-macos-arm64"],
|
|
58
|
+
["win32", "x64", "deepseek-windows-x64.exe"],
|
|
59
|
+
]) {
|
|
60
|
+
withMockedOs(platform, arch, () => {
|
|
61
|
+
const { detectBinaryNames } = require(ARTIFACTS_PATH);
|
|
62
|
+
const result = detectBinaryNames();
|
|
63
|
+
assert.equal(result.deepseek, expectedDeepseek);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
package/test/install.test.js
CHANGED
|
@@ -39,6 +39,7 @@ test("install failure hint explains release base override for blocked GitHub dow
|
|
|
39
39
|
assert.match(hint, /DEEPSEEK_TUI_RELEASE_BASE_URL/);
|
|
40
40
|
assert.match(hint, /deepseek-artifacts-sha256\.txt/);
|
|
41
41
|
assert.match(hint, /platform binaries/);
|
|
42
|
+
assert.match(hint, /#npm-binary-download-times-out/);
|
|
42
43
|
} finally {
|
|
43
44
|
if (previous === undefined) {
|
|
44
45
|
delete process.env.DEEPSEEK_TUI_RELEASE_BASE_URL;
|
package/test/postinstall.test.js
CHANGED
|
@@ -89,3 +89,42 @@ test("optional install still swallows wrapped http 5xx failures", async () => {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
+
|
|
93
|
+
test("withRetry prints install hint on first retryable failure", async () => {
|
|
94
|
+
const previousWrite = process.stderr.write;
|
|
95
|
+
const previousSetTimeout = global.setTimeout;
|
|
96
|
+
let stderr = "";
|
|
97
|
+
let attempts = 0;
|
|
98
|
+
process.stderr.write = (chunk) => {
|
|
99
|
+
stderr += String(chunk);
|
|
100
|
+
return true;
|
|
101
|
+
};
|
|
102
|
+
global.setTimeout = (callback) => {
|
|
103
|
+
callback();
|
|
104
|
+
return 0;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
const result = await _internal.withRetry(
|
|
109
|
+
"fetch https://github.com/example",
|
|
110
|
+
async () => {
|
|
111
|
+
attempts += 1;
|
|
112
|
+
if (attempts === 1) {
|
|
113
|
+
const err = new Error("connect ETIMEDOUT 20.205.243.166:443");
|
|
114
|
+
err.code = "ETIMEDOUT";
|
|
115
|
+
throw err;
|
|
116
|
+
}
|
|
117
|
+
return "ok";
|
|
118
|
+
},
|
|
119
|
+
"runtime",
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
assert.equal(result, "ok");
|
|
123
|
+
assert.equal(attempts, 2);
|
|
124
|
+
assert.match(stderr, /deepseek-tui install hint:/);
|
|
125
|
+
assert.match(stderr, /#npm-binary-download-times-out/);
|
|
126
|
+
} finally {
|
|
127
|
+
process.stderr.write = previousWrite;
|
|
128
|
+
global.setTimeout = previousSetTimeout;
|
|
129
|
+
}
|
|
130
|
+
});
|