@dsh-plus/llm-pi 0.1.16 → 0.1.18
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/lib/client.js +61142 -23
- package/lib/index.d.ts +2 -2
- package/lib/index.js +34 -34
- package/lib/style.css +1627 -0
- package/package.json +32 -30
- package/src/catalog/models-dev.ts +1 -6
- package/src/client/client.ts +1 -1
- package/src/compat.ts +2 -2
- package/src/config.ts +2 -3
- package/src/deepseek-routes.ts +3 -3
- package/src/ns.ts +4 -3
- package/src/profiles.ts +1 -1
- package/src/resolve-dsh.ts +2 -2
- package/src/service.ts +34 -29
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
2
|
import { Context } from "@deepseek-ai/cordis";
|
|
3
3
|
//#region src/config.d.ts
|
|
4
|
-
/** settings
|
|
5
|
-
declare const SETTINGS_NS
|
|
4
|
+
/** settings 命名空间(字面量即合法命名空间,0.1.2-alpha.2 起编译期校验;webui 配置卡片与插件运行期读取同一份)。 */
|
|
5
|
+
declare const SETTINGS_NS = "dsh-plus-llm-pi";
|
|
6
6
|
/** 本插件可为手写 route 提供的协议实现(与官方 PROTOCOLS 表一致)。 */
|
|
7
7
|
declare const PROTOCOL_IDS: readonly ["openai-completions", "openai-responses", "anthropic-messages"];
|
|
8
8
|
type ProtocolId = (typeof PROTOCOL_IDS)[number];
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { deepEqualJson, installSettingsSection, settingsNamespace } from "@deepseek-ai/dsh-settings";
|
|
2
1
|
import z from "@deepseek-ai/schemastery";
|
|
3
2
|
import { dshHomePath } from "@deepseek-ai/dsh-home-paths";
|
|
4
3
|
import { launchEnvironmentOf } from "@deepseek-ai/dsh-launch-environment";
|
|
4
|
+
import { deepEqualJson } from "@deepseek-ai/dsh-util-values";
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { request } from "node:http";
|
|
7
7
|
import { request as request$1 } from "node:https";
|
|
8
8
|
import { dirname, join, resolve } from "node:path";
|
|
9
|
-
import
|
|
9
|
+
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
10
10
|
import { credentialKeyId, credentialKeyScope, credentialRef, isCredentialKeySegment, isCredentialRefName } from "@deepseek-ai/dsh-credentials";
|
|
11
11
|
import { pathToFileURL } from "node:url";
|
|
12
12
|
import * as vendoredAnonId from "@deepseek-ai/dsh-anonymous-user-id";
|
|
@@ -33,8 +33,8 @@ import { homedir } from "node:os";
|
|
|
33
33
|
* - provider/model 均支持 extends 继承(见 inherit.ts)。
|
|
34
34
|
* @module llm-pi/config
|
|
35
35
|
*/
|
|
36
|
-
/** settings
|
|
37
|
-
const SETTINGS_NS =
|
|
36
|
+
/** settings 命名空间(字面量即合法命名空间,0.1.2-alpha.2 起编译期校验;webui 配置卡片与插件运行期读取同一份)。 */
|
|
37
|
+
const SETTINGS_NS = "dsh-plus-llm-pi";
|
|
38
38
|
/** 本插件可为手写 route 提供的协议实现(与官方 PROTOCOLS 表一致)。 */
|
|
39
39
|
const PROTOCOL_IDS = [
|
|
40
40
|
"openai-completions",
|
|
@@ -263,8 +263,6 @@ function registerCatalogApi(ctx, runtime) {
|
|
|
263
263
|
* 视觉等模态须用户在条目上显式声明(防 over-claiming 导致会话重复失败请求)。
|
|
264
264
|
* @module llm-pi/catalog/models-dev
|
|
265
265
|
*/
|
|
266
|
-
/** 仅 https 目标走代理(http 目标直连;代理通常只提供 CONNECT 隧道)。 */
|
|
267
|
-
const { HttpsProxyAgent } = HttpsProxyAgentModule;
|
|
268
266
|
const FETCH_TIMEOUT_MS = 2e4;
|
|
269
267
|
/** 目录文档体上限(api.json 全量约 1-2MB,放宽到 20MB 防未来膨胀)。 */
|
|
270
268
|
const MAX_RESPONSE_BYTES$1 = 20971520;
|
|
@@ -1116,7 +1114,7 @@ function buildDeepseekRoutes(providers, deps) {
|
|
|
1116
1114
|
//#endregion
|
|
1117
1115
|
//#region src/profiles.ts
|
|
1118
1116
|
/**
|
|
1119
|
-
* profile 构建器(0.1.2-alpha.
|
|
1117
|
+
* profile 构建器(0.1.2-alpha.2 复核兼容):插件 Config → 官方 schema 形状的
|
|
1120
1118
|
* 「前置数据源归一化」→ 官方 resolveProfiles(或插件等价兜底)→
|
|
1121
1119
|
* ResolvedPiAiProviderProfile。
|
|
1122
1120
|
*
|
|
@@ -1635,7 +1633,7 @@ function authContextFrom(ctx) {
|
|
|
1635
1633
|
* 两条路径产物都过形状自检(assertKitShape):上游重构导致形状漂移时
|
|
1636
1634
|
* 抛错,由调用方决定回退或放弃注册——绝不让坏套件进入消息链路。
|
|
1637
1635
|
*
|
|
1638
|
-
* 0.1.2-alpha.1
|
|
1636
|
+
* 0.1.2-alpha 线的新面(0.1.2-alpha.2 复核包根仍未导出、仅 src 子路径有):
|
|
1639
1637
|
* - resolveProfiles(config.ts):官方解析链,dev 布局树可经 src 子路径复用;
|
|
1640
1638
|
* - credentialStoreFrom/authContextFrom(auth.ts):PiAiAdapter 必需 auth 注入。
|
|
1641
1639
|
* npm 发布形态(lib/index.js 单 bundle + 无 src/)两者都拿不到:dsh 树优先
|
|
@@ -2068,33 +2066,35 @@ async function startRuntime(ctx, rawConfig) {
|
|
|
2068
2066
|
ensureRegistration();
|
|
2069
2067
|
ensureDeepseek();
|
|
2070
2068
|
ensureDirectory();
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2069
|
+
ctx.inject(["settings"], (settingsCtx) => {
|
|
2070
|
+
settingsCtx.settings.installSection(ctx, SETTINGS_NS, Config, config, {
|
|
2071
|
+
validate: (cfg) => assertServiceable(cfg, deps),
|
|
2072
|
+
setSource: (source) => {
|
|
2073
|
+
current = source;
|
|
2074
|
+
},
|
|
2075
|
+
onChange: () => {
|
|
2076
|
+
try {
|
|
2077
|
+
ensureRegistration();
|
|
2078
|
+
} catch (error) {
|
|
2079
|
+
logger.error("llm-pi: 更新被拒,保留此前注册的 route");
|
|
2080
|
+
logger.error(error);
|
|
2081
|
+
}
|
|
2082
|
+
try {
|
|
2083
|
+
ensureDeepseek();
|
|
2084
|
+
} catch (error) {
|
|
2085
|
+
logger.error("llm-pi: deepseek route 更新失败,保留此前注册");
|
|
2086
|
+
logger.error(error);
|
|
2087
|
+
}
|
|
2088
|
+
try {
|
|
2089
|
+
ensureDirectory();
|
|
2090
|
+
} catch (error) {
|
|
2091
|
+
logger.error("llm-pi: 更新被拒,保留此前的 configurable-provider 目录");
|
|
2092
|
+
logger.error(error);
|
|
2093
|
+
}
|
|
2094
|
+
const cfg = current();
|
|
2095
|
+
modelsDev.reconfigure(cfg.catalogUrl, cfg.catalogRefreshHours, cfg.catalogProxy ?? "");
|
|
2094
2096
|
}
|
|
2095
|
-
|
|
2096
|
-
modelsDev.reconfigure(cfg.catalogUrl, cfg.catalogRefreshHours, cfg.catalogProxy ?? "");
|
|
2097
|
-
}
|
|
2097
|
+
});
|
|
2098
2098
|
});
|
|
2099
2099
|
return {
|
|
2100
2100
|
currentConfig: () => current(),
|