@lynn123411/dsh-model-submenu 0.3.17 → 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,66 +113,36 @@ 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_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{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",
144
+ "modelBrowse": "TcCbqa_modelBrowse",
145
+ "modelCell": "TcCbqa_modelCell",
265
146
  "notice": "TcCbqa_notice",
266
147
  "pickerContent": "TcCbqa_pickerContent",
267
148
  "pickerDialog": "TcCbqa_pickerDialog",
@@ -272,6 +153,12 @@ window.__ModuleLoader__.load({
272
153
  "pickerSearchInput": "TcCbqa_pickerSearchInput",
273
154
  "pickerTab": "TcCbqa_pickerTab",
274
155
  "pickerTabs": "TcCbqa_pickerTabs",
156
+ "quickBadge": "TcCbqa_quickBadge",
157
+ "quickCheck": "TcCbqa_quickCheck",
158
+ "quickCopy": "TcCbqa_quickCopy",
159
+ "quickFooter": "TcCbqa_quickFooter",
160
+ "quickName": "TcCbqa_quickName",
161
+ "quickOption": "TcCbqa_quickOption",
275
162
  "retry": "TcCbqa_retry",
276
163
  "row": "TcCbqa_row",
277
164
  "rowBadge": "TcCbqa_rowBadge",
@@ -290,28 +177,6 @@ window.__ModuleLoader__.load({
290
177
  };
291
178
  //#endregion
292
179
  //#region src/client/EffortSlider.tsx
293
- /**
294
- * The reasoning-level slider that replaces the Host's effort drill.
295
- *
296
- * The Host's second menu cell is a button that drills into a list of levels.
297
- * This slider sits inside that same cell, between the Host's label and value, so
298
- * the levels are reachable without leaving the menu. The levels are discrete but
299
- * the drag is not: the knob follows the pointer continuously, the level it
300
- * reports is the detent nearest that position, and letting go eases the knob onto
301
- * that detent and commits once. Keyboard arrows step and commit immediately.
302
- *
303
- * The fill takes the level's color, so the track and the two captions read as
304
- * one signal: "off" is neutral, the levels above it walk a blue-to-violet ramp,
305
- * and only the top level fills with the whole gradient.
306
- *
307
- * "Provider default" is not a detent: it is a state, drawn as an empty track
308
- * with a hollow knob, so it never reads as the lowest level.
309
- */
310
- /**
311
- * Render the slider.
312
- * @param props - levels, the level in force, and the commit path.
313
- * @returns one focusable slider over the discrete levels.
314
- */
315
180
  function EffortSlider({ steps, current, defaultActive, defaultIndex, defaultLabel, busy, label, onCommit }) {
316
181
  const trackRef = (0, react.useRef)(null);
317
182
  const dragRef = (0, react.useRef)(null);
@@ -439,41 +304,218 @@ window.__ModuleLoader__.load({
439
304
  });
440
305
  }
441
306
  //#endregion
307
+ //#region src/client/effort-memory.ts
308
+ const EFFORTS_KEY = "dsh-model-submenu.efforts";
309
+ function readEfforts(storage) {
310
+ const raw = getItem$1(storage);
311
+ if (raw === null) return [];
312
+ let parsed;
313
+ try {
314
+ parsed = JSON.parse(raw);
315
+ } catch {
316
+ return [];
317
+ }
318
+ if (!Array.isArray(parsed)) return [];
319
+ return parsed.filter((row) => typeof row === "object" && row !== null && typeof row.provider === "string" && typeof row.model === "string" && typeof row.effort === "string" && row.effort !== "");
320
+ }
321
+ function effortFor(memory, provider, model) {
322
+ return memory.find((row) => row.provider === provider && row.model === model)?.effort;
323
+ }
324
+ function rememberEffort(storage, provider, model, effort) {
325
+ const rest = readEfforts(storage).filter((row) => row.provider !== provider || row.model !== model);
326
+ const next = effort === void 0 ? rest : [...rest, {
327
+ provider,
328
+ model,
329
+ effort
330
+ }];
331
+ try {
332
+ storage?.setItem(EFFORTS_KEY, JSON.stringify(next));
333
+ } catch {}
334
+ return next;
335
+ }
336
+ function getItem$1(storage) {
337
+ try {
338
+ return storage?.getItem("dsh-model-submenu.efforts") ?? null;
339
+ } catch {
340
+ return null;
341
+ }
342
+ }
343
+ //#endregion
344
+ //#region src/client/favorites.ts
345
+ const FAVORITES_KEY = "dsh-model-submenu.favorites";
346
+ function storageOf() {
347
+ try {
348
+ return globalThis.localStorage;
349
+ } catch {
350
+ return;
351
+ }
352
+ }
353
+ function readFavorites(storage) {
354
+ const raw = getItem(storage);
355
+ if (raw === null) return [];
356
+ let parsed;
357
+ try {
358
+ parsed = JSON.parse(raw);
359
+ } catch {
360
+ return [];
361
+ }
362
+ if (!Array.isArray(parsed)) return [];
363
+ return parsed.filter((row) => typeof row === "object" && row !== null && typeof row.provider === "string" && typeof row.model === "string");
364
+ }
365
+ function toggleFavorite(storage, provider, model) {
366
+ const current = readFavorites(storage);
367
+ const next = isFavorite(current, provider, model) ? current.filter((row) => row.provider !== provider || row.model !== model) : [...current, {
368
+ provider,
369
+ model
370
+ }];
371
+ try {
372
+ storage?.setItem(FAVORITES_KEY, JSON.stringify(next));
373
+ } catch {}
374
+ return next;
375
+ }
376
+ function isFavorite(favorites, provider, model) {
377
+ return favorites.some((row) => row.provider === provider && row.model === model);
378
+ }
379
+ function orderWithFavorites(rows, favorited) {
380
+ const starred = rows.filter(favorited);
381
+ if (starred.length === 0) return rows;
382
+ return [...starred, ...rows.filter((row) => !favorited(row))];
383
+ }
384
+ function getItem(storage) {
385
+ try {
386
+ return storage?.getItem("dsh-model-submenu.favorites") ?? null;
387
+ } catch {
388
+ return null;
389
+ }
390
+ }
391
+ //#endregion
392
+ //#region src/client/QuickModels.tsx
393
+ const QUICK_MODELS_PANE = "lynn-quick-models";
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 }) {
401
+ const state = (0, react.useSyncExternalStore)((listener) => directory.subscribe(listener), () => directory.getSnapshot());
402
+ const [favorites] = (0, react.useState)(() => readFavorites(storageOf()));
403
+ const open = (0, react.useRef)(false);
404
+ (0, react.useLayoutEffect)(() => {
405
+ open.current = true;
406
+ return () => {
407
+ open.current = false;
408
+ };
409
+ }, []);
410
+ const live = selectionOf(state);
411
+ const busy = locked || state.pending !== null;
412
+ const groups = state.groups.flatMap((group) => {
413
+ const models = group.models.filter((model) => live !== null && sameModel(live, group.id, model.id) || isFavorite(favorites, group.id, model.id));
414
+ return models.length === 0 ? [] : [{
415
+ ...group,
416
+ models
417
+ }];
418
+ });
419
+ const choose = async (provider, model) => {
420
+ if (busy || directory.getSnapshot().pending !== null) return;
421
+ const remembered = effortFor(readEfforts(storageOf()), provider, model.id);
422
+ const selection = planModelCommit(live, provider, model.id, () => model.reasoning, remembered);
423
+ if (selection === null) {
424
+ dismiss();
425
+ return;
426
+ }
427
+ const result = await select(selection);
428
+ if (result === void 0) return;
429
+ if (result.ok) {
430
+ if (open.current) dismiss();
431
+ return;
432
+ }
433
+ reportFailure(result.error.code === "session/writer-held" ? t("error.sessionInUse") : t("error.action", { message: `${result.error.code}: ${result.error.message}` }));
434
+ };
435
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
436
+ role: "menu",
437
+ "aria-label": t("picker.quick"),
438
+ "aria-busy": busy,
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", {
483
+ type: "button",
484
+ role: "menuitem",
485
+ "aria-haspopup": "dialog",
486
+ className: ModelOptions_module_css_default.quickOption,
487
+ disabled: busy,
488
+ onClick: () => {
489
+ if (busy || directory.getSnapshot().pending !== null) return;
490
+ dismiss();
491
+ picker.open(sessionId);
492
+ },
493
+ onKeyDown: confirmOnTab,
494
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
495
+ className: ModelOptions_module_css_default.quickCopy,
496
+ children: t("picker.browseAll")
497
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular, { size: 12 })]
498
+ })
499
+ })
500
+ ]
501
+ });
502
+ }
503
+ //#endregion
442
504
  //#region src/client/ModelMenuBridge.tsx
