@surfishs/dsh-prompt-enhance 0.1.0 → 0.1.2

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.
@@ -16,9 +16,16 @@ const STYLE_ID = 'dsh-prompt-enhance-styles'
16
16
 
17
17
  /** The plugin's stylesheet. */
18
18
  export const CSS = `
19
- .dsh-pe-dock { width: 100%; }
20
- .dsh-pe-panel {
21
- box-sizing: border-box;
19
+ /* One palette for everything the plugin paints into the dock: the result card
20
+ and the standalone undo row are siblings, so the tokens live on their shared
21
+ parent instead of on the card alone (a child could not reach its sibling's
22
+ variables, which is why the undo row used to re-derive its own colors). The
23
+ quick-settings menu lives in the composer slot instead, so it joins the same
24
+ rule to read the same palette. */
25
+ .dsh-pe-dock {
26
+ width: 100%;
27
+ }
28
+ .dsh-pe-dock {
22
29
  --pe-bg: var(--dsw-alias-bg-layer-1, #1f2127);
23
30
  --pe-fg: var(--dsw-alias-label-primary, #e6e8ee);
24
31
  --pe-fg-dim: var(--dsw-alias-label-secondary, rgba(230, 232, 238, 0.55));
@@ -27,11 +34,234 @@ export const CSS = `
27
34
  /* No hover token exists: a neutral grey alpha is already theme-agnostic. */
28
35
  --pe-hover: rgba(127, 127, 127, 0.18);
