dsh-thinking-levels 4.4.3 → 4.4.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/lib/index.d.ts CHANGED
@@ -38,6 +38,7 @@ import type { Volatile } from '@deepseek-ai/cosmokit';
38
38
  import z from '@deepseek-ai/schemastery';
39
39
  import { type EffortId } from './thinking-level.ts';
40
40
  import { type PricingPolicy } from './billing-projection.ts';
41
+ import { type PiAiSection } from './takeover-sync.ts';
41
42
  /** One configurer-confirmed capability override for a `provider/model` key. */
42
43
  export interface ModelCapabilityOverride {
43
44
  /** Manual override of the vision-model classification (auto: inputModalities). */
@@ -242,6 +243,30 @@ export declare function advertiseModelCapability(llm: {
242
243
  thinkingOn: boolean;
243
244
  supportsEffort: boolean;
244
245
  } | undefined): void;
246
+ /**
247
+ * The llm-pi-ai posture of one model, from the live llm-pi-ai section
248
+ * (the capability card writes `reasoningEfforts` and `compat` there). Absent
249
+ * when the route/model is not configured.
250
+ *
251
+ * A model is toggle-only (Off/On, no effort levels) only when ALL THREE hold:
252
+ * the model declares a thinking toggle (reasoningEfforts table, no
253
+ * supportsReasoningEffort), the route is taken over by the transport (it is in
254
+ * the takeover judgment), AND the route speaks the openai-completions wire
255
+ * protocol. The Off/On fold exists because a completions toggle model rejects
256
+ * any `reasoning_effort` string pi-ai does not resolve to its fixed seven
257
+ * levels; that physical reason does NOT apply to a Responses/Anthropic route,
258
+ * whose levels pi-ai maps natively (thinking budget / reasoning-effort enum)
259
+ * and whose `supportsReasoningEffort` compat field the host refuses to write
260
+ * at all (4.4.4). Folding such a route would silently strip the configured
261
+ * level set down to Off/On. A route OUTSIDE the takeover judgment is likewise
262
+ * served by pi-ai with its native reasoning semantics and is NOT folded here.
263
+ * (exported for the protocol-gate regression, issue #9 — same precedent as
264
+ * `advertiseModelCapability`)
265
+ */
266
+ export declare function piAiPosture(piAi: PiAiSection | undefined, provider: string, model: string, takeover: string[] | null): {
267
+ thinkingOn: boolean;
268
+ supportsEffort: boolean;
269
+ } | undefined;
245
270
  /**
246
271
  * Legacy (≤0.1.6) settings registration: on hosts whose settings service
247
272
  * carries the imperative face (`register` present, `describe` absent), install
package/lib/index.js CHANGED
@@ -205,17 +205,25 @@ function takeoverReadout(ctx) {
205
205
  * (the capability card writes `reasoningEfforts` and `compat` there). Absent
206
206
  * when the route/model is not configured.
207
207
  *
208
- * A model is toggle-only (Off/On, no effort levels) only when BOTH the model
209
- * declares a thinking toggle (reasoningEfforts table, no
210
- * supportsReasoningEffort) AND the route is taken over by the
211
- * openai-completions transport (it is in the takeover judgment). A route
212
- * OUTSIDE the takeover judgment is served by pi-ai with its native
213
- * reasoning semantics — off/high stay visible and pi-ai validates the
214
- * effort — so it is NOT folded into a toggle here.
208
+ * A model is toggle-only (Off/On, no effort levels) only when ALL THREE hold:
209
+ * the model declares a thinking toggle (reasoningEfforts table, no
210
+ * supportsReasoningEffort), the route is taken over by the transport (it is in
211
+ * the takeover judgment), AND the route speaks the openai-completions wire
212
+ * protocol. The Off/On fold exists because a completions toggle model rejects
213
+ * any `reasoning_effort` string pi-ai does not resolve to its fixed seven
214
+ * levels; that physical reason does NOT apply to a Responses/Anthropic route,
215
+ * whose levels pi-ai maps natively (thinking budget / reasoning-effort enum)
216
+ * and whose `supportsReasoningEffort` compat field the host refuses to write
217
+ * at all (4.4.4). Folding such a route would silently strip the configured
218
+ * level set down to Off/On. A route OUTSIDE the takeover judgment is likewise
219
+ * served by pi-ai with its native reasoning semantics and is NOT folded here.
220
+ * (exported for the protocol-gate regression, issue #9 — same precedent as
221
+ * `advertiseModelCapability`)
215
222
  */
216
- function piAiPosture(piAi, provider, model, takeover) {
217
- const rows = Array.isArray(piAi?.providers?.[provider]?.models)
218
- ? piAi.providers[provider].models
223
+ export function piAiPosture(piAi, provider, model, takeover) {
224
+ const profile = piAi?.providers?.[provider];
225
+ const rows = Array.isArray(profile?.models)
226
+ ? profile.models
219
227
  : [];
220
228
  const entry = rows.find(candidate => candidate['id'] === model);
221
229
  if (entry === undefined)
@@ -225,11 +233,17 @@ function piAiPosture(piAi, provider, model, takeover) {
225
233
  const thinkingOn = typeof efforts === 'object' && efforts !== null && !Array.isArray(efforts);
226
234
  const supportsEffort = typeof compat === 'object' && compat !== null
227
235
  && compat['supportsReasoningEffort'] === true;
228
- // Toggle folding is a takeover-judgment concern: only the openai-completions
229
- // transport's routes get the Off/On treatment. pi-ai-served routes keep their
230
- // native effort levels (off/high visible).
236
+ // Toggle folding is a takeover-judgment concern AND an openai-completions
237
+ // concern: only a taken-over completions route gets the Off/On treatment.
238
+ // The transport is named `dsh-llm-openai-completions` but since the 4.4.x
239
+ // line fronts three protocols; a Responses/Anthropic route keeps its native
240
+ // effort levels (the table drives pi-ai's thinkingLevelMap). An absent `api`
241
+ // keeps pi-ai's openai-completions default, so it stays foldable — the same
242
+ // predicate as the card's `completionsCompatConfigurable`.
243
+ const api = profile?.api;
244
+ const isCompletions = typeof api !== 'string' || api === 'openai-completions';
231
245
  const toggled = takeover !== null && takeover.includes(provider);
232
- return { thinkingOn: thinkingOn && toggled, supportsEffort };
246
+ return { thinkingOn: thinkingOn && toggled && isCompletions, supportsEffort };
233
247
  }
234
248
  const CAPABILITY_CACHE_KEY_SEPARATOR = '\u0000';
235
249
  /** A model that cannot be resolved is treated as non-reasoning: never inject. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-thinking-levels",
3
- "version": "4.4.3",
3
+ "version": "4.4.5",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public",
@@ -20,13 +20,28 @@
20
20
  "README.zh.md",
21
21
  "README.ja.md",
22
22
  "README.ko.md",
23
+ "README.fr.md",
24
+ "README.de.md",
25
+ "README.it.md",
26
+ "README.ru.md",
27
+ "README.es.md",
23
28
  "INSTALL.md",
24
29
  "INSTALL.zh.md",
25
30
  "INSTALL.ja.md",
26
31
  "INSTALL.ko.md",
32
+ "INSTALL.fr.md",
33
+ "INSTALL.de.md",
34
+ "INSTALL.it.md",
35
+ "INSTALL.ru.md",
36
+ "INSTALL.es.md",
27
37
  "CHANGELOG.md",
28
38
  "CHANGELOG.ja.md",
29
- "CHANGELOG.ko.md"
39
+ "CHANGELOG.ko.md",
40
+ "CHANGELOG.fr.md",
41
+ "CHANGELOG.de.md",
42
+ "CHANGELOG.it.md",
43
+ "CHANGELOG.ru.md",
44
+ "CHANGELOG.es.md"
30
45
  ],
31
46
  "main": "lib/index.js",
32
47
  "types": "lib/index.d.ts",
@@ -46,17 +61,17 @@
46
61
  },
47
62
  "engines": {
48
63
  "node": ">=22.19.0 || >=24.0.0",
49
- "dsh": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2"
64
+ "dsh": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3"
50
65
  },
51
66
  "peerDependencies": {
52
67
  "@deepseek-ai/cordis": "^4.0.1",
53
- "@deepseek-ai/dsh-api-remotes": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
54
- "@deepseek-ai/dsh-api-session-controller": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
55
- "@deepseek-ai/dsh-client-locale": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
56
- "@deepseek-ai/dsh-client-ui-model-selection": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
57
- "@deepseek-ai/dsh-client-ui-renderer": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
58
- "@deepseek-ai/dsh-client-ui-settings": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
59
- "@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2"
68
+ "@deepseek-ai/dsh-api-remotes": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
69
+ "@deepseek-ai/dsh-api-session-controller": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
70
+ "@deepseek-ai/dsh-client-locale": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
71
+ "@deepseek-ai/dsh-client-ui-model-selection": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
72
+ "@deepseek-ai/dsh-client-ui-renderer": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
73
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
74
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3"
60
75
  },
61
76
  "peerDependenciesMeta": {
62
77
  "@deepseek-ai/dsh-api-remotes": {