443
- /**
444
- * Bridge the Host's own model menu: the model cell opens the all-provider
445
- * picker, and the effort cell carries the reasoning-level slider.
446
- *
447
- * The Host owns the root menu's model and effort cells and opens a submenu for each.
448
- * While the root pane is open, this entry redirects the first cell to the model
449
- * dialog and mounts the slider in the second cell.
450
- *
451
- * Only the model menu's own direct buttons with the expected label, value and
452
- * chevron are recognized. The options slot output sits in its own wrapper,
453
- * so other plugins' rows never join that list.
454
- *
455
- * Clicking the cell's label switches to the provider default, which is a state
456
- * rather than a detent: the slider shows it as an empty track under a hollow
457
- * knob, so it never reads as the weakest level.
458
- */
459
505
  const cellLabel = ":scope > span[class*=\"cellLabel\"]";
460
506
  const cellValue = ":scope > span[class*=\"cellValue\"]";
461
507
  const cellChevron = ":scope > svg[class*=\"cellChevron\"]";
462
- /** Match only the host-owned buttons in the root model menu. */
463
508
  function hostCell(surface, index) {
464
509
  const button = surface.querySelectorAll(":scope > button[role=\"menuitem\"]")[index];
465
510
  if (!button?.querySelector(cellLabel) || !button.querySelector(cellValue) || !button.querySelector(cellChevron)) return null;
466
511
  return button;
467
512
  }
