@lynn123411/dsh-model-submenu 0.3.18 → 0.3.19

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/client.js CHANGED
@@ -9,68 +9,33 @@ window.__ModuleLoader__.load({
9
9
  let react_dom = require("react-dom");
10
10
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
11
11
  //#region src/client/level-color.ts
12
- /**
13
- * The accent one reasoning level carries.
14
- *
15
- * "Off" carries no accent at all — the fill and the caption stay neutral, so
16
- * switching reasoning off reads as switching it off rather than as the first
17
- * shade of a ramp. Every level above it walks a blue-to-violet ramp, and the
18
- * highest level is the only one whose fill is a gradient.
19
- */
20
- /** Off: the dimmed label tone, the same neutral the Host uses for quiet text. */
21
12
  const NEUTRAL = "var(--dsw-alias-label-dimmed)";
22
- /** Lowest lit level: the blue the composer already uses for accents. */
23
13
  const LOW = [
24
14
  77,
25
15
  147,
26
16
  248
27
17
  ];
28
- /** Highest level: violet. */
29
18
  const HIGH = [
30
19
  147,
31
20
  51,
32
21
  234
33
22
  ];
34
- /**
35
- * @param t - a point on the ramp, 0 at the lowest lit level and 1 at the top.
36
- * @returns the ramp color there.
37
- */
38
23
  function ramp(t) {
39
24
  const mix = (from, to) => Math.round(from + (to - from) * t);
40
25
  return `rgb(${mix(LOW[0], HIGH[0])}, ${mix(LOW[1], HIGH[1])}, ${mix(LOW[2], HIGH[2])})`;
41
26
  }
42
- /**
43
- * @param index - the level's detent, 0 being "off".
44
- * @param count - number of detents.
45
- * @returns the level's color as a CSS color string.
46
- */
47
27
  function levelColor(index, count) {
48
28
  if (index <= 0) return NEUTRAL;
49
29
  if (isTopLevel(index, count)) return ramp(1);
50
30
  const span = Math.max(1, count - 2);
51
31
  return ramp(Math.min(Math.max((index - 1) / span, 0), 1));
52
32
  }
53
- /**
54
- * @param index - the level's detent.
55
- * @param count - number of detents.
56
- * @returns whether this level is the only one painted with a gradient.
57
- */
58
33
  function isTopLevel(index, count) {
59
34
  return count > 1 && index === count - 1;
60
35
  }
61
- /** The top level's fill: the whole ramp, ending on the color its text takes. */
62
36
  const LEVEL_GRADIENT = `linear-gradient(90deg, ${ramp(0)}, ${ramp(1)})`;
63
37
  //#endregion
64
38
  //#region src/client/selection.ts
65
- /**
66
- * Build the slider's detents for one model.
67
- *
68
- * The provider default is deliberately absent: it is a state, not a level, and
69
- * giving it a detent would read as the weakest reasoning instead of "let the
70
- * provider decide". The label above the track switches to it.
71
- * @param reasoning - the catalog's reasoning metadata, undefined when the model has none.
72
- * @returns one detent per advertised level, in catalog order.
73
- */
74
39
  function effortChoices(reasoning) {
75
40
  if (reasoning === void 0) return [];
76
41
  return reasoning.efforts.map((level) => ({
@@ -79,12 +44,6 @@ window.__ModuleLoader__.load({
79
44
  label: level.name
80
45
  }));
81
46
  }
82
- /**
83
- * The selection a level click submits.
84
- * @param live - the selection in force right now.
85
- * @param effort - the clicked level, undefined meaning the provider default.
86
- * @returns the selection to submit, or null when the level already is the live one.
87
- */
88
47
  function planEffortCommit(live, effort) {
89
48
  if (sameEffort(live.reasoningEffort, effort)) return null;
90
49
  return {
@@ -93,15 +52,6 @@ window.__ModuleLoader__.load({
93
52
  ...effort === void 0 ? {} : { reasoningEffort: effort }
94
53
  };
95
54
  }
96
- /**
97
- * The selection a model click submits.
98
- * @param live - the selection in force right now, null before a first selection resolves.
99
- * @param provider - the clicked model's provider.
100
- * @param model - the clicked model id.
101
- * @param reasoningOf - the catalog's reasoning metadata for one provider and model.
102
- * @param remembered - the level this browser last used for the target model, if any.
103
- * @returns the selection to submit, or null when the click changes nothing.
104
- */
105
55
  function planModelCommit(live, provider, model, reasoningOf, remembered) {
106
56
  if (live !== null && sameModel(live, provider, model)) return null;
107
57
  const offered = reasoningOf(provider, model);
@@ -111,25 +61,14 @@ window.__ModuleLoader__.load({
111
61
  ...offered !== void 0 && remembered !== void 0 && offered.efforts.some((level) => level.id === remembered) ? { reasoningEffort: remembered } : {}
112
62
  };
113
63
  }
114
- /**
115
- * The reasoning metadata the catalog advertises for the model in force.
116
- * @param state - the session's directory snapshot.
117
- * @returns the metadata, or undefined when no model is live or it advertises none.
118
- */
119
64
  function liveReasoning(state) {
120
65
  return currentCatalogModel(state)?.reasoning;
121
66
  }
122
- /** Find the current model by its provider and model IDs. */
123
67
  function currentCatalogModel(state) {
124
68
  const current = state.current;
125
69
  if (current === null) return void 0;
126
70
  return state.groups.find((group) => group.id === current.provider)?.models.find((model) => model.id === current.model);
127
71
  }
128
- /**
129
- * The selection in force, or null while the Host has not resolved one.
130
- * @param state - the session's directory snapshot.
131
- * @returns the live selection, with the effort only when one is set.
132
- */
133
72
  function selectionOf(state) {
134
73
  if (state.current === null) return null;
135
74
  return state.current.reasoningEffort === void 0 ? {
@@ -141,42 +80,14 @@ window.__ModuleLoader__.load({
141
80
  reasoningEffort: state.current.reasoningEffort
142
81
  };
143
82
  }
144
- /**
145
- * @param live - one selection.
146
- * @param provider - the provider to compare.
147
- * @param model - the model id to compare.
148
- * @returns whether both name the same model.
149
- */
150
83
  function sameModel(live, provider, model) {
151
84
  return live.provider === provider && live.model === model;
152
85
  }
153
- /**
154
- * @param liveEffort - the level in force, undefined meaning the provider default.
155
- * @param effort - the level in question.
156
- * @returns whether they name the same level.
157
- */
158
86
  function sameEffort(liveEffort, effort) {
159
87
  return liveEffort === effort;
160
88
  }
161
89
  //#endregion
162
90
  //#region src/client/EffortTint.tsx
163
- /**
164
- * Tint the composer's effort caption with the level's color.
165
- *
166
- * The slider's fill and the menu's value already carry the level's color; the
167
- * caption on the collapsed trigger is the third place the level shows, and it
168
- * lives outside the menu. This entry stays mounted for the whole session and
169
- * writes that one color, so all three read as one signal.
170
- *
171
- * The caption is recognized as the trigger's `span[class*='triggerEffort']`
172
- * child — the same class-substring contract the menu row uses. When the model
173
- * declares no levels the span does not exist and nothing is written.
174
- */
175
- /**
176
- * Render nothing and keep the trigger caption colored.
177
- * @param props - the session's catalog face.
178
- * @returns an inert marker.
179
- */
180
91
  function EffortTint({ available, directory }) {
181
92
  const markerRef = (0, react.useRef)(null);
182
93
  const [caption, setCaption] = (0, react.useState)(null);
@@ -202,65 +113,33 @@ window.__ModuleLoader__.load({
202
113
  hidden: true
203
114
  });
204
115
  }
205
- /** The knob's centre keeps its own radius away from either end of the track. */
206
116
  const KNOB_RADIUS = 10;
207
- /**
208
- * @param index - detent index.
209
- * @param count - number of detents.
210
- * @returns the knob centre as a fraction of the track, 0 at the first detent and 1 at the last.
211
- */
212
117
  function offsetOf(index, count) {
213
118
  if (count <= 1) return 0;
214
119
  return Math.min(Math.max(index, 0), count - 1) / (count - 1);
215
120
  }
216
- /**
217
- * Where a pointer sits along the knob's travel. The drag reads this rather than a
218
- * detent, so the knob follows the pointer instead of jumping a level at a time.
219
- * @param clientX - pointer position in viewport coordinates.
220
- * @param left - the track's left edge in viewport coordinates.
221
- * @param width - the track's width in pixels.
222
- * @returns the position as a fraction of the travel, clamped to 0 and 1.
223
- */
224
121
  function fractionAt(clientX, left, width) {
225
122
  const usable = width - 20;
226
123
  if (usable <= 0) return 0;
227
124
  const fraction = (clientX - left - KNOB_RADIUS) / usable;
228
125
  return Math.min(Math.max(fraction, 0), 1);
229
126
  }
230
- /**
231
- * @param fraction - a knob position between 0 and 1.
232
- * @param count - number of detents.
233
- * @returns the detent nearest that position.
234
- */
235
127
  function detentAt(fraction, count) {
236
128
  if (count <= 1) return 0;
237
129
  return Math.round(Math.min(Math.max(fraction, 0), 1) * (count - 1));
238
130
  }
239
- /**
240
- * @param fraction - a knob position between 0 and 1.
241
- * @returns the CSS length that puts the knob centre there, inset at both ends.
242
- */
243
131
  function knobOffset(fraction) {
244
132
  return `calc(${KNOB_RADIUS}px + ${Math.min(Math.max(fraction, 0), 1)} * (100% - 20px))`;
245
133
  }
246
- /**
247
- * Width of the colored fill for a knob position.
248
- *
249
- * The fill is the track's own shape cut at the knob: its right cap carries the
250
- * track's radius and ends under the knob, so the color runs into the knob
251
- * instead of stopping at a straight edge, and the last detent reaches the track's
252
- * end rather than the knob's centre.
253
- * @param fraction - a knob position between 0 and 1.
254
- * @returns the CSS width of the fill.
255
- */
256
134
  function fillWidth(fraction) {
257
135
  return `calc(16px + ${Math.min(Math.max(fraction, 0), 1)} * (100% - 16px))`;
258
136
  }
259
137
  //#endregion
260
138
  //#region \0dsh-css:/home/runner/work/my-dsh/my-dsh/plugins/dsh-model-submenu/src/client/ModelOptions.module.css.mjs
261
- const stylesheet = ".TcCbqa_pickerHost{display:contents}.TcCbqa_modelCell.TcCbqa_modelCell{anchor-name:--dsh-quick-model-row;padding-inline-end:14px}.TcCbqa_modelCell>svg:last-child{visibility:hidden}.TcCbqa_modelBrowse{position-anchor:--dsh-quick-model-row;top:anchor(top);bottom:anchor(bottom);border-radius:var(--dsw-radius-md);width:32px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;place-items:center;padding:0;display:grid;position:absolute;inset-inline-end:anchor(end)}.TcCbqa_modelBrowse:hover:not(:disabled),.TcCbqa_modelBrowse:focus-visible{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.TcCbqa_quickOption{border-radius:var(--dsw-radius-md);width:100%;min-height:34px;color:inherit;text-align:start;cursor:pointer;background:0 0;border:0;outline:none;align-items:center;gap:6px;padding:5px 7px;font-size:13px;font-weight:400;line-height:18px;display:flex}.TcCbqa_quickOption:hover:not([aria-disabled=true]),.TcCbqa_quickOption:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}.TcCbqa_quickOption[aria-disabled=true]{color:var(--dsw-alias-label-dimmed);cursor:default}.TcCbqa_quickCopy{flex:1;align-items:center;gap:4px;min-width:0;display:flex}.TcCbqa_quickName{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.TcCbqa_quickBadge{flex:none}.TcCbqa_quickCheck{flex:0 0 14px;place-items:center;display:grid}.TcCbqa_sliderCell{flex:auto;align-self:stretch;align-items:center;min-width:96px;display:flex}.TcCbqa_slider{cursor:pointer;touch-action:none;-webkit-user-select:none;user-select:none;outline:none;flex:1;align-items:center;min-width:0;height:100%;display:flex}.TcCbqa_slider[data-busy]{cursor:default}.TcCbqa_sliderTrack{corner-shape:round;background:var(--dsw-alias-border-l3);border-radius:999px;width:100%;height:16px;position:relative}.TcCbqa_sliderFill{corner-shape:round;pointer-events:none;border-radius:999px;transition:width .16s cubic-bezier(.2,0,0,1);position:absolute;top:0;bottom:0;left:0}.TcCbqa_sliderTick{corner-shape:round;background:var(--dsw-alias-label-tertiary);pointer-events:none;border-radius:50%;width:4px;height:4px;margin:-2px 0 0 -2px;position:absolute;top:50%}.TcCbqa_sliderTick[data-on]{background:#00000047}.TcCbqa_sliderKnob{box-sizing:border-box;corner-shape:round;background:var(--dsw-alias-label-primary-foreground);width:20px;height:20px;box-shadow:var(--dsw-elevation-soft);pointer-events:none;border-radius:50%;margin:-10px 0 0 -10px;transition:left .16s cubic-bezier(.2,0,0,1);position:absolute;top:50%}.TcCbqa_slider[data-dragging] .TcCbqa_sliderKnob,.TcCbqa_slider[data-dragging] .TcCbqa_sliderFill{transition:none}@media (prefers-reduced-motion:reduce){.TcCbqa_sliderKnob,.TcCbqa_sliderFill{transition:none}}.TcCbqa_slider[data-default] .TcCbqa_sliderKnob{background:var(--dsw-alias-bg-layer-1);border:1.5px solid var(--dsw-alias-label-tertiary);box-shadow:none}.TcCbqa_slider[data-busy] .TcCbqa_sliderKnob{opacity:.6}.TcCbqa_slider:focus-visible .TcCbqa_sliderTrack{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:3px}.TcCbqa_rowBadge{flex:none;margin-inline-start:6px}.TcCbqa_row{align-items:center;gap:2px;display:flex}.TcCbqa_rowPick{box-sizing:border-box;width:100%;min-width:0;min-height:34px;color:inherit;text-align:left;cursor:pointer;border-radius:var(--dsw-radius-md);padding-inline:6px;background:0 0;border:none;outline:none;flex:1;align-items:center;gap:4px;padding:5px 7px;display:flex}.TcCbqa_rowPick:hover:not(:disabled),.TcCbqa_rowPick:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}.TcCbqa_rowPick:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.TcCbqa_rowCopy{flex-direction:column;flex:1;min-width:0;display:flex}.TcCbqa_rowName{color:inherit;text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;font-weight:400;line-height:17px;overflow:hidden}.TcCbqa_rowMeta{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:18px;overflow:hidden}.TcCbqa_check{color:var(--dsw-alias-label-primary);flex:0 0 15px;place-items:center;display:grid}.TcCbqa_starButton{color:var(--dsw-alias-label-tertiary);cursor:pointer;border-radius:var(--dsw-radius-sm);opacity:0;background:0 0;border:none;outline:none;flex:none;place-items:center;width:26px;height:26px;display:grid}.TcCbqa_starButton:focus-visible{outline:2px solid var(--dsw-alias-border-l3)}.TcCbqa_row:hover .TcCbqa_starButton,.TcCbqa_row:focus-within .TcCbqa_starButton{opacity:1}.TcCbqa_starButton[aria-pressed=true]{color:var(--dsw-alias-state-warn-primary);opacity:1}@media (hover:none){.TcCbqa_starButton{opacity:1}}.TcCbqa_star{flex:none}.TcCbqa_notice{color:var(--dsw-alias-label-tertiary);justify-content:space-between;align-items:flex-start;gap:8px;padding:6px 10px;font-size:12px;line-height:18px;display:flex}.TcCbqa_retry{color:inherit;font:inherit;cursor:pointer;background:0 0;border:none;flex:none;padding:0;font-weight:600;text-decoration:underline}.TcCbqa_pickerDialog.TcCbqa_pickerDialog{gap:0;width:min(680px,100%);height:min(640px,80vh);padding:0}.TcCbqa_pickerContent,.TcCbqa_pickerContent>:last-child{flex-direction:column;flex:1;min-height:0;display:flex}.TcCbqa_pickerSearch{padding:0 20px 12px}.TcCbqa_pickerSearchInput{width:100%}.TcCbqa_pickerTabs{border-bottom:.5px solid var(--dsw-alias-border-l2);overscroll-behavior-x:contain;scrollbar-width:none;flex-wrap:nowrap;gap:2px;padding:0 16px;display:flex;overflow-x:auto}.TcCbqa_pickerTabs::-webkit-scrollbar{display:none}.TcCbqa_pickerTab{color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:var(--dsw-radius-sm);white-space:nowrap;background:0 0;border:none;outline:none;flex:none;padding:6px 10px;font-size:13px;line-height:18px}.TcCbqa_pickerTab:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.TcCbqa_pickerTab[aria-selected=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover);font-weight:600}.TcCbqa_pickerTab:focus-visible{outline:2px solid var(--dsw-alias-border-l3)}.TcCbqa_pickerList{flex:1;min-height:0;padding:8px 12px;overflow-y:auto}.TcCbqa_pickerFooter{border-top:.5px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;padding:10px 20px;font-size:12px;line-height:18px;display:flex}.TcCbqa_footerHint{flex-wrap:wrap;align-items:center;gap:6px;display:flex}";
139
+ const stylesheet = ".TcCbqa_pickerHost{display:contents}.TcCbqa_modelCell.TcCbqa_modelCell{anchor-name:--dsh-quick-model-row;padding-inline-end:14px}.TcCbqa_modelCell>svg:last-child{visibility:hidden}.TcCbqa_modelBrowse{position-anchor:--dsh-quick-model-row;top:anchor(top);bottom:anchor(bottom);border-radius:var(--dsw-radius-md);width:32px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;place-items:center;padding:0;display:grid;position:absolute;inset-inline-end:anchor(end)}.TcCbqa_modelBrowse:hover:not(:disabled),.TcCbqa_modelBrowse:focus-visible{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.TcCbqa_quickOption{border-radius:var(--dsw-radius-md);width:100%;min-height:34px;color:inherit;text-align:start;cursor:pointer;background:0 0;border:0;outline:none;align-items:center;gap:6px;padding:5px 7px;font-size:13px;font-weight:400;line-height:18px;display:flex}.TcCbqa_quickOption:hover:not(:disabled,[aria-disabled=true]),.TcCbqa_quickOption:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}.TcCbqa_quickOption:disabled,.TcCbqa_quickOption[aria-disabled=true]{color:var(--dsw-alias-label-dimmed);cursor:default}.TcCbqa_quickCopy{flex:1;align-items:center;gap:4px;min-width:0;display:flex}.TcCbqa_quickName{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.TcCbqa_quickBadge{flex:none}.TcCbqa_quickCheck{flex:0 0 14px;place-items:center;display:grid}.TcCbqa_quickFooter{border-block-start:.5px solid var(--dsw-alias-border-l2);margin-block-start:4px;padding-block-start:4px}.TcCbqa_sliderCell{flex:auto;align-self:stretch;align-items:center;min-width:96px;display:flex}.TcCbqa_slider{cursor:pointer;touch-action:none;-webkit-user-select:none;user-select:none;outline:none;flex:1;align-items:center;min-width:0;height:100%;display:flex}.TcCbqa_slider[data-busy]{cursor:default}.TcCbqa_sliderTrack{corner-shape:round;background:var(--dsw-alias-border-l3);border-radius:999px;width:100%;height:16px;position:relative}.TcCbqa_sliderFill{corner-shape:round;pointer-events:none;border-radius:999px;transition:width .16s cubic-bezier(.2,0,0,1);position:absolute;top:0;bottom:0;left:0}.TcCbqa_sliderTick{corner-shape:round;background:var(--dsw-alias-label-tertiary);pointer-events:none;border-radius:50%;width:4px;height:4px;margin:-2px 0 0 -2px;position:absolute;top:50%}.TcCbqa_sliderTick[data-on]{background:#00000047}.TcCbqa_sliderKnob{box-sizing:border-box;corner-shape:round;background:var(--dsw-alias-label-primary-foreground);width:20px;height:20px;box-shadow:var(--dsw-elevation-soft);pointer-events:none;border-radius:50%;margin:-10px 0 0 -10px;transition:left .16s cubic-bezier(.2,0,0,1);position:absolute;top:50%}.TcCbqa_slider[data-dragging] .TcCbqa_sliderKnob,.TcCbqa_slider[data-dragging] .TcCbqa_sliderFill{transition:none}@media (prefers-reduced-motion:reduce){.TcCbqa_sliderKnob,.TcCbqa_sliderFill{transition:none}}.TcCbqa_slider[data-default] .TcCbqa_sliderKnob{background:var(--dsw-alias-bg-layer-1);border:1.5px solid var(--dsw-alias-label-tertiary);box-shadow:none}.TcCbqa_slider[data-busy] .TcCbqa_sliderKnob{opacity:.6}.TcCbqa_slider:focus-visible .TcCbqa_sliderTrack{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:3px}.TcCbqa_rowBadge{flex:none;margin-inline-start:6px}.TcCbqa_row{align-items:center;gap:2px;display:flex}.TcCbqa_rowPick{box-sizing:border-box;width:100%;min-width:0;min-height:34px;color:inherit;text-align:left;cursor:pointer;border-radius:var(--dsw-radius-md);padding-inline:6px;background:0 0;border:none;outline:none;flex:1;align-items:center;gap:4px;padding:5px 7px;display:flex}.TcCbqa_rowPick:hover:not(:disabled),.TcCbqa_rowPick:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}.TcCbqa_rowPick:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.TcCbqa_rowCopy{flex-direction:column;flex:1;min-width:0;display:flex}.TcCbqa_rowName{color:inherit;text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;font-weight:400;line-height:17px;overflow:hidden}.TcCbqa_rowMeta{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:18px;overflow:hidden}.TcCbqa_check{color:var(--dsw-alias-label-primary);flex:0 0 15px;place-items:center;display:grid}.TcCbqa_starButton{color:var(--dsw-alias-label-tertiary);cursor:pointer;border-radius:var(--dsw-radius-sm);opacity:0;background:0 0;border:none;outline:none;flex:none;place-items:center;width:26px;height:26px;display:grid}.TcCbqa_starButton:focus-visible{outline:2px solid var(--dsw-alias-border-l3)}.TcCbqa_row:hover .TcCbqa_starButton,.TcCbqa_row:focus-within .TcCbqa_starButton{opacity:1}.TcCbqa_starButton[aria-pressed=true]{color:var(--dsw-alias-state-warn-primary);opacity:1}@media (hover:none){.TcCbqa_starButton{opacity:1}}.TcCbqa_star{flex:none}.TcCbqa_notice{color:var(--dsw-alias-label-tertiary);justify-content:space-between;align-items:flex-start;gap:8px;padding:6px 10px;font-size:12px;line-height:18px;display:flex}.TcCbqa_retry{color:inherit;font:inherit;cursor:pointer;background:0 0;border:none;flex:none;padding:0;font-weight:600;text-decoration:underline}.TcCbqa_pickerDialog.TcCbqa_pickerDialog{gap:0;width:min(680px,100%);height:min(640px,80vh);padding:0}.TcCbqa_pickerContent,.TcCbqa_pickerContent>:last-child{flex-direction:column;flex:1;min-height:0;display:flex}.TcCbqa_pickerSearch{padding:0 20px 12px}.TcCbqa_pickerSearchInput{width:100%}.TcCbqa_pickerTabs{border-bottom:.5px solid var(--dsw-alias-border-l2);overscroll-behavior-x:contain;scrollbar-width:none;flex-wrap:nowrap;gap:2px;padding:0 16px;display:flex;overflow-x:auto}.TcCbqa_pickerTabs::-webkit-scrollbar{display:none}.TcCbqa_pickerTab{color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:var(--dsw-radius-sm);white-space:nowrap;background:0 0;border:none;outline:none;flex:none;padding:6px 10px;font-size:13px;line-height:18px}.TcCbqa_pickerTab:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.TcCbqa_pickerTab[aria-selected=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover);font-weight:600}.TcCbqa_pickerTab:focus-visible{outline:2px solid var(--dsw-alias-border-l3)}.TcCbqa_pickerList{flex:1;min-height:0;padding:8px 12px;overflow-y:auto}.TcCbqa_pickerFooter{border-top:.5px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);justify-content:space-between;align-items:center;gap:12px;padding:10px 20px;font-size:12px;line-height:18px;display:flex}.TcCbqa_footerHint{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.TcCbqa_footerFavorites{text-align:end}";
262
140
  var ModelOptions_module_css_default = {
263
141
  "check": "TcCbqa_check",
142
+ "footerFavorites": "TcCbqa_footerFavorites",
264
143
  "footerHint": "TcCbqa_footerHint",
265
144
  "modelBrowse": "TcCbqa_modelBrowse",
266
145
  "modelCell": "TcCbqa_modelCell",
@@ -277,6 +156,7 @@ window.__ModuleLoader__.load({
277
156
  "quickBadge": "TcCbqa_quickBadge",
278
157
  "quickCheck": "TcCbqa_quickCheck",
279
158
  "quickCopy": "TcCbqa_quickCopy",
159
+ "quickFooter": "TcCbqa_quickFooter",
280
160
  "quickName": "TcCbqa_quickName",
281
161
  "quickOption": "TcCbqa_quickOption",
282
162
  "retry": "TcCbqa_retry",
@@ -297,28 +177,6 @@ window.__ModuleLoader__.load({
297
177
  };
298
178
  //#endregion
299
179
  //#region src/client/EffortSlider.tsx
300
- /**
301
- * The reasoning-level slider that replaces the Host's effort drill.
302
- *
303
- * The Host's second menu cell is a button that drills into a list of levels.
304
- * This slider sits inside that same cell, between the Host's label and value, so
305
- * the levels are reachable without leaving the menu. The levels are discrete but
306
- * the drag is not: the knob follows the pointer continuously, the level it
307
- * reports is the detent nearest that position, and letting go eases the knob onto
308
- * that detent and commits once. Keyboard arrows step and commit immediately.
309
- *
310
- * The fill takes the level's color, so the track and the two captions read as
311
- * one signal: "off" is neutral, the levels above it walk a blue-to-violet ramp,
312
- * and only the top level fills with the whole gradient.
313
- *
314
- * "Provider default" is not a detent: it is a state, drawn as an empty track
315
- * with a hollow knob, so it never reads as the lowest level.
316
- */
317
- /**
318
- * Render the slider.
319
- * @param props - levels, the level in force, and the commit path.
320
- * @returns one focusable slider over the discrete levels.
321
- */
322
180
  function EffortSlider({ steps, current, defaultActive, defaultIndex, defaultLabel, busy, label, onCommit }) {
323
181
  const trackRef = (0, react.useRef)(null);
324
182
  const dragRef = (0, react.useRef)(null);
@@ -447,13 +305,7 @@ window.__ModuleLoader__.load({
447
305
  }
448
306
  //#endregion
449
307
  //#region src/client/effort-memory.ts
450
- /** The single browser-wide storage key holding the whole memory. */
451
308
  const EFFORTS_KEY = "dsh-model-submenu.efforts";
452
- /**
453
- * Read the memory, keeping only rows naming both halves and a level.
454
- * @param storage - browser storage, or undefined when the browser withholds it.
455
- * @returns the remembered rows; empty when unreadable.
456
- */
457
309
  function readEfforts(storage) {
458
310
  const raw = getItem$1(storage);
459
311
  if (raw === null) return [];
@@ -466,23 +318,9 @@ window.__ModuleLoader__.load({
466
318
  if (!Array.isArray(parsed)) return [];
467
319
  return parsed.filter((row) => typeof row === "object" && row !== null && typeof row.provider === "string" && typeof row.model === "string" && typeof row.effort === "string" && row.effort !== "");
468
320
  }
469
- /**
470
- * @param memory - the rows to search.
471
- * @param provider - the provider route key.
472
- * @param model - the model id inside that provider.
473
- * @returns the level last chosen for that exact model, or undefined.
474
- */
475
321
  function effortFor(memory, provider, model) {
476
322
  return memory.find((row) => row.provider === provider && row.model === model)?.effort;
477
323
  }
478
- /**
479
- * Remember one model's level, or forget it when the choice is the provider default.
480
- * @param storage - browser storage, or undefined when writes are unavailable.
481
- * @param provider - the provider route key.
482
- * @param model - the model id inside that provider.
483
- * @param effort - the chosen level, undefined meaning the provider default.
484
- * @returns the memory after the change, whether or not the write landed.
485
- */
486
324
  function rememberEffort(storage, provider, model, effort) {
487
325
  const rest = readEfforts(storage).filter((row) => row.provider !== provider || row.model !== model);
488
326
  const next = effort === void 0 ? rest : [...rest, {
@@ -504,9 +342,7 @@ window.__ModuleLoader__.load({
504
342
  }
505
343
  //#endregion
506
344
  //#region src/client/favorites.ts
507
- /** The single browser-wide storage key holding the whole table. */
508
345
  const FAVORITES_KEY = "dsh-model-submenu.favorites";
509
- /** A browser can withhold access to localStorage itself. */
510
346
  function storageOf() {
511
347
  try {
512
348
  return globalThis.localStorage;
@@ -514,11 +350,6 @@ window.__ModuleLoader__.load({
514
350
  return;
515
351
  }
516
352
  }
517
- /**
518
- * Read the table, keeping only rows that name both halves.
519
- * @param storage - browser storage, or undefined when the browser withholds it.
520
- * @returns the stored favorites in stored order; empty when unreadable.
521
- */
522
353
  function readFavorites(storage) {
523
354
  const raw = getItem(storage);
524
355
  if (raw === null) return [];
@@ -531,13 +362,6 @@ window.__ModuleLoader__.load({
531
362
  if (!Array.isArray(parsed)) return [];
532
363
  return parsed.filter((row) => typeof row === "object" && row !== null && typeof row.provider === "string" && typeof row.model === "string");
533
364
  }
534
- /**
535
- * Add or remove one model, writing the whole table back.
536
- * @param storage - browser storage, or undefined when writes are unavailable.
537
- * @param provider - the provider route key.
538
- * @param model - the model id inside that provider.
539
- * @returns the table after the change, whether or not the write landed.
540
- */
541
365
  function toggleFavorite(storage, provider, model) {
542
366
  const current = readFavorites(storage);
543
367
  const next = isFavorite(current, provider, model) ? current.filter((row) => row.provider !== provider || row.model !== model) : [...current, {
@@ -549,22 +373,9 @@ window.__ModuleLoader__.load({
549
373
  } catch {}
550
374
  return next;
551
375
  }
552
- /**
553
- * @param favorites - the table to search.
554
- * @param provider - the provider route key.
555
- * @param model - the model id inside that provider.
556
- * @returns whether that exact pair is favorited.
557
- */
558
376
  function isFavorite(favorites, provider, model) {
559
377
  return favorites.some((row) => row.provider === provider && row.model === model);
560
378
  }
561
- /**
562
- * Stable-partition a catalog so favorited rows lead, each part keeping the
563
- * catalog's own order.
564
- * @param rows - the catalog in its display order.
565
- * @param favorited - predicate answering whether one row is favorited.
566
- * @returns a new list; the input order when nothing is favorited.
567
- */
568
379
  function orderWithFavorites(rows, favorited) {
569
380
  const starred = rows.filter(favorited);
570
381
  if (starred.length === 0) return rows;
@@ -580,8 +391,13 @@ window.__ModuleLoader__.load({
580
391
  //#endregion
581
392
  //#region src/client/QuickModels.tsx
582
393
  const QUICK_MODELS_PANE = "lynn-quick-models";
583
- /** The current model and available favorites, grouped like the Host's picker. */
584
- function QuickModels({ locked, dismiss, reportFailure, directory, resolveText, select, t }) {
394
+ function confirmOnTab(event) {
395
+ if (event.key !== "Tab" || event.shiftKey || event.nativeEvent.isComposing) return;
396
+ event.preventDefault();
397
+ event.stopPropagation();
398
+ event.currentTarget.click();
399
+ }
400
+ function QuickModels({ sessionId, picker, locked, dismiss, reportFailure, directory, resolveText, select, t }) {
585
401
  const state = (0, react.useSyncExternalStore)((listener) => directory.subscribe(listener), () => directory.getSnapshot());
586
402
  const [favorites] = (0, react.useState)(() => readFavorites(storageOf()));
587
403
  const open = (0, react.useRef)(false);
@@ -620,85 +436,80 @@ window.__ModuleLoader__.load({
620
436
  role: "menu",
621
437
  "aria-label": t("picker.quick"),
622
438
  "aria-busy": busy,
623
- children: [groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
624
- className: ModelOptions_module_css_default.notice,
625
- role: "status",
626
- children: t(state.status === "loading" ? "status.loading" : "status.empty")
627
- }), groups.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuGroup, {
628
- label: group.name,
629
- children: group.models.map((model) => {
630
- const selected = live !== null && sameModel(live, group.id, model.id);
631
- const pending = state.pending !== null && sameModel(state.pending, group.id, model.id);
632
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
439
+ children: [
440
+ groups.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
441
+ className: ModelOptions_module_css_default.notice,
442
+ role: "status",
443
+ children: t(state.status === "loading" ? "status.loading" : "status.empty")
444
+ }),
445
+ groups.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuGroup, {
446
+ label: group.name,
447
+ children: group.models.map((model) => {
448
+ const selected = live !== null && sameModel(live, group.id, model.id);
449
+ const pending = state.pending !== null && sameModel(state.pending, group.id, model.id);
450
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
451
+ type: "button",
452
+ role: "menuitemradio",
453
+ "aria-checked": selected,
454
+ "aria-disabled": busy,
455
+ autoFocus: selected,
456
+ className: ModelOptions_module_css_default.quickOption,
457
+ title: model.name,
458
+ onClick: () => {
459
+ choose(group.id, model);
460
+ },
461
+ onKeyDown: confirmOnTab,
462
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
463
+ className: ModelOptions_module_css_default.quickCopy,
464
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
465
+ className: ModelOptions_module_css_default.quickName,
466
+ children: model.name
467
+ }), model.badge !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
468
+ className: ModelOptions_module_css_default.quickBadge,
469
+ tone: model.badge.tone,
470
+ children: resolveText(model.badge.text)
471
+ })]
472
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
473
+ className: ModelOptions_module_css_default.quickCheck,
474
+ "aria-hidden": "true",
475
+ children: pending ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "ongoing" }) : selected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, { size: 14 })
476
+ })]
477
+ }, model.id);
478
+ })
479
+ }, group.id)),
480
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
481
+ className: ModelOptions_module_css_default.quickFooter,
482
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
633
483
  type: "button",
634
- role: "menuitemradio",
635
- "aria-checked": selected,
636
- "aria-disabled": busy,
637
- autoFocus: selected,
484
+ role: "menuitem",
485
+ "aria-haspopup": "dialog",
638
486
  className: ModelOptions_module_css_default.quickOption,
639
- title: model.name,
487
+ disabled: busy,
640
488
  onClick: () => {
641
- choose(group.id, model);
642
- },
643
- onKeyDown: (event) => {
644
- if (event.key !== "Tab" || event.shiftKey || event.nativeEvent.isComposing) return;
645
- event.preventDefault();
646
- event.stopPropagation();
647
- choose(group.id, model);
489
+ if (busy || directory.getSnapshot().pending !== null) return;
490
+ dismiss();
491
+ picker.open(sessionId);
648
492
  },
649
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
493
+ onKeyDown: confirmOnTab,
494
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
650
495
  className: ModelOptions_module_css_default.quickCopy,
651
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
652
- className: ModelOptions_module_css_default.quickName,
653
- children: model.name
654
- }), model.badge !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
655
- className: ModelOptions_module_css_default.quickBadge,
656
- tone: model.badge.tone,
657
- children: resolveText(model.badge.text)
658
- })]
659
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
660
- className: ModelOptions_module_css_default.quickCheck,
661
- "aria-hidden": "true",
662
- children: pending ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: "ongoing" }) : selected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, { size: 14 })
663
- })]
664
- }, model.id);
496
+ children: t("picker.browseAll")
497
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular, { size: 12 })]
498
+ })
665
499
  })
666
- }, group.id))]
500
+ ]
667
501
  });
