@linxin666/dsh-liangshen 0.4.7 → 0.4.9
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/README.i18n.yaml +2 -2
- package/README.md +10 -8
- package/README.zh.md +10 -8
- package/lib/client.js +102 -55
- package/lib/client.js.map +1 -1
- package/lib/index.js +9 -1
- package/lib/types/client/PluginSettingsCard.d.ts +60 -0
- package/package.json +15 -15
- package/presets/liangshen/agent.cordis.yml +76 -18
- package/presets/liangshen/dispatcher-rules.mjs +128 -47
- package/presets/liangshen/fact-ledger.mjs +14 -0
- package/presets/liangshen/subagent-routes.mjs +396 -0
- package/presets/liangshen/tool-catalog.mjs +7 -4
- package/src/client/PluginSettingsCard.tsx +140 -20
- package/src/client/settings-card.module.css +141 -11
- package/src/composition.test.ts +20 -0
- package/src/composition.ts +10 -2
- package/tools/benchmark-live-run.mjs +116 -14
- package/tools/benchmark-report.mjs +44 -0
- package/tools/check-dispatcher-rules.mjs +130 -0
- package/tools/probe-selftest.mjs +130 -0
- package/tools/probes/budget-ledger/env.mjs +103 -0
- package/tools/probes/budget-ledger/grade.mjs +31 -0
- package/tools/probes/budget-ledger/strategies.mjs +25 -0
- package/tools/probes/oncall-backlog/env.mjs +141 -0
- package/tools/probes/oncall-backlog/grade.mjs +28 -0
- package/tools/probes/oncall-backlog/strategies.mjs +37 -0
- package/tools/probes/prior-override/env.mjs +153 -0
- package/tools/probes/prior-override/grade.mjs +31 -0
- package/tools/probes/prior-override/strategies.mjs +30 -0
- package/tools/probes/refresh-quota/env.mjs +140 -0
- package/tools/probes/refresh-quota/grade.mjs +30 -0
- package/tools/probes/refresh-quota/strategies.mjs +29 -0
- package/tools/probes/shared.mjs +75 -0
- package/tools/tasks/liangshen-v41-probes.json +59 -0
|
@@ -41,6 +41,14 @@ export interface PluginSettingsCardProps<TKey extends string = string> {
|
|
|
41
41
|
descriptionKey: TKey
|
|
42
42
|
/** Optional rich header description rendered instead of the plain t(descriptionKey) text (the plain text stays as the tooltip). */
|
|
43
43
|
descriptionNode?: ReactNode
|
|
44
|
+
/**
|
|
45
|
+
* Locale key of the full sentence behind a shortened description: when
|
|
46
|
+
* present, the header's native `title` takes this text while the visible
|
|
47
|
+
* line keeps `descriptionKey`/`descriptionNode`, so a compact card can
|
|
48
|
+
* compress the sentence without keeping a second visible copy of it.
|
|
49
|
+
* Defaults to the description key.
|
|
50
|
+
*/
|
|
51
|
+
descriptionTitleKey?: TKey
|
|
44
52
|
/**
|
|
45
53
|
* Optional leading mark identifying the plugin. A card without one keeps the
|
|
46
54
|
* plain official header shape, so the chrome stays a readable sibling of the
|
|
@@ -54,6 +62,19 @@ export interface PluginSettingsCardProps<TKey extends string = string> {
|
|
|
54
62
|
onSave: () => void
|
|
55
63
|
/** Drop every staged edit. */
|
|
56
64
|
onDiscard: () => void
|
|
65
|
+
/**
|
|
66
|
+
* Id applied to the card's title element, so a header control (an immediate
|
|
67
|
+
* toggle in `headerAction`) can name itself through `aria-labelledby`
|
|
68
|
+
* instead of repeating the title as a string.
|
|
69
|
+
*/
|
|
70
|
+
titleId?: string
|
|
71
|
+
/**
|
|
72
|
+
* Render the header only, with no body region. A card whose whole setting is
|
|
73
|
+
* the header control (a switch whose explanation is the description) has no
|
|
74
|
+
* controls to lay out below it, and an empty body would draw a divider line
|
|
75
|
+
* with nothing under it.
|
|
76
|
+
*/
|
|
77
|
+
headerOnly?: boolean
|
|
57
78
|
/**
|
|
58
79
|
* Render the controls expanded on arrival (still collapsible). Defaults to
|
|
59
80
|
* true: promoted first-level sections show their settings immediately.
|
|
@@ -71,14 +92,38 @@ export interface PluginSettingsCardProps<TKey extends string = string> {
|
|
|
71
92
|
* edits, so the footer would sit there permanently disabled.
|
|
72
93
|
*/
|
|
73
94
|
hideFooter?: boolean
|
|
95
|
+
/**
|
|
96
|
+
* Optional control rendered at the header's trailing edge, before the pending
|
|
97
|
+
* badge and the chevron. A card whose setting is one immediate flip (it
|
|
98
|
+
* applies outside the staged form) puts its ToggleSwitch here, so the control
|
|
99
|
+
* is reachable without opening the card and matches a plugin card's shape.
|
|
100
|
+
*/
|
|
101
|
+
headerAction?: ReactNode
|
|
74
102
|
/** Render children even when the settings namespace is not exposed by the host. */
|
|
75
103
|
renderChildrenWhenNotExposed?: boolean
|
|
76
104
|
/** Hide the 'not exposed' warning banner when the settings namespace is not exposed. */
|
|
77
105
|
hideNotExposedNotice?: boolean
|
|
106
|
+
/**
|
|
107
|
+
* Compact chrome for a topic card rendered inside another card's body: a
|
|
108
|
+
* smaller title, a tighter header and body inset, and a one-line description
|
|
109
|
+
* whose full text stays on the header's own title. Defaults to the
|
|
110
|
+
* first-level chrome, which is unchanged.
|
|
111
|
+
*/
|
|
112
|
+
density?: 'nested'
|
|
78
113
|
/** The plugin's controls. */
|
|
79
114
|
children: ReactNode
|
|
80
115
|
}
|
|
81
116
|
|
|
117
|
+
/** Length of the body's disclosure motion; it matches `--settings-card-motion` on the card root. */
|
|
118
|
+
const BODY_MOTION_MS = 180
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Lifecycle of one card body. `collapsed` is the mounted-but-closed frame the
|
|
122
|
+
* enter leg starts from, `entering` and `closing` are the two moving legs, and
|
|
123
|
+
* `shown` is the settled open body, which releases its clipping box.
|
|
124
|
+
*/
|
|
125
|
+
type BodyPhase = 'hidden' | 'collapsed' | 'entering' | 'shown' | 'closing'
|
|
126
|
+
|
|
82
127
|
/**
|
|
83
128
|
* Render one plugin settings card.
|
|
84
129
|
* @param props - the plugin's copy keys, its form state, and its controls.
|
|
@@ -87,12 +132,47 @@ export interface PluginSettingsCardProps<TKey extends string = string> {
|
|
|
87
132
|
export function PluginSettingsCard<TKey extends string = string>(props: PluginSettingsCardProps<TKey>) {
|
|
88
133
|
const [open, setOpen] = useState(props.defaultOpen ?? true)
|
|
89
134
|
const { state, alwaysOpen } = props
|
|
135
|
+
const expanded = alwaysOpen === true || open
|
|
136
|
+
const [bodyPhase, setBodyPhase] = useState<BodyPhase>(expanded ? 'shown' : 'hidden')
|
|
137
|
+
const bodyRef = useRef<HTMLDivElement | null>(null)
|
|
138
|
+
// Enter and leave run the same pair: a body that should open is mounted
|
|
139
|
+
// closed for one frame so its transition has a state to leave, and a closing
|
|
140
|
+
// one stays mounted until its leg has run.
|
|
141
|
+
useLayoutEffect(() => {
|
|
142
|
+
if (expanded) {
|
|
143
|
+
if (bodyPhase === 'hidden') setBodyPhase('collapsed')
|
|
144
|
+
else if (bodyPhase === 'collapsed') {
|
|
145
|
+
const node = bodyRef.current
|
|
146
|
+
if (node !== null) void node.offsetHeight
|
|
147
|
+
setBodyPhase('entering')
|
|
148
|
+
} else if (bodyPhase === 'closing') setBodyPhase('entering')
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
if (bodyPhase === 'collapsed') setBodyPhase('hidden')
|
|
152
|
+
else if (bodyPhase === 'entering' || bodyPhase === 'shown') setBodyPhase('closing')
|
|
153
|
+
}, [expanded, bodyPhase])
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
if (bodyPhase !== 'entering' && bodyPhase !== 'closing') return
|
|
156
|
+
const timer = setTimeout(() => {
|
|
157
|
+
setBodyPhase(bodyPhase === 'entering' ? 'shown' : 'hidden')
|
|
158
|
+
}, BODY_MOTION_MS)
|
|
159
|
+
return () => { clearTimeout(timer) }
|
|
160
|
+
}, [bodyPhase])
|
|
90
161
|
if (!state.available) return null
|
|
91
162
|
const title = props.t(props.titleKey)
|
|
92
163
|
const description = props.t(props.descriptionKey)
|
|
164
|
+
const descriptionTitle = props.descriptionTitleKey === undefined ? description : props.t(props.descriptionTitleKey)
|
|
93
165
|
const blocked = !state.dirty || state.invalid || state.saving
|
|
94
|
-
const
|
|
95
|
-
const cardClass =
|
|
166
|
+
const baseClass = expanded ? `${css.cardOpen} ${css.card}` : css.card
|
|
167
|
+
const cardClass = props.density === 'nested' ? `${baseClass} ${css.cardNested}` : baseClass
|
|
168
|
+
/** The body region both legs share; a hidden phase renders nothing at all. */
|
|
169
|
+
const bodyRegion = (content: ReactNode) => bodyPhase === 'hidden'
|
|
170
|
+
? null
|
|
171
|
+
: (
|
|
172
|
+
<div className={css.disclosure} data-state={bodyPhase} ref={bodyRef}>
|
|
173
|
+
<div className={css.body}>{content}</div>
|
|
174
|
+
</div>
|
|
175
|
+
)
|
|
96
176
|
// With alwaysOpen the nav entry already provides the selection, so the
|
|
97
177
|
// header is a static title row instead of a disclosure button.
|
|
98
178
|
const header = alwaysOpen === true
|
|
@@ -100,9 +180,10 @@ export function PluginSettingsCard<TKey extends string = string>(props: PluginSe
|
|
|
100
180
|
<div className={css.headerStatic}>
|
|
101
181
|
{props.icon !== undefined ? <span className={css.mark} aria-hidden="true">{props.icon}</span> : null}
|
|
102
182
|
<span className={css.headText}>
|
|
103
|
-
<span className={css.name} title={title}>{title}</span>
|
|
104
|
-
<span className={css.description} title={
|
|
183
|
+
<span className={css.name} id={props.titleId} title={title}>{title}</span>
|
|
184
|
+
<span className={css.description} title={descriptionTitle}>{props.descriptionNode ?? description}</span>
|
|
105
185
|
</span>
|
|
186
|
+
{props.headerAction !== undefined ? <span className={css.headerAction}>{props.headerAction}</span> : null}
|
|
106
187
|
{state.dirty ? <span className={css.pending} title={props.t('settings.unsaved')}>{props.t('settings.unsaved')}</span> : null}
|
|
107
188
|
</div>
|
|
108
189
|
)
|
|
@@ -116,9 +197,10 @@ export function PluginSettingsCard<TKey extends string = string>(props: PluginSe
|
|
|
116
197
|
>
|
|
117
198
|
{props.icon !== undefined ? <span className={css.mark} aria-hidden="true">{props.icon}</span> : null}
|
|
118
199
|
<span className={css.headText}>
|
|
119
|
-
<span className={css.name} title={title}>{title}</span>
|
|
120
|
-
<span className={css.description} title={
|
|
200
|
+
<span className={css.name} id={props.titleId} title={title}>{title}</span>
|
|
201
|
+
<span className={css.description} title={descriptionTitle}>{props.descriptionNode ?? description}</span>
|
|
121
202
|
</span>
|
|
203
|
+
{props.headerAction !== undefined ? <span className={css.headerAction}>{props.headerAction}</span> : null}
|
|
122
204
|
{state.dirty ? <span className={css.pending} title={props.t('settings.unsaved')}>{props.t('settings.unsaved')}</span> : null}
|
|
123
205
|
<svg
|
|
124
206
|
width="14"
|
|
@@ -144,22 +226,19 @@ export function PluginSettingsCard<TKey extends string = string>(props: PluginSe
|
|
|
144
226
|
return (
|
|
145
227
|
<li className={cardClass}>
|
|
146
228
|
{header}
|
|
147
|
-
{
|
|
148
|
-
? (
|
|
149
|
-
<div className={css.body}>
|
|
150
|
-
{showNotice ? <p className={css.notExposed} role="status">{props.t('settings.notExposed')}</p> : null}
|
|
151
|
-
</div>
|
|
152
|
-
)
|
|
153
|
-
: null}
|
|
229
|
+
{bodyRegion(showNotice ? <p className={css.notExposed} role="status">{props.t('settings.notExposed')}</p> : null)}
|
|
154
230
|
</li>
|
|
155
231
|
)
|
|
156
232
|
}
|
|
233
|
+
// A header-only card has no body region at all: the divider would otherwise
|
|
234
|
+
// sit above an empty box.
|
|
235
|
+
const bodyVisible = props.headerOnly !== true
|
|
157
236
|
return (
|
|
158
237
|
<li className={cardClass}>
|
|
159
238
|
{header}
|
|
160
|
-
{
|
|
161
|
-
? (
|
|
162
|
-
|
|
239
|
+
{bodyVisible
|
|
240
|
+
? bodyRegion(
|
|
241
|
+
<>
|
|
163
242
|
{!state.writable ? <p className={css.readOnly} role="status">{props.t('settings.readOnly')}</p> : null}
|
|
164
243
|
{props.children}
|
|
165
244
|
{props.hideFooter === true
|
|
@@ -191,7 +270,7 @@ export function PluginSettingsCard<TKey extends string = string>(props: PluginSe
|
|
|
191
270
|
</button>
|
|
192
271
|
</div>
|
|
193
272
|
)}
|
|
194
|
-
|
|
273
|
+
</>,
|
|
195
274
|
)
|
|
196
275
|
: null}
|
|
197
276
|
</li>
|
|
@@ -206,6 +285,12 @@ export interface FieldProps {
|
|
|
206
285
|
label: string
|
|
207
286
|
/** One-line explanation rendered under the control. */
|
|
208
287
|
hint: string
|
|
288
|
+
/**
|
|
289
|
+
* Full sentence behind the visible hint, exposed as the paragraph's native
|
|
290
|
+
* `title` so a card can shorten the line without losing the text. Omitted:
|
|
291
|
+
* the paragraph carries no title attribute at all.
|
|
292
|
+
*/
|
|
293
|
+
hintTitle?: string
|
|
209
294
|
/** Draft text this control renders. */
|
|
210
295
|
text: string
|
|
211
296
|
/** True when saving would leave a user-layer entry for this field. */
|
|
@@ -264,7 +349,7 @@ export function ValueField(props: FieldProps & {
|
|
|
264
349
|
disabled={props.disabled}
|
|
265
350
|
onChange={(event) => { props.onEdit(event.target.value) }}
|
|
266
351
|
/>
|
|
267
|
-
<p className={props.invalid ? css.invalid : css.hint}>
|
|
352
|
+
<p className={props.invalid ? css.invalid : css.hint} title={props.hintTitle}>
|
|
268
353
|
{props.invalid ? props.invalidLabel : props.hint}
|
|
269
354
|
</p>
|
|
270
355
|
</div>
|
|
@@ -516,7 +601,7 @@ export function BooleanField(props: FieldProps & {
|
|
|
516
601
|
invalid={props.invalid}
|
|
517
602
|
onEdit={props.onEdit}
|
|
518
603
|
/>
|
|
519
|
-
<p className={css.hint}>{props.hint}</p>
|
|
604
|
+
<p className={css.hint} title={props.hintTitle}>{props.hint}</p>
|
|
520
605
|
</div>
|
|
521
606
|
)
|
|
522
607
|
}
|
|
@@ -556,9 +641,44 @@ export function ChoiceField(props: FieldProps & {
|
|
|
556
641
|
invalid={props.invalid}
|
|
557
642
|
onEdit={props.onEdit}
|
|
558
643
|
/>
|
|
559
|
-
<p className={props.invalid ? css.invalid : css.hint}>
|
|
644
|
+
<p className={props.invalid ? css.invalid : css.hint} title={props.hintTitle}>
|
|
560
645
|
{props.invalid ? props.invalidLabel : props.hint}
|
|
561
646
|
</p>
|
|
562
647
|
</div>
|
|
563
648
|
)
|
|
564
649
|
}
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* An immediate boolean toggle drawn as a switch track, for a setting that
|
|
653
|
+
* applies on flip rather than through a staged save. It is a real button with
|
|
654
|
+
* `role="switch"` and `aria-checked`, so keyboard and assistive activation
|
|
655
|
+
* arrive as a click and the state is announced instead of inferred from a
|
|
656
|
+
* checkbox tick.
|
|
657
|
+
*/
|
|
658
|
+
export function ToggleSwitch(props: {
|
|
659
|
+
/** Id of the element naming the switch (the card's title). */
|
|
660
|
+
labelledBy?: string
|
|
661
|
+
/** Accessible name when no element labels it. */
|
|
662
|
+
ariaLabel?: string
|
|
663
|
+
/** Current state. */
|
|
664
|
+
checked: boolean
|
|
665
|
+
/** Disables the switch while a write is in flight or the Host refuses writes. */
|
|
666
|
+
disabled?: boolean
|
|
667
|
+
/** Called with the requested next state. */
|
|
668
|
+
onChange: (next: boolean) => void
|
|
669
|
+
}) {
|
|
670
|
+
return (
|
|
671
|
+
<button
|
|
672
|
+
type="button"
|
|
673
|
+
className={css.toggle}
|
|
674
|
+
role="switch"
|
|
675
|
+
aria-checked={props.checked}
|
|
676
|
+
aria-labelledby={props.labelledBy}
|
|
677
|
+
aria-label={props.labelledBy === undefined ? props.ariaLabel : undefined}
|
|
678
|
+
disabled={props.disabled}
|
|
679
|
+
onClick={() => { props.onChange(!props.checked) }}
|
|
680
|
+
>
|
|
681
|
+
<span className={css.toggleTrack}><span className={css.toggleThumb} /></span>
|
|
682
|
+
</button>
|
|
683
|
+
)
|
|
684
|
+
}
|
|
@@ -5,9 +5,19 @@
|
|
|
5
5
|
* as siblings of the built-in Shell / Agent loop / Web search cards. */
|
|
6
6
|
|
|
7
7
|
.card {
|
|
8
|
+
/* The card's local scale: every literal below reads one of these, and the
|
|
9
|
+
nested density overrides the same seven on the same element, so one rule
|
|
10
|
+
set serves both densities. */
|
|
11
|
+
--settings-card-radius: 12px;
|
|
12
|
+
--settings-card-header-pad: 16px;
|
|
13
|
+
--settings-card-header-gap: 13px;
|
|
14
|
+
--settings-card-title-size: 15px;
|
|
15
|
+
--settings-card-description-size: 13px;
|
|
16
|
+
--settings-card-body-inset: 16px;
|
|
17
|
+
--settings-card-motion: 0.18s;
|
|
8
18
|
border: 1px solid var(--dsw-alias-border-l2);
|
|
9
19
|
background: var(--dsw-alias-bg-layer-3);
|
|
10
|
-
border-radius:
|
|
20
|
+
border-radius: var(--settings-card-radius);
|
|
11
21
|
list-style: none;
|
|
12
22
|
transition: border-color 0.16s, background 0.16s;
|
|
13
23
|
}
|
|
@@ -21,6 +31,24 @@
|
|
|
21
31
|
border-color: var(--dsw-alias-label-dimmed);
|
|
22
32
|
}
|
|
23
33
|
|
|
34
|
+
/* Nested density: a topic card inside another card's body. It overrides the
|
|
35
|
+
local scale only, so the first-level card and this one stay one rule set. */
|
|
36
|
+
.cardNested {
|
|
37
|
+
--settings-card-radius: 10px;
|
|
38
|
+
--settings-card-header-pad: 10px 12px;
|
|
39
|
+
--settings-card-header-gap: 10px;
|
|
40
|
+
--settings-card-title-size: 13px;
|
|
41
|
+
--settings-card-description-size: 12px;
|
|
42
|
+
--settings-card-body-inset: 12px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* One line: the header already carries the full sentence on its title. */
|
|
46
|
+
.cardNested .description {
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
text-overflow: ellipsis;
|
|
50
|
+
}
|
|
51
|
+
|
|
24
52
|
.header {
|
|
25
53
|
appearance: none;
|
|
26
54
|
width: 100%;
|
|
@@ -34,10 +62,10 @@
|
|
|
34
62
|
cursor: pointer;
|
|
35
63
|
background: transparent;
|
|
36
64
|
border: 0;
|
|
37
|
-
border-radius:
|
|
65
|
+
border-radius: var(--settings-card-radius);
|
|
38
66
|
align-items: center;
|
|
39
|
-
gap:
|
|
40
|
-
padding:
|
|
67
|
+
gap: var(--settings-card-header-gap);
|
|
68
|
+
padding: var(--settings-card-header-pad);
|
|
41
69
|
display: flex;
|
|
42
70
|
}
|
|
43
71
|
|
|
@@ -49,10 +77,10 @@
|
|
|
49
77
|
.headerStatic {
|
|
50
78
|
width: 100%;
|
|
51
79
|
box-sizing: border-box;
|
|
52
|
-
border-radius:
|
|
80
|
+
border-radius: var(--settings-card-radius);
|
|
53
81
|
align-items: center;
|
|
54
|
-
gap:
|
|
55
|
-
padding:
|
|
82
|
+
gap: var(--settings-card-header-gap);
|
|
83
|
+
padding: var(--settings-card-header-pad);
|
|
56
84
|
display: flex;
|
|
57
85
|
}
|
|
58
86
|
|
|
@@ -85,7 +113,7 @@
|
|
|
85
113
|
|
|
86
114
|
.name {
|
|
87
115
|
color: var(--dsw-alias-label-primary);
|
|
88
|
-
font-size:
|
|
116
|
+
font-size: var(--settings-card-title-size);
|
|
89
117
|
font-weight: 600;
|
|
90
118
|
line-height: 1.4;
|
|
91
119
|
}
|
|
@@ -95,7 +123,7 @@
|
|
|
95
123
|
print leave 12-13px hint text below readable contrast (orca-link #778399
|
|
96
124
|
on cream measures ~3.4:1). */
|
|
97
125
|
color: var(--dsw-alias-label-secondary);
|
|
98
|
-
font-size:
|
|
126
|
+
font-size: var(--settings-card-description-size);
|
|
99
127
|
line-height: 1.5;
|
|
100
128
|
}
|
|
101
129
|
|
|
@@ -111,6 +139,14 @@
|
|
|
111
139
|
line-height: 17px;
|
|
112
140
|
}
|
|
113
141
|
|
|
142
|
+
/* Header trailing control (an immediate toggle): a flex item that keeps its
|
|
143
|
+
natural width while the title block takes the remaining space. */
|
|
144
|
+
.headerAction {
|
|
145
|
+
flex: none;
|
|
146
|
+
display: inline-flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
}
|
|
149
|
+
|
|
114
150
|
.chevron {
|
|
115
151
|
color: var(--dsw-alias-label-tertiary);
|
|
116
152
|
flex: none;
|
|
@@ -127,9 +163,36 @@
|
|
|
127
163
|
transform: rotate(180deg);
|
|
128
164
|
}
|
|
129
165
|
|
|
166
|
+
/* Body disclosure. One transition pair drives both legs: the wrapper
|
|
167
|
+
animates 0fr -> 1fr and back, the body is its only item and shrinks into the
|
|
168
|
+
collapsed track. Only the moving states clip, so a settled card never cuts
|
|
169
|
+
off a field's popup. */
|
|
170
|
+
.disclosure {
|
|
171
|
+
display: grid;
|
|
172
|
+
grid-template-rows: 0fr;
|
|
173
|
+
opacity: 0;
|
|
174
|
+
transition: grid-template-rows var(--settings-card-motion) ease, opacity var(--settings-card-motion) ease;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.disclosure[data-state='collapsed'],
|
|
178
|
+
.disclosure[data-state='entering'],
|
|
179
|
+
.disclosure[data-state='closing'] {
|
|
180
|
+
overflow: hidden;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.disclosure[data-state='entering'],
|
|
184
|
+
.disclosure[data-state='shown'] {
|
|
185
|
+
grid-template-rows: 1fr;
|
|
186
|
+
opacity: 1;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.disclosure > .body {
|
|
190
|
+
min-height: 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
130
193
|
.body {
|
|
131
194
|
border-top: 1px solid var(--dsw-alias-border-l2);
|
|
132
|
-
margin: 0
|
|
195
|
+
margin: 0 var(--settings-card-body-inset);
|
|
133
196
|
padding-bottom: 8px;
|
|
134
197
|
}
|
|
135
198
|
|
|
@@ -428,6 +491,65 @@
|
|
|
428
491
|
line-height: 1.5;
|
|
429
492
|
}
|
|
430
493
|
|
|
494
|
+
/* Immediate boolean toggle: the official switch shape (30x16 track, 12px
|
|
495
|
+
thumb). The on state fills with the primary-action pair rather than a fixed
|
|
496
|
+
state color, so it stays legible in every theme; disabled dims through
|
|
497
|
+
opacity instead of a second palette. */
|
|
498
|
+
.toggle {
|
|
499
|
+
appearance: none;
|
|
500
|
+
display: inline-flex;
|
|
501
|
+
align-items: center;
|
|
502
|
+
background: transparent;
|
|
503
|
+
border: 0;
|
|
504
|
+
border-radius: 999px;
|
|
505
|
+
margin: 0;
|
|
506
|
+
padding: 0;
|
|
507
|
+
cursor: pointer;
|
|
508
|
+
font: inherit;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.toggleTrack {
|
|
512
|
+
position: relative;
|
|
513
|
+
flex: none;
|
|
514
|
+
width: 30px;
|
|
515
|
+
height: 16px;
|
|
516
|
+
border-radius: 999px;
|
|
517
|
+
/* Off must still read as a rail: border-l2 is an alpha hairline color and
|
|
518
|
+
leaves the track nearly invisible on a card surface. */
|
|
519
|
+
background: var(--dsw-alias-label-dimmed);
|
|
520
|
+
transition: background 0.18s ease;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.toggleThumb {
|
|
524
|
+
position: absolute;
|
|
525
|
+
top: 2px;
|
|
526
|
+
left: 2px;
|
|
527
|
+
width: 12px;
|
|
528
|
+
height: 12px;
|
|
529
|
+
border-radius: 50%;
|
|
530
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
531
|
+
transition: left 0.18s ease;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.toggle[aria-checked='true'] .toggleTrack {
|
|
535
|
+
background: var(--dsw-alias-button-primary-fill, var(--dsw-alias-label-primary));
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.toggle[aria-checked='true'] .toggleThumb {
|
|
539
|
+
left: 16px;
|
|
540
|
+
background: var(--dsw-alias-label-primary-foreground, var(--dsw-alias-bg-layer-3));
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.toggle:focus-visible {
|
|
544
|
+
outline: 2px solid var(--dsw-alias-brand-primary);
|
|
545
|
+
outline-offset: 2px;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.toggle:disabled {
|
|
549
|
+
opacity: 0.45;
|
|
550
|
+
cursor: default;
|
|
551
|
+
}
|
|
552
|
+
|
|
431
553
|
@media (prefers-reduced-motion: reduce) {
|
|
432
554
|
.card,
|
|
433
555
|
.header,
|
|
@@ -438,7 +560,15 @@
|
|
|
438
560
|
.save,
|
|
439
561
|
.selectChevron,
|
|
440
562
|
.selectChevronOpen,
|
|
441
|
-
.selectPopup
|
|
563
|
+
.selectPopup,
|
|
564
|
+
.toggleTrack,
|
|
565
|
+
.toggleThumb {
|
|
442
566
|
transition: none;
|
|
443
567
|
}
|
|
568
|
+
|
|
569
|
+
/* Reduced motion drops the height travel but keeps the fade, so a closing
|
|
570
|
+
body still leaves through the leg its own state started. */
|
|
571
|
+
.disclosure {
|
|
572
|
+
transition-property: opacity;
|
|
573
|
+
}
|
|
444
574
|
}
|
package/src/composition.test.ts
CHANGED
|
@@ -275,6 +275,26 @@ describe('applyPresetOverrides', () => {
|
|
|
275
275
|
expect(configOf(rowOf(applied, 'minimal-prompt'))['dispatcher']).toBe(false)
|
|
276
276
|
})
|
|
277
277
|
|
|
278
|
+
it('operator gets the wire from the catalog row this preset declares', () => {
|
|
279
|
+
// Given the 0.2.1 API, where a preset selects its wire through
|
|
280
|
+
// agent.ctx.tools.presentAs, When the operator commits a presentation, Then
|
|
281
|
+
// the tool-catalog row carries it and nothing else is written: the
|
|
282
|
+
// declaration and the catalog text read one value.
|
|
283
|
+
const ptc = applyPresetOverrides(rows(), { presentation: 'ptc' })
|
|
284
|
+
expect(configOf(rowOf(ptc, 'tool-catalog'))['presentation']).toBe('ptc')
|
|
285
|
+
const native = applyPresetOverrides(rows(), { presentation: 'native' })
|
|
286
|
+
expect(configOf(rowOf(native, 'tool-catalog'))['presentation']).toBe('native')
|
|
287
|
+
expect(rowOf(native, 'tool-catalog').disabled).toBeUndefined()
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
it('operator keeps the shipped ptc wire when no presentation is committed', () => {
|
|
291
|
+
// Given no committed presentation, When the overlay is applied, Then the
|
|
292
|
+
// catalog row keeps the value the composition ships: the shipped default is
|
|
293
|
+
// the collapsed wire, and an absent setting never rewrites it.
|
|
294
|
+
const applied = applyPresetOverrides(rows(), {})
|
|
295
|
+
expect(configOf(rowOf(applied, 'tool-catalog'))['presentation']).toBe('ptc')
|
|
296
|
+
})
|
|
297
|
+
|
|
278
298
|
it('operator is never given a row the composition does not carry', () => {
|
|
279
299
|
// Given a composition with no tool-catalog row, When the operator applies
|
|
280
300
|
// a presentation choice, Then no row is invented for it.
|
package/src/composition.ts
CHANGED
|
@@ -500,10 +500,18 @@ export interface PresetOverrides {
|
|
|
500
500
|
dispatcher?: boolean
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
-
/** One settings overlay entry: the row it targets and the keys it writes. */
|
|
503
|
+
/** One settings overlay entry: the row it targets and the config keys it writes. */
|
|
504
504
|
type OverrideTarget = readonly [string, Readonly<Record<string, unknown>>]
|
|
505
505
|
|
|
506
|
-
/**
|
|
506
|
+
/**
|
|
507
|
+
* The overlay table: settings field to composition row and config key.
|
|
508
|
+
*
|
|
509
|
+
* `presentation` writes the `tool-catalog` row alone, because that row's
|
|
510
|
+
* declaration IS the wire: the plugin hands the value to
|
|
511
|
+
* `agent.ctx.tools.presentAs` and re-assembles, so the catalog text and the
|
|
512
|
+
* declared presentation always travel together. The composition carries no
|
|
513
|
+
* executor row to mount or unmount.
|
|
514
|
+
*/
|
|
507
515
|
function overrideTargets(overrides: PresetOverrides): OverrideTarget[] {
|
|
508
516
|
return [
|
|
509
517
|
['tool-catalog', { ...overrides.presentation === undefined ? {} : { presentation: overrides.presentation } }],
|