468
- /**
469
- * Render the marker, redirect the model cell, and mount the effort slider.
470
- * @param props - menu state, session, catalog face, and localized copy.
471
- * @returns an inert marker plus the slider while the effort cell is present.
472
- */
473
- function ModelMenuBridge({ sessionId, picker, locked, dismiss, reportFailure, available, directory, select, t }) {
513
+ function ModelMenuBridge({ sessionId, picker, locked, dismiss, openPane, reportFailure, available, directory, select, t }) {
474
514
  const markerRef = (0, react.useRef)(null);
475
515
  const sliderRef = (0, react.useRef)(null);
476
516
  const [surface, setSurface] = (0, react.useState)(null);
517
+ const [modelRow, setModelRow] = (0, react.useState)(null);
518
+ const [browseMount, setBrowseMount] = (0, react.useState)(null);
477
519
  const [effortRow, setEffortRow] = (0, react.useState)(null);
478
520
  const [rowLabel, setRowLabel] = (0, react.useState)(null);
479
521
  const state = (0, react.useSyncExternalStore)((listener) => directory.subscribe(listener), () => directory.getSnapshot());
@@ -487,6 +529,7 @@ window.__ModuleLoader__.load({
487
529
  const defaultIndex = declared >= 0 ? declared : 0;
488
530
  const busy = locked || state.pending !== null;
489
531
  const canDefault = !busy && !defaultActive;
532
+ const showQuickModels = available && modelRow !== null && browseMount !== null;
490
533
  const showSlider = available && levels.length >= 2 && effortRow !== null;
491
534
  (0, react.useLayoutEffect)(() => {
492
535
  const nextSurface = markerRef.current?.closest("[data-model-menu][role=\"menu\"]") ?? null;
@@ -496,6 +539,33 @@ window.__ModuleLoader__.load({
496
539
  const nextLabel = nextRow?.querySelector(cellLabel)?.textContent?.trim() ?? "";
497
540
  if (nextLabel !== (rowLabel ?? "")) setRowLabel(nextLabel);
498
541
  });
542
+ (0, react.useLayoutEffect)(() => {
543
+ const menu = markerRef.current?.closest("[data-model-menu][role=\"menu\"]");
544
+ const row = available && menu ? hostCell(menu, 0) : null;
545
+ if (row === null) {
546
+ setModelRow(null);
547
+ setBrowseMount(null);
548
+ return;
549
+ }
550
+ const mount = row.ownerDocument.createElement("span");
551
+ mount.style.display = "contents";
552
+ row.after(mount);
553
+ const previousPane = row.dataset.modelMenuPane;
554
+ const previousPopup = row.getAttribute("aria-haspopup");
555
+ row.dataset.modelMenuPane = QUICK_MODELS_PANE;
556
+ row.setAttribute("aria-haspopup", "menu");
557
+ row.classList.add(ModelOptions_module_css_default.modelCell);
558
+ setModelRow(row);
559
+ setBrowseMount(mount);
560
+ return () => {
561
+ mount.remove();
562
+ row.classList.remove(ModelOptions_module_css_default.modelCell);
563
+ if (previousPane === void 0) delete row.dataset.modelMenuPane;
564
+ else row.dataset.modelMenuPane = previousPane;
565
+ if (previousPopup === null) row.removeAttribute("aria-haspopup");
566
+ else row.setAttribute("aria-haspopup", previousPopup);
567
+ };
568
+ }, [available]);
499
569
  const submit = (selection) => {
500
570
  if (selection === null || busy || directory.getSnapshot().pending !== null) return;
501
571
  select(selection).then((result) => {
@@ -514,11 +584,14 @@ window.__ModuleLoader__.load({
514
584
  if (live === null) return;
515
585
  submit(planEffortCommit(live, void 0));
516
586
  };
587
+ const openQuickModels = () => openPane({
588
+ key: QUICK_MODELS_PANE,
589
+ title: t("picker.quick")
590
+ });
517
591
  const latest = (0, react.useRef)({
518
- sessionId,
519
- picker,
520
- dismiss,
521
- available,
592
+ modelRow,
593
+ showQuickModels,
594
+ openQuickModels,
522
595
  busy,
523
596
  showSlider,
524
597
  effortRow,
@@ -527,10 +600,9 @@ window.__ModuleLoader__.load({
527
600
  });
528
601
  (0, react.useLayoutEffect)(() => {
529
602
  latest.current = {
530
- sessionId,
531
- picker,
532
- dismiss,
533
- available,
603
+ modelRow,
604
+ showQuickModels,
605
+ openQuickModels,
534
606
  busy,
535
607
  showSlider,
536
608
  effortRow,
@@ -543,13 +615,11 @@ window.__ModuleLoader__.load({
543
615
  const redirect = (event) => {
544
616
  const target = event.target;
545
617
  const request = latest.current;
546
- if (!(target instanceof Node) || event.defaultPrevented || !request.available) return;
547
- if (hostCell(surface, 0)?.contains(target)) {
618
+ if (!(target instanceof Node) || event.defaultPrevented) return;
619
+ if (request.showQuickModels && request.modelRow?.contains(target)) {
548
620
  event.preventDefault();
549
621
  event.stopPropagation();
550
- if (request.busy) return;
551
- request.dismiss();
552
- request.picker.open(request.sessionId);
622
+ if (!request.busy) request.openQuickModels();
553
623
  return;
554
624
  }
555
625
  const row = request.effortRow;
@@ -600,40 +670,49 @@ window.__ModuleLoader__.load({
600
670
  canDefault,
601
671
  t
602
672
  ]);
603
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
604
- ref: markerRef,
605
- hidden: true
606
- }), showSlider && effortRow !== null && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
607
- ref: sliderRef,
608
- className: ModelOptions_module_css_default.sliderCell,
609
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EffortSlider, {
610
- steps: levels,
611
- current: currentIndex,
612
- defaultActive,
613
- defaultIndex,
614
- defaultLabel: t("effort.providerDefault"),
615
- busy,
616
- label: rowLabel !== null && rowLabel !== "" ? rowLabel : t("effort.label"),
617
- onCommit: commit
618
- }, JSON.stringify([current?.provider, current?.model]))
619
- }), effortRow)] });
673
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
674
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
675
+ ref: markerRef,
676
+ hidden: true
677
+ }),
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,
681
+ disabled: busy,
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
+ })
697
+ }), browseMount),
698
+ showSlider && effortRow !== null && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
699
+ ref: sliderRef,
700
+ className: ModelOptions_module_css_default.sliderCell,
701
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EffortSlider, {
702
+ steps: levels,
703
+ current: currentIndex,
704
+ defaultActive,
705
+ defaultIndex,
706
+ defaultLabel: t("effort.providerDefault"),
707
+ busy,
708
+ label: rowLabel !== null && rowLabel !== "" ? rowLabel : t("effort.label"),
709
+ onCommit: commit
710
+ }, JSON.stringify([current?.provider, current?.model]))
711
+ }), effortRow)
712
+ ] });
620
713
  }