668
502
  }
669
503
  //#endregion
670
504
  //#region src/client/ModelMenuBridge.tsx
671
- /**
672
- * Bridge the Host's own model menu: the model cell opens a short list, its
673
- * trailing button opens the all-provider picker, and the effort cell carries
674
- * the reasoning-level slider.
675
- *
676
- * The Host owns the root menu's model and effort cells and opens a submenu for each.
677
- * While the root pane is open, this entry redirects the first cell to a detail
678
- * pane and mounts the slider in the second cell.
679
- *
680
- * Only the model menu's own direct buttons with the expected label, value and
681
- * chevron are recognized. The options slot output sits in its own wrapper,
682
- * so other plugins' rows never join that list.
683
- *
684
- * Clicking the cell's label switches to the provider default, which is a state
685
- * rather than a detent: the slider shows it as an empty track under a hollow
686
- * knob, so it never reads as the weakest level.
687
- */
688
505
  const cellLabel = ":scope > span[class*=\"cellLabel\"]";
689
506
  const cellValue = ":scope > span[class*=\"cellValue\"]";
690
507
  const cellChevron = ":scope > svg[class*=\"cellChevron\"]";
691
- /** Match only the host-owned buttons in the root model menu. */
692
508
  function hostCell(surface, index) {
693
509
  const button = surface.querySelectorAll(":scope > button[role=\"menuitem\"]")[index];
694
510
  if (!button?.querySelector(cellLabel) || !button.querySelector(cellValue) || !button.querySelector(cellChevron)) return null;
695
511
  return button;
696
512
  }
