@huaqiu/dsh-hardware-ui 0.7.19 → 0.7.21

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.
@@ -0,0 +1,275 @@
1
+ /**
2
+ * The Place Order view: pick a KiCad project, then pick the operation.
3
+ *
4
+ * This is the plugin-owned entry point the desktop menu and the user both reach
5
+ * without an agent message. It does exactly two things — list what the Host
6
+ * discovered in the current workspace, and hand one project to the existing
7
+ * order destination — because the manufacturing work already exists: packaging,
8
+ * validation, the upload, the token and the page are the same code the agent's
9
+ * tools and the order panel use. Nothing here prices, packages or scans on its
10
+ * own; `discover()` is the Host's deterministic scan and every row is rendered
11
+ * from its answer.
12
+ *
13
+ * Readiness is shown, not guessed: PCB needs a saved board, PCBA additionally
14
+ * needs the project schematic the positions and BOM are exported from, and both
15
+ * need a configured KiCad and a signed-in account. An unavailable operation keeps
16
+ * its button visible but disabled with the reason next to it.
17
+ */
18
+ import { createElement, useEffect, useState, type CSSProperties, type ReactNode } from 'react'
19
+ import type { HardwareArtifactInfo, HardwareProjectInfo, HardwareState } from './model.js'
20
+ import { COPY } from './copy.js'
21
+ import { messageOf, loadOrderConfig, type OrderConfigInfo } from './transport.js'
22
+ import { buttonStyle, C, cardStyle, disabled, dotStyle, MUTED, MONO, pillStyle, R, SECTION_TITLE } from './theme.js'
23
+
24
+ type UseStore = <S>(selector: (state: HardwareState) => S) => S
25
+
26
+ export interface PlaceOrderProps {
27
+ readonly useStore?: UseStore
28
+ readonly sessionId?: string
29
+ readonly useSessions?: (selector: (state: {
30
+ readonly ids: readonly string[]
31
+ readonly byId: Readonly<Record<string, { readonly cwd?: string }>>
32
+ }) => string | undefined) => string | undefined
33
+ readonly discover: (cwd?: string, project?: string, session?: string) => Promise<{
34
+ readonly cwd: string
35
+ readonly projects?: readonly HardwareProjectInfo[]
36
+ readonly issue?: { readonly code: string; readonly message: string }
37
+ }>
38
+ readonly installations: () => Promise<{ readonly kicad?: { readonly configured: boolean } }>
39
+ readonly orderProject: (request: {
40
+ readonly projectPath: string
41
+ readonly boardPath: string
42
+ readonly schematicPath?: string
43
+ readonly kind: 'pcb' | 'smt'
44
+ }) => void
45
+ }
46
+
47
+ const ROOT: CSSProperties = {
48
+ display: 'flex', flexDirection: 'column', height: '100%', minHeight: 0, minWidth: 0,
49
+ boxSizing: 'border-box', background: C.base, color: C.text,
50
+ }
51
+ const HEAD: CSSProperties = {
52
+ display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap',
53
+ padding: '8px 12px', borderBottom: `1px solid ${C.borderSoft}`, flex: '0 0 auto',
54
+ }
55
+ const BODY: CSSProperties = {
56
+ flex: '1 1 0', minHeight: 0, overflow: 'auto', padding: 12,
57
+ display: 'flex', flexDirection: 'column', gap: 8,
58
+ }
59
+ const ROW: CSSProperties = {
60
+ display: 'flex', alignItems: 'center', gap: 8, minWidth: 0,
61
+ }
62
+ const NAME: CSSProperties = { fontSize: 12.5, fontWeight: 600, color: C.text, minWidth: 0 }
63
+ const SUB: CSSProperties = { ...MUTED, fontFamily: MONO, fontSize: 10.5, wordBreak: 'break-all' }
64
+ const CHIP: CSSProperties = { ...pillStyle('muted'), fontSize: 9.5, padding: '0 5px', whiteSpace: 'nowrap' }
65
+ const REASON: CSSProperties = { ...MUTED, fontSize: 10, maxWidth: 190, lineHeight: 1.45 }
66
+
67
+ /** Boardless-safe artifact summary for one row. */
68
+ function artifactsLine(project: HardwareProjectInfo): string {
69
+ const boards = project.boards?.length ?? 0
70
+ const board = boards === 0 ? undefined : (project.defaultBoard ?? project.boards?.[0]?.path)
71
+ const boardName = board === undefined ? undefined : board.slice(Math.max(board.lastIndexOf('\\'), board.lastIndexOf('/')) + 1)
72
+ const schematic = project.schematic?.path
73
+ const schematicName = schematic === undefined ? undefined : schematic.slice(Math.max(schematic.lastIndexOf('\\'), schematic.lastIndexOf('/')) + 1)
74
+ return [
75
+ COPY.order.placeOrder.boardCount(boards),
76
+ boardName ?? COPY.order.placeOrder.noBoard,
77
+ schematicName ?? COPY.order.placeOrder.noSchematic,
78
+ ].join(' · ')
79
+ }
80
+
81
+ /** Path of the project directory relative to the scanned workspace. */
82
+ function relativePath(root: string, path: string): string {
83
+ const normalizedRoot = root.replace(/[\\/]+$/u, '')
84
+ if (!path.startsWith(normalizedRoot)) return path
85
+ return path.slice(normalizedRoot.length).replace(/^[\\/]+/u, '') || '.'
86
+ }
87
+
88
+ export function PlaceOrderBody(props: PlaceOrderProps): ReactNode {
89
+ const { discover, installations, orderProject, sessionId, useSessions } = props
90
+ const cwd = useSessions?.(state => {
91
+ if (sessionId === undefined) return undefined
92
+ return state.byId[sessionId]?.cwd
93
+ })
94
+ const [root, setRoot] = useState<string>()
95
+ const [projects, setProjects] = useState<readonly HardwareProjectInfo[]>()
96
+ const [issue, setIssue] = useState<{ code: string; message: string }>()
97
+ const [error, setError] = useState<string>()
98
+ const [scanning, setScanning] = useState(false)
99
+ const [kicadReady, setKicadReady] = useState<boolean>()
100
+ const [config, setConfig] = useState<OrderConfigInfo>()
101
+ const [revision, setRevision] = useState(0)
102
+
103
+ useEffect(() => {
104
+ let live = true
105
+ setScanning(true)
106
+ setError(undefined)
107
+ discover(cwd, undefined, sessionId)
108
+ .then((result) => {
109
+ if (!live) return
110
+ setRoot(result.cwd)
111
+ setProjects(result.projects ?? [])
112
+ setIssue(result.issue)
113
+ })
114
+ .catch((failure: unknown) => {
115
+ if (!live) return
116
+ setProjects([])
117
+ setError(messageOf(failure))
118
+ })
119
+ .finally(() => { if (live) setScanning(false) })
120
+ return () => { live = false }
121
+ }, [cwd, sessionId, discover, revision])
122
+
123
+ useEffect(() => {
124
+ let live = true
125
+ installations()
126
+ .then((result) => { if (live) setKicadReady(result.kicad?.configured === true) })
127
+ .catch(() => { if (live) setKicadReady(false) })
128
+ loadOrderConfig()
129
+ .then((value) => { if (live) setConfig(value) })
130
+ .catch(() => { if (live) setConfig(undefined) })
131
+ return () => { live = false }
132
+ }, [installations])
133
+
134
+ const signedIn = config?.hasToken
135
+ const scanningNow = scanning
136
+
137
+ /** Why one operation is unavailable for this row, in priority order. */
138
+ const blockedReason = (kind: 'pcb' | 'pcba', project: HardwareProjectInfo): string | undefined => {
139
+ if (kind === 'pcb') {
140
+ if ((project.boards?.length ?? 0) === 0) return COPY.order.placeOrder.noBoard
141
+ } else {
142
+ if ((project.boards?.length ?? 0) === 0) return COPY.order.placeOrder.noBoard
143
+ if (project.schematic === undefined) return COPY.order.placeOrder.noSchematic
144
+ }
145
+ if (kicadReady === false) return COPY.order.placeOrder.needsKicad
146
+ if (signedIn === false) return COPY.order.placeOrder.needsSignIn
147
+ return undefined
148
+ }
149
+
150
+ const order = (kind: 'pcb' | 'pcba', project: HardwareProjectInfo): void => {
151
+ const boards = project.boards ?? []
152
+ const board: HardwareArtifactInfo | undefined = project.defaultBoard === undefined
153
+ ? boards[0]
154
+ : boards.find(candidate => candidate.path === project.defaultBoard) ?? boards[0]
155
+ if (board === undefined) return
156
+ orderProject({
157
+ projectPath: project.path,
158
+ boardPath: board.path,
159
+ ...(project.schematic === undefined ? {} : { schematicPath: project.schematic.path }),
160
+ kind: kind === 'pcb' ? 'pcb' : 'smt',
161
+ })
162
+ }
163
+
164
+ const row = (project: HardwareProjectInfo): ReactNode => {
165
+ const pcbReason = blockedReason('pcb', project)
166
+ const pcbaReason = blockedReason('pcba', project)
167
+ return createElement(
168
+ 'div',
169
+ {
170
+ key: project.path,
171
+ style: cardStyle({ gap: 6, padding: 10 }),
172
+ 'data-hardware-place-order-project': project.path,
173
+ 'data-hardware-place-order-pcb': pcbReason === undefined ? 'ready' : 'blocked',
174
+ 'data-hardware-place-order-pcba': pcbaReason === undefined ? 'ready' : 'blocked',
175
+ },
176
+ createElement(
177
+ 'div',
178
+ { style: { ...ROW, justifyContent: 'space-between', alignItems: 'flex-start' } },
179
+ createElement(
180
+ 'div',
181
+ { style: { display: 'flex', flexDirection: 'column', gap: 2, minWidth: 0 } },
182
+ createElement('span', { style: NAME }, project.name),
183
+ createElement('span', { style: SUB, title: project.path }, relativePath(root ?? '', project.path)),
184
+ ),
185
+ createElement('span', { style: CHIP }, artifactsLine(project)),
186
+ ),
187
+ createElement(
188
+ 'div',
189
+ { style: { ...ROW, alignItems: 'flex-start', flexWrap: 'wrap' } },
190
+ createElement(
191
+ 'div',
192
+ { style: { display: 'flex', flexDirection: 'column', gap: 2, minWidth: 0 } },
193
+ createElement('button', {
194
+ type: 'button',
195
+ style: { ...buttonStyle('primary', { padding: '4px 10px', fontSize: 11 }), ...disabled(pcbReason !== undefined || scanningNow) },
196
+ disabled: pcbReason !== undefined || scanningNow,
197
+ 'data-hardware-place-order-action': 'pcb',
198
+ onClick: () => { order('pcb', project) },
199
+ }, COPY.order.placeOrder.pcbAction),
200
+ ...(pcbReason === undefined ? [] : [createElement('span', { key: 'pcb-why', style: REASON }, pcbReason)]),
201
+ ),
202
+ createElement(
203
+ 'div',
204
+ { style: { display: 'flex', flexDirection: 'column', gap: 2, minWidth: 0 } },
205
+ createElement('button', {
206
+ type: 'button',
207
+ style: { ...buttonStyle('secondary', { padding: '4px 10px', fontSize: 11 }), ...disabled(pcbaReason !== undefined || scanningNow) },
208
+ disabled: pcbaReason !== undefined || scanningNow,
209
+ 'data-hardware-place-order-action': 'pcba',
210
+ onClick: () => { order('pcba', project) },
211
+ }, COPY.order.placeOrder.pcbaAction),
212
+ ...(pcbaReason === undefined ? [] : [createElement('span', { key: 'pcba-why', style: REASON }, pcbaReason)]),
213
+ ),
214
+ ),
215
+ )
216
+ }
217
+
218
+ const header = createElement(
219
+ 'div',
220
+ { style: HEAD },
221
+ createElement('span', { style: { ...SECTION_TITLE, marginRight: 2 } }, COPY.order.placeOrder.title),
222
+ createElement(
223
+ 'span',
224
+ { style: { fontFamily: MONO, fontSize: 10.5, color: C.text3, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: '1 1 120px' }, title: root ?? '' },
225
+ root ?? COPY.order.placeOrder.workspaceUnknown,
226
+ ),
227
+ createElement(
228
+ 'span',
229
+ { style: pillStyle(kicadReady === false ? 'warn' : 'muted'), 'data-hardware-place-order-kicad': kicadReady === false ? 'missing' : kicadReady === true ? 'ok' : 'checking' },
230
+ createElement('span', { style: dotStyle(kicadReady === false ? C.warn : kicadReady === true ? C.ok : C.text3, 6) }),
231
+ kicadReady === false ? COPY.order.placeOrder.needsKicad : kicadReady === true ? COPY.order.placeOrder.kicadReady : COPY.order.placeOrder.checking,
232
+ ),
233
+ createElement(
234
+ 'span',
235
+ { style: pillStyle(signedIn === false ? 'warn' : 'muted'), 'data-hardware-place-order-signin': signedIn === false ? 'missing' : signedIn === true ? 'ok' : 'checking' },
236
+ createElement('span', { style: dotStyle(signedIn === false ? C.warn : signedIn === true ? C.ok : C.text3, 6) }),
237
+ signedIn === false ? COPY.order.placeOrder.needsSignIn : signedIn === true ? COPY.order.placeOrder.signInReady : COPY.order.placeOrder.checking,
238
+ ),
239
+ createElement(
240
+ 'button',
241
+ {
242
+ type: 'button',
243
+ style: { ...buttonStyle('quiet', { padding: '3px 8px', fontSize: 10.5 }), ...disabled(scanningNow) },
244
+ disabled: scanningNow,
245
+ 'data-hardware-place-order-refresh': true,
246
+ onClick: () => { setRevision(value => value + 1) },
247
+ },
248
+ scanningNow ? COPY.order.placeOrder.refreshing : COPY.order.placeOrder.refresh,
249
+ ),
250
+ )
251
+
252
+ const body = createElement(
253
+ 'div',
254
+ { style: BODY },
255
+ createElement('p', { style: MUTED }, COPY.order.placeOrder.lead),
256
+ ...(error === undefined ? [] : [createElement('p', {
257
+ key: 'error', role: 'status',
258
+ style: { ...MUTED, color: C.warn, borderLeft: `2px solid ${C.warn}`, paddingLeft: 8 },
259
+ }, COPY.order.placeOrder.discoveryFailed(error))]),
260
+ ...(scanningNow && projects === undefined
261
+ ? [createElement('p', { key: 'loading', style: MUTED }, COPY.order.placeOrder.loading)]
262
+ : []),
263
+ ...(projects === undefined || scanningNow || error !== undefined || projects.length > 0
264
+ ? []
265
+ : [createElement(
266
+ 'div',
267
+ { key: 'empty', style: cardStyle({ alignItems: 'flex-start', gap: 4 }), 'data-hardware-place-order-empty': issue?.code ?? 'none' },
268
+ createElement('span', { style: pillStyle('warn') }, COPY.order.placeOrder.noProjects),
269
+ createElement('p', { style: MUTED }, COPY.order.placeOrder.noProjectsHint),
270
+ )]),
271
+ ...(projects === undefined ? [] : projects.map(row)),
272
+ )
273
+
274
+ return createElement('div', { style: ROOT, 'data-hardware-place-order': true }, header, body)
275
+ }
@@ -405,11 +405,13 @@ export interface HardwarePreviewProps {
405
405
  readonly revision: number
406
406
  /** Whether a validated KiCad installation exists. */
407
407
  readonly configured?: boolean
408
+ /** Operation the user picked in the Place Order view, if any. */
409
+ readonly orderKind?: 'pcb' | 'smt'
408
410
  }
