dsh-agent-control-center 0.3.1 → 0.4.1
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/CHANGELOG.md +85 -0
- package/README.md +6 -4
- package/README.zh.md +6 -4
- package/client.js +1142 -18
- package/docs/01-CONTRACT.md +1 -1
- package/docs/05-ACCEPTANCE-EVIDENCE.md +79 -0
- package/docs/07-GUIDE.md +1 -1
- package/docs/08-COMPATIBILITY.md +23 -4
- package/docs/09-ARCHITECTURE.md +2 -2
- package/docs/12-PLUGIN-HEALTH.md +49 -0
- package/docs/13-PAGE-REGRESSION-0.4.0.md +47 -0
- package/index.js +4 -1
- package/lib/core/caps.js +28 -7
- package/lib/core/compat.js +16 -5
- package/lib/core/http.js +17 -1
- package/lib/core/index.js +15 -1
- package/lib/core/store.js +5 -1
- package/lib/core/tools-view.js +92 -0
- package/lib/modules/b-tools.js +62 -38
- package/lib/modules/e-meta.js +12 -10
- package/lib/modules/j-instruction.js +162 -2
- package/lib/modules/l-health.js +862 -0
- package/package.json +1 -1
- package/scripts/verify.mjs +1 -0
- package/src/client/i18n/health.js +260 -0
- package/src/client/pages/health.js +832 -0
- package/src/client/pages/tools.js +42 -16
|
@@ -146,20 +146,6 @@
|
|
|
146
146
|
return h(C.Btn, { tone: 'ghost', onClick: copy, title: label, 'aria-live': 'polite' }, label)
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
/** Esc collapses the open detail panel while it is open. */
|
|
150
|
-
function useEscape(active, onEscape) {
|
|
151
|
-
ACC.useEffect(() => {
|
|
152
|
-
if (!active) return undefined
|
|
153
|
-
const handler = (event) => {
|
|
154
|
-
if (event.key !== 'Escape') return
|
|
155
|
-
event.stopPropagation()
|
|
156
|
-
onEscape()
|
|
157
|
-
}
|
|
158
|
-
document.addEventListener('keydown', handler)
|
|
159
|
-
return () => document.removeEventListener('keydown', handler)
|
|
160
|
-
}, [active, onEscape])
|
|
161
|
-
}
|
|
162
|
-
|
|
163
149
|
/** @param {{ value: unknown, onOpen: Function, t: Function }} props */
|
|
164
150
|
function SourceBadge(props) {
|
|
165
151
|
const source = props.value || {}
|
|
@@ -474,7 +460,42 @@
|
|
|
474
460
|
[selected, days, agentId],
|
|
475
461
|
)
|
|
476
462
|
|
|
477
|
-
|
|
463
|
+
// Escape closes the host Settings dialog. Local state (an open detail row or a
|
|
464
|
+
// non-empty search) must consume the key first: a capture-phase listener runs
|
|
465
|
+
// before the host's document-level handler, and stopPropagation keeps it from
|
|
466
|
+
// reaching the dialog.
|
|
467
|
+
ACC.useEffect(() => {
|
|
468
|
+
// The host may close the Settings dialog from any of the three key events
|
|
469
|
+
// at any level, so the whole Escape gesture is consumed here: keydown
|
|
470
|
+
// decides whether the page owns it, keypress/keyup follow for the same
|
|
471
|
+
// gesture so a later phase cannot reopen the dialog's close path.
|
|
472
|
+
let ownedByPage = false
|
|
473
|
+
const handler = (event) => {
|
|
474
|
+
if (event.key !== 'Escape') return
|
|
475
|
+
const input = searchRef.current
|
|
476
|
+
if (event.type === 'keydown') {
|
|
477
|
+
ownedByPage = selected !== '' || search !== '' || (input !== null && document.activeElement === input)
|
|
478
|
+
}
|
|
479
|
+
if (!ownedByPage) return
|
|
480
|
+
event.preventDefault()
|
|
481
|
+
event.stopPropagation()
|
|
482
|
+
if (event.type !== 'keydown') return
|
|
483
|
+
if (selected !== '') {
|
|
484
|
+
setSelected('')
|
|
485
|
+
return
|
|
486
|
+
}
|
|
487
|
+
if (search !== '') {
|
|
488
|
+
setSearch('')
|
|
489
|
+
return
|
|
490
|
+
}
|
|
491
|
+
if (input !== null) input.blur()
|
|
492
|
+
}
|
|
493
|
+
const types = ['keydown', 'keypress', 'keyup']
|
|
494
|
+
for (const type of types) window.addEventListener(type, handler, true)
|
|
495
|
+
return () => {
|
|
496
|
+
for (const type of types) window.removeEventListener(type, handler, true)
|
|
497
|
+
}
|
|
498
|
+
}, [selected, search])
|
|
478
499
|
ACC.useEffect(() => {
|
|
479
500
|
const onKey = (event) => {
|
|
480
501
|
if (event.key !== '/' || event.metaKey || event.ctrlKey || event.altKey) return
|
|
@@ -560,7 +581,12 @@
|
|
|
560
581
|
placeholder: t('tools.searchPlaceholder'),
|
|
561
582
|
value: search,
|
|
562
583
|
onChange: (event) => setSearch(event.target.value),
|
|
563
|
-
onKeyDown: (event) => {
|
|
584
|
+
onKeyDown: (event) => {
|
|
585
|
+
if (event.key !== 'Escape') return
|
|
586
|
+
// The page-level capture handler already clears the query; keep the
|
|
587
|
+
// dialog open if it ever arrives here first.
|
|
588
|
+
event.preventDefault()
|
|
589
|
+
},
|
|
564
590
|
'aria-label': t('tools.search'),
|
|
565
591
|
style: { minWidth: '180px' },
|
|
566
592
|
}),
|