697
- /**
698
- * Render the marker, redirect the model cell, and mount the effort slider.
699
- * @param props - menu state, session, catalog face, and localized copy.
700
- * @returns an inert marker plus the slider while the effort cell is present.
701
- */
702
513
  function ModelMenuBridge({ sessionId, picker, locked, dismiss, openPane, reportFailure, available, directory, select, t }) {
703
514
  const markerRef = (0, react.useRef)(null);
704
515
  const sliderRef = (0, react.useRef)(null);
@@ -864,20 +675,25 @@ window.__ModuleLoader__.load({
864
675
  ref: markerRef,
865
676
  hidden: true
866
677
  }),
867
- showQuickModels && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
868
- className: ModelOptions_module_css_default.modelBrowse,
869
- type: "button",
870
- role: "menuitem",
871
- "aria-haspopup": "dialog",
872
- "aria-label": t("picker.browseAll"),
873
- title: t("picker.browseAll"),
678
+ showQuickModels && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
679
+ label: t("picker.browseAll"),
680
+ delayMs: 300,
874
681
  disabled: busy,
875
- onClick: () => {
876
- if (directory.getSnapshot().pending !== null) return;
877
- dismiss();
878
- picker.open(sessionId);
879
- },
880
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular, { size: 12 })
682
+ portal: true,
683
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
684
+ className: ModelOptions_module_css_default.modelBrowse,
685
+ type: "button",
686
+ role: "menuitem",
687
+ "aria-haspopup": "dialog",
688
+ "aria-label": t("picker.browseAll"),
689
+ disabled: busy,
690
+ onClick: () => {
691
+ if (directory.getSnapshot().pending !== null) return;
692
+ dismiss();
693
+ picker.open(sessionId);
694
+ },
695
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular, { size: 12 })
696
+ })
881
697
  }), browseMount),