29
36
  --pe-danger: var(--dsw-alias-state-error-primary, #ffb4a8);
37
+ --pe-success: var(--dsw-alias-state-success-primary, #2da44e);
30
38
  --pe-warn-fg: var(--dsw-alias-state-warn-primary, #e8c07d);
31
39
  /* Tints of the themed warning color, so the banner cannot keep an amber cast
32
40
  from the other scheme. */
33
41
  --pe-warn-border: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #e8c07d) 35%, transparent);
34
42
  --pe-warn-bg: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #e8c07d) 12%, transparent);
43
+ }
44
+ /* Quick-settings menu, copied from the shell's own menu primitives:
45
+ - the card surface is MenuSurface.module.css (radius-lg, elevation stroke,
46
+ prominent shadow) with the menu fill over an opaque bg-base, so a
47
+ translucent fill never shows the page through it;
48
+ - rows and the trailing check are Menu.module.css (.item / .label /
49
+ .separator / .check);
50
+ - the check artwork is the exact check-outline regular glyph from
51
+ @deepseek-ai/dsh-client-ui-primitives (16-unit viewBox, 1px stroke),
52
+ painted at the shell's 14x14 check size through a mask. */
53
+ .dsh-pe-menu {
54
+ z-index: 1100;
55
+ display: flex;
56
+ flex-direction: column;
57
+ box-sizing: border-box;
58
+ /* The shell's model-menu card (ModelSelect.module.css .menu) is the closest
59
+ relative of this card and starts at 240px, so a short value like "Off" does
60
+ not leave the card cramped; the primitive's 144px floor is for plain lists. */
61
+ min-width: min(240px, 100vw - 24px);
62
+ max-width: min(360px, 100vw - 24px);
63
+ padding: 4px;
64
+ border: 0;
65
+ border-radius: var(--dsw-radius-lg, 12px);
66
+ --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);
67
+ color: var(--dsw-alias-label-primary, inherit);
68
+ box-shadow: var(--dsw-elevation-prominent, 0 12px 32px rgba(0, 0, 0, 0.24));
69
+ cursor: default;
70
+ /* The host isolates the card so the material below never becomes a backdrop
71
+ root for nested menus; matching the shell keeps the blur behaviour equal. */
72
+ isolation: isolate;
73
+ }
74
+ /* The material, exactly as MenuSurface.module.css paints it (the host uses a
75
+ child element with z-index:-1; a pseudo-element is the same layer without
76
+ touching the component): menu fill + backdrop blur. */
77
+ .dsh-pe-menu::before {
78
+ content: '';
79
+ position: absolute;
80
+ inset: 0;
81
+ z-index: -1;
82
+ border-radius: inherit;
83
+ background: var(--dsw-menu-surface-fill, rgba(255, 255, 255, 0.96));
84
+ -webkit-backdrop-filter: var(--dsw-menu-backdrop-filter, blur(12px));
85
+ backdrop-filter: var(--dsw-menu-backdrop-filter, blur(12px));
86
+ pointer-events: none;
87
+ }
88
+ /* macOS: the host backs the material with an opaque layer (its .backing
89
+ element) because Chromium needs opaque pixels behind page content to blur it
90
+ over native vibrancy. One opaque base colour on the card is that layer here. */
91
+ html[data-platform='darwin'] .dsh-pe-menu {
92
+ background-color: var(--dsw-alias-bg-base, #ffffff);
93
+ }
94
+ .dsh-pe-menu-group { display: flex; flex-direction: column; }
95
+
96
+ .dsh-pe-menu-item {
97
+ display: flex;
98
+ align-items: center;
99
+ gap: 6px;
100
+ width: 100%;
101
+ min-height: 34px;
102
+ padding: 6px 8px;
103
+ border: none;
104
+ border-radius: var(--dsw-radius-md, 8px);
105
+ background: transparent;
106
+ color: var(--dsw-alias-label-primary, inherit);
107
+ font: inherit;
108
+ font-size: 13px;
109
+ line-height: 20px;
110
+ text-align: left;
111
+ cursor: pointer;
112
+ }
113
+ .dsh-pe-menu-item:hover { background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.12)); }
114
+ .dsh-pe-menu-item:focus-visible { background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.12)); outline: none; }/* Folded tier cell: the shell model menu's .cell (34px, value right in
115
+ tertiary, a 12px chevron in the menu-icon tone) so the card reads as one
116
+ compact row until the list is opened. */
117
+ .dsh-pe-menu-cell {
118
+ height: 34px;
119
+ min-height: 34px;
120
+ padding: 0 8px;
121
+ }
122
+ /* Read-only route row: the cell metrics without a pointer or hover, because the
123
+ value is changed on the plugin settings page, not here. */
124
+ .dsh-pe-menu-info {
125
+ display: flex;
126
+ align-items: center;
127
+ gap: 6px;
128
+ min-height: 34px;
129
+ padding: 0 8px;
130
+ border-radius: var(--dsw-radius-md, 8px);
131
+ color: var(--dsw-alias-label-primary, inherit);
132
+ font-size: 13px;
133
+ line-height: 20px;
134
+ cursor: default;
135
+ }
136
+ .dsh-pe-menu-info .dsh-pe-menu-label { flex: 0 0 auto; }
137
+ .dsh-pe-menu-info .dsh-pe-menu-state {
138
+ flex: 1 1 auto;
139
+ min-width: 0;
140
+ margin-left: 0;
141
+ overflow: hidden;
142
+ text-align: right;
143
+ text-overflow: ellipsis;
144
+ white-space: nowrap;
145
+ }
146
+ .dsh-pe-menu-cell .dsh-pe-menu-label { flex: 0 0 auto; }
147
+ .dsh-pe-menu-cell .dsh-pe-menu-state {
148
+ flex: 1 1 auto;
149
+ min-width: 0;
150
+ margin-left: 0;
151
+ overflow: hidden;
152
+ text-align: right;
153
+ text-overflow: ellipsis;
154
+ white-space: nowrap;
155
+ }
156
+ /* The chevron is the shell's own chevron-right-outline artwork (16-unit
157
+ viewBox, 1px stroke) masked at the model menu's 12px cell size; it turns to
158
+ point down while the list is open. */
159
+ .dsh-pe-menu-chevron {
160
+ flex: none;
161
+ width: 12px;
162
+ height: 12px;
163
+ color: var(--dsw-alias-menu-icon, var(--dsw-alias-label-tertiary, inherit));
164
+ background-color: currentColor;
165
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='none'%20stroke='%23fff'%20stroke-width='1'%3E%3Cpath%20d='M6%2012L9.29289%208.70711C9.68342%208.31658%209.68342%207.68342%209.29289%207.29289L6%204'/%3E%3C/svg%3E");
166
+ mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='none'%20stroke='%23fff'%20stroke-width='1'%3E%3Cpath%20d='M6%2012L9.29289%208.70711C9.68342%208.31658%209.68342%207.68342%209.29289%207.29289L6%204'/%3E%3C/svg%3E");
167
+ -webkit-mask-size: 16px 16px;
168
+ mask-size: 16px 16px;
169
+ -webkit-mask-repeat: no-repeat;
170
+ mask-repeat: no-repeat;
171
+ -webkit-mask-position: center;
172
+ mask-position: center;
173
+ transition: transform 120ms ease;
174
+ }
175
+ @media (prefers-reduced-motion: reduce) {
176
+ .dsh-pe-menu-chevron { transition: none; }
177
+ }
178
+ .dsh-pe-menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
179
+ .dsh-pe-menu-state { flex: none; margin-left: auto; color: var(--dsw-alias-label-tertiary, inherit); }
180
+ /* The shell's check: a 14x14 icon in label-primary. The text glyph is hidden
181
+ and the exact outline artwork is masked in, so the shape, weight and size
182
+ are the shell's own. */
183
+ .dsh-pe-menu-mark {
184
+ flex: none;
185
+ width: 14px;
186
+ height: 14px;
187
+ margin-left: auto;
188
+ color: var(--dsw-alias-label-primary, inherit);
189
+ font-size: 0;
190
+ background-color: transparent;
191
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='none'%20stroke='%23fff'%20stroke-width='1'%3E%3Cpath%20d='M2.25%208.5L5.49732%2011.7473C5.90519%2012.1552%206.57263%2012.1344%206.95426%2011.7018L13.75%204'/%3E%3C/svg%3E");
192
+ mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='none'%20stroke='%23fff'%20stroke-width='1'%3E%3Cpath%20d='M2.25%208.5L5.49732%2011.7473C5.90519%2012.1552%206.57263%2012.1344%206.95426%2011.7018L13.75%204'/%3E%3C/svg%3E");
193
+ -webkit-mask-size: 14px 14px;
194
+ mask-size: 14px 14px;
195
+ -webkit-mask-repeat: no-repeat;
196
+ mask-repeat: no-repeat;
197
+ -webkit-mask-position: center;
198
+ mask-position: center;
199
+ }
200
+ .dsh-pe-menu-item[aria-checked='true'] .dsh-pe-menu-mark { background-color: currentColor; }
201
+ /* The context switch row, copied from the shell's TeamModeToggle row: the label
202
+ on the left, the shell's own switch on the right, and the whole row (minus
203
+ nothing here) as the switch's hit target. */
204
+ .dsh-pe-menu-switch {
205
+ position: relative;
206
+ display: flex;
207
+ align-items: center;
208
+ justify-content: space-between;
209
+ gap: 16px;
210
+ min-height: 34px;
211
+ padding: 0 8px;
212
+ border-radius: var(--dsw-radius-md, 8px);
213
+ color: var(--dsw-alias-label-primary, inherit);
214
+ font-size: 13px;
215
+ line-height: 20px;
216
+ }
217
+ .dsh-pe-menu-switch-label {
218
+ display: inline-flex;
219
+ align-items: center;
220
+ gap: 4px;
221
+ min-width: 0;
222
+ }
223
+ /* Extend the native switch hit target over the whole row. */
224
+ .dsh-pe-menu-switch .dsh-pe-menu-switch-input { position: static; }
225
+ .dsh-pe-menu-switch .dsh-pe-menu-switch-input::after {
226
+ content: '';
227
+ position: absolute;
228
+ inset: 0;
229
+ border-radius: var(--dsw-radius-md, 8px);
230
+ }
231
+ .dsh-pe-menu-switch:has(.dsh-pe-menu-switch-input:focus-visible) {
232
+ background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.12));
233
+ }
234
+ /* The shell switch animates its thumb; its track colour is driven straight by
235
+ aria-checked, so both get the same 120ms transition here, and both stop when
236
+ the user asks for reduced motion. */
237
+ .dsh-pe-menu-switch .dsh-pe-menu-switch-input {
238
+ transition: background-color 120ms ease;
239
+ }
240
+ .dsh-pe-menu-switch .dsh-pe-menu-switch-input > * {
241
+ transition: transform 120ms ease, background-color 120ms ease;
242
+ }
243
+ @media (prefers-reduced-motion: reduce) {
244
+ .dsh-pe-menu-switch .dsh-pe-menu-switch-input,
245
+ .dsh-pe-menu-switch .dsh-pe-menu-switch-input > * {
246
+ transition: none;
247
+ }
248
+ }
249
+ @media (hover: hover) {
250
+ .dsh-pe-menu-switch:has(.dsh-pe-menu-switch-input:not(:disabled)):hover {
251
+ background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.12));
252
+ }
253
+ }
254
+ .dsh-pe-menu-sep { height: 0.5px; margin: 3px 8px; background: var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.25)); }
255
+ .dsh-pe-menu-error { padding: 6px 8px; font-size: 12px; color: var(--dsw-alias-state-error-primary, #e5484d); }
256
+ /* Why the tier list is empty: an explanation, not an error. */
257
+ .dsh-pe-menu-note {
258
+ padding: 4px 8px 6px;
259
+ color: var(--dsw-alias-label-tertiary, inherit);
260
+ font-size: 12px;
261
+ line-height: 16px;
262
+ }
263
+ .dsh-pe-panel {
264
+ box-sizing: border-box;
35
265
  display: flex;
36
266
  flex-direction: column;
37
267
  width: 100%;
@@ -42,7 +272,46 @@ export const CSS = `
42
272
  color: var(--pe-fg);
43
273
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 4px 14px rgba(0, 0, 0, 0.05);
44
274
  overflow: hidden;
275
+ /* The card is chrome: titles, badges, banners and button labels are not
276
+ content to be selected. The two blocks the user may want to copy opt back
277
+ in below (.dsh-pe-result-text, .dsh-pe-error). */
278
+ -webkit-user-select: none;
279
+ user-select: none;
45
280
  }
281
+ /* The body folds along a single grid track (1fr <-> 0fr): the height animates to
282
+ the content's own size, so nothing is measured in JS and the fold can never
283
+ overshoot a long result. The inner clips, and once the track has closed it
284
+ also leaves the paint, selection and accessibility trees. */
285
+ .dsh-pe-body {
286
+ display: grid;
287
+ grid-template-rows: 1fr;
288
+ transition: grid-template-rows 160ms ease;
289
+ }
290
+ .dsh-pe-body > .dsh-pe-body-inner {
291
+ min-height: 0;
292
+ overflow: hidden;
293
+ visibility: visible;
294
+ transition: visibility 0s;
295
+ }
296
+ .dsh-pe-panel.is-collapsed .dsh-pe-body { grid-template-rows: 0fr; }
297
+ .dsh-pe-panel.is-collapsed .dsh-pe-body > .dsh-pe-body-inner {
298
+ visibility: hidden;
299
+ /* Hidden only after the track has finished closing, so the fold is visible
300
+ the whole way down; expanding drops the delay and shows it at once. */
301
+ transition: visibility 0s linear 160ms;
302
+ }
303
+ /* The chevron turns with the fold, so the button and the body read as one gesture. */
304
+ .dsh-pe-collapse svg { transition: transform 160ms ease; }
305
+ @media (prefers-reduced-motion: reduce) {
306
+ .dsh-pe-body,
307
+ .dsh-pe-body > .dsh-pe-body-inner,
308
+ .dsh-pe-collapse svg { transition: none; }
309
+ }
310
+ /* The fold animation is a setting; switching it off makes the fold instant.
311
+ The OS preference above still wins for users who ask for less motion. */
312
+ .dsh-pe-panel.is-static .dsh-pe-body,
313
+ .dsh-pe-panel.is-static .dsh-pe-body > .dsh-pe-body-inner,
314
+ .dsh-pe-panel.is-static .dsh-pe-collapse svg { transition: none; }
46
315
  .dsh-pe-head {
47
316
  display: flex;
48
317
  align-items: center;
@@ -69,22 +338,30 @@ export const CSS = `
69
338
  font-size: 11px;
70
339
  opacity: 0.72;
71
340
  white-space: nowrap;
341
+ cursor: default;
342
+ /* Four segments (model, elapsed, tokens, effort) can outgrow a narrow header:
343
+ shrink with an ellipsis instead of pushing the fold and close controls. */
344
+ max-width: 100%;
345
+ overflow: hidden;
346
+ text-overflow: ellipsis;
72
347
  }
73
- .dsh-pe-applied {
74
- font-size: 10.5px;
75
- font-weight: 500;
76
- line-height: 1;
77
- padding: 3px 7px;
78
- border-radius: 999px;
79
- color: var(--dsw-alias-state-success-primary, #2da44e);
80
- border: 1px solid currentColor;
81
- white-space: nowrap;
82
- }
83
- .dsh-pe-close {
348
+ /* The close and collapse controls share one square hit target: same box, same
349
+ hover surface, so the two glyphs read as a pair instead of one looking
350
+ flatter than the other. */
351
+ .dsh-pe-close,
352
+ .dsh-pe-collapse {
353
+ box-sizing: border-box;
84
354
  border: none; background: transparent; color: inherit; opacity: 0.6;
85
- font-size: 15px; cursor: pointer; padding: 2px 6px; border-radius: 4px;
86
- }
87
- .dsh-pe-close:hover { opacity: 1; background: var(--pe-hover); }
355
+ cursor: pointer; border-radius: 4px; padding: 0;
356
+ width: 22px; height: 22px; line-height: 0;
357
+ display: inline-flex; align-items: center; justify-content: center;
358
+ }
359
+ .dsh-pe-close { font-size: 15px; }
360
+ .dsh-pe-close:hover,
361
+ .dsh-pe-collapse:hover { opacity: 1; background: var(--pe-hover); }
362
+ /* Collapsed, the warning banners live in the hidden body; this marker stands in
363
+ for them so a stale or truncated result never folds away silently. */
364
+ .dsh-pe-warn-dot { font-size: 15px; line-height: 1; color: var(--pe-warn-fg); }
88
365
  .dsh-pe-result { padding: 2px 10px 6px; }
89
366
  .dsh-pe-result-text {
90
367
  margin: 0;
@@ -96,6 +373,9 @@ export const CSS = `
96
373
  font-family: inherit;
97
374
  font-size: 12.5px;
98
375
  line-height: 1.6;
376
+ /* The one block in the card the user is expected to copy by hand. */
377
+ -webkit-user-select: text;
378
+ user-select: text;
99
379
  }
100
380
  .dsh-pe-col-title {
101
381
  padding: 4px 10px 2px;
@@ -109,6 +389,10 @@ export const CSS = `
109
389
  line-height: 1.6;
110
390
  color: var(--pe-danger);
111
391
  white-space: pre-wrap;
392
+ /* Selectable with its detail line: the provider message is what users paste
393
+ into an issue when they report a failure. */
394
+ -webkit-user-select: text;
395
+ user-select: text;
112
396
  }
113
397
  .dsh-pe-error .dsh-pe-error-detail {
114
398
  margin-top: 8px;
@@ -163,7 +447,6 @@ export const CSS = `
163
447
  cursor: pointer;
164
448
  }
165
449
  .dsh-pe-btn-action.primary {
166
- min-width: 112px;
167
450
  border-color: transparent;
168
451
  /* Fill and label are a PAIR: the alias layer flips brand-primary from
169
452
  near-black (light theme) to near-white (dark theme), so the label has to
@@ -181,9 +464,23 @@ export const CSS = `
181
464
  }
182
465
  .dsh-pe-btn-action.plain { background: transparent; color: inherit; }
183
466
  .dsh-pe-btn-action.plain:hover { background: var(--pe-hover); }
184
- .dsh-pe-btn-action.dsh-pe-copy { min-width: 96px; }
467
+ /* A floor for every footer action button, so a button keeps a visible, clickable
468
+ width even if its label ever collapses to nothing. The label-swap groups
469
+ (.dsh-pe-swap) already make a button as wide as its longest label, and 96px is
470
+ below every real content width here, so this never widens a labelled button in
471
+ practice — it only bounds the empty case and keeps the single-label buttons
472
+ (retry, cancel) the same size as the rest. */
473
+ .dsh-pe-btn-floor { min-width: 96px; }
185
474
  .dsh-pe-btn-action:disabled { opacity: 0.45; cursor: default; }
186
475
 
476
+ /* Both labels of the regenerate button share one cell, so the button is as wide
477
+ as the longer label of the active language and a label swap can never move
478
+ the footer. visibility:hidden keeps the inert label out of the accessibility
479
+ tree, leaving the visible text as the button's name. */
480
+ .dsh-pe-swap { display: inline-grid; }
481
+ .dsh-pe-swap > * { grid-area: 1 / 1; visibility: hidden; }
482
+ .dsh-pe-swap > .on { visibility: visible; }
483
+
187
484
  .dsh-pe-stale {
188
485
  padding: 6px 10px;
189
486
  font-size: 12px;
@@ -212,6 +509,9 @@ export const CSS = `
212
509
  .dsh-pe-btn:hover:not(:disabled) { opacity: 1; background: var(--pe-hover); }
213
510
  .dsh-pe-btn.is-busy { cursor: progress; }
214
511
  .dsh-pe-btn.is-blocked { cursor: progress; }
512
+ /* Empty draft: dimmed and a forbidden pointer. The plain click really is inert
513
+ here; the card stays reachable by right-click (long-press / Shift+F10) and the
514
+ tooltip says so, so the cursor still marks "left click does nothing". */
215
515
  .dsh-pe-btn.is-empty { opacity: 0.4; cursor: not-allowed; }
216
516
  .dsh-pe-btn.is-empty:hover { opacity: 0.4; background: transparent; }
217
517
  .dsh-pe-btn:disabled { opacity: 0.45; cursor: default; }
@@ -225,15 +525,19 @@ export const CSS = `
225
525
  width: fit-content;
226
526
  margin-left: auto;
227
527
  padding: 3px 6px 3px 10px;
228
- border: 1px solid var(--dsw-alias-border-l2, rgba(128, 128, 128, 0.32));
528
+ border: 1px solid var(--pe-border);
229
529
  border-radius: 12px;
230
- background: var(--dsw-alias-bg-layer-1, transparent);
530
+ background: var(--pe-bg);
231
531
  font-size: 12px;
232
- color: inherit;
532
+ color: var(--pe-fg);
533
+ /* The undo row is chrome too, like the card header and footer. */
534
+ -webkit-user-select: none;
535
+ user-select: none;
233
536
  }
234
537
  .dsh-pe-undo .dsh-pe-undo-check {
235
- color: var(--dsw-alias-state-success-primary, #2da44e);
236
- font-weight: 600;
538
+ display: inline-flex;
539
+ align-items: center;
540
+ color: var(--pe-success);
237
541
  }
238
542
  .dsh-pe-undo-link {
239
543
  display: inline-flex;
@@ -242,16 +546,14 @@ export const CSS = `
242
546
  gap: 6px;
243
547
  height: 28px;
244
548
  padding: 0 10px;
245
- border: 1px solid var(--dsw-alias-border-l2, rgba(128, 128, 128, 0.32));
549
+ border: 1px solid var(--pe-border);
246
550
  border-radius: 6px;
247
551
  background: transparent;
248
552
  color: inherit;
249
553
  font-size: 12px;
250
554
  cursor: pointer;
251
- transition: background-color 120ms ease;
252
555
  }
253
- .dsh-pe-undo-link:hover { background: rgba(127, 127, 127, 0.16); }
254
- .dsh-pe-undo-link:active { background: rgba(127, 127, 127, 0.22); }
556
+ .dsh-pe-undo-link:hover { background: var(--pe-hover); }
255
557
  .dsh-pe-undo-x {
256
558
  display: inline-flex;
257
559
  align-items: center;
@@ -262,12 +564,20 @@ export const CSS = `
262
564
  border-radius: 6px;
263
565
  background: transparent;
264
566
  color: inherit;
265
- opacity: 0.55;
567
+ opacity: 0.6;
266
568
  cursor: pointer;
267
569
  padding: 0;
268
570
  font-size: 12px;
269
571
  }
270
- .dsh-pe-undo-x:hover { opacity: 1; background: var(--dsw-alias-bg-layer-2, rgba(128, 128, 128, 0.12)); }
572
+ .dsh-pe-undo-x:hover { opacity: 1; background: var(--pe-hover); }
573
+ /* The host's segmented control slides its indicator with a 160ms transform
574
+ transition. This row re-lists its options whenever a capability answer lands
575
+ (loading -> ready, model switch, a cleared tier), so the pill would appear to
576
+ fly in from outside the track while the option count changes under it. The
577
+ selection change is the information here, not the motion. */
578
+ .dsh-pe-segmented-labels > span[aria-hidden='true'] {
579
+ transition: none !important;
580
+ }
271
581
  .dsh-pe-segmented-labels [role="tab"] {
272
582
  min-width: 0;
273
583
  overflow: hidden;
@@ -275,20 +585,25 @@ export const CSS = `
275
585
  text-align: center;
276
586
  white-space: nowrap;
277
587
  }
588
+ /* The Advanced disclosure reads as one more settings row: same 13px/500 label
589
+ tone as every row title, same vertical rhythm, and a 16px chevron drawn from
590
+ the shell's chevron-down-outline artwork instead of a hand-drawn triangle. */
278
591
  .dsh-pe-advanced {
279
- margin-top: 12px;
280
- border-top: 1px solid var(--dsw-alias-border-l3, rgba(128, 128, 128, 0.22));
592
+ margin-top: 4px;
593
+ border-top: 0.5px solid var(--dsw-alias-border-l3, rgba(128, 128, 128, 0.22));
281
594
  }
595
+ /* The shell's settings rows have no hover fill (its DisclosureRow only lifts the
596
+ text tone), so the row keeps the page chrome and the glyph carries the state. */
282
597
  .dsh-pe-advanced > summary {
283
598
  display: flex;
284
599
  align-items: center;
285
600
  gap: 8px;
286
- min-height: 40px;
287
- padding: 0 4px;
601
+ padding: 12px 0;
288
602
  list-style: none;
603
+ color: var(--dsw-alias-label-primary, inherit);
289
604
  font-size: 13px;
290
605
  font-weight: 500;
291
- color: var(--dsw-alias-label-secondary, inherit);
606
+ line-height: 20px;
292
607
  cursor: pointer;
293
608
  user-select: none;
294
609
  }
@@ -297,26 +612,42 @@ export const CSS = `
297
612
  .dsh-pe-advanced > summary::before {
298
613
  content: '';
299
614
  flex: none;
300
- width: 0;
301
- height: 0;
302
- border-top: 4px solid transparent;
303
- border-bottom: 4px solid transparent;
304
- border-left: 5px solid currentColor;
615
+ width: 16px;
616
+ height: 16px;
617
+ color: var(--dsw-alias-label-tertiary, inherit);
618
+ background-color: currentColor;
619
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='none'%20stroke='%23fff'%20stroke-width='1'%3E%3Cpath%20d='M4%206L7.29289%209.29289C7.68342%209.68342%208.31658%209.68342%208.70711%209.29289L12%206'/%3E%3C/svg%3E");
620
+ mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='none'%20stroke='%23fff'%20stroke-width='1'%3E%3Cpath%20d='M4%206L7.29289%209.29289C7.68342%209.68342%208.31658%209.68342%208.70711%209.29289L12%206'/%3E%3C/svg%3E");
621
+ -webkit-mask-size: 16px 16px;
622
+ mask-size: 16px 16px;
623
+ -webkit-mask-repeat: no-repeat;
624
+ mask-repeat: no-repeat;
625
+ -webkit-mask-position: center;
626
+ mask-position: center;
627
+ /* Closed points at the collapsed content, open points down at it. */
628
+ transform: rotate(-90deg);
305
629
  transition: transform 120ms ease;
306
630
  }
307
- .dsh-pe-advanced[open] > summary::before { transform: rotate(90deg); }
631
+ .dsh-pe-advanced[open] > summary::before { transform: none; }
308
632
  .dsh-pe-advanced > summary:hover {
309
- color: var(--dsw-alias-label-primary, inherit);
310
- background: rgba(127, 127, 127, 0.08);
311
- border-radius: 6px;
633
+ color: var(--dsw-alias-label-secondary, inherit);
634
+ }
635
+ .dsh-pe-advanced > summary:hover::before {
636
+ color: var(--dsw-alias-label-secondary, inherit);
312
637
  }
313
638
  .dsh-pe-advanced > summary:focus-visible {
314
639
  outline: 2px solid var(--dsw-alias-state-business-primary, #4f8cff);
315
640
  outline-offset: -2px;
316
- border-radius: 6px;
317
641
  }
318
- .dsh-pe-advanced[open] > summary { margin-bottom: 4px; }
642
+ @media (prefers-reduced-motion: reduce) {
643
+ .dsh-pe-advanced > summary::before { transition: none; }
644
+ }/* The footer already adds its own 12px top margin; after the disclosure that would
645
+ double the header's bottom whitespace (12px padding + 12px margin) against the
646
+ 12px above it, so the two gaps are equalised here. */
319
647
  .dsh-pe-advanced + .dsh-pe-form-footer { margin-top: 0; }
648
+ /* Open: the first advanced row brings its own 12px top padding, so the header
649
+ drops its bottom padding to keep the same rhythm between the two gaps. */
650
+ .dsh-pe-advanced[open] > summary { padding-bottom: 0; }
320
651
  .dsh-pe-chip-reset:hover:not(:disabled),
321
652
  .dsh-pe-chip-refresh:hover:not(:disabled) {
322
653
  --pe-chip-bg: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.18));
@@ -365,7 +696,7 @@ export const CSS = `
365
696
  font-size: 12px;
366
697
  cursor: pointer;
367
698
  }
368
- .dsh-pe-save-button:hover:not(:disabled) { background: rgba(127, 127, 127, 0.12); }
699
+ .dsh-pe-save-button:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.12)); }
369
700
  .dsh-pe-save-button:disabled { opacity: 0.5; cursor: default; }
370
701
  `
371
702
 
@@ -19,6 +19,8 @@ export interface PanelState {
19
19
  readonly original: string
20
20
  readonly result?: EnhanceResult
21
21
  readonly error?: EnhanceError
22
+ /** True while the card body is collapsed: the header and the footer stay, the body hides. */
23
+ readonly collapsed?: boolean
22
24
  /** Cancels the in-flight request; absent once settled. */
23
25
  readonly abort?: () => void
24
26
  /** The composer draft changed after the request started — the result is based on the old text. */
@@ -207,6 +209,20 @@ export function setStale(sessionId: string, stale: boolean): void {
207
209
  notify()
208
210
  }
209
211
 
212
+ /**
213
+ * Collapse or expand the open card. Only the body hides; the header (with the
214
+ * toggle and close) and the footer (with the actions) stay usable. A new request
215
+ * or an error drops the flag, because {@link openLoading} and {@link settleError}
216
+ * build a fresh state without it.
217
+ * @param sessionId - the session that owns the card.
218
+ * @param collapsed - whether the body should be hidden.
219
+ */
220
+ export function setCollapsed(sessionId: string, collapsed: boolean): void {
221
+ if (panelState?.sessionId !== sessionId || (panelState.collapsed === true) === collapsed) return
222
+ panelState = { ...panelState, collapsed }
223
+ notify()
224
+ }
225
+
210
226
  /** Close the panel (cancel/dismiss/apply); aborts an in-flight request. */
211
227
  export function closePanel(): void {
212
228
  abortOf(panelState)
package/src/config.ts CHANGED
@@ -103,6 +103,10 @@ export interface Config {
103
103
  contextMaxMessages: number
104
104
  /** Context window depth: character budget of the assembled history snippet; 0 admits none. */
105
105
  contextMaxChars: number
106
+ /** Play the result card's expand/collapse transition. */
107
+ foldAnimation: boolean
108
+ /** Fold the card when a result is applied, and re-open it when that apply is undone. */
109
+ autoFold: boolean
106
110
  }
107
111
 
108
112
  /** Field defaults, the source of truth for schema defaults and client mirrors. */
@@ -185,6 +189,8 @@ export const Config = z.object({
185
189
  .description('每分钟增强次数上限(滑动窗口),超出返回 429')
186
190
  .volatile(),
187
191
  streaming: z.boolean().default(DEFAULT_CONFIG.streaming).description('增量展示:模型边写边在面板显示(仅影响显示节奏,最终结果不变;宿主或网络不支持时自动回退为一次性返回)').volatile(),
192
+ foldAnimation: z.boolean().default(DEFAULT_CONFIG.foldAnimation).description('卡片折叠动画:展开/收起时播放过渡;关闭后立即切换(系统「减少动态效果」偏好始终优先)').volatile(),
193
+ autoFold: z.boolean().default(DEFAULT_CONFIG.autoFold).description('自动收纳卡片:回填到输入框后自动收起卡片,撤销后自动展开;关闭后卡片保持当前展开状态').volatile(),
188
194
  contextAware: z
189
195
  .boolean()
190
196
  .default(DEFAULT_CONFIG.contextAware)
@@ -296,6 +302,8 @@ export function resolveConfig(config: Config): Config {
296
302
  maxConcurrent: intInRange(config.maxConcurrent, 'maxConcurrent', FIELD_LIMITS.maxConcurrent),
297
303
  rateLimitPerMinute: intInRange(config.rateLimitPerMinute, 'rateLimitPerMinute', FIELD_LIMITS.rateLimitPerMinute),
298
304
  streaming: typeof config.streaming === 'boolean' ? config.streaming : DEFAULT_CONFIG.streaming,
305
+ foldAnimation: typeof config.foldAnimation === 'boolean' ? config.foldAnimation : DEFAULT_CONFIG.foldAnimation,
306
+ autoFold: typeof config.autoFold === 'boolean' ? config.autoFold : DEFAULT_CONFIG.autoFold,
299
307
  contextAware: typeof config.contextAware === 'boolean' ? config.contextAware : DEFAULT_CONFIG.contextAware,
300
308
  contextMaxMessages: intInRange(config.contextMaxMessages, 'contextMaxMessages', FIELD_LIMITS.contextMaxMessages),
301
309
  contextMaxChars: intInRange(config.contextMaxChars, 'contextMaxChars', FIELD_LIMITS.contextMaxChars),
package/src/enhancer.ts CHANGED
@@ -363,6 +363,9 @@ export async function enhanceText(llm: LlmStreamFace, options: EnhanceCallOption
363
363
  provider: options.route.provider,
364
364
  model: options.route.model,
365
365
  elapsedMs: Date.now() - started,
366
+ // What was actually sent: a rejected tier is retried without the field, so
367
+ // the retry path reports inherit rather than the tier that never ran.
368
+ reasoningEffort: retriedWithoutEffort ? 'inherit' : requestedEffort,
366
369
  ...(reportedUsage === undefined ? {} : { usage: reportedUsage }),
367
370
  ...(outcome.truncated ? { truncated: true } : {}),
368
371
  }
@@ -31,4 +31,8 @@ export const DEFAULT_VALUES = {
31
31
  contextAware: true,
32
32
  contextMaxMessages: 8,
33
33
  contextMaxChars: 4000,
34
+ /** Play the card's expand/collapse transition. */
35
+ foldAnimation: true,
36
+ /** Fold the card after Apply, and re-open it after Undo. */
37
+ autoFold: true,
34
38
  } as const
@@ -78,6 +78,12 @@ export interface EnhanceResult {
78
78
  usage?: EnhanceUsage
79
79
  /** True when the model stopped at the output token cap (the body may be incomplete). */
80
80
  truncated?: boolean
81
+ /**
82
+ * The reasoning effort this call actually sent, or inherit when the field was
83
+ * omitted and the provider default applied. Absent from hosts that predate the
84
+ * field, so the UI must treat it as optional.
85
+ */
86
+ reasoningEffort?: string
81
87
  }
82
88
 
83
89
  /**