dsh-model-think-level 1.1.3 → 1.1.5
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/README.md +30 -8
- package/docs/image.png +0 -0
- package/docs/image2.png +0 -0
- package/docs/image3.png +0 -0
- package/docs/image4.png +0 -0
- package/docs/image5.png +0 -0
- package/lib/client/ComposerSlider.d.ts +3 -0
- package/lib/client/EffortEditor.d.ts +2 -57
- package/lib/client/configured-inputs.d.ts +12 -0
- package/lib/client/injection/autofill-run.d.ts +2 -0
- package/lib/client/injection/composer-menu.d.ts +3 -0
- package/lib/client/injection/models-page-editor.d.ts +5 -14
- package/lib/client/locales.d.ts +0 -18
- package/lib/client/ops.d.ts +0 -1
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/types.d.ts +5 -21
- package/lib/client.js +7 -314
- package/lib/client.js.map +4 -4
- package/lib/index.js +224 -112
- package/lib/index.js.map +3 -3
- package/lib/key-index.d.ts +4 -3
- package/lib/knowledge.d.ts +15 -2
- package/package.json +19 -4
package/README.md
CHANGED
|
@@ -2,11 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
DSH 的第三方模型补齐思考等级:在官方 Models 页每个模型行注入 Thinking 开关和强度/模态编辑器,在输入框模型菜单加供应商→模型选择器、视觉徽章与等级行,并带搜索、拖拽排序、供应商启用开关;以及按路由接管请求头与 user-agent。
|
|
4
4
|
|
|
5
|
-
模型选择器
|
|
6
|
-
|
|
7
|
-

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
## 供应商配置
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+

|
|
14
|
+