882
698
  showSlider && effortRow !== null && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
883
699
  ref: sliderRef,
@@ -897,20 +713,6 @@ window.__ModuleLoader__.load({
897
713
  }
898
714
  //#endregion
899
715
  //#region src/client/icons.tsx
900
- /**
901
- * The one glyph this plugin draws itself.
902
- *
903
- * The shared icon library carries no star, so the favorite mark is defined here:
904
- * a five-point star whose outline and fill use the same path, which keeps the
905
- * hover-only outline and the standing filled state identical in geometry.
906
- */
907
- /**
908
- * Render the favorite star.
909
- * @param props.filled - draw the solid star; otherwise the outline.
910
- * @param props.size - square edge in pixels, matching the shared icon set's default.
911
- * @param props.className - extra class for colour and placement.
912
- * @returns the inline SVG.
913
- */
914
716
  function StarIcon({ filled, size = 14, className }) {
915
717
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
916
718
  width: size,
@@ -927,11 +729,6 @@ window.__ModuleLoader__.load({
927
729
  }
928
730
  //#endregion
929
731
  //#region src/client/ModelRow.tsx
930
- /**
931
- * Render one model row.
932
- * @param props - the row's content and behaviour.
933
- * @returns the row element.
934
- */
935
732
  function ModelRow({ name, badge, selected, busy, favorited, meta, starLabel, onPick, onToggleFavorite, children }) {
936
733
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
937
734
  className: ModelOptions_module_css_default.row,
@@ -983,15 +780,6 @@ window.__ModuleLoader__.load({
983
780
  }
984
781
  //#endregion
985
782
  //#region src/client/model-facts.ts
986
- /**
987
- * The model knowledge a shipped adapter carries for its own account route.
988
- *
989
- * The account route has no `models` list on purpose: the account listing
990
- * supplies the catalog and settings only carry per-model overrides. The same
991
- * adapter family ships a default catalog for its API-key route, and the account
992
- * route serves the same models, so those entries answer what the account
993
- * profile cannot. Ids and facts mirror the adapter's own table.
994
- */
995
783
  const FAMILY_DEFAULTS = { "deepseek-account": [{
996
784
  id: "deepseek-flash",
997
785
  contextWindow: 1e6,
@@ -1001,12 +789,6 @@ window.__ModuleLoader__.load({
1001
789
  contextWindow: 1e6,
1002
790
  images: false
1003
791
  }] };
1004
- /**
1005
- * Build the fact lookup from the settings answer.
1006
- * @param providers - provider directory rows giving each route's settings address.
1007
- * @param namespaces - the describe answer's namespace views.
1008
- * @returns a lookup answering both fields for one provider and model.
1009
- */
1010
792
  function buildModelFacts(providers, namespaces) {
1011
793
  const byName = new Map(namespaces.map((row) => [row.ns, row.value]));
1012
794
  const profiles = /* @__PURE__ */ new Map();
@@ -1036,14 +818,6 @@ window.__ModuleLoader__.load({
1036
818
  };
1037
819
  };
1038
820
  }
1039
- /**
1040
- * Read one model entry's accepted image modalities.
1041
- *
1042
- * The two adapter families disagree about an omission. The Messages family
1043
- * names the field `inputModalities`, and leaving it out means text only. The
1044
- * pi-ai family names it `input`, and an empty or absent list defers to the
1045
- * route's `defaultInput`; with no route default the answer stays unknown.
1046
- */
1047
821
  function imageAnswer(entry, profile) {
1048
822
  if (Array.isArray(entry.inputModalities)) return containsImage(entry.inputModalities);
1049
823
  const defaultInput = Array.isArray(profile.defaultInput) ? profile.defaultInput : void 0;
@@ -1053,7 +827,6 @@ window.__ModuleLoader__.load({
1053
827
  }
1054
828
  return defaultInput === void 0 ? "no" : containsImage(defaultInput);
1055
829
  }
1056
- /** One model's declared override, when the route keeps a `modelOverrides` table. */
1057
830
  function readOverride(profile, model) {
1058
831
  const overrides = profile?.modelOverrides;
1059
832
  if (!isRecord(overrides)) return void 0;
@@ -1063,25 +836,11 @@ window.__ModuleLoader__.load({
1063
836
  function containsImage(modalities) {
1064
837
  return modalities.includes("image") ? "yes" : "no";
1065
838
  }
1066
- /**
1067
- * Abbreviate one capacity the way the metadata line shows it.
1068
- * @param tokens - exact advertised capacity in tokens.
1069
- * @returns e.g. `1M ctx`, `1.5M ctx`, `272k ctx`, or `512 ctx` below a thousand.
1070
- */
1071
839
  function formatContextWindow(tokens) {
1072
840
  if (tokens >= 1e6) return `${trimNumber(tokens / 1e6)}M ctx`;
1073
841
  if (tokens >= 1e3) return `${Math.round(tokens / 1e3)}k ctx`;
1074
842
  return `${tokens} ctx`;
1075
843
  }
1076
- /**
1077
- * Build the metadata line's segments.
1078
- * @param input.providerName - the provider's display name, omitted inside that provider's own tab.
1079
- * @param input.facts - what the settings document answered.
1080
- * @param input.thinks - whether the catalog advertises reasoning levels for this model.
1081
- * @param input.effortLabel - the localized word for the reasoning segment.
1082
- * @param input.imageLabel - the localized word for the image segment.
1083
- * @returns the segments to join; an empty list means show no line.
1084
- */
1085
844
  function metaSegments(input) {
1086
845
  const segments = [];
1087
846
  if (input.providerName !== void 0) segments.push(input.providerName);
@@ -2704,11 +2463,6 @@ window.__ModuleLoader__.load({
2704
2463
  return ranked.map((entry) => this.#items[entry.index]);
2705
2464
  }
2706
2465
  };
2707
- /**
2708
- * Flatten the catalog to one row per model.
2709
- * @param groups - the shared directory's provider groups, in display order.
2710
- * @returns the rows in catalog order.
2711
- */
2712
2466
  function flattenGroups(groups) {
2713
2467
  return groups.flatMap((group) => group.models.map((model) => ({
2714
2468
  provider: group.id,
@@ -2717,12 +2471,6 @@ window.__ModuleLoader__.load({
2717
2471
  entry: model
2718
2472
  })));
2719
2473
  }
2720
- /**
2721
- * Build the picker's tabs: the all-tab, then one per provider that has a model.
2722
- * @param groups - the shared directory's provider groups.
2723
- * @param allLabel - localized label for the all-tab.
2724
- * @returns the tabs in catalog order.
2725
- */
2726
2474
  function pickerTabs(groups, allLabel = "All") {
2727
2475
  return [{
2728
2476
  id: "*",
@@ -2732,15 +2480,9 @@ window.__ModuleLoader__.load({
2732
2480
  label: group.name
2733
2481
  }))];
2734
2482
  }
2735
- /**
2736
- * @param rows - the flat catalog.
2737
- * @param tab - the tab id; the all-tab keeps every row.
2738
- * @returns the rows the tab shows, in their current order.
2739
- */
2740
2483
  function rowsForTab(rows, tab) {
2741
2484
  return tab === "*" ? rows : rows.filter((row) => row.provider === tab);
2742
2485
  }
2743
- /** Build a reusable search index for the rows in the current provider tab. */
2744
2486
  function createModelSearch(rows) {
2745
2487
  return new TextSearchIndex(rows, (row) => ({ fuzzy: [
2746
2488
  row.entry.name,
@@ -2749,30 +2491,11 @@ window.__ModuleLoader__.load({
2749
2491
  row.provider
2750
2492
  ] }));
2751
2493
  }
2752
- /**
2753
- * Read the reasoning metadata the catalog advertises for one model.
2754
- * @param groups - the shared directory's provider groups.
2755
- * @returns the metadata, or undefined when that model advertises none.
2756
- */
2757
2494
  function reasoningOf(groups) {
2758
2495
  return (provider, model) => groups.find((group) => group.id === provider)?.models.find((candidate) => candidate.id === model)?.reasoning;
2759
2496
  }
2760
2497
  //#endregion
2761
2498
  //#region src/client/ModelPicker.tsx
2762
- /**
2763
- * The model picker: the centered dialog opened from the menu's model row.
2764
- *
2765
- * It is the one place every provider is visible at once — a search field, a tab
2766
- * per provider with a model, and one flat list with each model's metadata line.
2767
- * Favorites lead the list and can be toggled from a row's star without
2768
- * selecting that row. A click commits at once; a rejected commit keeps the
2769
- * dialog open so the user can retry or pick another model.
2770
- */
2771
- /**
2772
- * Render the picker.
2773
- * @param props - the catalog, the live selection, and the picker's verbs.
2774
- * @returns the dialog; nothing while closed.
2775
- */
2776
2499
  function ModelPicker({ open, resolveText, state, live, facts, favorites, busy, rememberedOf, onPick, onToggleFavorite, onReload, onClose, t }) {
2777
2500
  const id = (0, react.useId)();
2778
2501
  const listRef = (0, react.useRef)(null);
@@ -2910,12 +2633,15 @@ window.__ModuleLoader__.load({
2910
2633
  }) }, `${row.provider}/${row.model}`))
2911
2634
  ]
2912
2635
  }),
2913
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2636
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2914
2637
  className: ModelOptions_module_css_default.pickerFooter,
2915
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2638
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2916
2639
  className: ModelOptions_module_css_default.footerHint,
2917
2640
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.ShortcutKeys, { keys: ["Esc"] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("picker.hintClose") })]
2918
- })
2641
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2642
+ className: ModelOptions_module_css_default.footerFavorites,
2643
+ children: t("picker.hintFavorites")
2644
+ })]
2919
2645
  })
2920
2646
  ]
2921
2647
  });