409
411
 
410
412
  /** Destination → preview dispatcher. */
411
413
  export function HardwarePreview({
412
- destination, artifact, schematicPath, workspaceRoot, session, revision, configured = false,
414
+ destination, artifact, schematicPath, workspaceRoot, session, revision, configured = false, orderKind,
413
415
  }: HardwarePreviewProps): ReactNode {
414
416
  if (artifact === undefined) return null
415
417
  const key = `${destination}:${artifact.path}:${String(revision)}`
@@ -446,5 +448,6 @@ export function HardwarePreview({
446
448
  ...(workspaceRoot === undefined ? {} : { workspaceRoot }),
447
449
  ...(session === undefined ? {} : { session }),
448
450
  configured,
451
+ ...(orderKind === undefined ? {} : { focus: orderKind }),
449
452
  })
450
453
  }
@@ -96,6 +96,9 @@ const mutators = {
96
96
  applyNavigation(draft: Mutable<HardwareState>, params: ViewerNavigationParams): void {
97
97
  draft.activeDestination = params.destination
98
98
  if (params.projectPath !== undefined) draft.projectPath = params.projectPath
99
+ // An explicit schematic wins over whatever the tab was showing: an order
100
+ // carries the project it belongs to, not the previous artifact.
101
+ if (params.schematicPath !== undefined) draft.schematicPath = params.schematicPath
99
102
  if (params.path !== undefined) {
100
103
  if (params.destination === 'schematic' || params.destination === 'bom') {
101
104
  draft.schematicPath = params.path
@@ -19,7 +19,7 @@ import { createElement, Fragment, useSyncExternalStore, type CSSProperties, type
19
19
  import { COPY } from './copy.js'
20
20
  import {
21
21
  jobPercent, jobRunning, setupIncomplete, setupSummary,
22
- type InstallJob, type ToolStatus, type ToolchainController, type ToolchainId,
22
+ type DraftCheck, type InstallJob, type ToolStatus, type ToolchainController, type ToolchainId,
23
23
  type ToolchainSnapshot,
24
24
  } from './toolchain.js'
25
25
  import {
@@ -136,6 +136,52 @@ export function statusPill(
136
136
  }
137
137
  }
138
138
 
139
+ /**
140
+ * The wizard's badge, which is about **readiness**, not configuration.
141
+ *
142
+ * The prototype reads `✓ Ready (v10.0.7)`. The wizard is the first-run surface,
143
+ * so it must light up as soon as the user has a tool it can actually use —
144
+ * whether that came from a saved root, a path the Host just validated, or an
145
+ * executable discovery already checked. Only when none of those hold does it fall
146
+ * back to the state pill (`Not configured`, a running download, a failure), which
147
+ * is also what it shows while a job is in flight.
148
+ */
149
+ export function wizardPill(
150
+ tool: ToolStatus,
151
+ job: InstallJob | undefined,
152
+ check: DraftCheck | undefined,
153
+ ): { readonly text: string; readonly tone: 'ok' | 'warn' | 'info' | 'muted' | 'accent' } {
154
+ const statePill = statusPill(tool, job)
155
+ if (job !== undefined && job.tool === tool.tool && (jobRunning(job) || job.phase === 'failed')) return statePill
156
+ const detected = tool.discovery?.selected
157
+ // A saved root *with* a resolved version is a usable tool, whatever transitory
158
+ // state the Host happens to report (`validating`, a stale `missing`): the wizard
159
+ // must not tell a user with a working KiCad that it is unconfigured.
160
+ const saved = tool.installPath !== undefined && tool.version !== undefined && tool.state !== 'invalid'
161
+ const ready = tool.state === 'configured' || saved || check?.state === 'valid' || detected?.valid === true
162
+ if (!ready) return statePill
163
+ const version = tool.state === 'configured' || saved
164
+ ? tool.version
165
+ : check?.state === 'valid'
166
+ ? check.version
167
+ : detected?.version
168
+ return {
169
+ text: version === undefined ? COPY.wizard.readyDetected : COPY.wizard.ready(version),
170
+ tone: 'ok',
171
+ }
172
+ }
173
+
174
+ /** One line of verdict text beside the validate button; never a filesystem path. */
175
+ function textVerdict(text: string, color: string): ReactNode {
176
+ return createElement('span', {
177
+ style: {
178
+ ...MONO_TEXT, fontSize: 11, color, maxWidth: 260,
179
+ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
180
+ },
181
+ title: text,
182
+ }, text)
183
+ }
184
+
139
185
  /** One line describing what discovery found, or that it is still looking. */
140
186
  export function discoveryLine(tool: ToolStatus): { readonly text: string; readonly tone: 'muted' | 'ok' | 'warn' } | undefined {
141
187
  const discovery = tool.discovery
@@ -213,9 +259,10 @@ export function ToolchainCard(props: {
213
259
  const draft = snapshot.drafts[id]
214
260
  const saving = snapshot.saving === id
215
261
  const running = jobRunning(job)
262
+ const check = snapshot.checks[id]
216
263
  const pill = tool === undefined
217
264
  ? { text: COPY.toolchain.statusValidating, tone: 'muted' as const }
218
- : statusPill(tool, job)
265
+ : variant === 'wizard' ? wizardPill(tool, job, check) : statusPill(tool, job)
219
266
  const entry = tool?.download
220
267
  const busy = running || saving
221
268
 
@@ -249,7 +296,7 @@ export function ToolchainCard(props: {
249
296
  : null,
250
297
  ),
251
298
  ),
252
- createElement('span', { style: pillStyle(pill.tone) }, pill.text),
299
+ createElement('span', { style: pillStyle(pill.tone), 'data-hardware-toolchain-pill': id }, pill.text),
253
300
  )
254
301
 
255
302
  const description = variant === 'settings'
@@ -288,13 +335,36 @@ export function ToolchainCard(props: {
288
335
  // It reports what the Host knows — except while the field holds an edit the Host
289
336
  // has never seen, where saying "awaiting executable path" beside a filled input
290
337
  // would be plainly false.
338
+ //
339
+ // The *path* is never printed here. A card that just wrote its configuration
340
+ // says so with a success badge that fades by itself; the full executable path
341
+ // (which the Host resolves, not the user) is the one thing nobody asked to read,
342
+ // and it used to sit in place of the verdict and read as a permanent "saved"
343
+ // even before anything was saved.
291
344
  const savedRoot = tool?.installPath ?? ''
292
345
  const dirty = draft.trim() !== '' && draft.trim() !== savedRoot
293
- const statusText = dirty
294
- ? COPY.settings.statusUnsaved
295
- : tool?.state === 'configured'
296
- ? (tool.cliPath ?? COPY.settings.statusVerified)
297
- : tool?.error ?? COPY.settings.statusAwaiting
346
+ const confirmation = snapshot.confirmed[id]
347
+
348
+ const verdict = (() => {
349
+ if (confirmation !== undefined) {
350
+ return createElement('span', {
351
+ style: { ...pillStyle('ok'), display: 'inline-flex', alignItems: 'center', gap: 6, whiteSpace: 'nowrap' },
352
+ role: 'status',
353
+ 'data-hardware-toolchain-confirmed': id,
354
+ },
355
+ createElement('span', { style: dotStyle(C.ok, 6) }),
356
+ confirmation.version === undefined
357
+ ? COPY.settings.statusSavedPlain
358
+ : COPY.settings.statusSavedBadge(confirmation.version))
359
+ }
360
+ if (dirty && check?.state === 'invalid') {
361
+ return textVerdict(check.error ?? COPY.toolchain.statusInvalid, C.warn)
362
+ }
363
+ if (dirty && check?.state === 'pending') return textVerdict(COPY.toolchain.statusValidating, C.text3)
364
+ if (dirty) return textVerdict(COPY.settings.statusUnsaved, C.text3)
365
+ if (tool?.state === 'configured') return null
366
+ return textVerdict(tool?.error ?? COPY.settings.statusAwaiting, tool?.error === undefined ? C.text3 : C.warn)
367
+ })()
298
368
 
299
369
  const validateRow = createElement(
300
370
  'div',
@@ -305,12 +375,7 @@ export function ToolchainCard(props: {
305
375
  disabled: busy,
306
376
  onClick: onSave,
307
377
  }, saving ? COPY.settings.validating : COPY.settings.validate),
308
- variant === 'settings'
309
- ? createElement('span', {
310
- style: { ...MONO_TEXT, fontSize: 11, maxWidth: 260, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },
311
- title: statusText,
312
- }, statusText)
313
- : null,
378
+ variant === 'settings' ? verdict : null,
314
379
  )
315
380
 
316
381
  /** Download affordance: a plugin job first, the vendor page as the honest fallback. */
@@ -377,6 +442,9 @@ export function ToolchainCard(props: {
377
442
  style: cardStyle({ gap: variant === 'wizard' ? 10 : 12, padding: variant === 'wizard' ? 14 : 16 }),
378
443
  'data-hardware-toolchain-card': id,
379
444
  'data-variant': variant,
445
+ // The input's own verdict, exposed for support and for the UI walk that has
446
+ // to prove the wizard only lights up for a path the Host accepted.
447
+ 'data-hardware-toolchain-check': check?.state ?? 'none',
380
448
  },
381
449
  header,
382
450
  ...(description === null ? [] : [description]),
@@ -395,7 +463,7 @@ export function ToolchainCard(props: {
395
463
  /** §9.2: no in-app build for this platform means the vendor page, never a fake button. */
396
464
  function officialFallback(tool: ToolchainId, snapshot: ToolchainSnapshot): ReactNode {
397
465
  return createElement('a', {
398
- href: snapshot.status?.official[tool] ?? '#',
466
+ href: snapshot.status?.official?.[tool] ?? '#',
399
467
  target: '_blank',
400
468
  rel: 'noreferrer noopener',
401
469
  style: { fontSize: 11, color: C.info, textDecoration: 'none', whiteSpace: 'nowrap' },
@@ -524,7 +592,12 @@ function ExecutablePicker(props: {
524
592
  {
525
593
  style: {
526
594
  position: 'fixed', inset: 0, zIndex: 2200, display: 'flex', alignItems: 'center',
527
- justifyContent: 'center', padding: 16, background: 'rgba(0,0,0,0.75)',
595
+ justifyContent: 'center', padding: 16,
596
+ // The picker opens *inside* a modal that already dims the page (`rgba(0,0,0,0.75)`).
597
+ // Two stacked 0.75 scrims multiply to ~0.94 black, which reads as "the lights
598
+ // went out" rather than "a dialog is on top" — so this layer only adds a light
599
+ // veil, enough to separate the panel from the settings card behind it.
600
+ background: 'rgba(0,0,0,0.32)',
528
601
  pointerEvents: 'auto',
529
602
  },
530
603
  role: 'dialog',
@@ -659,7 +732,7 @@ export function ToolchainToastHost(props: { readonly controller: ToolchainContro
659
732
  if (snapshot.toasts.length === 0) return null
660
733
  return createElement(
661
734
  'div',
662
- { style: { position: 'fixed', inset: 0, zIndex: 2100, pointerEvents: 'none' }, 'data-hardware-toolchain-toasts': true },
735
+ { style: { position: 'fixed', inset: 0, zIndex: 2400, pointerEvents: 'none' }, 'data-hardware-toolchain-toasts': true },
663
736
  createElement(
664
737
  'div',
665
738
  {