621
714
  //#endregion
622
715
  //#region src/client/icons.tsx
623
- /**
624
- * The one glyph this plugin draws itself.
625
- *
626
- * The shared icon library carries no star, so the favorite mark is defined here:
627
- * a five-point star whose outline and fill use the same path, which keeps the
628
- * hover-only outline and the standing filled state identical in geometry.
629
- */
630
- /**
631
- * Render the favorite star.
632
- * @param props.filled - draw the solid star; otherwise the outline.
633
- * @param props.size - square edge in pixels, matching the shared icon set's default.
634
- * @param props.className - extra class for colour and placement.
635
- * @returns the inline SVG.
636
- */
637
716
  function StarIcon({ filled, size = 14, className }) {
638
717
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
639
718
  width: size,
@@ -650,11 +729,6 @@ window.__ModuleLoader__.load({
650
729
  }
651
730
  //#endregion
652
731
  //#region src/client/ModelRow.tsx
653
- /**
654
- * Render one model row.
655
- * @param props - the row's content and behaviour.
656
- * @returns the row element.
657
- */
658
732
  function ModelRow({ name, badge, selected, busy, favorited, meta, starLabel, onPick, onToggleFavorite, children }) {
659
733
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
660
734
  className: ModelOptions_module_css_default.row,
@@ -705,83 +779,7 @@ window.__ModuleLoader__.load({
705
779
  });
706
780
  }
707
781
  //#endregion
708
- //#region src/client/favorites.ts
709
- /** The single browser-wide storage key holding the whole table. */
710
- const FAVORITES_KEY = "dsh-model-submenu.favorites";
711
- /**
712
- * Read the table, keeping only rows that name both halves.
713
- * @param storage - browser storage, or undefined when the browser withholds it.
714
- * @returns the stored favorites in stored order; empty when unreadable.
715
- */
716
- function readFavorites(storage) {
717
- const raw = getItem$1(storage);
718
- if (raw === null) return [];
719
- let parsed;
720
- try {
721
- parsed = JSON.parse(raw);
722
- } catch {
723
- return [];
724
- }
725
- if (!Array.isArray(parsed)) return [];
726
- return parsed.filter((row) => typeof row === "object" && row !== null && typeof row.provider === "string" && typeof row.model === "string");
727
- }
728
- /**
729
- * Add or remove one model, writing the whole table back.
730
- * @param storage - browser storage, or undefined when writes are unavailable.
731
- * @param provider - the provider route key.
732
- * @param model - the model id inside that provider.
733
- * @returns the table after the change, whether or not the write landed.
734
- */
735
- function toggleFavorite(storage, provider, model) {
736
- const current = readFavorites(storage);
737
- const next = isFavorite(current, provider, model) ? current.filter((row) => row.provider !== provider || row.model !== model) : [...current, {
738
- provider,
739
- model
740
- }];
741
- try {
742
- storage?.setItem(FAVORITES_KEY, JSON.stringify(next));
743
- } catch {}
744
- return next;
745
- }
746
- /**
747
- * @param favorites - the table to search.
748
- * @param provider - the provider route key.
749
- * @param model - the model id inside that provider.
750
- * @returns whether that exact pair is favorited.
751
- */
752
- function isFavorite(favorites, provider, model) {
753
- return favorites.some((row) => row.provider === provider && row.model === model);
754
- }
755
- /**
756
- * Stable-partition a catalog so favorited rows lead, each part keeping the
757
- * catalog's own order.
758
- * @param rows - the catalog in its display order.
759
- * @param favorited - predicate answering whether one row is favorited.
760
- * @returns a new list; the input order when nothing is favorited.
761
- */
762
- function orderWithFavorites(rows, favorited) {
763
- const starred = rows.filter(favorited);
764
- if (starred.length === 0) return rows;
765
- return [...starred, ...rows.filter((row) => !favorited(row))];
766
- }
767
- function getItem$1(storage) {
768
- try {
769
- return storage?.getItem("dsh-model-submenu.favorites") ?? null;
770
- } catch {
771
- return null;
772
- }
773
- }
774
- //#endregion
775
782
  //#region src/client/model-facts.ts
776
- /**
777
- * The model knowledge a shipped adapter carries for its own account route.
778
- *
779
- * The account route has no `models` list on purpose: the account listing
780
- * supplies the catalog and settings only carry per-model overrides. The same
781
- * adapter family ships a default catalog for its API-key route, and the account
782
- * route serves the same models, so those entries answer what the account
783
- * profile cannot. Ids and facts mirror the adapter's own table.
784
- */
785
783
  const FAMILY_DEFAULTS = { "deepseek-account": [{
786
784
  id: "deepseek-flash",
787
785
  contextWindow: 1e6,
@@ -791,12 +789,6 @@ window.__ModuleLoader__.load({
791
789
  contextWindow: 1e6,
792
790
  images: false
793
791
  }] };
794
- /**
795
- * Build the fact lookup from the settings answer.
796
- * @param providers - provider directory rows giving each route's settings address.
797
- * @param namespaces - the describe answer's namespace views.
798
- * @returns a lookup answering both fields for one provider and model.
799
- */
800
792
  function buildModelFacts(providers, namespaces) {
801
793
  const byName = new Map(namespaces.map((row) => [row.ns, row.value]));
802
794
  const profiles = /* @__PURE__ */ new Map();
@@ -826,14 +818,6 @@ window.__ModuleLoader__.load({
826
818
  };
827
819
  };
828
820
  }
829
- /**
830
- * Read one model entry's accepted image modalities.
831
- *
832
- * The two adapter families disagree about an omission. The Messages family
833
- * names the field `inputModalities`, and leaving it out means text only. The
834
- * pi-ai family names it `input`, and an empty or absent list defers to the
835
- * route's `defaultInput`; with no route default the answer stays unknown.
836
- */
837
821
  function imageAnswer(entry, profile) {
838
822
  if (Array.isArray(entry.inputModalities)) return containsImage(entry.inputModalities);
839
823
  const defaultInput = Array.isArray(profile.defaultInput) ? profile.defaultInput : void 0;
@@ -843,7 +827,6 @@ window.__ModuleLoader__.load({
843
827
  }
844
828
  return defaultInput === void 0 ? "no" : containsImage(defaultInput);
845
829
  }
846
- /** One model's declared override, when the route keeps a `modelOverrides` table. */
847
830
  function readOverride(profile, model) {
848
831
  const overrides = profile?.modelOverrides;
849
832
  if (!isRecord(overrides)) return void 0;
@@ -853,25 +836,11 @@ window.__ModuleLoader__.load({
853
836
  function containsImage(modalities) {
854
837
  return modalities.includes("image") ? "yes" : "no";
855
838
  }
856
- /**
857
- * Abbreviate one capacity the way the metadata line shows it.
858
- * @param tokens - exact advertised capacity in tokens.
859
- * @returns e.g. `1M ctx`, `1.5M ctx`, `272k ctx`, or `512 ctx` below a thousand.
860
- */
861
839
  function formatContextWindow(tokens) {
862
840
  if (tokens >= 1e6) return `${trimNumber(tokens / 1e6)}M ctx`;
863
841
  if (tokens >= 1e3) return `${Math.round(tokens / 1e3)}k ctx`;
864
842
  return `${tokens} ctx`;
865
843
  }
866
- /**
867
- * Build the metadata line's segments.
868
- * @param input.providerName - the provider's display name, omitted inside that provider's own tab.
869
- * @param input.facts - what the settings document answered.
870
- * @param input.thinks - whether the catalog advertises reasoning levels for this model.
871
- * @param input.effortLabel - the localized word for the reasoning segment.
872
- * @param input.imageLabel - the localized word for the image segment.
873
- * @returns the segments to join; an empty list means show no line.
874
- */
875
844
  function metaSegments(input) {
876
845
  const segments = [];
877
846
  if (input.providerName !== void 0) segments.push(input.providerName);
@@ -2494,11 +2463,6 @@ window.__ModuleLoader__.load({
2494
2463
  return ranked.map((entry) => this.#items[entry.index]);
2495
2464
  }
2496
2465
  };
2497
- /**
2498
- * Flatten the catalog to one row per model.
2499
- * @param groups - the shared directory's provider groups, in display order.
2500
- * @returns the rows in catalog order.
2501
- */
2502
2466
  function flattenGroups(groups) {
2503
2467
  return groups.flatMap((group) => group.models.map((model) => ({
2504
2468
  provider: group.id,
@@ -2507,12 +2471,6 @@ window.__ModuleLoader__.load({
2507
2471
  entry: model
2508
2472
  })));
2509
2473
  }
2510
- /**
2511
- * Build the picker's tabs: the all-tab, then one per provider that has a model.
2512
- * @param groups - the shared directory's provider groups.
2513
- * @param allLabel - localized label for the all-tab.
2514
- * @returns the tabs in catalog order.
2515
- */
2516
2474
  function pickerTabs(groups, allLabel = "All") {
2517
2475
  return [{
2518
2476
  id: "*",
@@ -2522,15 +2480,9 @@ window.__ModuleLoader__.load({
2522
2480
  label: group.name
2523
2481
  }))];
2524
2482
  }
2525
- /**
2526
- * @param rows - the flat catalog.
2527
- * @param tab - the tab id; the all-tab keeps every row.
2528
- * @returns the rows the tab shows, in their current order.
2529
- */
2530
2483
  function rowsForTab(rows, tab) {
2531
2484
  return tab === "*" ? rows : rows.filter((row) => row.provider === tab);
2532
2485
  }
2533
- /** Build a reusable search index for the rows in the current provider tab. */
2534
2486
  function createModelSearch(rows) {
2535
2487
  return new TextSearchIndex(rows, (row) => ({ fuzzy: [
2536
2488
  row.entry.name,
@@ -2539,30 +2491,11 @@ window.__ModuleLoader__.load({
2539
2491
  row.provider
2540
2492
  ] }));
2541
2493
  }
2542
- /**
2543
- * Read the reasoning metadata the catalog advertises for one model.
2544
- * @param groups - the shared directory's provider groups.
2545
- * @returns the metadata, or undefined when that model advertises none.
2546
- */
2547
2494
  function reasoningOf(groups) {
2548
2495
  return (provider, model) => groups.find((group) => group.id === provider)?.models.find((candidate) => candidate.id === model)?.reasoning;
2549
2496
  }
2550
2497
  //#endregion
2551
2498
  //#region src/client/ModelPicker.tsx
2552
- /**
2553
- * The model picker: the centered dialog opened from the menu's model row.
2554
- *
2555
- * It is the one place every provider is visible at once — a search field, a tab
2556
- * per provider with a model, and one flat list with each model's metadata line.
2557
- * Favorites lead the list and can be toggled from a row's star without
2558
- * selecting that row. A click commits at once; a rejected commit keeps the
2559
- * dialog open so the user can retry or pick another model.
2560
- */
2561
- /**
2562
- * Render the picker.
2563
- * @param props - the catalog, the live selection, and the picker's verbs.
2564
- * @returns the dialog; nothing while closed.
2565
- */
2566
2499
  function ModelPicker({ open, resolveText, state, live, facts, favorites, busy, rememberedOf, onPick, onToggleFavorite, onReload, onClose, t }) {
2567
2500
  const id = (0, react.useId)();
2568
2501
  const listRef = (0, react.useRef)(null);
@@ -2700,12 +2633,15 @@ window.__ModuleLoader__.load({
2700
2633
  }) }, `${row.provider}/${row.model}`))
2701
2634
  ]
2702
2635
  }),
2703
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2636
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2704
2637
  className: ModelOptions_module_css_default.pickerFooter,
2705
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2638
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2706
2639
  className: ModelOptions_module_css_default.footerHint,
2707
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") })]
2708
- })
2641
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2642
+ className: ModelOptions_module_css_default.footerFavorites,
2643
+ children: t("picker.hintFavorites")
2644
+ })]
2709
2645
  })
2710
2646
  ]
2711
2647
  });
