@sparkelf/dsh-patch-responses-reasoning-status 0.1.0-rc.10

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ # Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
2
+ # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
+ # after editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write patches/npm/responses-reasoning-status/README.md
5
+ README.md: 62853688c4437f309232ceec35e6aea88e0521db
6
+ README.zh.md: e96fec15936e56573dde03480be7307a7dfd4077
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # @sparkelf/dsh-patch-responses-reasoning-status
2
+
3
+ English | [中文](README.zh.md)
4
+
5
+ This data-only package adds one explicit `llm-pi-ai` route option for OpenAI Responses gateways that accept replayed reasoning input items but reject their response-only `status` field. `responsesCompatibility.omitReasoningInputStatus: true` is accepted only with `api: openai-responses`; after pi-ai serializes the complete request, the adapter removes `status` only from top-level `type: reasoning` input items. Assistant messages, tool items, and every other field remain unchanged.
6
+
7
+ The official Models editor shows a localized **Gateway compatibility mode** checkbox only for pi-ai routes whose effective protocol is `openai-responses`. User-layer disablement deletes the leaf unless an inherited true requires an explicit false, and changing protocol removes or masks the incompatible setting without replacing sibling fields.
8
+
9
+ The target is exact official source revision `cd5ef8148158c3a752a658978873241fdf8e2bbc`. This package has no JavaScript entry, lifecycle script, Cordis plugin, fallback, or alternate variant. Retire it when official DSH ships equivalent pi-ai Responses input adjustment and Models editor behavior.
package/README.zh.md ADDED
@@ -0,0 +1,9 @@
1
+ # @sparkelf/dsh-patch-responses-reasoning-status
2
+
3
+ [English](README.md) | 中文
4
+
5
+ 该data-only package为接受历史reasoning input items、但拒绝其中response-only `status`字段的OpenAI Responses网关增加一个显式`llm-pi-ai` route option。仅当`api: openai-responses`时才接受`responsesCompatibility.omitReasoningInputStatus: true`;pi-ai完成整个request序列化后,adapter只从顶层`type: reasoning` input items删除`status`。assistant messages、tool items与其他所有fields均保持不变。
6
+
7
+ official Models editor只在effective protocol为`openai-responses`的pi-ai routes中显示localized **中转站兼容模式** checkbox。user-layer关闭操作在没有inherited true时删除该leaf;存在inherited true时写入显式false。切换protocol会删除或遮蔽不兼容设置,而不会替换sibling fields。
8
+
9
+ target是exact official source revision `cd5ef8148158c3a752a658978873241fdf8e2bbc`。本package没有JavaScript entry、lifecycle script、Cordis plugin、fallback或alternate variant。official DSH提供等价pi-ai Responses input adjustment与Models editor behavior后,retire本package。
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "description": "Data-only exact official-source patch for OpenAI Responses gateways that reject replayed reasoning status metadata",
3
+ "dshPatch": {
4
+ "formatVersion": 1,
5
+ "variants": [
6
+ {
7
+ "dsh": ">=0.1.2-alpha.1",
8
+ "file": "./patches/responses-reasoning-status.patch",
9
+ "id": "responses-omit-reasoning-input-status",
10
+ "target": {
11
+ "baseRevision": "cd5ef8148158c3a752a658978873241fdf8e2bbc",
12
+ "kind": "dsh-source",
13
+ "paths": [
14
+ "packages/llm/llm-pi-ai/",
15
+ "packages/client/ui-settings-models/"
16
+ ]
17
+ }
18
+ }
19
+ ]
20
+ },
21
+ "files": [
22
+ "patches/*.patch"
23
+ ],
24
+ "license": "MIT",
25
+ "name": "@sparkelf/dsh-patch-responses-reasoning-status",
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "repository": {
30
+ "directory": "patches/npm/responses-reasoning-status",
31
+ "type": "git",
32
+ "url": "git+https://github.com/SparkElf/deepseek-harness-plus.git"
33
+ },
34
+ "type": "module",
35
+ "version": "0.1.0-rc.10"
36
+ }
@@ -0,0 +1,331 @@
1
+ diff --git a/packages/client/ui-settings-models/README.i18n.yaml b/packages/client/ui-settings-models/README.i18n.yaml
2
+ index 8b69e152a0..2f8226726f 100644
3
+ --- a/packages/client/ui-settings-models/README.i18n.yaml
4
+ +++ b/packages/client/ui-settings-models/README.i18n.yaml
5
+ @@ -2,5 +2,5 @@
6
+ # side as of the last confirmed-consistent state. Both languages carry equal authority;
7
+ # after editing either side, bring the other along and re-record with:
8
+ # pnpm run verify-translation-pairing --write packages/client/ui-settings-models/README.md
9
+ -README.md: 75efb18daf3e4a96fea637f36633f216046ebccd
10
+ -README.zh.md: f3c7099e242e379be5143352d4045208a8209dc6
11
+ +README.md: 18be58b5a85cb1fcf10710c57d7aea8211c104d8
12
+ +README.zh.md: 073b581bf425bea07bbc52b5e35207c2a4a34514
13
+ diff --git a/packages/client/ui-settings-models/README.md b/packages/client/ui-settings-models/README.md
14
+ index 75efb18daf..18be58b5a8 100644
15
+ --- a/packages/client/ui-settings-models/README.md
16
+ +++ b/packages/client/ui-settings-models/README.md
17
+ @@ -33,7 +33,7 @@ The primary field on an editor card is a single **API key** input — the page n
18
+
19
+ ### Editing a provider
20
+
21
+ -The collapsed 自定义设置 fold carries the curated extras: `baseURL` for both families (the deepseek placeholder shows the public endpoint), each adapter's model catalog, and the **display name** and **API protocol** of a pi-ai route the adapter does not ship. The Provider ID stays fixed: it is the settings key, the name every other namespace and every logged session references, and the stem of a credential reference the page cannot read back to move. Reasoning effort is deliberately not among the editable fields: it is a per-model capability, so a provider-scoped control could only be set to a value some models reject. Each DeepSeek row edits `id`, optional display `name`, and optional `contextWindow`/`maxTokens`; existing fields outside that curated set survive edits.
22
+ +The collapsed 自定义设置 fold carries the curated extras: `baseURL` for both families (the deepseek placeholder shows the public endpoint), each adapter's model catalog, and the **display name** and **API protocol** of a pi-ai route the adapter does not ship. A pi-ai route whose effective protocol is `openai-responses` also shows **Gateway compatibility mode**, which writes `responsesCompatibility.omitReasoningInputStatus`; disabling it deletes the user leaf unless an inherited true requires an explicit false, and changing protocol removes or masks the incompatible setting while preserving sibling fields. The Provider ID stays fixed: it is the settings key, the name every other namespace and every logged session references, and the stem of a credential reference the page cannot read back to move. Reasoning effort is deliberately not among the editable fields: it is a per-model capability, so a provider-scoped control could only be set to a value some models reject. Each DeepSeek row edits `id`, optional display `name`, and optional `contextWindow`/`maxTokens`; existing fields outside that curated set survive edits.
23
+
24
+ ### Adding and deleting providers
25
+
26
+ diff --git a/packages/client/ui-settings-models/README.zh.md b/packages/client/ui-settings-models/README.zh.md
27
+ index f3c7099e24..073b581bf4 100644
28
+ --- a/packages/client/ui-settings-models/README.zh.md
29
+ +++ b/packages/client/ui-settings-models/README.zh.md
30
+ @@ -33,7 +33,7 @@ kind: "package-reference"
31
+
32
+ ### 编辑提供方
33
+
34
+ -收起的「自定义设置」折叠区承载精选的额外字段:两个家族都有 `baseURL`(deepseek 的占位符显示公共端点)、各适配器自己的模型目录,以及适配器未提供的 pi-ai 路由的**显示名称**与 **API 协议**。Provider ID 保持固定:它是 settings 的键、其他每个 namespace 与每一条已记录会话引用的名字,也是页面读不回、因而搬不走的凭据引用词干。推理等级刻意不在可编辑字段之列:它是按模型的能力,提供方级的控件只可能被设成某些模型会拒绝的值。每个 DeepSeek 行编辑 `id`、可选显示 `name` 与可选 `contextWindow`/`maxTokens`;该精选集之外的现有字段在编辑后仍会保留。
35
+ +收起的「自定义设置」折叠区承载精选的额外字段:两个家族都有 `baseURL`(deepseek 的占位符显示公共端点)、各适配器自己的模型目录,以及适配器未提供的 pi-ai 路由的**显示名称**与 **API 协议**。effective protocol为 `openai-responses` 的pi-ai路由还会显示**中转站兼容模式**,写入 `responsesCompatibility.omitReasoningInputStatus`;关闭时,若没有继承的true则删除user leaf,否则写入显式false,切换协议也会删除或遮蔽不兼容设置,并保留sibling fields。Provider ID 保持固定:它是 settings 的键、其他每个 namespace 与每一条已记录会话引用的名字,也是页面读不回、因而搬不走的凭据引用词干。推理等级刻意不在可编辑字段之列:它是按模型的能力,提供方级的控件只可能被设成某些模型会拒绝的值。每个 DeepSeek 行编辑 `id`、可选显示 `name` 与可选 `contextWindow`/`maxTokens`;该精选集之外的现有字段在编辑后仍会保留。
36
+
37
+ ### 新增与删除提供方
38
+
39
+ diff --git a/packages/client/ui-settings-models/src/client/ModelsSection.module.css b/packages/client/ui-settings-models/src/client/ModelsSection.module.css
40
+ index fe2fe87d3a..a0e3103270 100644
41
+ --- a/packages/client/ui-settings-models/src/client/ModelsSection.module.css
42
+ +++ b/packages/client/ui-settings-models/src/client/ModelsSection.module.css
43
+ @@ -396,6 +396,31 @@
44
+ padding-top: 12px;
45
+ }
46
+
47
+ +.settingToggle {
48
+ + display: flex;
49
+ + align-items: center;
50
+ + gap: 8px;
51
+ + min-height: 32px;
52
+ + width: fit-content;
53
+ + color: var(--dsw-alias-label-primary);
54
+ + font-size: 12px;
55
+ + line-height: 18px;
56
+ + cursor: pointer;
57
+ +}
58
+ +
59
+ +.settingCheckbox {
60
+ + flex: none;
61
+ + width: 16px;
62
+ + height: 16px;
63
+ + margin: 0;
64
+ + accent-color: var(--dsw-alias-state-business-primary);
65
+ + cursor: pointer;
66
+ +}
67
+ +
68
+ +.settingCheckbox:disabled {
69
+ + cursor: not-allowed;
70
+ +}
71
+ +
72
+ /* Model catalog: a table, not a stack of cards. The column captions are
73
+ written once above the rows, so a row is one line of fields plus its
74
+ delete control; each field still carries the indexed `aria-label` that
75
+ diff --git a/packages/client/ui-settings-models/src/client/ProviderEditor.tsx b/packages/client/ui-settings-models/src/client/ProviderEditor.tsx
76
+ index 675c852125..cb16012c56 100644
77
+ --- a/packages/client/ui-settings-models/src/client/ProviderEditor.tsx
78
+ +++ b/packages/client/ui-settings-models/src/client/ProviderEditor.tsx
79
+ @@ -44,6 +44,9 @@ type EditorLayout = 'deepseek' | 'pi-ai' | 'unknown'
80
+ /** The public DeepSeek endpoint shown as the deepseek base-URL placeholder. */
81
+ const DEEPSEEK_PUBLIC_BASE_URL = 'https://api.deepseek.com'
82
+
83
+ +/** Leaf path of the curated OpenAI Responses compatibility setting. */
84
+ +const OMIT_REASONING_INPUT_STATUS_PATH = ['responsesCompatibility', 'omitReasoningInputStatus'] as const
85
+ +
86
+ /** Props of {@link ProviderEditor}. */
87
+ export interface ProviderEditorProps {
88
+ /** Provider route id. */
89
+ @@ -171,6 +174,10 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
90
+ const root = useMemo(() => schema.rehydrate(namespace.schema), [namespace.schema, schema])
91
+ const node = useMemo(() => schema.nodeAtPath(root, settingsPath), [root, schema, settingsPath])
92
+ const fallback = schema.getPath(namespace.value, settingsPath)
93
+ + const inheritedOmitReasoningInputStatus = schema.getPath(
94
+ + namespace.base,
95
+ + [...settingsPath, ...OMIT_REASONING_INPUT_STATUS_PATH],
96
+ + ) === true
97
+ const disabled = props.readOnly || busy
98
+ const layout = layoutOf(namespace.ns)
99
+ const keyRef = refFor(schema, namespace, settingsPath, props.provider)
100
+ @@ -204,6 +211,11 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
101
+ const value = schema.getPath(source, [key])
102
+ return typeof value === 'string' && value.trim().length > 0 ? value : undefined
103
+ }
104
+ + const disableOmitReasoningInputStatus = (current: Record<string, unknown>): Record<string, unknown> => {
105
+ + return inheritedOmitReasoningInputStatus
106
+ + ? schema.setPath(current, OMIT_REASONING_INPUT_STATUS_PATH, false)
107
+ + : schema.deletePath(current, OMIT_REASONING_INPUT_STATUS_PATH)
108
+ + }
109
+ const setField = (key: string, next: string | undefined): void => {
110
+ // A value of nothing but whitespace is cleared, not stored: `stringAt`
111
+ // already reports it as absent, so the field would otherwise render empty
112
+ @@ -232,6 +244,9 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
113
+ // What the form currently shows, which is what an interrogation must ask:
114
+ // an edited-but-unsaved endpoint, and a key typed but not yet stored.
115
+ const probeApi = stringAt(draft, 'api') ?? stringAt(fallback, 'api')
116
+ + const omitReasoningInputStatus = schema.hasPath(draft, OMIT_REASONING_INPUT_STATUS_PATH)
117
+ + ? schema.getPath(draft, OMIT_REASONING_INPUT_STATUS_PATH) === true
118
+ + : schema.getPath(fallback, OMIT_REASONING_INPUT_STATUS_PATH) === true
119
+ const probeBaseURL = stringAt(draft, 'baseURL') ?? stringAt(fallback, 'baseURL')
120
+ const probe = {
121
+ settingsNs: namespace.ns,
122
+ @@ -447,7 +462,15 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
123
+ value={probeApi ?? ''}
124
+ aria-label={t('customApi')}
125
+ disabled={disabled}
126
+ - onChange={(event) => { setField('api', event.target.value) }}
127
+ + onChange={(event) => {
128
+ + const selectedApi = event.target.value
129
+ + setDraft((current) => {
130
+ + const next = schema.setPath(current, ['api'], selectedApi)
131
+ + return selectedApi === 'openai-responses'
132
+ + ? next
133
+ + : disableOmitReasoningInputStatus(next)
134
+ + })
135
+ + }}
136
+ >
137
+ {/* A profile naming no protocol — hand-written into
138
+ settings.yaml with no model to need one — selects
139
+ @@ -461,6 +484,24 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
140
+ </div>
141
+ )
142
+ : null}
143
+ + {family === 'pi-ai' && probeApi === 'openai-responses'
144
+ + ? (
145
+ + <label className={styles['settingToggle']}>
146
+ + <input
147
+ + className={styles['settingCheckbox']}
148
+ + type="checkbox"
149
+ + checked={omitReasoningInputStatus}
150
+ + disabled={disabled}
151
+ + onChange={(event) => {
152
+ + setDraft(current => event.target.checked
153
+ + ? schema.setPath(current, OMIT_REASONING_INPUT_STATUS_PATH, true)
154
+ + : disableOmitReasoningInputStatus(current))
155
+ + }}
156
+ + />
157
+ + <span>{t('omitReasoningInputStatus')}</span>
158
+ + </label>
159
+ + )
160
+ + : null}
161
+ {/* Both families edit the same rows through the same contract; only
162
+ the extras differ — DeepSeek's inherited capacities, pi-ai's
163
+ endpoint interrogation. */}
164
+ diff --git a/packages/client/ui-settings-models/src/client/locales.ts b/packages/client/ui-settings-models/src/client/locales.ts
165
+ index f1b0718ba5..7d664492a5 100644
166
+ --- a/packages/client/ui-settings-models/src/client/locales.ts
167
+ +++ b/packages/client/ui-settings-models/src/client/locales.ts
168
+ @@ -83,6 +83,7 @@ export const en = {
169
+ customDisplayName: 'Display name',
170
+ customApi: 'API protocol',
171
+ customApiUnset: 'Not selected',
172
+ + omitReasoningInputStatus: 'Gateway compatibility mode',
173
+ customNeedsBaseUrl: 'A custom provider needs a base URL.',
174
+ customNeedsModels: 'A custom provider needs at least one model.',
175
+ customBaseUrlPlaceholder: 'https://gateway.example/v1',
176
+ @@ -187,6 +188,7 @@ export const zh: { [Key in keyof typeof en]: string } = {
177
+ customDisplayName: '显示名称',
178
+ customApi: 'API 协议',
179
+ customApiUnset: '未选择',
180
+ + omitReasoningInputStatus: '中转站兼容模式',
181
+ customNeedsBaseUrl: '自定义提供方需要填写 API 地址。',
182
+ customNeedsModels: '自定义提供方至少需要一个模型。',
183
+ customBaseUrlPlaceholder: 'https://gateway.example/v1',
184
+ diff --git a/packages/llm/llm-pi-ai/README.i18n.yaml b/packages/llm/llm-pi-ai/README.i18n.yaml
185
+ index 38b01bcd52..43d8e199ba 100644
186
+ --- a/packages/llm/llm-pi-ai/README.i18n.yaml
187
+ +++ b/packages/llm/llm-pi-ai/README.i18n.yaml
188
+ @@ -2,5 +2,5 @@
189
+ # side as of the last confirmed-consistent state. Both languages carry equal authority;
190
+ # after editing either side, bring the other along and re-record with:
191
+ # pnpm run verify-translation-pairing --write packages/llm/llm-pi-ai/README.md
192
+ -README.md: dcafde78e176bd0acd142145d651d6d5b5539626
193
+ -README.zh.md: a7292638b8449d7192d3e003f0377967d11ef94d
194
+ +README.md: 5db7b2fecd77bcdc27f55851fcbaa32401326adf
195
+ +README.zh.md: 319059c93916e87f127bf56ba5d1b9c6f81c006c
196
+ diff --git a/packages/llm/llm-pi-ai/README.md b/packages/llm/llm-pi-ai/README.md
197
+ index dcafde78e1..5db7b2fecd 100644
198
+ --- a/packages/llm/llm-pi-ai/README.md
199
+ +++ b/packages/llm/llm-pi-ai/README.md
200
+ @@ -79,6 +79,7 @@ Each profile may set a `retryPolicy`; omission uses normal mode with five retrie
201
+ | `models` | installed catalog | Replaces the route's catalog wholesale; each entry defaults from the installed model |
202
+ | `modelOverrides` | none | Reshapes individual installed-catalog models without replacing the rest |
203
+ | `compat` | catalog detection | Wire-compatibility switches for unrecognized endpoints |
204
+ +| `responsesCompatibility` | absent | OpenAI Responses input-item adjustments for compatible gateways |
205
+ | `defaultContextWindow` | `262,144` | Capacity fallback for undescribed models |
206
+ | `defaultMaxTokens` | `32,768` | Output-cap fallback for undescribed models |
207
+ | `requestImagePixelBudget` | `4,194,304` | Total-pixel budget for each deterministic request image |
208
+ @@ -98,7 +99,7 @@ A profile's `models` list replaces the route's installed catalog rather than ext
209
+
210
+ ### Run with reasoning and wire compatibility
211
+
212
+ -`reasoningEfforts` declares a model's selectable thinking levels: each key is a level selectors offer, its value the spelling dispatch sends on the wire, so `max: ultra` renames a level for a gateway with its own vocabulary. Omitting the field keeps the installed catalog entry's capability; `false` declares a non-reasoning model. `compat` switches reshape the request for endpoints pi-ai cannot recognize — which role carries the system prompt, which field caps output, how a thinking level travels — configurable per route and per model. A model neither the entry nor the installed catalog sizes takes the route's `defaultContextWindow` and `defaultMaxTokens` fallbacks.
213
+ +`reasoningEfforts` declares a model's selectable thinking levels: each key is a level selectors offer, its value the spelling dispatch sends on the wire, so `max: ultra` renames a level for a gateway with its own vocabulary. Omitting the field keeps the installed catalog entry's capability; `false` declares a non-reasoning model. `compat` switches reshape the request for endpoints pi-ai cannot recognize — which role carries the system prompt, which field caps output, how a thinking level travels — configurable per route and per model. An explicit `openai-responses` route may set `responsesCompatibility.omitReasoningInputStatus: true` when its gateway accepts replayed reasoning items but rejects their response-only `status` field; the adapter removes only that field from top-level reasoning input items after pi-ai serializes the request, and every other protocol refuses the option. A model neither the entry nor the installed catalog sizes takes the route's `defaultContextWindow` and `defaultMaxTokens` fallbacks.
214
+
215
+ ### Change configuration at runtime
216
+
217
+ diff --git a/packages/llm/llm-pi-ai/README.zh.md b/packages/llm/llm-pi-ai/README.zh.md
218
+ index a7292638b8..319059c939 100644
219
+ --- a/packages/llm/llm-pi-ai/README.zh.md
220
+ +++ b/packages/llm/llm-pi-ai/README.zh.md
221
+ @@ -79,6 +79,7 @@ kind: "package-reference"
222
+ | `models` | 已安装目录 | 整体替换路由目录;每个条目从已安装模型取默认值 |
223
+ | `modelOverrides` | 无 | 重塑个别已安装目录模型,而不替换其余模型 |
224
+ | `compat` | 目录检测 | 无法识别端点的协议兼容开关 |
225
+ +| `responsesCompatibility` | 无 | 兼容网关的 OpenAI Responses 输入项调整 |
226
+ | `defaultContextWindow` | `262,144` | 未描述模型的容量回退 |
227
+ | `defaultMaxTokens` | `32,768` | 未描述模型的输出上限回退 |
228
+ | `requestImagePixelBudget` | `4,194,304` | 每张确定性请求图片的总像素预算 |
229
+ @@ -98,7 +99,7 @@ profile 的 `models` 列表会替换而非扩展路由的已安装目录;每
230
+
231
+ ### 带推理与协议兼容运行
232
+
233
+ -`reasoningEfforts` 声明模型可选择的 thinking 等级:每个键都是选择器提供的等级,其值是该等级过线的拼写,因此 `max: ultra` 可以为拥有自有词汇的网关重命名等级。省略该字段时保留已安装目录条目的能力;`false` 声明非推理模型。对于 pi-ai 无法识别的端点,`compat` 开关重塑请求——哪个角色携带系统提示词、哪个字段限制输出、thinking 等级如何传递——可逐路由、逐模型配置。条目与已安装目录都没有尺寸的模型,会采用路由的 `defaultContextWindow` 与 `defaultMaxTokens` 回退值。
234
+ +`reasoningEfforts` 声明模型可选择的 thinking 等级:每个键都是选择器提供的等级,其值是该等级过线的拼写,因此 `max: ultra` 可以为拥有自有词汇的网关重命名等级。省略该字段时保留已安装目录条目的能力;`false` 声明非推理模型。对于 pi-ai 无法识别的端点,`compat` 开关重塑请求——哪个角色携带系统提示词、哪个字段限制输出、thinking 等级如何传递——可逐路由、逐模型配置。显式使用 `openai-responses` 的路由可在网关接受历史 reasoning 项、但拒绝其中响应侧专用 `status` 字段时设置 `responsesCompatibility.omitReasoningInputStatus: true`;适配器在 pi-ai 序列化请求后,仅从顶层 reasoning 输入项删除该字段,其他协议会拒绝此选项。条目与已安装目录都没有尺寸的模型,会采用路由的 `defaultContextWindow` 与 `defaultMaxTokens` 回退值。
235
+
236
+ ### 运行时更改配置
237
+
238
+ diff --git a/packages/llm/llm-pi-ai/src/adapter.ts b/packages/llm/llm-pi-ai/src/adapter.ts
239
+ index e20b8e0072..d392ab7c72 100644
240
+ --- a/packages/llm/llm-pi-ai/src/adapter.ts
241
+ +++ b/packages/llm/llm-pi-ai/src/adapter.ts
242
+ @@ -111,6 +111,24 @@ export interface PiAiAuthInjection {
243
+ authContext: AuthContext
244
+ }
245
+
246
+ +/** Whether one Responses input item is replayed reasoning with response status metadata. */
247
+ +function hasReasoningInputStatus(item: unknown): boolean {
248
+ + const inputItem = item as Record<string, unknown>
249
+ + return inputItem.type === 'reasoning' && Object.hasOwn(inputItem, 'status')
250
+ +}
251
+ +
252
+ +/** Remove response-only status metadata from replayed reasoning input items. */
253
+ +function omitReasoningInputStatus(payload: unknown): unknown {
254
+ + const request = payload as Record<string, unknown> & { input: unknown[] }
255
+ + if (!request.input.some(hasReasoningInputStatus)) return undefined
256
+ + const input = request.input.map((item) => {
257
+ + if (!hasReasoningInputStatus(item)) return item
258
+ + const { status: _status, ...withoutStatus } = item as Record<string, unknown>
259
+ + return withoutStatus
260
+ + })
261
+ + return { ...request, input }
262
+ +}
263
+ +
264
+ /** Copy profile stream knobs into pi-ai's common option vocabulary. */
265
+ function profileOptions(
266
+ profile: ResolvedPiAiProviderProfile,
267
+ @@ -126,6 +144,7 @@ function profileOptions(
268
+ ...profile.transport === undefined ? {} : { transport: profile.transport },
269
+ ...profile.timeoutMs === undefined ? {} : { timeoutMs: profile.timeoutMs },
270
+ ...profile.websocketConnectTimeoutMs === undefined ? {} : { websocketConnectTimeoutMs: profile.websocketConnectTimeoutMs },
271
+ + ...profile.responsesCompatibility?.omitReasoningInputStatus === true ? { onPayload: omitReasoningInputStatus } : {},
272
+ // The agent recovery layer owns visible attempts; one adapter call is one SDK attempt.
273
+ maxRetries: 0,
274
+ }
275
+ diff --git a/packages/llm/llm-pi-ai/src/config.ts b/packages/llm/llm-pi-ai/src/config.ts
276
+ index e5a7e608b9..ce8192bf28 100644
277
+ --- a/packages/llm/llm-pi-ai/src/config.ts
278
+ +++ b/packages/llm/llm-pi-ai/src/config.ts
279
+ @@ -84,6 +84,12 @@ export type {
280
+ PiAiThinkingFormat,
281
+ } from './catalog.ts'
282
+
283
+ +/** OpenAI Responses input-item adjustments for compatible gateways. */
284
+ +export interface PiAiResponsesCompatibility {
285
+ + /** Omit response-only status metadata from replayed reasoning input items. */
286
+ + omitReasoningInputStatus?: boolean
287
+ +}
288
+ +
289
+ /** Configuration for one pi-ai provider route; the `providers` dict key IS the route. */
290
+ export interface PiAiProviderProfile {
291
+ /** Credential reference (environment-variable name) resolved per request through `ctx.credentials`. */
292
+ @@ -121,6 +127,8 @@ export interface PiAiProviderProfile {
293
+ * refused rather than left looking applied.
294
+ */
295
+ compat?: PiAiCompatProfile
296
+ + /** OpenAI Responses input-item adjustments for compatible gateways. */
297
+ + responsesCompatibility?: PiAiResponsesCompatibility
298
+ /**
299
+ * Context capacity for a model this route lists that neither the entry nor
300
+ * the installed catalog sizes (default 262,144). A guess by construction, so
301
+ @@ -311,6 +319,10 @@ const modelProfile: z<PiAiModelProfile> = z.object({
302
+ /** A {@link modelProfile} whose id lives in the `modelOverrides` dict key. */
303
+ const modelOverride: z<PiAiModelOverride> = z.object(modelFields)
304
+
305
+ +const responsesCompatibility: z<PiAiResponsesCompatibility> = z.object({
306
+ + omitReasoningInputStatus: z.boolean(),
307
+ +})
308
+ +
309
+ const profile = z.object({
310
+ apiKeyEnv: z.string().role('credential-ref'),
311
+ displayName: z.string(),
312
+ @@ -319,6 +331,7 @@ const profile = z.object({
313
+ models: z.array(modelProfile),
314
+ modelOverrides: z.dict(modelOverride),
315
+ compat: compatProfile,
316
+ + responsesCompatibility,
317
+ defaultContextWindow: z.number().step(1).min(1).default(DEFAULT_CONTEXT_WINDOW),
318
+ defaultMaxTokens: z.number().step(1).min(1).default(DEFAULT_MAX_TOKENS),
319
+ defaultInput: z.array(z.union(MODALITIES)).default([...DEFAULT_INPUT]),
320
+ @@ -400,6 +413,11 @@ export function resolveProfiles(
321
+ if (source.displayName !== undefined && source.displayName.length === 0) {
322
+ throw new Error(`llm-pi-ai: provider "${provider}" has an empty displayName`)
323
+ }
324
+ + if (source.responsesCompatibility?.omitReasoningInputStatus === true && source.api !== 'openai-responses') {
325
+ + throw new Error(
326
+ + `llm-pi-ai: provider "${provider}" responsesCompatibility.omitReasoningInputStatus requires api "openai-responses"`,
327
+ + )
328
+ + }
329
+ const streamIdleTimeoutMs = source.streamIdleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS
330
+ if (!Number.isFinite(streamIdleTimeoutMs)
331
+ || streamIdleTimeoutMs <= 0