dsh-gpt-adapter 0.2.4 → 0.2.6
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 +11 -14
- package/README.zh-CN.md +11 -14
- package/THIRD_PARTY_NOTICES.md +7 -3
- package/dist/src/client/context-window-preset.d.ts +11 -0
- package/dist/src/client/native-context-settings.d.ts +3 -0
- package/dist/src/host.d.ts +13 -1
- package/dist/src/settings-overlay.d.ts +2 -0
- package/lib/client.js +5137 -219
- package/lib/index.js +125 -79
- package/package.json +1 -1
- package/scripts/build.mjs +36 -0
- package/scripts/native-context-settings.mjs +139 -0
- package/dist/src/client/context-window.d.ts +0 -9
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Install one plugin to reuse local Codex instructions, skills, enabled plugin res
|
|
|
12
12
|
|
|
13
13
|
- Discover upstream models with `GET /models` and retain stale entries until explicit cleanup.
|
|
14
14
|
- Provide the GPT reasoning preset `low / medium / high / xhigh / max / ultra` through the native Models page and conversation menu.
|
|
15
|
-
-
|
|
15
|
+
- Reuse the native per-model context field with Default / 516K / 1M / Custom choices; show a value input only for Custom.
|
|
16
16
|
- Offer independent Standard and Fast speed choices. Fast sends `service_tier: "priority"`; Ultrafast requires an explicit upstream declaration or override.
|
|
17
17
|
- Preserve optional function arguments on GPT Responses requests by setting missing `strict` values to `false`.
|
|
18
18
|
- Read Codex instruction files and refresh them at the next model step without repeating unchanged baselines.
|
|
@@ -23,14 +23,14 @@ Reasoning and speed presets are requests to the configured gateway, not guarante
|
|
|
23
23
|
|
|
24
24
|
## Compatibility and installation
|
|
25
25
|
|
|
26
|
-
The native integration targets DSH `0.2.2-rc.1`, Cordis `4.1.0`, and the pinned adapter source hash. The development dependency uses Pi AI `1.3.0`. Installed third-party package files are never edited. The package version is `dsh-gpt-adapter@0.2.
|
|
26
|
+
The native integration targets DSH `0.2.2-rc.1`, Cordis `4.1.0`, and the pinned adapter source hash. The development dependency uses Pi AI `1.3.0`. Installed third-party package files are never edited. The package version is `dsh-gpt-adapter@0.2.6`.
|
|
27
27
|
|
|
28
28
|
Requires Node.js `>=24.9.0` and DSH. Source builds also require pnpm.
|
|
29
29
|
|
|
30
30
|
Install the published package in the web profile:
|
|
31
31
|
|
|
32
32
|
```sh
|
|
33
|
-
dsh plugin --profile web add dsh-gpt-adapter@0.2.
|
|
33
|
+
dsh plugin --profile web add dsh-gpt-adapter@0.2.6
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
Restart the DSH host after installing or upgrading. Configure GPT connections under **Settings → Models**; Codex environment reuse is enabled by default. The plugin extends the existing native settings and conversation controls.
|
|
@@ -43,7 +43,7 @@ cd dsh-gpt-adapter
|
|
|
43
43
|
pnpm install --frozen-lockfile
|
|
44
44
|
mkdir -p artifacts
|
|
45
45
|
pnpm pack --pack-destination artifacts
|
|
46
|
-
dsh plugin --profile web add ./artifacts/dsh-gpt-adapter-0.2.
|
|
46
|
+
dsh plugin --profile web add ./artifacts/dsh-gpt-adapter-0.2.6.tgz
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
`pnpm pack` runs the production build.
|
|
@@ -128,22 +128,19 @@ Capability precedence is user override, explicit upstream metadata, external cat
|
|
|
128
128
|
|
|
129
129
|
### Context windows
|
|
130
130
|
|
|
131
|
-
Under **Settings → Models**,
|
|
131
|
+
Under **Settings → Models → Custom settings → Model catalog**, use the original **Context window** field. For GPT models, it offers **Default / 516K / 1M / Custom**. Default restores automatic resolution; 516K and 1M save `516000` and `1000000` tokens. Only Custom shows an input, accepting a token count or decimal K/M suffix. Use the native Save or Cancel action; no separate context editor is added.
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
| --- | --- |
|
|
135
|
-
| Default | Resolve automatically for this model and provider. |
|
|
136
|
-
| 516K | `516000` |
|
|
137
|
-
| 1M | `1000000` |
|
|
138
|
-
| Custom | A positive safe integer entered by the user. |
|
|
133
|
+
Inherited model rows and provider defaults participate in edit detection and final budget validation. A failed legacy cleanup restores the previous native capacity while preserving unrelated edits.
|
|
139
134
|
|
|
140
|
-
|
|
135
|
+
Default leaves the native context value unset for automatic resolution. Automatic capacities stay in the effective model information; the editable draft contains manual values only, including existing legacy overrides. An explicit preset or custom value equal to the current automatic capacity is still saved as a manual value. Empty or invalid custom input prevents saving.
|
|
141
136
|
|
|
142
|
-
|
|
137
|
+
Capacity suffixes use decimal units. Automatic resolution uses a distinguishable explicit provider default, upstream model metadata, the configured capability catalog, the shipped exact-model preset, then the native catalog/DSH fallback. Shipped presets are dated data, not a live fetch from OpenAI: `gpt-6-astra`, `gpt-6.1-sol`, `gpt-6.1-terra`, `gpt-6-luna`, and `gpt-5.4` use `1050000`; `gpt-4.1` uses `1047576`; `gpt-4o` uses `128000`. Only documented snapshot aliases share these presets. References and verification dates are in [the preset table](src/context-window.ts).
|
|
138
|
+
|
|
139
|
+
Existing native per-model values, including catalog `modelOverrides`, and legacy JSON context overrides remain effective until deliberately edited. Editing the native context field clears only that model's legacy context override; selecting Default removes its manual context values while retaining provider defaults and other settings. Saving unrelated settings or discovering models does not turn automatic values into manual overrides. Identical model IDs on different providers are independent.
|
|
143
140
|
|
|
144
141
|
Providers using native catalog `modelOverrides` keep their catalog configuration during synchronization. Discovery and stale cleanup update the plugin snapshot without creating an incompatible explicit `models` list or deleting native overrides.
|
|
145
142
|
|
|
146
|
-
Native forms reject stale drafts when their automatic capacities change; refresh the form before retrying.
|
|
143
|
+
Native forms reject stale drafts when their automatic capacities change; refresh the form before retrying. Context, output-limit, and relevant provider-default edits are checked against the saved draft's output budget and native compaction headroom. An omitted output limit uses the native model catalog or provider/schema default. Invalid saves leave the previous values in place.
|
|
147
144
|
|
|
148
145
|
Changes apply to the next prepared call; calls already prepared retain their captured capacity. Model information, the inference model, overflow detection, and native compaction use the same effective window. Maximum output tokens and DSH's compaction policy remain independent. A larger local window does not increase the gateway's accepted limit.
|
|
149
146
|
|
package/README.zh-CN.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
- 通过 `GET /models` 发现上游模型;失效模型保留到用户主动清理。
|
|
14
14
|
- 在原生模型设置页和对话菜单中提供 `low / medium / high / xhigh / max / ultra` 六档思考预设。
|
|
15
|
-
-
|
|
15
|
+
- 在原生逐模型上下文字段中选择「默认 / 516K / 1M / 自定义」,仅在选择「自定义」时显示输入框。
|
|
16
16
|
- 提供独立的 Standard 和 Fast 速度选择。Fast 发送 `service_tier: "priority"`;Ultrafast 由上游明确声明或用户覆盖提供。
|
|
17
17
|
- 为 GPT Responses 函数工具补齐缺失的 `strict: false`,保留可选参数。
|
|
18
18
|
- 读取 Codex 指令,在下一模型步骤更新;内容不变时不重复注入。
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
|
|
24
24
|
## 兼容性与安装
|
|
25
25
|
|
|
26
|
-
原生集成面向 DSH `0.2.2-rc.1`、Cordis `4.1.0`,并校验适配器源码指纹。开发依赖固定 Pi AI `1.3.0`。插件不会修改已安装的第三方包文件。插件版本为 `dsh-gpt-adapter@0.2.
|
|
26
|
+
原生集成面向 DSH `0.2.2-rc.1`、Cordis `4.1.0`,并校验适配器源码指纹。开发依赖固定 Pi AI `1.3.0`。插件不会修改已安装的第三方包文件。插件版本为 `dsh-gpt-adapter@0.2.6`。
|
|
27
27
|
|
|
28
28
|
需要 Node.js `>=24.9.0` 和 DSH。源码构建另外需要 pnpm。
|
|
29
29
|
|
|
30
30
|
在 `web` 配置档(profile)中安装已发布的 npm 包:
|
|
31
31
|
|
|
32
32
|
```sh
|
|
33
|
-
dsh plugin --profile web add dsh-gpt-adapter@0.2.
|
|
33
|
+
dsh plugin --profile web add dsh-gpt-adapter@0.2.6
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
安装或升级后重启 DSH 宿主。在「设置 → 模型」中配置 GPT 连接;Codex 环境复用默认开启。插件扩展现有原生设置与对话控件。
|
|
@@ -43,7 +43,7 @@ cd dsh-gpt-adapter
|
|
|
43
43
|
pnpm install --frozen-lockfile
|
|
44
44
|
mkdir -p artifacts
|
|
45
45
|
pnpm pack --pack-destination artifacts
|
|
46
|
-
dsh plugin --profile web add ./artifacts/dsh-gpt-adapter-0.2.
|
|
46
|
+
dsh plugin --profile web add ./artifacts/dsh-gpt-adapter-0.2.6.tgz
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
`pnpm pack` 会自动执行生产构建。
|
|
@@ -128,22 +128,19 @@ codexCompatibility:
|
|
|
128
128
|
|
|
129
129
|
### 上下文窗口
|
|
130
130
|
|
|
131
|
-
在「设置 →
|
|
131
|
+
在「设置 → 模型 → 自定义设置 → 模型目录」中,复用原来的「上下文窗口」位置。GPT 模型在这里选择「默认 / 516K / 1M / 自定义」:「默认」恢复自动解析;516K 和 1M 分别保存 `516000` 和 `1000000` 词元。只有选择「自定义」时才显示输入框,可输入完整词元数或十进制 K/M 后缀。继续使用原生的保存、取消操作,不增加独立编辑入口。
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
| --- | --- |
|
|
135
|
-
| 默认 | 根据当前模型与提供商自动解析。 |
|
|
136
|
-
| 516K | `516000` |
|
|
137
|
-
| 1M | `1000000` |
|
|
138
|
-
| 自定义 | 用户输入的正安全整数。 |
|
|
133
|
+
编辑前后状态比较和最终预算校验会纳入继承模型及提供商默认值。旧覆盖清理失败时,恢复原生容量并保留无关修改。
|
|
139
134
|
|
|
140
|
-
|
|
135
|
+
选择「默认」时不保存模型的手动上下文值,由系统自动解析。自动容量保留在模型有效信息中,编辑草稿只包含手动值(包括已有旧版覆盖);明确选择与当前自动容量相同的预设或自定义数值,也会保存为手动值。自定义输入为空或无效时不能保存。
|
|
141
136
|
|
|
142
|
-
|
|
137
|
+
容量后缀使用十进制单位。自动解析依次采用可辨识的显式提供商默认值、上游模型元数据、已配置的能力目录、插件内置的精确模型预设、原生目录或 DSH 后备值。内置预设是带核验日期的数据,不会实时抓取 OpenAI 页面:`gpt-6-astra`、`gpt-6.1-sol`、`gpt-6.1-terra`、`gpt-6-luna`、`gpt-5.4` 为 `1050000`,`gpt-4.1` 为 `1047576`,`gpt-4o` 为 `128000`;仅为有文档依据的快照别名复用预设。参考页面和核验日期见[预设表](src/context-window.ts)。
|
|
138
|
+
|
|
139
|
+
已有原生模型数值(包括目录模型的 `modelOverrides`)和旧版 JSON 上下文覆盖继续生效,直到用户主动编辑。编辑原生上下文字段时,仅清除该模型的旧版上下文覆盖;选择「默认」会删除该模型的手动上下文数值,保留提供商默认值和其他设置。保存无关设置或发现模型不会把自动值固化为手动覆盖。同名模型在不同提供商下独立设置。
|
|
143
140
|
|
|
144
141
|
使用原生目录 `modelOverrides` 的提供商在同步时保留目录配置。模型发现和失效清理只更新插件快照,不会生成不兼容的显式 `models` 列表,也不会删除原生覆盖。
|
|
145
142
|
|
|
146
|
-
|
|
143
|
+
原生表单的自动容量变化后,过期草稿会被拒绝,刷新表单再保存即可。修改上下文、最大输出或相关提供商默认值时,会校验同次保存的输出预算和原生压缩预留;未填写输出上限时采用原生模型目录或提供商、参数结构的默认值;无效数值不会覆盖已保存设置。
|
|
147
144
|
|
|
148
145
|
修改对下一次准备的调用生效,已准备的调用继续使用原有容量。模型信息、推理模型、溢出判断和原生上下文压缩采用同一有效窗口;最大输出词元设置与 DSH 原生压缩策略保持独立。扩大本地窗口不会提高网关实际接受的上限。
|
|
149
146
|
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -6,9 +6,13 @@ from the pinned `@deepseek-ai/dsh-llm-pi-ai`,
|
|
|
6
6
|
`@deepseek-ai/dsh-client-ui-settings-models`, and `@deepseek-ai/dsh-mcp-client` version `0.2.2-rc.1` packages.
|
|
7
7
|
Original project: https://github.com/deepseek-ai/deepseek-harness
|
|
8
8
|
|
|
9
|
-
The build records native source hashes
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
The build records native source hashes, reads native Models CSS class names,
|
|
10
|
+
and adapts the pinned native Models renderer to add a preset selector at the
|
|
11
|
+
original GPT context-window field. The runtime retains the original settings
|
|
12
|
+
entry, controller, child slots, and save/cancel operations, and restores its
|
|
13
|
+
renderer when unloaded. Other controls extend existing UI slots. MCP tool
|
|
14
|
+
filtering uses the pinned client's public tool-name encoding. Installed
|
|
15
|
+
third-party package files are never modified.
|
|
12
16
|
|
|
13
17
|
## DeepSeek Harness — MIT License
|
|
14
18
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const ContextWindowPresetScope: React.Context<boolean>;
|
|
3
|
+
type Props = {
|
|
4
|
+
inputProps: React.InputHTMLAttributes<HTMLInputElement>;
|
|
5
|
+
tokens: number | undefined;
|
|
6
|
+
onValueChange(value: string): void;
|
|
7
|
+
onCustomValueChange(value: string): void;
|
|
8
|
+
};
|
|
9
|
+
/** Reuse the native field callbacks and draft; only the field's UI changes. */
|
|
10
|
+
export declare function ContextWindowPreset({ inputProps, tokens, onValueChange, onCustomValueChange, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client';
|
|
2
|
+
/** Keep the native entry, controller, stores, child slots, and save operations. */
|
|
3
|
+
export declare function installNativeContextPresets(slots: Pick<SlotRegistry, 'entries' | 'subscribe' | 'provideRoot'>): () => void;
|
package/dist/src/host.d.ts
CHANGED
|
@@ -98,8 +98,20 @@ export declare class GptModels extends Service {
|
|
|
98
98
|
updateOptions(provider: string, refreshIntervalMs: number, capabilityCatalogUrl: string, overridesJSON: string): Promise<void>;
|
|
99
99
|
refresh(provider: string): Promise<void>;
|
|
100
100
|
removeStale(provider: string): Promise<void>;
|
|
101
|
+
/** Internal model-list writes must use the same manual fields as native drafts. */
|
|
102
|
+
private editableModel;
|
|
103
|
+
editableContextWindow(provider: string, model: Record<string, any>): any;
|
|
101
104
|
/** Resolve raw metadata separately from merged capabilities and cached overrides. */
|
|
102
|
-
contextWindow(provider: string, modelId: string, nativeDefault?: number
|
|
105
|
+
contextWindow(provider: string, modelId: string, nativeDefault?: number, profileOverride?: {
|
|
106
|
+
defaultContextWindow?: number;
|
|
107
|
+
models?: Array<{
|
|
108
|
+
id: string;
|
|
109
|
+
[key: string]: unknown;
|
|
110
|
+
}>;
|
|
111
|
+
modelOverrides?: Record<string, Record<string, unknown>>;
|
|
112
|
+
}): ContextWindowResolution;
|
|
113
|
+
/** Both native form saves and the compatibility RPC validate the same budget. */
|
|
114
|
+
validateContextWindow(provider: string, model: Record<string, any>, profile: Record<string, any>): void;
|
|
103
115
|
contextWriteRevision(): number | undefined;
|
|
104
116
|
/** Public form revisions also cover changes to projected model capacities. */
|
|
105
117
|
private modelsRevision;
|
|
@@ -11,6 +11,8 @@ export type ContextWindowEdit = {
|
|
|
11
11
|
previousTokens: number | undefined;
|
|
12
12
|
};
|
|
13
13
|
type ContextWrites = {
|
|
14
|
+
editableContext?(provider: string, model: JsonObject): number | undefined;
|
|
15
|
+
validate?(provider: string, model: JsonObject, profile: JsonObject): void;
|
|
14
16
|
revision(): number | undefined;
|
|
15
17
|
saved(edits: ContextWindowEdit[], revision: number | undefined): Promise<void>;
|
|
16
18
|
};
|