@@ -2720,76 +2656,7 @@ window.__ModuleLoader__.load({
2720
2656
  }).join(" · ");
2721
2657
  }
2722
2658
  //#endregion
2723
- //#region src/client/effort-memory.ts
2724
- /** The single browser-wide storage key holding the whole memory. */
2725
- const EFFORTS_KEY = "dsh-model-submenu.efforts";
2726
- /**
2727
- * Read the memory, keeping only rows naming both halves and a level.
2728
- * @param storage - browser storage, or undefined when the browser withholds it.
2729
- * @returns the remembered rows; empty when unreadable.
2730
- */
2731
- function readEfforts(storage) {
2732
- const raw = getItem(storage);
2733
- if (raw === null) return [];
2734
- let parsed;
2735
- try {
2736
- parsed = JSON.parse(raw);
2737
- } catch {
2738
- return [];
2739
- }
2740
- if (!Array.isArray(parsed)) return [];
2741
- return parsed.filter((row) => typeof row === "object" && row !== null && typeof row.provider === "string" && typeof row.model === "string" && typeof row.effort === "string" && row.effort !== "");
2742
- }
2743
- /**
2744
- * @param memory - the rows to search.
2745
- * @param provider - the provider route key.
2746
- * @param model - the model id inside that provider.
2747
- * @returns the level last chosen for that exact model, or undefined.
2748
- */
2749
- function effortFor(memory, provider, model) {
2750
- return memory.find((row) => row.provider === provider && row.model === model)?.effort;
2751
- }
2752
- /**
2753
- * Remember one model's level, or forget it when the choice is the provider default.
2754
- * @param storage - browser storage, or undefined when writes are unavailable.
2755
- * @param provider - the provider route key.
2756
- * @param model - the model id inside that provider.
2757
- * @param effort - the chosen level, undefined meaning the provider default.
2758
- * @returns the memory after the change, whether or not the write landed.
2759
- */
2760
- function rememberEffort(storage, provider, model, effort) {
2761
- const rest = readEfforts(storage).filter((row) => row.provider !== provider || row.model !== model);
2762
- const next = effort === void 0 ? rest : [...rest, {
2763
- provider,
2764
- model,
2765
- effort
2766
- }];
2767
- try {
2768
- storage?.setItem(EFFORTS_KEY, JSON.stringify(next));
2769
- } catch {}
2770
- return next;
2771
- }
2772
- function getItem(storage) {
2773
- try {
2774
- return storage?.getItem("dsh-model-submenu.efforts") ?? null;
2775
- } catch {
2776
- return null;
2777
- }
2778
- }
2779
- //#endregion
2780
2659
  //#region src/client/ModelPickerHost.tsx