|
|
15
|
+
|
|
16
|
+
## 兼容字段与已有配置
|
|
17
|
+
|
|
18
|
+
1.1.4 起不再提供 `thinkingTokenBudgetField`、`vllmPriority`、`supportsMaxOutputTokens` 的专用编辑控件。已有值仍由 DSH 的 pi-ai 适配器使用;修改模型的思考档位或输入模态时,插件会保留这些值和其他手动兼容配置,避免覆盖供应商的定制行为。
|
|
19
|
+
|
|
20
|
+
需要调整旧值时,先备份当前 profile 的 `cordis.patch.yml`(位于 DSH 数据目录的 `profiles/<profile>/`),找到 `llm-pi-ai` 对应供应商、模型行的 `compat`,仅修改或删除所需字段,保存后重新加载该 profile:
|
|
21
|
+
|
|
22
|
+
- `thinkingTokenBudgetField`:令牌预算的请求字段名,可设为 `thinking_token_budget`、`thinking_budget` 或 `thinking_budget_tokens`。删除后使用默认字段;启用令牌预算的模型在后续适配或保存时可能重新补入 `thinking_token_budget`。若端点不支持令牌预算,应将 `supportsThinkingTokenBudget` 设为 `false`。
|
|
23
|
+
- `vllmPriority`:删除后不再发送定制的 vLLM 优先级。
|
|
24
|
+
- `supportsMaxOutputTokens`:删除后恢复适配器默认行为;保留 `false` 会继续关闭对应输出令牌参数。
|
|
25
|
+
|
|
26
|
+
不要删除整个供应商配置,也不要将包含 API key 的配置文件贴到公开 issue。
|
|
27
|
+
|
|
28
|
+
## 开发与验证
|
|
29
|
+
|
|
30
|
+
使用 Node.js `^22.19.0 || >=24`。依次运行 `npm ci`、`npm run typecheck`、`npm test`、`npm run build`、`npm run check:package`。测试最多并行 4 个 worker,以控制 DOM 测试的内存占用;仍使用 Vitest 默认超时。
|
|
31
|
+
|
|
32
|
+
`check:package` 检查 npm 实际打包清单中的入口、截图和声明文件依赖,CI 与发布流程都会执行。类型声明所引用的 DSH 可选 peer 由宿主开发环境提供,不会自动安装额外宿主插件。
|
|
33
|
+
|
|
34
|
+
更新模型知识表后,可运行 `npm run docs:models` 生成可查阅的模型列表。`node scripts/wire-repro.mjs` 使用当前安装的 pi-ai,向本地回显服务发送测试请求,无需供应商凭据。
|
package/docs/image.png
ADDED
|
Binary file
|
package/docs/image2.png
ADDED
|
Binary file
|
package/docs/image3.png
ADDED
|
Binary file
|
package/docs/image4.png
ADDED
|
Binary file
|
package/docs/image5.png
ADDED
|
Binary file
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import { type ConfiguredInputs } from './configured-inputs.js';
|
|
2
3
|
import type { DirectoryCurrentLike, DirectoryGroupLike, EffortLevelLike, ModelDirectoryLike, ModelDirectoryStateLike } from './types.js';
|
|
3
4
|
/** The model's declared effort levels, when there are at least two to choose from. */
|
|
4
5
|
export declare function sliderLevels(state: ModelDirectoryStateLike): readonly EffortLevelLike[];
|
|
@@ -15,6 +16,8 @@ type Translator = (key: string, params?: Record<string, string | number>) => str
|
|
|
15
16
|
export interface ComposerSliderProps {
|
|
16
17
|
/** The session's shared model directory (load + select ride the official seam). */
|
|
17
18
|
directory: ModelDirectoryLike;
|
|
19
|
+
/** Saved provider/model inputs; the host catalog may omit modalities. */
|
|
20
|
+
configuredInputs?: ConfiguredInputs;
|
|
18
21
|
/** Localized copy (the plugin's bound translator). */
|
|
19
22
|
t: Translator;
|
|
20
23
|
/**
|
|
@@ -90,32 +90,6 @@ export interface DraftModality {
|
|
|
90
90
|
export declare function modalityFrom(input: InputModalities | undefined): DraftModality;
|
|
91
91
|
/** Resolve a modality draft to the write intent (null = durably unset). */
|
|
92
92
|
export declare function buildModalityIntent(draft: DraftModality): InputModalities | null;
|
|
93
|
-
/**
|
|
94
|
-
* The compat fields this editor can SET, per protocol — which is also the set
|
|
95
|
-
* it may clear. A key from neither list survives an apply untouched: a
|
|
96
|
-
* hand-tuned field the UI never showed is not this editor's to drop. Clearing
|
|
97
|
-
* a picker means unset, not "keep whatever was chosen last".
|
|
98
|
-
*/
|
|
99
|
-
export declare const OWNED_COMPAT_KEYS: Readonly<Record<string, readonly string[]>>;
|
|
100
|
-
/** The compat fields clearable on one protocol (empty = this edit owns none). */
|
|
101
|
-
export declare function ownedCompatKeys(routeApi: string | undefined): readonly string[];
|
|
102
|
-
/** The owned compat fields the draft actually left EMPTY. */
|
|
103
|
-
export declare function clearedCompatKeys(routeApi: string | undefined, draft: CompatSuggestion | undefined): readonly string[];
|
|
104
|
-
/**
|
|
105
|
-
* The `clearCompatKeys` part of a commit, derived from the draft.
|
|
106
|
-
*
|
|
107
|
-
* A DEFINED draft always reports (an empty array is meaningful: every owned
|
|
108
|
-
* field it shows is set). An EMPTY draft must still clear the fields the
|
|
109
|
-
* protocol OWNS -- dropping the last owned pick is a user decision to unset --
|
|
110
|
-
* but only when there is something to clear: an unrelated route keeps the
|
|
111
|
-
* shape it always had (no `clearCompatKeys` at all).
|
|
112
|
-
* @param routeApi - the route's wire protocol.
|
|
113
|
-
* @param writeCompat - the compat bytes this commit writes, if any.
|
|
114
|
-
* @returns the clear part to spread into the commit payload.
|
|
115
|
-
*/
|
|
116
|
-
export declare function compatClearIntent(routeApi: string | undefined, writeCompat: CompatSuggestion | undefined): {
|
|
117
|
-
clearCompatKeys?: readonly string[];
|
|
118
|
-
};
|
|
119
93
|
/** Semantic equality between a modality draft and a stored declaration. */
|
|
120
94
|
export declare function sameModality(draft: DraftModality, stored: InputModalities | undefined): boolean;
|
|
121
95
|
/**
|
|
@@ -131,39 +105,10 @@ export declare function sameModality(draft: DraftModality, stored: InputModaliti
|
|
|
131
105
|
* @returns the ladder intent to write.
|
|
132
106
|
*/
|
|
133
107
|
export declare function ladderIntent(nextThinking: boolean, built: EffortIntent, initialEfforts: EffortWriteIntent | undefined): EffortWriteIntent;
|
|
134
|
-
/**
|
|
135
|
-
* The compat draft a FRESH editor on this row would hold.
|
|
136
|
-
*
|
|
137
|
-
* The editor's three compat inputs are seeded from the stored block, so an
|
|
138
|
-
* untouched editor's draft is exactly the stored block restricted to the three
|
|
139
|
-
* fields it shows. The injector's provider-wide adapt has no editor to ask for
|
|
140
|
-
* a draft, so it derives the same value here: a hand-tuned field the UI does
|
|
141
|
-
* not show stays untouchable, and one it does show survives the write.
|
|
142
|
-
* @param compat - the row's stored compat block.
|
|
143
|
-
* @returns the draft, or undefined when it holds no field at all.
|
|
144
|
-
*/
|
|
145
|
-
export declare function compatDraftOf(compat: CompatSuggestion | undefined): CompatSuggestion | undefined;
|
|
146
|
-
/**
|
|
147
|
-
* The compat advice three MANUAL field values spell, from the values handed in.
|
|
148
|
-
*
|
|
149
|
-
* The editor's three compat controls are its own edit surface, so the handler
|
|
150
|
-
* that just changed one must report the value it computed: re-reading the
|
|
151
|
-
* component state there reports the PRE-update field, because React commits
|
|
152
|
-
* that state after the event — the queued write then carries the previous
|
|
153
|
-
* advice while the control already shows the new one.
|
|
154
|
-
* @param parts - the three field values as they will read after the event.
|
|
155
|
-
* @returns the draft, or undefined when all three are empty.
|
|
156
|
-
*/
|
|
157
|
-
export declare function manualCompatOf(parts: {
|
|
158
|
-
budgetField: string;
|
|
159
|
-
priorityText: string;
|
|
160
|
-
maxOutput: string;
|
|
161
|
-
}): CompatSuggestion | undefined;
|
|
162
108
|
/**
|
|
163
109
|
* Assemble one complete pending write from the parts a caller resolved: the
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* the clear list for the fields this write OWNS and left empty.
|
|
110
|
+
* applied suggestion's compat block and the thinking-budget default an
|
|
111
|
+
* openai-completions endpoint needs.
|
|
167
112
|
*
|
|
168
113
|
* The single implementation of that assembly: the row's own editor reports the
|
|
169
114
|
* user's edits through it, and the injector's provider-wide adapt reports
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RemoteApi } from './types.js';
|
|
2
|
+
export type ConfiguredInputSnapshot = ReadonlyMap<string, ReadonlyMap<string, readonly string[]>>;
|
|
3
|
+
/** Stable empty snapshot for a composer mounted without a settings reader. */
|
|
4
|
+
export declare const EMPTY_CONFIGURED_INPUTS: ConfiguredInputSnapshot;
|
|
5
|
+
/** Saved model inputs, shared by composer mounts and refreshed on settings pushes. */
|
|
6
|
+
export interface ConfiguredInputs {
|
|
7
|
+
getSnapshot(): ConfiguredInputSnapshot;
|
|
8
|
+
subscribe(listener: () => void): () => void;
|
|
9
|
+
load(): Promise<void>;
|
|
10
|
+
invalidate(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare function createConfiguredInputs(api: RemoteApi): ConfiguredInputs;
|
|
@@ -17,6 +17,8 @@ export interface IdleAutofillDeps {
|
|
|
17
17
|
export interface IdleAutofill {
|
|
18
18
|
/** Run the complement; fire-and-forget on the injector's idle pass. */
|
|
19
19
|
run: () => void;
|
|
20
|
+
/** Drop the host-switch snapshot; the next idle run reads it again. */
|
|
21
|
+
invalidate: () => void;
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Build the auto-fill complement.
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import type { ReactNode } from 'react';
|
|
22
22
|
import type { Translate } from '@deepseek-ai/dsh-client-ui-slots';
|
|
23
|
+
import type { ConfiguredInputs } from '../configured-inputs.js';
|
|
23
24
|
import type { ModelDirectoryLike } from '../types.js';
|
|
24
25
|
/** Everything the composer injection needs from its host. */
|
|
25
26
|
export interface ComposerMenuDeps {
|
|
@@ -35,6 +36,8 @@ export interface ComposerMenuDeps {
|
|
|
35
36
|
sliderEnabled: () => boolean;
|
|
36
37
|
/** The current session's model directory, or undefined in the boot window. */
|
|
37
38
|
directory: () => ModelDirectoryLike | undefined;
|
|
39
|
+
/** Saved input declarations, independent of the host catalog projection. */
|
|
40
|
+
configuredInputs?: ConfiguredInputs;
|
|
38
41
|
}
|
|
39
42
|
/** The composer injection's face: one reconcile per scan, one dispose per fiber. */
|
|
40
43
|
export interface ComposerMenuInjection {
|
|
@@ -168,6 +168,8 @@ export interface EditorMountProps {
|
|
|
168
168
|
}
|
|
169
169
|
/** Mutable scan state kept across reconcile invocations. */
|
|
170
170
|
export interface ScanState {
|
|
171
|
+
/** The owning page was torn down; late reads must not mount new roots. */
|
|
172
|
+
disposed: boolean;
|
|
171
173
|
/** Currently mounted editors, keyed by their container element. */
|
|
172
174
|
mounted: Map<HTMLElement, {
|
|
173
175
|
editor: MountedEditor;
|
|
@@ -372,19 +374,6 @@ export interface EffectiveStagedIntents {
|
|
|
372
374
|
input?: InputModalities;
|
|
373
375
|
/** The staged default-effort pick, when the staging carried one. */
|
|
374
376
|
defaultEffort?: string | null;
|
|
375
|
-
/**
|
|
376
|
-
* Compat fields the edit OWNS and left empty, so "unset" can mean unset
|
|
377
|
-
* instead of keeping the last choice forever. Computed by the editor's own
|
|
378
|
-
* `clearedCompatKeys` against the route's protocol, never against the whole
|
|
379
|
-
* stored block: a hand-tuned field the editor never showed survives.
|
|
380
|
-
*
|
|
381
|
-
* A STAGED flush never sets this. Staging carries a ladder and a modality,
|
|
382
|
-
* not a compat decision, and the host autofill writes the knowledge base's
|
|
383
|
-
* compat block into the very row it fills -- so clearing here would delete
|
|
384
|
-
* the suggestion the row is supposed to start from (the same "the plugin's
|
|
385
|
-
* own proposal is not a user decision" rule the ladder follows).
|
|
386
|
-
*/
|
|
387
|
-
clearCompatKeys?: readonly string[];
|
|
388
377
|
}
|
|
389
378
|
export declare function effectiveStagedIntents(declaration: StagedDeclaration, current: Record<string, unknown> | undefined, autofill?: AutofillFootprint): EffectiveStagedIntents | null;
|
|
390
379
|
/** What this plugin's host autofill would write for one model, as the flush compares it. */
|
|
@@ -468,7 +457,7 @@ export interface ScreenModel {
|
|
|
468
457
|
* routine answers from the settings DOCUMENT instead of the DOM: every model
|
|
469
458
|
* the provider declares goes through the same suggestion the row's own
|
|
470
459
|
* auto-adapt would have asked for, is mapped by the same pure functions
|
|
471
|
-
* ({@link ladderIntent}, {@link
|
|
460
|
+
* ({@link ladderIntent}, {@link pendingWriteOf}) so both
|
|
472
461
|
* paths write identical bytes, and lands by the same rule — nothing is written
|
|
473
462
|
* while an official card holds the document; the write is held on the route
|
|
474
463
|
* and the card's own Save commits it (issue #7 / C2).
|
|
@@ -496,6 +485,8 @@ export interface ScreenModel {
|
|
|
496
485
|
* suggestion, and -- when nothing could be adapted at all -- why.
|
|
497
486
|
*/
|
|
498
487
|
export declare function adaptEveryModel(state: ScanState, deps: InjectorDeps, route: string, visibleRows?: readonly ScreenModel[]): Promise<AutoAdaptReport>;
|
|
488
|
+
/** Restore anchoring and remove every live re-pin window's frame and listeners. */
|
|
489
|
+
export declare function releaseModelListRepins(): void;
|
|
499
490
|
/**
|
|
500
491
|
* Hand a viewport delta back to whichever container actually moved the card.
|
|
501
492
|
*
|
package/lib/client/locales.d.ts
CHANGED
|
@@ -35,7 +35,6 @@ export declare const en: {
|
|
|
35
35
|
confidence_medium: string;
|
|
36
36
|
confidence_low: string;
|
|
37
37
|
noSuggestion: string;
|
|
38
|
-
conflict: string;
|
|
39
38
|
writeError: string;
|
|
40
39
|
renderFailed: string;
|
|
41
40
|
wirePlaceholder: string;
|
|
@@ -57,7 +56,6 @@ export declare const en: {
|
|
|
57
56
|
sliderToggleAria: string;
|
|
58
57
|
settingOn: string;
|
|
59
58
|
settingOff: string;
|
|
60
|
-
sliderEffortAria: string;
|
|
61
59
|
sliderNoLevels: string;
|
|
62
60
|
triggerFallback: string;
|
|
63
61
|
effortDefault: string;
|
|
@@ -65,27 +63,11 @@ export declare const en: {
|
|
|
65
63
|
effortRowLabel: string;
|
|
66
64
|
tagVision: string;
|
|
67
65
|
tagThinking: string;
|
|
68
|
-
sliderEffortTitle: string;
|
|
69
|
-
sliderEffortTitleError: string;
|
|
70
66
|
sliderNoCurrent: string;
|
|
71
|
-
compatTitle: string;
|
|
72
|
-
budgetFieldLabel: string;
|
|
73
|
-
budgetFieldHint: string;
|
|
74
|
-
budgetUnset: string;
|
|
75
67
|
defaultEffortLabel: string;
|
|
76
68
|
defaultEffortUnset: string;
|
|
77
69
|
defaultEffortHint: string;
|
|
78
70
|
clearDefaultEffort: string;
|
|
79
|
-
priorityLabel: string;
|
|
80
|
-
priorityPlaceholder: string;
|
|
81
|
-
priorityHint: string;
|
|
82
|
-
priorityInvalid: string;
|
|
83
|
-
maxOutputLabel: string;
|
|
84
|
-
maxOutputUnset: string;
|
|
85
|
-
maxOutputOn: string;
|
|
86
|
-
maxOutputOff: string;
|
|
87
|
-
maxOutputHint: string;
|
|
88
|
-
aliasMigrated: string;
|
|
89
71
|
modelSearchPlaceholder: string;
|
|
90
72
|
modelSearchNoMatches: string;
|
|
91
73
|
modelSearchClear: string;
|
package/lib/client/ops.d.ts
CHANGED
|
@@ -92,7 +92,6 @@ export interface RowIntent {
|
|
|
92
92
|
efforts: EffortWriteIntent;
|
|
93
93
|
compat?: CompatSuggestion;
|
|
94
94
|
input?: InputIntent;
|
|
95
|
-
clearCompatKeys?: readonly string[];
|
|
96
95
|
defaultEffort?: DefaultEffortIntent;
|
|
97
96
|
}
|
|
98
97
|
/** The outcome of one batch write, as the caller's ledgers need it. */
|