dsh-thinking-levels 3.4.3 → 3.4.5-beta.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.
@@ -150,3 +150,30 @@ export declare function clampToEfforts(level: EffortId, efforts: readonly string
150
150
  export declare function resolveEffortInjection(input: EffortInjectionInput): EffortInjectionDecision;
151
151
  /** Wall-clock delta of one tool call, for the timing telemetry. */
152
152
  export declare function toolDurationMs(startedAt: number, finishedAt: number): number;
153
+ /**
154
+ * Display rank of the effort slider stops: `auto` is the scheduler sentinel and
155
+ * sits LEFTMOST regardless of whether the model allows disabling thinking;
156
+ * `off` / `on` follow, then the strength gradient. Ids outside the standard set
157
+ * (custom gateway wire values such as `ultra`) rank last, in arrival order.
158
+ */
159
+ export declare const EFFORT_SLIDER_RANK: Readonly<Record<string, number>>;
160
+ /**
161
+ * Order a model's advertised efforts for the slider track (left → right).
162
+ * Stable sort: unknown ids keep their relative arrival order after the known
163
+ * ranks, so a gateway's custom wire values are never dropped or reordered
164
+ * against each other.
165
+ */
166
+ export declare function orderEffortsForSlider<T extends {
167
+ id: string;
168
+ }>(efforts: readonly T[]): T[];
169
+ /**
170
+ * Map the line's effective effort to a stop index of the ordered track: exact
171
+ * id match wins; an unmatched id (e.g. a defaultEffort the track does not
172
+ * advertise) parks on the nearest stop by display rank, ties resolving to the
173
+ * stronger level (higher index); an absent value parks on stop 0 (the neutral
174
+ * left end — `auto` when advertised) and an empty track always yields 0, so the
175
+ * caller never faces an out-of-range thumb.
176
+ */
177
+ export declare function nearestEffortStopIndex(stops: readonly {
178
+ id: string;
179
+ }[], value: string | undefined): number;
@@ -201,3 +201,58 @@ export function resolveEffortInjection(input) {
201
201
  export function toolDurationMs(startedAt, finishedAt) {
202
202
  return Math.max(0, finishedAt - startedAt);
203
203
  }
204
+ /* ── effort slider ordering & placement (client face, kept pure for tests) ── */
205
+ /**
206
+ * Display rank of the effort slider stops: `auto` is the scheduler sentinel and
207
+ * sits LEFTMOST regardless of whether the model allows disabling thinking;
208
+ * `off` / `on` follow, then the strength gradient. Ids outside the standard set
209
+ * (custom gateway wire values such as `ultra`) rank last, in arrival order.
210
+ */
211
+ export const EFFORT_SLIDER_RANK = {
212
+ auto: 0, off: 1, on: 2, minimal: 3, low: 4, medium: 5, high: 6, xhigh: 7, max: 8,
213
+ };
214
+ /** Fallback rank for ids outside the standard table. */
215
+ const EFFORT_SLIDER_RANK_TAIL = 100;
216
+ /**
217
+ * Order a model's advertised efforts for the slider track (left → right).
218
+ * Stable sort: unknown ids keep their relative arrival order after the known
219
+ * ranks, so a gateway's custom wire values are never dropped or reordered
220
+ * against each other.
221
+ */
222
+ export function orderEffortsForSlider(efforts) {
223
+ return [...efforts].sort((a, b) => {
224
+ const rankA = EFFORT_SLIDER_RANK[a.id] ?? EFFORT_SLIDER_RANK_TAIL;
225
+ const rankB = EFFORT_SLIDER_RANK[b.id] ?? EFFORT_SLIDER_RANK_TAIL;
226
+ return rankA - rankB;
227
+ });
228
+ }
229
+ /**
230
+ * Map the line's effective effort to a stop index of the ordered track: exact
231
+ * id match wins; an unmatched id (e.g. a defaultEffort the track does not
232
+ * advertise) parks on the nearest stop by display rank, ties resolving to the
233
+ * stronger level (higher index); an absent value parks on stop 0 (the neutral
234
+ * left end — `auto` when advertised) and an empty track always yields 0, so the
235
+ * caller never faces an out-of-range thumb.
236
+ */
237
+ export function nearestEffortStopIndex(stops, value) {
238
+ if (stops.length === 0)
239
+ return 0;
240
+ if (value === undefined)
241
+ return 0;
242
+ const exact = stops.findIndex(stop => stop.id === value);
243
+ if (exact >= 0)
244
+ return exact;
245
+ const rank = EFFORT_SLIDER_RANK[value] ?? EFFORT_SLIDER_RANK_TAIL;
246
+ let best = 0;
247
+ let bestDistance = Number.POSITIVE_INFINITY;
248
+ stops.forEach((stop, index) => {
249
+ const stopRank = EFFORT_SLIDER_RANK[stop.id] ?? EFFORT_SLIDER_RANK_TAIL;
250
+ const distance = Math.abs(stopRank - rank);
251
+ // `<=` resolves ties toward the stronger (right-most) level.
252
+ if (distance <= bestDistance) {
253
+ bestDistance = distance;
254
+ best = index;
255
+ }
256
+ });
257
+ return best;
258
+ }
package/locale/de.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Denkstufen",
4
+ "description": "DSH-Host-Plugin: Denkstufen-Steuerung (reasoning_effort) — automatische Anpassung pro Tool-Runde, mit optionaler manueller Sperre und Tool-Timing-Telemetrie."
5
+ }
6
+ }
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Thinking Levels",
4
+ "description": "DSH host plugin: thinking-level (reasoning_effort) control — auto-adjusts per tool round, with optional manual lock and per-tool timing telemetry."
5
+ }
6
+ }
package/locale/es.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Niveles de razonamiento",
4
+ "description": "Plugin de host DSH: control de nivel de razonamiento (reasoning_effort) — ajuste automático por ronda de herramientas, con bloqueo manual opcional y telemetría de temporización por herramienta."
5
+ }
6
+ }
package/locale/fr.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Niveaux de réflexion",
4
+ "description": "Plugin hôte DSH : contrôle du niveau de réflexion (reasoning_effort) — ajustement automatique par tour d'outil, avec verrouillage manuel optionnel et télémétrie de temporisation par outil."
5
+ }
6
+ }
package/locale/it.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Livelli di ragionamento",
4
+ "description": "Plugin host DSH: controllo del livello di ragionamento (reasoning_effort) — regolazione automatica per round di strumenti, con blocco manuale opzionale e telemetria dei tempi per strumento."
5
+ }
6
+ }
package/locale/ja.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "思考レベル",
4
+ "description": "DSH ホストプラグイン:思考レベル(reasoning_effort)制御 — ツールラウンドごとに自動調整、手動ロックとツール別タイミングテレメトリに対応。"
5
+ }
6
+ }
package/locale/ko.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "사고 수준",
4
+ "description": "DSH 호스트 플러그인: 사고 수준(reasoning_effort) 제어 — 도구 라운드별 자동 조정, 수동 잠금 및 도구별 타이밍 텔레메트리 지원."
5
+ }
6
+ }
package/locale/ru.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Уровни мышления",
4
+ "description": "Плагин хоста DSH: управление уровнем мышления (reasoning_effort) — автонастройка за раунд инструментов, с опциональной ручной блокировкой и телеметрией времени по инструментам."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "思考档位",
4
+ "description": "DSH 宿主插件:思考档位(reasoning_effort)控制 — 按工具轮次自动调整,支持手动锁定与逐工具计时遥测。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-thinking-levels",
3
- "version": "3.4.3",
3
+ "version": "3.4.5-beta.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public",
@@ -14,6 +14,7 @@
14
14
  "type": "module",
15
15
  "files": [
16
16
  "lib",
17
+ "locale",
17
18
  "cordis.patch.yml",
18
19
  "dsh.plugin.json",
19
20
  "README.md",
@@ -42,7 +43,8 @@
42
43
  "./client": {
43
44
  "default": "./lib/client.js"
44
45
  },
45
- "./package.json": "./package.json"
46
+ "./package.json": "./package.json",
47
+ "./locale/*.json": "./locale/*.json"
46
48
  },
47
49
  "engines": {
48
50
  "node": ">=22.19.0 || >=24.0.0",