@aipanel/provider-deepseek 1.2.18 → 1.2.20
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/es/dsh-install.d.ts +5 -1
- package/es/dsh-install.js +30 -1
- package/es/provider.js +10 -4
- package/lib/dsh-install.cjs +32 -1
- package/lib/dsh-install.d.ts +5 -1
- package/lib/provider.cjs +9 -4
- package/package.json +4 -3
package/es/dsh-install.d.ts
CHANGED
|
@@ -12,10 +12,14 @@ export declare function resolveDevDshPackageSource(metaUrl: string, subdir: stri
|
|
|
12
12
|
export declare function dshProfileDir(home?: string): string;
|
|
13
13
|
/** 某 @aipanel/dsh-* 包在 profile 的 node_modules 中是否可解析 */
|
|
14
14
|
export declare function isDshPackageInstalled(profileDir: string, packageName: string): boolean;
|
|
15
|
+
/** 读取 profile 内已安装的某包版本(可解析不到时返回 null) */
|
|
16
|
+
export declare function readPackageVersion(profileDir: string, packageName: string): string | null;
|
|
17
|
+
/** 读取当前 provider 包版本(运行时源码 lib/es 的上一级即 package.json) */
|
|
18
|
+
export declare function readProviderVersion(metaUrl: string): string | null;
|
|
15
19
|
/**
|
|
16
20
|
* 确保某 @aipanel/dsh-* 包已安装且为最新(官方命令 dsh plugin add)。
|
|
17
21
|
* 每次启动都执行(不跳过已安装):dev 本地目录每次重装保证改代码生效,
|
|
18
22
|
* 生产 npm 包每次检查 registry 拉取最新版本。安装失败返回 false(不阻塞启动,
|
|
19
23
|
* 仅对应 overlay 行停用,如失去 chip 高亮 / 审查工具)。
|
|
20
24
|
*/
|
|
21
|
-
export declare function ensureDshPackage(profileDir: string, packageName: string, target: string, home?: string): Promise<boolean>;
|
|
25
|
+
export declare function ensureDshPackage(profileDir: string, packageName: string, target: string, home?: string, expectedVersion?: string | null): Promise<boolean>;
|
package/es/dsh-install.js
CHANGED
|
@@ -25,7 +25,24 @@ function dshProfileDir(home) {
|
|
|
25
25
|
function isDshPackageInstalled(profileDir, packageName) {
|
|
26
26
|
return fs.existsSync(packageJsonIn(profileDir, packageName));
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
function readPackageVersion(profileDir, packageName) {
|
|
29
|
+
try {
|
|
30
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonIn(profileDir, packageName), "utf8"));
|
|
31
|
+
return typeof pkg.version === "string" ? pkg.version : null;
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function readProviderVersion(metaUrl) {
|
|
37
|
+
try {
|
|
38
|
+
const pkgPath = path.resolve(path.dirname(fileURLToPath(metaUrl)), "../package.json");
|
|
39
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
40
|
+
return typeof pkg.version === "string" ? pkg.version : null;
|
|
41
|
+
} catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function ensureDshPackage(profileDir, packageName, target, home, expectedVersion) {
|
|
29
46
|
try {
|
|
30
47
|
log.debug(`installing ${target} into dsh profile via dsh plugin add`);
|
|
31
48
|
await execa("dsh", ["plugin", "--profile", "web", "add", target], {
|
|
@@ -42,6 +59,16 @@ async function ensureDshPackage(profileDir, packageName, target, home) {
|
|
|
42
59
|
});
|
|
43
60
|
return false;
|
|
44
61
|
}
|
|
62
|
+
const installed = readPackageVersion(profileDir, packageName);
|
|
63
|
+
if (expectedVersion && installed && installed !== expectedVersion) {
|
|
64
|
+
log.warn(
|
|
65
|
+
`${packageName} version ${installed} is out of sync with provider ${expectedVersion}`,
|
|
66
|
+
{
|
|
67
|
+
profileDir,
|
|
68
|
+
install: `dsh plugin --profile web add ${packageName}@${expectedVersion}`
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
45
72
|
return true;
|
|
46
73
|
} catch (e) {
|
|
47
74
|
log.warn(`failed to install ${packageName} via dsh plugin add`, {
|
|
@@ -57,5 +84,7 @@ export {
|
|
|
57
84
|
dshProfileDir,
|
|
58
85
|
ensureDshPackage,
|
|
59
86
|
isDshPackageInstalled,
|
|
87
|
+
readPackageVersion,
|
|
88
|
+
readProviderVersion,
|
|
60
89
|
resolveDevDshPackageSource
|
|
61
90
|
};
|
package/es/provider.js
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
DSH_PLUGIN_PACKAGE,
|
|
21
21
|
dshProfileDir,
|
|
22
22
|
ensureDshPackage,
|
|
23
|
+
readProviderVersion,
|
|
23
24
|
resolveDevDshPackageSource
|
|
24
25
|
} from "./dsh-install.js";
|
|
25
26
|
const log = createLogger("DeepSeekWebProvider");
|
|
@@ -87,11 +88,14 @@ Please upgrade:
|
|
|
87
88
|
const launchToken = new LaunchToken();
|
|
88
89
|
this.api.setLaunchTokenSource(() => launchToken.wait());
|
|
89
90
|
const devClientDir = resolveDevDshPackageSource(import.meta.url, "dsh-client", "lib/client.js");
|
|
91
|
+
const providerVersion = readProviderVersion(import.meta.url);
|
|
92
|
+
const clientTarget = devClientDir ?? (providerVersion ? `${DSH_CLIENT_PACKAGE}@${providerVersion}` : `${DSH_CLIENT_PACKAGE}@latest`);
|
|
90
93
|
const clientAvailable = await ensureDshPackage(
|
|
91
94
|
profileDir,
|
|
92
95
|
DSH_CLIENT_PACKAGE,
|
|
93
|
-
|
|
94
|
-
this.opts.home
|
|
96
|
+
clientTarget,
|
|
97
|
+
this.opts.home,
|
|
98
|
+
providerVersion
|
|
95
99
|
);
|
|
96
100
|
if (!clientAvailable) {
|
|
97
101
|
log.warn("@aipanel/dsh-client unavailable; @ menu chip highlight disabled", {
|
|
@@ -99,11 +103,13 @@ Please upgrade:
|
|
|
99
103
|
});
|
|
100
104
|
}
|
|
101
105
|
const devPluginDir = resolveDevDshPackageSource(import.meta.url, "dsh-plugin", "dist/index.js");
|
|
106
|
+
const pluginTarget = devPluginDir ?? (providerVersion ? `${DSH_PLUGIN_PACKAGE}@${providerVersion}` : `${DSH_PLUGIN_PACKAGE}@latest`);
|
|
102
107
|
const pluginAvailable = await ensureDshPackage(
|
|
103
108
|
profileDir,
|
|
104
109
|
DSH_PLUGIN_PACKAGE,
|
|
105
|
-
|
|
106
|
-
this.opts.home
|
|
110
|
+
pluginTarget,
|
|
111
|
+
this.opts.home,
|
|
112
|
+
providerVersion
|
|
107
113
|
);
|
|
108
114
|
if (!pluginAvailable) {
|
|
109
115
|
log.warn("@aipanel/dsh-plugin unavailable; run_diagnostics & settings application disabled", {
|
package/lib/dsh-install.cjs
CHANGED
|
@@ -32,6 +32,8 @@ __export(dsh_install_exports, {
|
|
|
32
32
|
dshProfileDir: () => dshProfileDir,
|
|
33
33
|
ensureDshPackage: () => ensureDshPackage,
|
|
34
34
|
isDshPackageInstalled: () => isDshPackageInstalled,
|
|
35
|
+
readPackageVersion: () => readPackageVersion,
|
|
36
|
+
readProviderVersion: () => readProviderVersion,
|
|
35
37
|
resolveDevDshPackageSource: () => resolveDevDshPackageSource
|
|
36
38
|
});
|
|
37
39
|
module.exports = __toCommonJS(dsh_install_exports);
|
|
@@ -62,7 +64,24 @@ function dshProfileDir(home) {
|
|
|
62
64
|
function isDshPackageInstalled(profileDir, packageName) {
|
|
63
65
|
return import_node_fs.default.existsSync(packageJsonIn(profileDir, packageName));
|
|
64
66
|
}
|
|
65
|
-
|
|
67
|
+
function readPackageVersion(profileDir, packageName) {
|
|
68
|
+
try {
|
|
69
|
+
const pkg = JSON.parse(import_node_fs.default.readFileSync(packageJsonIn(profileDir, packageName), "utf8"));
|
|
70
|
+
return typeof pkg.version === "string" ? pkg.version : null;
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function readProviderVersion(metaUrl) {
|
|
76
|
+
try {
|
|
77
|
+
const pkgPath = import_node_path.default.resolve(import_node_path.default.dirname((0, import_node_url.fileURLToPath)(metaUrl)), "../package.json");
|
|
78
|
+
const pkg = JSON.parse(import_node_fs.default.readFileSync(pkgPath, "utf8"));
|
|
79
|
+
return typeof pkg.version === "string" ? pkg.version : null;
|
|
80
|
+
} catch {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async function ensureDshPackage(profileDir, packageName, target, home, expectedVersion) {
|
|
66
85
|
try {
|
|
67
86
|
log.debug(`installing ${target} into dsh profile via dsh plugin add`);
|
|
68
87
|
await (0, import_execa.execa)("dsh", ["plugin", "--profile", "web", "add", target], {
|
|
@@ -79,6 +98,16 @@ async function ensureDshPackage(profileDir, packageName, target, home) {
|
|
|
79
98
|
});
|
|
80
99
|
return false;
|
|
81
100
|
}
|
|
101
|
+
const installed = readPackageVersion(profileDir, packageName);
|
|
102
|
+
if (expectedVersion && installed && installed !== expectedVersion) {
|
|
103
|
+
log.warn(
|
|
104
|
+
`${packageName} version ${installed} is out of sync with provider ${expectedVersion}`,
|
|
105
|
+
{
|
|
106
|
+
profileDir,
|
|
107
|
+
install: `dsh plugin --profile web add ${packageName}@${expectedVersion}`
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
}
|
|
82
111
|
return true;
|
|
83
112
|
} catch (e) {
|
|
84
113
|
log.warn(`failed to install ${packageName} via dsh plugin add`, {
|
|
@@ -95,5 +124,7 @@ async function ensureDshPackage(profileDir, packageName, target, home) {
|
|
|
95
124
|
dshProfileDir,
|
|
96
125
|
ensureDshPackage,
|
|
97
126
|
isDshPackageInstalled,
|
|
127
|
+
readPackageVersion,
|
|
128
|
+
readProviderVersion,
|
|
98
129
|
resolveDevDshPackageSource
|
|
99
130
|
});
|
package/lib/dsh-install.d.ts
CHANGED
|
@@ -12,10 +12,14 @@ export declare function resolveDevDshPackageSource(metaUrl: string, subdir: stri
|
|
|
12
12
|
export declare function dshProfileDir(home?: string): string;
|
|
13
13
|
/** 某 @aipanel/dsh-* 包在 profile 的 node_modules 中是否可解析 */
|
|
14
14
|
export declare function isDshPackageInstalled(profileDir: string, packageName: string): boolean;
|
|
15
|
+
/** 读取 profile 内已安装的某包版本(可解析不到时返回 null) */
|
|
16
|
+
export declare function readPackageVersion(profileDir: string, packageName: string): string | null;
|
|
17
|
+
/** 读取当前 provider 包版本(运行时源码 lib/es 的上一级即 package.json) */
|
|
18
|
+
export declare function readProviderVersion(metaUrl: string): string | null;
|
|
15
19
|
/**
|
|
16
20
|
* 确保某 @aipanel/dsh-* 包已安装且为最新(官方命令 dsh plugin add)。
|
|
17
21
|
* 每次启动都执行(不跳过已安装):dev 本地目录每次重装保证改代码生效,
|
|
18
22
|
* 生产 npm 包每次检查 registry 拉取最新版本。安装失败返回 false(不阻塞启动,
|
|
19
23
|
* 仅对应 overlay 行停用,如失去 chip 高亮 / 审查工具)。
|
|
20
24
|
*/
|
|
21
|
-
export declare function ensureDshPackage(profileDir: string, packageName: string, target: string, home?: string): Promise<boolean>;
|
|
25
|
+
export declare function ensureDshPackage(profileDir: string, packageName: string, target: string, home?: string, expectedVersion?: string | null): Promise<boolean>;
|
package/lib/provider.cjs
CHANGED
|
@@ -97,11 +97,14 @@ Please upgrade:
|
|
|
97
97
|
const launchToken = new import_deepseek_web.LaunchToken();
|
|
98
98
|
this.api.setLaunchTokenSource(() => launchToken.wait());
|
|
99
99
|
const devClientDir = (0, import_dsh_install.resolveDevDshPackageSource)(import_meta.url, "dsh-client", "lib/client.js");
|
|
100
|
+
const providerVersion = (0, import_dsh_install.readProviderVersion)(import_meta.url);
|
|
101
|
+
const clientTarget = devClientDir ?? (providerVersion ? `${import_dsh_install.DSH_CLIENT_PACKAGE}@${providerVersion}` : `${import_dsh_install.DSH_CLIENT_PACKAGE}@latest`);
|
|
100
102
|
const clientAvailable = await (0, import_dsh_install.ensureDshPackage)(
|
|
101
103
|
profileDir,
|
|
102
104
|
import_dsh_install.DSH_CLIENT_PACKAGE,
|
|
103
|
-
|
|
104
|
-
this.opts.home
|
|
105
|
+
clientTarget,
|
|
106
|
+
this.opts.home,
|
|
107
|
+
providerVersion
|
|
105
108
|
);
|
|
106
109
|
if (!clientAvailable) {
|
|
107
110
|
log.warn("@aipanel/dsh-client unavailable; @ menu chip highlight disabled", {
|
|
@@ -109,11 +112,13 @@ Please upgrade:
|
|
|
109
112
|
});
|
|
110
113
|
}
|
|
111
114
|
const devPluginDir = (0, import_dsh_install.resolveDevDshPackageSource)(import_meta.url, "dsh-plugin", "dist/index.js");
|
|
115
|
+
const pluginTarget = devPluginDir ?? (providerVersion ? `${import_dsh_install.DSH_PLUGIN_PACKAGE}@${providerVersion}` : `${import_dsh_install.DSH_PLUGIN_PACKAGE}@latest`);
|
|
112
116
|
const pluginAvailable = await (0, import_dsh_install.ensureDshPackage)(
|
|
113
117
|
profileDir,
|
|
114
118
|
import_dsh_install.DSH_PLUGIN_PACKAGE,
|
|
115
|
-
|
|
116
|
-
this.opts.home
|
|
119
|
+
pluginTarget,
|
|
120
|
+
this.opts.home,
|
|
121
|
+
providerVersion
|
|
117
122
|
);
|
|
118
123
|
if (!pluginAvailable) {
|
|
119
124
|
log.warn("@aipanel/dsh-plugin unavailable; run_diagnostics & settings application disabled", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aipanel/provider-deepseek",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"execa": "^9.6.1",
|
|
25
|
-
"@aipanel/core": "1.2.
|
|
25
|
+
"@aipanel/core": "1.2.20"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"esbuild": "^0.25.0"
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "pagoda-cli build && node scripts/build-dsh-assets.mjs",
|
|
32
32
|
"typecheck": "tsc -p tsconfig.declaration.json --noEmit",
|
|
33
|
-
"test": "vitest run"
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"test:coverage": "vitest run --coverage"
|
|
34
35
|
}
|
|
35
36
|
}
|