@@ -2931,18 +2657,6 @@ window.__ModuleLoader__.load({
2931
2657
  }
2932
2658
  //#endregion
2933
2659
  //#region src/client/ModelPickerHost.tsx
2934
- /**
2935
- * The composer overlay's picker view: the dialog, its catalog, and its verbs.
2936
- *
2937
- * It lives in `conversation.input.overlay` so it can open after the Host's menu
2938
- * closes or from the toolbar when the current model is missing. Its data comes
2939
- * from the slot entry's injected face.
2940
- */
2941
- /**
2942
- * Render the picker for this session.
2943
- * @param props - session, store, catalog face, and localized copy.
2944
- * @returns the dialog while the store names this session; otherwise nothing.
2945
- */
2946
2660
  function ModelPickerHost({ sessionId, picker, available, directory, load, select, resolveText, factsSource, t }) {
2947
2661
  const request = (0, react.useSyncExternalStore)(picker.subscribe, picker.getSnapshot);
2948
2662
  const state = (0, react.useSyncExternalStore)((listener) => directory.subscribe(listener), () => directory.getSnapshot());
@@ -3031,7 +2745,6 @@ window.__ModuleLoader__.load({
3031
2745
  }, toast.seq)]
3032
2746
  });
3033
2747
  }
3034
- /** The Host skips the root menu when the current model is absent from its catalog. */
3035
2748
  function ModelPickerFallback({ sessionId, picker, available, directory, t }) {
3036
2749
  const state = (0, react.useSyncExternalStore)((listener) => directory.subscribe(listener), () => directory.getSnapshot());
3037
2750
  if (!available || currentCatalogModel(state) !== void 0) return null;
@@ -3048,9 +2761,6 @@ window.__ModuleLoader__.load({
3048
2761
  }
3049
2762
  //#endregion
3050
2763
  //#region src/client/picker-state.ts
3051
- /**
3052
- * @returns a store that starts closed.
3053
- */
3054
2764
  function createPickerStore() {
3055
2765
  let snapshot = { sessionId: null };
3056
2766
  const listeners = /* @__PURE__ */ new Set();
@@ -3084,12 +2794,6 @@ window.__ModuleLoader__.load({
3084
2794
  contextWindow: void 0,
3085
2795
  images: "unknown"
3086
2796
  });
3087
- /**
3088
- * Join the settings mirror with the provider directory.
3089
- * @param deps.describe - the settings mirror's describe face.
3090
- * @param deps.listProviders - reads the LLM provider directory once.
3091
- * @returns the source, plus `start` which wires both reads and returns its disposer.
3092
- */
3093
2797
  function createFactsSource(deps) {
3094
2798
  const listeners = /* @__PURE__ */ new Set();
3095
2799
  let providers = [];
@@ -3126,10 +2830,7 @@ window.__ModuleLoader__.load({
3126
2830
  }
3127
2831
  //#endregion
3128
2832
  //#region src/client/locales.ts
3129
- /** Locale bundles for the all-provider model picker. */
3130
- /** Dictionary namespace owned by this plugin. */
3131
2833
  const NS = "modelSubmenu";
3132
- /** Simplified Chinese dictionary (the key-set source of truth). */
3133
2834
  const zh = {
3134
2835
  "status.loading": "正在加载模型…",
3135
2836
  "status.empty": "没有可用的模型。",
@@ -3149,13 +2850,13 @@ window.__ModuleLoader__.load({
3149
2850
  "picker.favorite": "收藏 {model}",
3150
2851
  "picker.unfavorite": "取消收藏 {model}",
3151
2852
  "picker.hintClose": "关闭",
2853
+ "picker.hintFavorites": "收藏的模型置顶,并加入快捷菜单",
3152
2854
  "meta.effort": "思考",
3153
2855
  "meta.images": "图片输入",
3154
2856
  "effort.label": "推理等级",
3155
2857
  "effort.providerDefault": "Default",
3156
2858
  "effort.useDefault": "切换为默认档位"
3157
2859
  };
3158
- /** English dictionary, checked complete against the zh key set. */
3159
2860
  const en = {
3160
2861
  "status.loading": "Loading models…",
3161
2862
  "status.empty": "No models available.",
@@ -3175,6 +2876,7 @@ window.__ModuleLoader__.load({
3175
2876
  "picker.favorite": "Favorite {model}",
3176
2877
  "picker.unfavorite": "Remove {model} from favorites",
3177
2878
  "picker.hintClose": "close",
2879
+ "picker.hintFavorites": "Favorites first, also in the quick menu",
3178
2880
  "meta.effort": "Effort",
3179
2881
  "meta.images": "Images",
3180
2882
  "effort.label": "Reasoning effort",
@@ -3183,17 +2885,6 @@ window.__ModuleLoader__.load({
3183
2885
  };
3184
2886
  //#endregion
3185
2887
  //#region src/client/index.ts
3186
- /**
3187
- * Cordis services required by the browser half. `slots` is the contribution
3188
- * registry, `sessions` tells whether a session may select a model,
3189
- * `modelDirectories` owns the per-session catalog snapshot both entries render
3190
- * from, and `configForms` carries the settings provider's shared describe
3191
- * mirror, which answers each model's context window and accepted modalities.
3192
- * `remote`, `remote.llm`, and `remote.session` are declared because a service
3193
- * method runs on the calling context: `directoryFor` reads
3194
- * `this.ctx.remote.session`, and the provider directory that names each
3195
- * settings address is read through `this.ctx.remote.llm`.
3196
- */
3197
2888
  const inject = [
3198
2889
  "configForms",
3199
2890
  "locale",
@@ -3204,15 +2895,6 @@ window.__ModuleLoader__.load({
3204
2895
  "sessions",
3205
2896
  "slots"
3206
2897
  ];
3207
- /**
3208
- * Client plugin body: register this plugin's dictionaries, then contribute the
3209
- * menu bridge, the toolbar entry for a missing current model, the picker
3210
- * overlay, and the tint for the collapsed trigger's effort caption.
3211
- *
3212
- * The overlay stays mounted when the Host closes the model menu, allowing the
3213
- * picker to open after the menu has been removed.
3214
- * @param ctx - client root context.
3215
- */
3216
2898
  function apply(ctx) {
3217
2899
  if (typeof document !== "undefined") ctx.effect(() => {
3218
2900
  const style = document.createElement("style");
@@ -3240,11 +2922,6 @@ window.__ModuleLoader__.load({
3240
2922
  listProviders: () => scope.remote.llm.listConfigurableProviders()
3241
2923
  });
3242
2924
  scope.effect(() => facts.start(), "dsh-model-submenu: model metadata");
3243
- /**
3244
- * Build one entry's business face for a session.
3245
- * @param sessionId - the slot's session scope.
3246
- * @returns the catalog face plus the session and store both entries need.
3247
- */
3248
2925
  const faceOf = (sessionId) => {
3249
2926
  const key = sessionId;
3250
2927
  const directory = models.directoryFor(key);