2781
- /**
2782
- * The composer overlay's picker view: the dialog, its catalog, and its verbs.
2783
- *
2784
- * It lives in `conversation.input.overlay` so it can open after the Host's menu
2785
- * closes or from the toolbar when the current model is missing. Its data comes
2786
- * from the slot entry's injected face.
2787
- */
2788
- /**
2789
- * Render the picker for this session.
2790
- * @param props - session, store, catalog face, and localized copy.
2791
- * @returns the dialog while the store names this session; otherwise nothing.
2792
- */
2793
2660
  function ModelPickerHost({ sessionId, picker, available, directory, load, select, resolveText, factsSource, t }) {
2794
2661
  const request = (0, react.useSyncExternalStore)(picker.subscribe, picker.getSnapshot);
2795
2662
  const state = (0, react.useSyncExternalStore)((listener) => directory.subscribe(listener), () => directory.getSnapshot());
@@ -2878,7 +2745,6 @@ window.__ModuleLoader__.load({
2878
2745
  }, toast.seq)]
2879
2746
  });
2880
2747
  }
2881
- /** The Host skips the root menu when the current model is absent from its catalog. */
2882
2748
  function ModelPickerFallback({ sessionId, picker, available, directory, t }) {
2883
2749
  const state = (0, react.useSyncExternalStore)((listener) => directory.subscribe(listener), () => directory.getSnapshot());
2884
2750
  if (!available || currentCatalogModel(state) !== void 0) return null;
@@ -2893,19 +2759,8 @@ window.__ModuleLoader__.load({
2893
2759
  children: t("picker.browse")
2894
2760
  });
2895
2761
  }
