dsh-connect-modelscope-token-plan 0.5.0 → 0.6.1
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/CHANGELOG.md +235 -208
- package/README.md +3 -1
- package/client.js +150 -27
- package/cordis.patch.yml +36 -5
- package/lib/host-config.js +151 -16
- package/lib/index.js +344 -103
- package/lib/llm-adapter.js +8 -2
- package/package.json +115 -115
package/lib/llm-adapter.js
CHANGED
|
@@ -558,6 +558,11 @@ function withUsageObserver(inner, sinks, onError) {
|
|
|
558
558
|
* `fs`)的服务解析器。
|
|
559
559
|
* @param {string[]} [options.unavailableModelIds] - 额度耗尽的模型 id,从 offer 里
|
|
560
560
|
* 排除,避免发出注定 429 的请求。
|
|
561
|
+
* @param {object} [options.maxTokensOverrides] - 逐模型输出上限覆盖(id → tokens),
|
|
562
|
+
* 归一后的 `ResolvedSettings.maxTokensOverrides`。**构造期读入**(apply 时随
|
|
563
|
+
* wiring 一次性 `resolveSettings`,与 `apiBase` 同理):改 patch 要 reload
|
|
564
|
+
* (apply 重跑)才生效,不是下一轮目录轮询。魔搭目录从不声明该字段,所以这是
|
|
565
|
+
* 输出上限唯一的真值来源(见 llm-models.ts 的 `maxTokensFor`)。
|
|
561
566
|
* @param {UsageSinks} [options.usage] - 本地计数的写入口(usage-store 的两条
|
|
562
567
|
* 方法)。**这是面板「今日次数 / 模型分布 / 趋势 / 429 事件流」唯一的生产
|
|
563
568
|
* 者**——probe 那条写入路径已随目录表删除,缺了它四块面板恒为 0 与空。
|
|
@@ -567,12 +572,13 @@ function withUsageObserver(inner, sinks, onError) {
|
|
|
567
572
|
* 应该可见——否则用户发现计数不对时没有任何线索。
|
|
568
573
|
* @returns {{adapter: object, providerIds: string[]}} 适配器与它拥有的 ids。
|
|
569
574
|
*/
|
|
570
|
-
function createModelScopeAdapter({ entries, enabledIds = [], baseUrl, resolveApiKey, get, unavailableModelIds = [], usage, onError }) {
|
|
575
|
+
function createModelScopeAdapter({ entries, enabledIds = [], baseUrl, resolveApiKey, get, unavailableModelIds = [], maxTokensOverrides = {}, usage, onError }) {
|
|
571
576
|
const models = buildDescriptors(entries, {
|
|
572
577
|
providerId: LLM_PROVIDER_ID,
|
|
573
578
|
baseUrl,
|
|
574
579
|
enabledIds,
|
|
575
|
-
unavailableModelIds
|
|
580
|
+
unavailableModelIds,
|
|
581
|
+
maxTokensOverrides
|
|
576
582
|
});
|
|
577
583
|
const built = assemblePiAiAdapter({
|
|
578
584
|
providerId: LLM_PROVIDER_ID,
|
package/package.json
CHANGED
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-connect-modelscope-token-plan",
|
|
3
|
-
"displayName": "DSH Connect ModelScope Token Plan",
|
|
4
|
-
"icon": "./icon.svg",
|
|
5
|
-
"version": "0.
|
|
6
|
-
"homepage": "https://github.com/eghrhegpe/dsh-connect-modelscope-token-plan",
|
|
7
|
-
"bugs": {
|
|
8
|
-
"url": "https://github.com/eghrhegpe/dsh-connect-modelscope-token-plan/issues"
|
|
9
|
-
},
|
|
10
|
-
"author": "eghrhegpe",
|
|
11
|
-
"description": "ModelScope (modelscope.cn) connect bundle for the Harness Web UI: the official Magicube balance plus, for calls made through this plugin, per-model counts, a daily trend, and a 429 error event list on the Plugins-page panel, plus a default-off switch that registers ModelScope models as a DSH LLM provider.",
|
|
12
|
-
"keywords": [
|
|
13
|
-
"dsh-plugin",
|
|
14
|
-
"deepseek-harness",
|
|
15
|
-
"modelscope",
|
|
16
|
-
"token-plan",
|
|
17
|
-
"quota",
|
|
18
|
-
"api-inference"
|
|
19
|
-
],
|
|
20
|
-
"type": "module",
|
|
21
|
-
"main": "./lib/index.js",
|
|
22
|
-
"exports": {
|
|
23
|
-
".": "./lib/index.js",
|
|
24
|
-
"./client": "./client.js",
|
|
25
|
-
"./locale/*.json": "./locale/*.json",
|
|
26
|
-
"./package.json": "./package.json"
|
|
27
|
-
},
|
|
28
|
-
"files": [
|
|
29
|
-
"lib",
|
|
30
|
-
"client.js",
|
|
31
|
-
"icon.svg",
|
|
32
|
-
"locale",
|
|
33
|
-
"assets",
|
|
34
|
-
"cordis.patch.yml",
|
|
35
|
-
"README.md",
|
|
36
|
-
"CHANGELOG.md",
|
|
37
|
-
"LICENSE",
|
|
38
|
-
"screenshots.json"
|
|
39
|
-
],
|
|
40
|
-
"scripts": {
|
|
41
|
-
"typecheck": "tsc -p tsconfig.json",
|
|
42
|
-
"build:client": "tsdown -c tsdown.config.mjs",
|
|
43
|
-
"duplicate-check": "jscpd src --min-tokens 70 --reporters console-full",
|
|
44
|
-
"test": "node test/run-all.mjs",
|
|
45
|
-
"test:mutate": "node tools/dev/mutate.mjs tools/dev/mutate-spec.json",
|
|
46
|
-
"doctor": "node tools/doctor.mjs",
|
|
47
|
-
"doctor:json": "node tools/doctor.mjs --json",
|
|
48
|
-
"build": "tsdown -c tsdown.config.mjs",
|
|
49
|
-
"prepack": "npm run build"
|
|
50
|
-
},
|
|
51
|
-
"dsh": {
|
|
52
|
-
"bundle": {
|
|
53
|
-
"patch": "./cordis.patch.yml"
|
|
54
|
-
},
|
|
55
|
-
"client": {
|
|
56
|
-
"platform": "web",
|
|
57
|
-
"immediately": true,
|
|
58
|
-
"inject": [
|
|
59
|
-
"@deepseek-ai/dsh-client-locale",
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-renderer"
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"peerDependencies": {
|
|
65
|
-
"@deepseek-ai/cordis": ">=4.0.2 <5.0.0",
|
|
66
|
-
"@deepseek-ai/dsh-client-locale": ">=0.1.5 <0.3",
|
|
67
|
-
"@deepseek-ai/dsh-client-ui-layout": ">=0.1.5 <0.3",
|
|
68
|
-
"@deepseek-ai/dsh-client-ui-renderer": ">=0.1.5 <0.3",
|
|
69
|
-
"@deepseek-ai/dsh-credentials": ">=0.1.5 <0.3",
|
|
70
|
-
"@deepseek-ai/dsh-home-paths": ">=0.1.5 <0.3",
|
|
71
|
-
"@deepseek-ai/dsh-host-webserver": ">=0.1.5 <0.3",
|
|
72
|
-
"@deepseek-ai/dsh-llm": ">=0.1.5 <0.3",
|
|
73
|
-
"@deepseek-ai/dsh-llm-pi-ai": ">=0.1.5 <0.3",
|
|
74
|
-
"@deepseek-ai/dsh-settings": ">=0.1.5 <0.3",
|
|
75
|
-
"@deepseek-ai/dsh-tools": ">=0.1.5 <0.3",
|
|
76
|
-
"@deepseek-ai/schemastery": "^3.18.2",
|
|
77
|
-
"@earendil-works/pi-ai": "^0.85.1"
|
|
78
|
-
},
|
|
79
|
-
"peerDependenciesMeta": {
|
|
80
|
-
"@deepseek-ai/cordis": { "optional": true },
|
|
81
|
-
"@deepseek-ai/dsh-client-locale": { "optional": true },
|
|
82
|
-
"@deepseek-ai/dsh-client-ui-layout": { "optional": true },
|
|
83
|
-
"@deepseek-ai/dsh-client-ui-renderer": { "optional": true },
|
|
84
|
-
"@deepseek-ai/dsh-credentials": { "optional": true },
|
|
85
|
-
"@deepseek-ai/dsh-home-paths": { "optional": true },
|
|
86
|
-
"@deepseek-ai/dsh-host-webserver": { "optional": true },
|
|
87
|
-
"@deepseek-ai/dsh-llm": { "optional": true },
|
|
88
|
-
"@deepseek-ai/dsh-llm-pi-ai": { "optional": true },
|
|
89
|
-
"@deepseek-ai/dsh-settings": { "optional": true },
|
|
90
|
-
"@deepseek-ai/dsh-tools": { "optional": true },
|
|
91
|
-
"@deepseek-ai/schemastery": { "optional": true },
|
|
92
|
-
"@earendil-works/pi-ai": { "optional": true }
|
|
93
|
-
},
|
|
94
|
-
"engines": {
|
|
95
|
-
"node": "^22.19.0 || >=24.0.0"
|
|
96
|
-
},
|
|
97
|
-
"repository": {
|
|
98
|
-
"type": "git",
|
|
99
|
-
"url": "git+https://github.com/eghrhegpe/dsh-connect-modelscope-token-plan.git"
|
|
100
|
-
},
|
|
101
|
-
"license": "MIT",
|
|
102
|
-
"devDependencies": {
|
|
103
|
-
"@types/node": "^22.19.0",
|
|
104
|
-
"jscpd": "^5.4.0",
|
|
105
|
-
"jsdom": "^30.1.3",
|
|
106
|
-
"react": "18.3.1",
|
|
107
|
-
"react-dom": "18.3.1",
|
|
108
|
-
"tsdown": "0.23.0",
|
|
109
|
-
"typescript": "5.9.3"
|
|
110
|
-
},
|
|
111
|
-
"overrides": {
|
|
112
|
-
"rolldown": "1.2.12",
|
|
113
|
-
"rolldown-plugin-dts": "0.28.6"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-connect-modelscope-token-plan",
|
|
3
|
+
"displayName": "DSH Connect ModelScope Token Plan",
|
|
4
|
+
"icon": "./icon.svg",
|
|
5
|
+
"version": "0.6.1",
|
|
6
|
+
"homepage": "https://github.com/eghrhegpe/dsh-connect-modelscope-token-plan",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/eghrhegpe/dsh-connect-modelscope-token-plan/issues"
|
|
9
|
+
},
|
|
10
|
+
"author": "eghrhegpe",
|
|
11
|
+
"description": "ModelScope (modelscope.cn) connect bundle for the Harness Web UI: the official Magicube balance plus, for calls made through this plugin, per-model counts, a daily trend, and a 429 error event list on the Plugins-page panel, plus a default-off switch that registers ModelScope models as a DSH LLM provider.",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"dsh-plugin",
|
|
14
|
+
"deepseek-harness",
|
|
15
|
+
"modelscope",
|
|
16
|
+
"token-plan",
|
|
17
|
+
"quota",
|
|
18
|
+
"api-inference"
|
|
19
|
+
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"main": "./lib/index.js",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": "./lib/index.js",
|
|
24
|
+
"./client": "./client.js",
|
|
25
|
+
"./locale/*.json": "./locale/*.json",
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"lib",
|
|
30
|
+
"client.js",
|
|
31
|
+
"icon.svg",
|
|
32
|
+
"locale",
|
|
33
|
+
"assets",
|
|
34
|
+
"cordis.patch.yml",
|
|
35
|
+
"README.md",
|
|
36
|
+
"CHANGELOG.md",
|
|
37
|
+
"LICENSE",
|
|
38
|
+
"screenshots.json"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
42
|
+
"build:client": "tsdown -c tsdown.config.mjs",
|
|
43
|
+
"duplicate-check": "jscpd src --min-tokens 70 --reporters console-full",
|
|
44
|
+
"test": "node test/run-all.mjs",
|
|
45
|
+
"test:mutate": "node tools/dev/mutate.mjs tools/dev/mutate-spec.json",
|
|
46
|
+
"doctor": "node tools/doctor.mjs",
|
|
47
|
+
"doctor:json": "node tools/doctor.mjs --json",
|
|
48
|
+
"build": "tsdown -c tsdown.config.mjs",
|
|
49
|
+
"prepack": "npm run build"
|
|
50
|
+
},
|
|
51
|
+
"dsh": {
|
|
52
|
+
"bundle": {
|
|
53
|
+
"patch": "./cordis.patch.yml"
|
|
54
|
+
},
|
|
55
|
+
"client": {
|
|
56
|
+
"platform": "web",
|
|
57
|
+
"immediately": true,
|
|
58
|
+
"inject": [
|
|
59
|
+
"@deepseek-ai/dsh-client-locale",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-renderer"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"@deepseek-ai/cordis": ">=4.0.2 <5.0.0",
|
|
66
|
+
"@deepseek-ai/dsh-client-locale": ">=0.1.5 <0.3",
|
|
67
|
+
"@deepseek-ai/dsh-client-ui-layout": ">=0.1.5 <0.3",
|
|
68
|
+
"@deepseek-ai/dsh-client-ui-renderer": ">=0.1.5 <0.3",
|
|
69
|
+
"@deepseek-ai/dsh-credentials": ">=0.1.5 <0.3",
|
|
70
|
+
"@deepseek-ai/dsh-home-paths": ">=0.1.5 <0.3",
|
|
71
|
+
"@deepseek-ai/dsh-host-webserver": ">=0.1.5 <0.3",
|
|
72
|
+
"@deepseek-ai/dsh-llm": ">=0.1.5 <0.3",
|
|
73
|
+
"@deepseek-ai/dsh-llm-pi-ai": ">=0.1.5 <0.3",
|
|
74
|
+
"@deepseek-ai/dsh-settings": ">=0.1.5 <0.3",
|
|
75
|
+
"@deepseek-ai/dsh-tools": ">=0.1.5 <0.3",
|
|
76
|
+
"@deepseek-ai/schemastery": "^3.18.2",
|
|
77
|
+
"@earendil-works/pi-ai": "^0.85.1"
|
|
78
|
+
},
|
|
79
|
+
"peerDependenciesMeta": {
|
|
80
|
+
"@deepseek-ai/cordis": { "optional": true },
|
|
81
|
+
"@deepseek-ai/dsh-client-locale": { "optional": true },
|
|
82
|
+
"@deepseek-ai/dsh-client-ui-layout": { "optional": true },
|
|
83
|
+
"@deepseek-ai/dsh-client-ui-renderer": { "optional": true },
|
|
84
|
+
"@deepseek-ai/dsh-credentials": { "optional": true },
|
|
85
|
+
"@deepseek-ai/dsh-home-paths": { "optional": true },
|
|
86
|
+
"@deepseek-ai/dsh-host-webserver": { "optional": true },
|
|
87
|
+
"@deepseek-ai/dsh-llm": { "optional": true },
|
|
88
|
+
"@deepseek-ai/dsh-llm-pi-ai": { "optional": true },
|
|
89
|
+
"@deepseek-ai/dsh-settings": { "optional": true },
|
|
90
|
+
"@deepseek-ai/dsh-tools": { "optional": true },
|
|
91
|
+
"@deepseek-ai/schemastery": { "optional": true },
|
|
92
|
+
"@earendil-works/pi-ai": { "optional": true }
|
|
93
|
+
},
|
|
94
|
+
"engines": {
|
|
95
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
96
|
+
},
|
|
97
|
+
"repository": {
|
|
98
|
+
"type": "git",
|
|
99
|
+
"url": "git+https://github.com/eghrhegpe/dsh-connect-modelscope-token-plan.git"
|
|
100
|
+
},
|
|
101
|
+
"license": "MIT",
|
|
102
|
+
"devDependencies": {
|
|
103
|
+
"@types/node": "^22.19.0",
|
|
104
|
+
"jscpd": "^5.4.0",
|
|
105
|
+
"jsdom": "^30.1.3",
|
|
106
|
+
"react": "18.3.1",
|
|
107
|
+
"react-dom": "18.3.1",
|
|
108
|
+
"tsdown": "0.23.0",
|
|
109
|
+
"typescript": "5.9.3"
|
|
110
|
+
},
|
|
111
|
+
"overrides": {
|
|
112
|
+
"rolldown": "1.2.12",
|
|
113
|
+
"rolldown-plugin-dts": "0.28.6"
|
|
114
|
+
}
|
|
115
|
+
}
|