2896
- /** Isolate the browser's storage so a locked-down browser reads as "no favorites". */
2897
- function storageOf() {
2898
- try {
2899
- return globalThis.localStorage;
2900
- } catch {
2901
- return;
2902
- }
2903
- }
2904
2762
  //#endregion
2905
2763
  //#region src/client/picker-state.ts
2906
- /**
2907
- * @returns a store that starts closed.
2908
- */
2909
2764
  function createPickerStore() {
2910
2765
  let snapshot = { sessionId: null };
2911
2766
  const listeners = /* @__PURE__ */ new Set();
@@ -2939,12 +2794,6 @@ window.__ModuleLoader__.load({
2939
2794
  contextWindow: void 0,
2940
2795
  images: "unknown"
2941
2796
  });
2942
- /**
2943
- * Join the settings mirror with the provider directory.
2944
- * @param deps.describe - the settings mirror's describe face.
2945
- * @param deps.listProviders - reads the LLM provider directory once.
2946
- * @returns the source, plus `start` which wires both reads and returns its disposer.
2947
- */
2948
2797
  function createFactsSource(deps) {
2949
2798
  const listeners = /* @__PURE__ */ new Set();
2950
2799
  let providers = [];
@@ -2981,10 +2830,7 @@ window.__ModuleLoader__.load({
2981
2830
  }
2982
2831
  //#endregion
2983
2832
  //#region src/client/locales.ts
2984
- /** Locale bundles for the all-provider model picker. */
2985
- /** Dictionary namespace owned by this plugin. */
2986
2833
  const NS = "modelSubmenu";
2987
- /** Simplified Chinese dictionary (the key-set source of truth). */
2988
2834
  const zh = {
2989
2835
  "status.loading": "正在加载模型…",
2990
2836
  "status.empty": "没有可用的模型。",
@@ -2995,6 +2841,8 @@ window.__ModuleLoader__.load({
2995
2841
  "error.sessionInUse": "当前会话已被占用,可能是其他正在运行的 DSH 导致的(如其他 dsh web、桌面端),请退出其他正在运行的 DSH 后重试。",
2996
2842
  "picker.title": "切换模型",
2997
2843
  "picker.browse": "浏览模型",
2844
+ "picker.browseAll": "浏览全部模型",
2845
+ "picker.quick": "快捷切换模型",
2998
2846
  "picker.close": "关闭",
2999
2847
  "picker.search": "搜索模型或提供商…",
3000
2848
  "picker.searchEmpty": "没有匹配的模型。",
@@ -3002,13 +2850,13 @@ window.__ModuleLoader__.load({
3002
2850
  "picker.favorite": "收藏 {model}",
3003
2851
  "picker.unfavorite": "取消收藏 {model}",
3004
2852
  "picker.hintClose": "关闭",
2853
+ "picker.hintFavorites": "收藏的模型置顶,并加入快捷菜单",
3005
2854
  "meta.effort": "思考",
3006
2855
  "meta.images": "图片输入",
3007
2856
  "effort.label": "推理等级",
3008
2857
  "effort.providerDefault": "Default",
3009
2858
  "effort.useDefault": "切换为默认档位"
3010
2859
  };
3011
- /** English dictionary, checked complete against the zh key set. */
3012
2860
  const en = {
3013
2861
  "status.loading": "Loading models…",
3014
2862
  "status.empty": "No models available.",
@@ -3019,6 +2867,8 @@ window.__ModuleLoader__.load({
3019
2867
  "error.sessionInUse": "This session is already in use, possibly by another running DSH instance (such as dsh web or the desktop app). Quit other running DSH instances and try again.",
3020
2868
  "picker.title": "Switch model",
3021
2869
  "picker.browse": "Browse models",
2870
+ "picker.browseAll": "Browse all models",
2871
+ "picker.quick": "Quick model selection",
3022
2872
  "picker.close": "Close",
3023
2873
  "picker.search": "Search models or providers…",
3024
2874
  "picker.searchEmpty": "No matching models.",
@@ -3026,6 +2876,7 @@ window.__ModuleLoader__.load({
3026
2876
  "picker.favorite": "Favorite {model}",
3027
2877
  "picker.unfavorite": "Remove {model} from favorites",
3028
2878
  "picker.hintClose": "close",
2879
+ "picker.hintFavorites": "Favorites first, also in the quick menu",
3029
2880
  "meta.effort": "Effort",
3030
2881
  "meta.images": "Images",
3031
2882
  "effort.label": "Reasoning effort",
@@ -3034,17 +2885,6 @@ window.__ModuleLoader__.load({
3034
2885
  };
3035
2886
  //#endregion
3036
2887
  //#region src/client/index.ts
3037
- /**
3038
- * Cordis services required by the browser half. `slots` is the contribution
3039
- * registry, `sessions` tells whether a session may select a model,
3040
- * `modelDirectories` owns the per-session catalog snapshot both entries render
3041
- * from, and `configForms` carries the settings provider's shared describe
3042
- * mirror, which answers each model's context window and accepted modalities.
3043
- * `remote`, `remote.llm`, and `remote.session` are declared because a service
3044
- * method runs on the calling context: `directoryFor` reads
3045
- * `this.ctx.remote.session`, and the provider directory that names each
3046
- * settings address is read through `this.ctx.remote.llm`.
3047
- */
3048
2888
  const inject = [
3049
2889
  "configForms",
3050
2890
  "locale",
@@ -3055,15 +2895,6 @@ window.__ModuleLoader__.load({
3055
2895
  "sessions",
3056
2896
  "slots"
3057
2897
  ];
3058
- /**
3059
- * Client plugin body: register this plugin's dictionaries, then contribute the
3060
- * menu bridge, the toolbar entry for a missing current model, the picker
3061
- * overlay, and the tint for the collapsed trigger's effort caption.
3062
- *
3063
- * The overlay stays mounted when the Host closes the model menu, allowing the
3064
- * picker to open after the menu has been removed.
3065
- * @param ctx - client root context.
3066
- */
3067
2898
  function apply(ctx) {
3068
2899
  if (typeof document !== "undefined") ctx.effect(() => {
3069
2900
  const style = document.createElement("style");
@@ -3091,11 +2922,6 @@ window.__ModuleLoader__.load({
3091
2922
  listProviders: () => scope.remote.llm.listConfigurableProviders()
3092
2923
  });
3093
2924
  scope.effect(() => facts.start(), "dsh-model-submenu: model metadata");
3094
- /**
3095
- * Build one entry's business face for a session.
3096
- * @param sessionId - the slot's session scope.
3097
- * @returns the catalog face plus the session and store both entries need.
3098
- */
3099
2925
  const faceOf = (sessionId) => {
3100
2926
  const key = sessionId;
3101
2927
  const directory = models.directoryFor(key);
@@ -3120,6 +2946,13 @@ window.__ModuleLoader__.load({
3120
2946
  locale: NS,
3121
2947
  inject: faceOf
3122
2948
  }, ModelMenuBridge));
2949
+ scope.slots.inject("conversation.input.model.pane", () => scope.slots.register({
2950
+ name: "conversation.input.model.pane",
2951
+ key: QUICK_MODELS_PANE,
2952
+ registrant: "@lynn123411/dsh-model-submenu",
2953
+ locale: NS,
2954
+ inject: faceOf
2955
+ }, QuickModels));
3123
2956
  scope.slots.inject("conversation.input.overlay", () => scope.slots.register({
3124
2957
  name: "conversation.input.overlay",
3125
2958
  id: "model-picker",