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
package/client.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Generated by scripts/build-client.mjs from src/client/ — do not edit.
|
|
2
|
-
// DSH client module: dsh-agent-control-center@0.
|
|
2
|
+
// DSH client module: dsh-agent-control-center@0.4.1 (13 i18n fragments, 12 pages)
|
|
3
3
|
window.__ModuleLoader__.load({
|
|
4
4
|
id: "dsh-agent-control-center",
|
|
5
5
|
factory(require) {
|
|
6
6
|
'use strict'
|
|
7
7
|
const React = require('react')
|
|
8
8
|
const h = React.createElement
|
|
9
|
-
const ACC_VERSION = "0.
|
|
9
|
+
const ACC_VERSION = "0.4.1"
|
|
10
10
|
/* ---- kernel.js ---- */
|
|
11
11
|
/* ---------------------------------------------------------------------------
|
|
12
12
|
* ACC kernel — shared runtime attached to every page script.
|
|
@@ -1729,6 +1729,269 @@ ACC.addI18n({
|
|
|
1729
1729
|
})
|
|
1730
1730
|
;
|
|
1731
1731
|
|
|
1732
|
+
/* ---- i18n/health.js ---- */
|
|
1733
|
+
/* Health page (module L) — vocabulary for the read-only health check.
|
|
1734
|
+
*
|
|
1735
|
+
* Host-provided evidence (plugin ids, module names, settings namespace ids,
|
|
1736
|
+
* secret key names, scan file paths and compatibility reason texts) is data and
|
|
1737
|
+
* is rendered verbatim by the page; every sentence the page itself writes lives
|
|
1738
|
+
* here, in both languages, with the same key set (the build proves parity). */
|
|
1739
|
+
ACC.addI18n({
|
|
1740
|
+
zh: {
|
|
1741
|
+
'nav.health': '健康检查',
|
|
1742
|
+
'nav.desc.health': '插件清单、设置命名空间、分区冲突与兼容性的只读体检',
|
|
1743
|
+
|
|
1744
|
+
'health.readOnlyNotice': '本页只读:只读取插件行、设置元数据、扫描结果与兼容性结论,不修改任何插件或配置。',
|
|
1745
|
+
'health.loading': '正在读取体检数据…',
|
|
1746
|
+
'health.refreshing': '刷新中…',
|
|
1747
|
+
'health.refresh': '刷新',
|
|
1748
|
+
'health.blockFailed': '这一块不可用',
|
|
1749
|
+
'health.unavailable': '当前不可用',
|
|
1750
|
+
'health.unavailableNextStep': '下一步:确认宿主已加载包含 health 模块的本插件版本(旧宿主没有 health.* 方法),然后刷新本页。',
|
|
1751
|
+
'health.reasonMissing': '宿主没有给出原因',
|
|
1752
|
+
'health.noteLabel': '说明',
|
|
1753
|
+
'health.hostHealthTitle': '宿主通道',
|
|
1754
|
+
'health.moduleMissingReason': '宿主没有加载 health 模块(可能是旧版插件或该模块未启用)',
|
|
1755
|
+
'health.moduleMissingHint': '升级本插件到包含 health 模块的版本后刷新本页;本页不会退回显示推测数据。',
|
|
1756
|
+
'health.moduleBlockedReason': '宿主报告 health 模块被阻断',
|
|
1757
|
+
'health.moduleBlockedHint': '按该模块的详情修复后刷新;只读页不会执行修复。',
|
|
1758
|
+
|
|
1759
|
+
'health.summaryTitle': '体检结论',
|
|
1760
|
+
'health.summarySubtitle': '四项只读事实的汇总:插件清单、设置命名空间、section 冲突与兼容性',
|
|
1761
|
+
'health.worst': '最严重项',
|
|
1762
|
+
'health.worstNone': '全部通过',
|
|
1763
|
+
'health.worstHint': '先处理这一块;其余块的证据在下方各自列出。',
|
|
1764
|
+
'health.severity.ok': '通过',
|
|
1765
|
+
'health.severity.warn': '注意',
|
|
1766
|
+
'health.severity.error': '错误',
|
|
1767
|
+
'health.severity.info': '信息',
|
|
1768
|
+
'health.block.plugins': '插件',
|
|
1769
|
+
'health.block.settings': '设置',
|
|
1770
|
+
'health.block.sections': '分区扫描',
|
|
1771
|
+
'health.block.compat': '兼容性',
|
|
1772
|
+
'health.tile.plugins': '插件',
|
|
1773
|
+
'health.tile.settings': '设置命名空间',
|
|
1774
|
+
'health.tile.sections': '分区冲突',
|
|
1775
|
+
'health.tile.compat': '兼容',
|
|
1776
|
+
'health.tileAnomalies': '{count} 个异常',
|
|
1777
|
+
'health.tileNoAnomalies': '无异常',
|
|
1778
|
+
'health.tileSectionsCount': '共 {count} 个 section',
|
|
1779
|
+
'health.redacted': '已脱敏',
|
|
1780
|
+
'health.notRedacted': '未验证脱敏',
|
|
1781
|
+
'health.readOnlyYes': '只读',
|
|
1782
|
+
'health.readOnlyNo': '可写',
|
|
1783
|
+
'health.generatedAt': '生成时间 {time}',
|
|
1784
|
+
'health.summaryPartial': '部分子项不可用:空值显示为 —,不显示推测数据。',
|
|
1785
|
+
'health.summaryMissingWorst': '汇总没有给出最严重项结论;请刷新或逐块查看原因。',
|
|
1786
|
+
'health.tilesAria': '体检分项',
|
|
1787
|
+
|
|
1788
|
+
'health.refresh.summary': '刷新体检结论',
|
|
1789
|
+
'health.refresh.plugins': '刷新插件清单',
|
|
1790
|
+
'health.refresh.settings': '刷新设置命名空间',
|
|
1791
|
+
'health.refresh.sections': '刷新分区扫描结果',
|
|
1792
|
+
'health.refresh.compat': '刷新兼容性结论',
|
|
1793
|
+
'health.refresh.host': '刷新宿主通道',
|
|
1794
|
+
|
|
1795
|
+
'health.pluginsTitle': '插件清单',
|
|
1796
|
+
'health.pluginsSubtitle': '来自宿主 pluginManager 的插件行;无法地址化的行与重复注册单独列出',
|
|
1797
|
+
'health.source': '来源',
|
|
1798
|
+
'health.pluginsColumnEntry': 'entryId',
|
|
1799
|
+
'health.pluginsColumnModule': 'moduleName',
|
|
1800
|
+
'health.pluginsColumnPatch': 'patchId',
|
|
1801
|
+
'health.pluginsColumnReadOnly': 'readOnlyReason',
|
|
1802
|
+
'health.pluginsEmpty': '没有插件行',
|
|
1803
|
+
'health.pluginsEmptyHint': '宿主 pluginManager 返回空清单;请确认当前 profile 是否安装了插件。',
|
|
1804
|
+
'health.anomaliesTitle': '清单异常',
|
|
1805
|
+
'health.anomaliesNone': '没有检测到插件清单异常',
|
|
1806
|
+
'health.anomaliesNoneHint': '插件行地址与 moduleName 均唯一。',
|
|
1807
|
+
'health.anomalyKindLabel': '类型',
|
|
1808
|
+
'health.anomalySuggestion': '建议动作',
|
|
1809
|
+
'health.anomalyKind.duplicate-module': '重复模块',
|
|
1810
|
+
'health.anomalyKind.unaddressable': '不可地址化',
|
|
1811
|
+
'health.anomalyKindUnknown': '其他异常',
|
|
1812
|
+
'health.anomalyAction.duplicate-module': '在 profile 中只保留一个注册行,或为重复的模块改名。',
|
|
1813
|
+
'health.anomalyAction.unaddressable': '改用插件自身配置或 profile patch 中可寻址的行;无法通过 patch 控制的插件行不应在此修改。',
|
|
1814
|
+
'health.anomalyActionGeneric': '核对重复或无地址的行,必要时在 profile patch 中调整注册。',
|
|
1815
|
+
|
|
1816
|
+
'health.settingsTitle': '设置命名空间',
|
|
1817
|
+
'health.settingsSubtitle': '只读元数据:命名空间、修订、自动生成与 secret 键名',
|
|
1818
|
+
'health.settingsRedactionOk': '已脱敏',
|
|
1819
|
+
'health.settingsRedactionFail': '未验证脱敏',
|
|
1820
|
+
'health.settingsRedactionOkHint': '宿主按 redactSecrets:true 返回元数据,未出现原值。',
|
|
1821
|
+
'health.settingsRedactionFailHint': '检测到未经脱敏的 secret 元数据;原值已丢弃,请升级宿主或移除该命名空间。',
|
|
1822
|
+
'health.settingsOwn': '本插件命名空间',
|
|
1823
|
+
'health.settingsDeclared': '已声明',
|
|
1824
|
+
'health.settingsNotDeclared': '未声明',
|
|
1825
|
+
'health.settingsEnabled': '已启用',
|
|
1826
|
+
'health.settingsDisabled': '已禁用',
|
|
1827
|
+
'health.settingsColumnNs': 'ns',
|
|
1828
|
+
'health.settingsColumnRevision': 'revision',
|
|
1829
|
+
'health.settingsColumnAutoGenerate': 'autoGenerate',
|
|
1830
|
+
'health.settingsColumnSecretKeys': 'secretKeys',
|
|
1831
|
+
'health.secretKeyCount': '{count} 个',
|
|
1832
|
+
'health.yes': '是',
|
|
1833
|
+
'health.no': '否',
|
|
1834
|
+
'health.settingsEmpty': '没有设置命名空间',
|
|
1835
|
+
'health.settingsEmptyHint': '宿主 settings.describe 返回空列表;请确认当前 profile 与插件命名空间是否正确。',
|
|
1836
|
+
'health.settingsNote': '来源 settings.describe({ redactSecrets: true }):只返回命名空间元数据与 secret 键名,schema/value/base/user 原值不进入响应。',
|
|
1837
|
+
|
|
1838
|
+
'health.sectionsTitle': '设置分区静态扫描',
|
|
1839
|
+
'health.sectionsSubtitle': '扫描 profile 下客户端 bundle 中的字面量 settings.section 注册',
|
|
1840
|
+
'health.sectionsScanned': '已扫描 {packages} 个包、{files} 个客户端文件',
|
|
1841
|
+
'health.sectionsColumnId': 'id',
|
|
1842
|
+
'health.sectionsColumnOwner': 'owner',
|
|
1843
|
+
'health.sectionsColumnFile': 'file',
|
|
1844
|
+
'health.sectionsEmpty': '扫描没有发现 settings.section 注册',
|
|
1845
|
+
'health.sectionsEmptyHint': '若期望有设置项,请确认对应插件已构建带字面量 settings.section 的 client.js。',
|
|
1846
|
+
'health.sectionsNote': '静态扫描可能漏检动态注册:只覆盖构建产物内的字面量 settings.section。',
|
|
1847
|
+
'health.conflictsTitle': '分区 id 冲突',
|
|
1848
|
+
'health.conflictsNone': '没有检测到冲突',
|
|
1849
|
+
'health.conflictsNoneHint': '没有被多个插件包重复注册的 settings.section id;动态注册不在静态扫描范围内。',
|
|
1850
|
+
'health.conflictKindLabel': '类型',
|
|
1851
|
+
'health.conflictOwners': '注册者',
|
|
1852
|
+
'health.conflictSuggestion': '建议',
|
|
1853
|
+
'health.conflictKind.duplicate-id': '重复 id',
|
|
1854
|
+
'health.conflictKindUnknown': '其他冲突',
|
|
1855
|
+
'health.conflictSuggestionFallback': '请核对注册者并只保留一个 settings.section id。',
|
|
1856
|
+
|
|
1857
|
+
'health.compatTitle': '兼容性',
|
|
1858
|
+
'health.compatSubtitle': '宿主版本判定结论与只读模式;写操作在看结论前应保持关闭',
|
|
1859
|
+
'health.compatLevel': 'level',
|
|
1860
|
+
'health.compatVersion': 'version',
|
|
1861
|
+
'health.compatReadOnly': 'readOnly',
|
|
1862
|
+
'health.compatReasons': '兼容性原因',
|
|
1863
|
+
'health.compatReasonsNone': '兼容层没有给出原因',
|
|
1864
|
+
'health.compatReasonsNoneHint': '没有给出原因通常表示当前宿主版本已通过校验;写操作仍应先看 readOnly。',
|
|
1865
|
+
},
|
|
1866
|
+
en: {
|
|
1867
|
+
'nav.health': 'Health check',
|
|
1868
|
+
'nav.desc.health': 'Read-only check of the plugin inventory, settings namespaces, section conflicts and compatibility',
|
|
1869
|
+
|
|
1870
|
+
'health.readOnlyNotice': 'This page is read-only: it only reads plugin rows, settings metadata, scan results and the compatibility verdict. It never modifies a plugin or configuration.',
|
|
1871
|
+
'health.loading': 'Loading health data…',
|
|
1872
|
+
'health.refreshing': 'Refreshing…',
|
|
1873
|
+
'health.refresh': 'Refresh',
|
|
1874
|
+
'health.blockFailed': 'This block is unavailable',
|
|
1875
|
+
'health.unavailable': 'Currently unavailable',
|
|
1876
|
+
'health.unavailableNextStep': 'Next step: confirm the host loaded a plugin build that includes the health module (older hosts expose no health.* methods), then refresh this page.',
|
|
1877
|
+
'health.reasonMissing': 'The host gave no reason',
|
|
1878
|
+
'health.noteLabel': 'Note',
|
|
1879
|
+
'health.hostHealthTitle': 'Host channel',
|
|
1880
|
+
'health.moduleMissingReason': 'The host did not load the health module (older plugin build or the module is disabled)',
|
|
1881
|
+
'health.moduleMissingHint': 'Upgrade this plugin to a build that includes the health module, then refresh this page; the page never falls back to guessed data.',
|
|
1882
|
+
'health.moduleBlockedReason': 'The host reports the health module is blocked',
|
|
1883
|
+
'health.moduleBlockedHint': 'Fix this module detail, then refresh; this read-only page performs no repair.',
|
|
1884
|
+
|
|
1885
|
+
'health.summaryTitle': 'Health verdict',
|
|
1886
|
+
'health.summarySubtitle': 'Four read-only facts folded together: plugin inventory, settings namespaces, section conflicts and compatibility',
|
|
1887
|
+
'health.worst': 'Most severe',
|
|
1888
|
+
'health.worstNone': 'All checks passed',
|
|
1889
|
+
'health.worstHint': 'Address this block first; evidence for the other blocks is listed below.',
|
|
1890
|
+
'health.severity.ok': 'OK',
|
|
1891
|
+
'health.severity.warn': 'Warning',
|
|
1892
|
+
'health.severity.error': 'Error',
|
|
1893
|
+
'health.severity.info': 'Info',
|
|
1894
|
+
'health.block.plugins': 'Plugins',
|
|
1895
|
+
'health.block.settings': 'Settings',
|
|
1896
|
+
'health.block.sections': 'Section scan',
|
|
1897
|
+
'health.block.compat': 'Compatibility',
|
|
1898
|
+
'health.tile.plugins': 'Plugins',
|
|
1899
|
+
'health.tile.settings': 'Settings namespaces',
|
|
1900
|
+
'health.tile.sections': 'Section conflicts',
|
|
1901
|
+
'health.tile.compat': 'Compatibility',
|
|
1902
|
+
'health.tileAnomalies': '{count} anomalies',
|
|
1903
|
+
'health.tileNoAnomalies': 'No anomalies',
|
|
1904
|
+
'health.tileSectionsCount': '{count} sections',
|
|
1905
|
+
'health.redacted': 'Redaction verified',
|
|
1906
|
+
'health.notRedacted': 'Redaction unverified',
|
|
1907
|
+
'health.readOnlyYes': 'Read-only',
|
|
1908
|
+
'health.readOnlyNo': 'Writable',
|
|
1909
|
+
'health.generatedAt': 'Generated {time}',
|
|
1910
|
+
'health.summaryPartial': 'Some sub-results are unavailable: empty values render as — instead of guessed data.',
|
|
1911
|
+
'health.summaryMissingWorst': 'The summary reported no most-severe verdict; refresh or inspect each block for the reason.',
|
|
1912
|
+
'health.tilesAria': 'Health check sections',
|
|
1913
|
+
|
|
1914
|
+
'health.refresh.summary': 'Refresh health summary',
|
|
1915
|
+
'health.refresh.plugins': 'Refresh plugin inventory',
|
|
1916
|
+
'health.refresh.settings': 'Refresh settings namespaces',
|
|
1917
|
+
'health.refresh.sections': 'Refresh section scan',
|
|
1918
|
+
'health.refresh.compat': 'Refresh compatibility verdict',
|
|
1919
|
+
'health.refresh.host': 'Refresh host channel',
|
|
1920
|
+
|
|
1921
|
+
'health.pluginsTitle': 'Plugin inventory',
|
|
1922
|
+
'health.pluginsSubtitle': 'Plugin rows from the host pluginManager; unaddressable rows and duplicate registrations are listed separately',
|
|
1923
|
+
'health.source': 'Source',
|
|
1924
|
+
'health.pluginsColumnEntry': 'entryId',
|
|
1925
|
+
'health.pluginsColumnModule': 'moduleName',
|
|
1926
|
+
'health.pluginsColumnPatch': 'patchId',
|
|
1927
|
+
'health.pluginsColumnReadOnly': 'readOnlyReason',
|
|
1928
|
+
'health.pluginsEmpty': 'No plugin rows',
|
|
1929
|
+
'health.pluginsEmptyHint': 'The host pluginManager returned an empty list; confirm the current profile is expected to install plugins.',
|
|
1930
|
+
'health.anomaliesTitle': 'Inventory anomalies',
|
|
1931
|
+
'health.anomaliesNone': 'No plugin-inventory anomalies detected',
|
|
1932
|
+
'health.anomaliesNoneHint': 'Plugin entry ids and module names are all unique.',
|
|
1933
|
+
'health.anomalyKindLabel': 'Kind',
|
|
1934
|
+
'health.anomalySuggestion': 'Suggested action',
|
|
1935
|
+
'health.anomalyKind.duplicate-module': 'Duplicate module',
|
|
1936
|
+
'health.anomalyKind.unaddressable': 'Unaddressable row',
|
|
1937
|
+
'health.anomalyKindUnknown': 'Other anomaly',
|
|
1938
|
+
'health.anomalyAction.duplicate-module': 'Keep a single row per module in the profile, or rename the duplicate registration.',
|
|
1939
|
+
'health.anomalyAction.unaddressable': "Use the addressable row from the plugin's own configuration or profile patch; a row the patch cannot address must not be edited here.",
|
|
1940
|
+
'health.anomalyActionGeneric': 'Inspect the duplicate or unaddressable rows and adjust their registration in the profile patch if needed.',
|
|
1941
|
+
|
|
1942
|
+
'health.settingsTitle': 'Settings namespaces',
|
|
1943
|
+
'health.settingsSubtitle': 'Read-only metadata: namespace, revision, auto-generate and secret key names',
|
|
1944
|
+
'health.settingsRedactionOk': 'Redaction verified',
|
|
1945
|
+
'health.settingsRedactionFail': 'Redaction unverified',
|
|
1946
|
+
'health.settingsRedactionOkHint': 'The host returned metadata under redactSecrets:true; no raw values appeared.',
|
|
1947
|
+
'health.settingsRedactionFailHint': 'Secret metadata arrived unredacted; raw values were dropped. Upgrade the host or remove that namespace.',
|
|
1948
|
+
'health.settingsOwn': 'Own namespace',
|
|
1949
|
+
'health.settingsDeclared': 'Declared',
|
|
1950
|
+
'health.settingsNotDeclared': 'Not declared',
|
|
1951
|
+
'health.settingsEnabled': 'Enabled',
|
|
1952
|
+
'health.settingsDisabled': 'Disabled',
|
|
1953
|
+
'health.settingsColumnNs': 'ns',
|
|
1954
|
+
'health.settingsColumnRevision': 'revision',
|
|
1955
|
+
'health.settingsColumnAutoGenerate': 'autoGenerate',
|
|
1956
|
+
'health.settingsColumnSecretKeys': 'secretKeys',
|
|
1957
|
+
'health.secretKeyCount': '{count}',
|
|
1958
|
+
'health.yes': 'Yes',
|
|
1959
|
+
'health.no': 'No',
|
|
1960
|
+
'health.settingsEmpty': 'No settings namespaces',
|
|
1961
|
+
'health.settingsEmptyHint': 'The host settings.describe returned an empty list; confirm the current profile and plugin namespace.',
|
|
1962
|
+
'health.settingsNote': 'Source settings.describe({ redactSecrets: true }): namespace metadata and secret key names only; schema/value/base/user never enter the response.',
|
|
1963
|
+
|
|
1964
|
+
'health.sectionsTitle': 'Settings-section static scan',
|
|
1965
|
+
'health.sectionsSubtitle': 'Scans literal settings.section registrations inside client bundles under the profile',
|
|
1966
|
+
'health.sectionsScanned': 'Scanned {packages} packages and {files} client files',
|
|
1967
|
+
'health.sectionsColumnId': 'id',
|
|
1968
|
+
'health.sectionsColumnOwner': 'owner',
|
|
1969
|
+
'health.sectionsColumnFile': 'file',
|
|
1970
|
+
'health.sectionsEmpty': 'The scan found no settings.section registrations',
|
|
1971
|
+
'health.sectionsEmptyHint': 'If settings entries are expected, confirm the owning plugin built a client.js that contains a literal settings.section registration.',
|
|
1972
|
+
'health.sectionsNote': 'The static scan can miss dynamically registered sections: it only covers literal settings.section entries in built bundles.',
|
|
1973
|
+
'health.conflictsTitle': 'Section id conflicts',
|
|
1974
|
+
'health.conflictsNone': 'No conflicts detected',
|
|
1975
|
+
'health.conflictsNoneHint': 'No settings.section id is registered by more than one plugin package; dynamic registrations stay outside the static scan.',
|
|
1976
|
+
'health.conflictKindLabel': 'Kind',
|
|
1977
|
+
'health.conflictOwners': 'Owners',
|
|
1978
|
+
'health.conflictSuggestion': 'Suggestion',
|
|
1979
|
+
'health.conflictKind.duplicate-id': 'Duplicate id',
|
|
1980
|
+
'health.conflictKindUnknown': 'Other conflict',
|
|
1981
|
+
'health.conflictSuggestionFallback': 'Inspect the owners and keep a single settings.section id.',
|
|
1982
|
+
|
|
1983
|
+
'health.compatTitle': 'Compatibility',
|
|
1984
|
+
'health.compatSubtitle': 'Host version verdict and read-only mode; write operations stay disabled until this verdict is known',
|
|
1985
|
+
'health.compatLevel': 'level',
|
|
1986
|
+
'health.compatVersion': 'version',
|
|
1987
|
+
'health.compatReadOnly': 'readOnly',
|
|
1988
|
+
'health.compatReasons': 'Compatibility reasons',
|
|
1989
|
+
'health.compatReasonsNone': 'The compatibility layer reported no reasons',
|
|
1990
|
+
'health.compatReasonsNoneHint': 'No reasons usually means the current host version passed validation; still check readOnly before writing.',
|
|
1991
|
+
},
|
|
1992
|
+
})
|
|
1993
|
+
;
|
|
1994
|
+
|
|
1732
1995
|
/* ---- i18n/instruction.js ---- */
|
|
1733
1996
|
/* Instruction preview page vocabulary (module J). Every user-visible string
|
|
1734
1997
|
* lives here; the English dictionary is a complete mirror of the Chinese one
|
|
@@ -6223,6 +6486,841 @@ ACC.l10n = (function createL10n() {
|
|
|
6223
6486
|
})()
|
|
6224
6487
|
;
|
|
6225
6488
|
|
|
6489
|
+
/* ---- pages/health.js ---- */
|
|
6490
|
+
/* Health page (module L) — one read-only, evidence-first health check.
|
|
6491
|
+
*
|
|
6492
|
+
* Page order, top to bottom:
|
|
6493
|
+
* 1. Read-only policy notice: this page never writes a plugin or config.
|
|
6494
|
+
* 2. Verdict card: worst-severity notice plus four status cells from
|
|
6495
|
+
* `health.summary()` (plugins, settings namespaces, section conflicts,
|
|
6496
|
+
* compatibility).
|
|
6497
|
+
* 3. Plugin inventory: `health.plugins()` rows and its anomalies, with the
|
|
6498
|
+
* action each anomaly calls for.
|
|
6499
|
+
* 4. Settings namespaces: `health.settings()` metadata only, the redaction
|
|
6500
|
+
* badge and this plugin's own declared/enabled row.
|
|
6501
|
+
* 5. Section static scan: `health.sections()` counts, sections, duplicate-id
|
|
6502
|
+
* conflicts and the mandatory limitation note.
|
|
6503
|
+
* 6. Compatibility: `health.compat()` level, version, read-only flag and
|
|
6504
|
+
* reasons.
|
|
6505
|
+
*
|
|
6506
|
+
* Each block loads, fails and reloads on its own: a missing host method shows
|
|
6507
|
+
* the reason plus the next step, never a fabricated value. Layout is vertical
|
|
6508
|
+
* rhythm only — the host settings column already scrolls. */
|
|
6509
|
+
(function healthPage() {
|
|
6510
|
+
const PAGE_STYLE = { display: 'flex', flexDirection: 'column', gap: '12px', padding: '8px 0' }
|
|
6511
|
+
const STACK_STYLE = { display: 'flex', flexDirection: 'column', gap: '8px' }
|
|
6512
|
+
const COLUMN_STYLE = { display: 'flex', flexDirection: 'column', gap: '2px' }
|
|
6513
|
+
const SMALL_STYLE = { fontSize: '11px' }
|
|
6514
|
+
const BREAK_STYLE = { wordBreak: 'break-word' }
|
|
6515
|
+
const EMPTY_VALUE = '—'
|
|
6516
|
+
|
|
6517
|
+
const SEVERITY_TONE = { ok: 'success', warn: 'warn', error: 'danger', info: 'info' }
|
|
6518
|
+
const COMPAT_TONE = { full: 'success', degraded: 'warn', unknown: 'warn', unsupported: 'danger' }
|
|
6519
|
+
/** Anomaly kind → shared tone; `unaddressable` rows are usable, only uneditable. */
|
|
6520
|
+
const ANOMALY_TONE = { 'duplicate-module': 'warn', unaddressable: 'warn' }
|
|
6521
|
+
/** Summary section id → navigation copy. */
|
|
6522
|
+
const BLOCK_KEYS = {
|
|
6523
|
+
plugins: 'health.block.plugins',
|
|
6524
|
+
settings: 'health.block.settings',
|
|
6525
|
+
sections: 'health.block.sections',
|
|
6526
|
+
compat: 'health.block.compat',
|
|
6527
|
+
}
|
|
6528
|
+
|
|
6529
|
+
/** @param {unknown} value @returns {string} */
|
|
6530
|
+
function textOf(value) {
|
|
6531
|
+
return value === null || value === undefined ? '' : String(value).trim()
|
|
6532
|
+
}
|
|
6533
|
+
|
|
6534
|
+
/** @param {unknown} value @returns {boolean} */
|
|
6535
|
+
function isRecord(value) {
|
|
6536
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
6537
|
+
}
|
|
6538
|
+
|
|
6539
|
+
/** @param {unknown} value @returns {string} a formatted count, or — when the host had no number */
|
|
6540
|
+
function countText(value) {
|
|
6541
|
+
return typeof value === 'number' && Number.isFinite(value) ? ACC.fmt.num(value) : EMPTY_VALUE
|
|
6542
|
+
}
|
|
6543
|
+
|
|
6544
|
+
/** @param {string} severity @param {Function} t @returns {string} */
|
|
6545
|
+
function severityLabel(severity, t) {
|
|
6546
|
+
if (severity === 'ok') return t('health.severity.ok')
|
|
6547
|
+
if (severity === 'warn') return t('health.severity.warn')
|
|
6548
|
+
if (severity === 'error') return t('health.severity.error')
|
|
6549
|
+
return t('health.severity.info')
|
|
6550
|
+
}
|
|
6551
|
+
|
|
6552
|
+
/** @param {string} id @param {Function} t @returns {string} */
|
|
6553
|
+
function blockLabel(id, t) {
|
|
6554
|
+
const key = BLOCK_KEYS[id]
|
|
6555
|
+
return key === undefined ? textOf(id) || EMPTY_VALUE : t(key)
|
|
6556
|
+
}
|
|
6557
|
+
|
|
6558
|
+
/**
|
|
6559
|
+
* Host free text for a note. In Chinese it is shown as-is; in English a mapped
|
|
6560
|
+
* translation wins, then ASCII host text is shown verbatim and CJK host text
|
|
6561
|
+
* falls back to the translated key so the English UI never prints Chinese.
|
|
6562
|
+
* @param {string} key @param {unknown} raw @param {Function} t @returns {string}
|
|
6563
|
+
*/
|
|
6564
|
+
function noteText(key, raw, t) {
|
|
6565
|
+
const value = textOf(raw)
|
|
6566
|
+
if (value.length === 0) return t(key)
|
|
6567
|
+
if (ACC.l10n !== undefined && ACC.l10n !== null && typeof ACC.l10n.hostOr === 'function') {
|
|
6568
|
+
return ACC.l10n.hostOr(key, value, t(key))
|
|
6569
|
+
}
|
|
6570
|
+
return value
|
|
6571
|
+
}
|
|
6572
|
+
|
|
6573
|
+
/** @param {string} kind @param {Function} t @returns {string} */
|
|
6574
|
+
function anomalyKindLabel(kind, t) {
|
|
6575
|
+
if (kind === 'duplicate-module') return t('health.anomalyKind.duplicate-module')
|
|
6576
|
+
if (kind === 'unaddressable') return t('health.anomalyKind.unaddressable')
|
|
6577
|
+
return t('health.anomalyKindUnknown')
|
|
6578
|
+
}
|
|
6579
|
+
|
|
6580
|
+
/** @param {string} kind @param {Function} t @returns {string} */
|
|
6581
|
+
function anomalyAction(kind, t) {
|
|
6582
|
+
if (kind === 'duplicate-module') return t('health.anomalyAction.duplicate-module')
|
|
6583
|
+
if (kind === 'unaddressable') return t('health.anomalyAction.unaddressable')
|
|
6584
|
+
return t('health.anomalyActionGeneric')
|
|
6585
|
+
}
|
|
6586
|
+
|
|
6587
|
+
/** @param {string} kind @param {Function} t @returns {string} */
|
|
6588
|
+
function conflictKindLabel(kind, t) {
|
|
6589
|
+
return kind === 'duplicate-id' ? t('health.conflictKind.duplicate-id') : t('health.conflictKindUnknown')
|
|
6590
|
+
}
|
|
6591
|
+
|
|
6592
|
+
/**
|
|
6593
|
+
* One truthy/falsey/absent own-row flag as a badge. An absent flag is data the
|
|
6594
|
+
* host did not provide, so it renders as — instead of a guessed state.
|
|
6595
|
+
* @param {unknown} value @param {Function} t @param {string} trueKey @param {string} falseKey
|
|
6596
|
+
* @returns {unknown}
|
|
6597
|
+
*/
|
|
6598
|
+
function ownBadge(value, t, trueKey, falseKey) {
|
|
6599
|
+
if (value === true) return h(C.Badge, { tone: 'success' }, t(trueKey))
|
|
6600
|
+
if (value === false) return h(C.Badge, { tone: 'warn' }, t(falseKey))
|
|
6601
|
+
return h('span', { className: 'acc-muted' }, EMPTY_VALUE)
|
|
6602
|
+
}
|
|
6603
|
+
|
|
6604
|
+
/**
|
|
6605
|
+
* Failure or `{available:false}` answer: the host reason, an optional hint and
|
|
6606
|
+
* the next step are all visible. A hint that is missing gets the generic next
|
|
6607
|
+
* step, so the block never ends without an action.
|
|
6608
|
+
* @param {{ t: Function, title?: string, reason?: unknown, code?: unknown, hint?: unknown, onRetry?: Function, extra?: unknown }} props
|
|
6609
|
+
*/
|
|
6610
|
+
function FailurePanel(props) {
|
|
6611
|
+
const t = props.t
|
|
6612
|
+
const reason = textOf(props.reason)
|
|
6613
|
+
const hint = textOf(props.hint)
|
|
6614
|
+
return h(
|
|
6615
|
+
'div',
|
|
6616
|
+
{ style: STACK_STYLE },
|
|
6617
|
+
h(C.ErrorBox, {
|
|
6618
|
+
error: {
|
|
6619
|
+
code: textOf(props.code) || 'unavailable',
|
|
6620
|
+
message: reason.length > 0 ? reason : t('health.reasonMissing'),
|
|
6621
|
+
hint: hint.length > 0 ? hint : undefined,
|
|
6622
|
+
},
|
|
6623
|
+
label: props.title || t('health.unavailable'),
|
|
6624
|
+
onRetry: props.onRetry,
|
|
6625
|
+
}),
|
|
6626
|
+
hint.length === 0 ? h(C.Notice, { tone: 'info' }, t('health.unavailableNextStep')) : null,
|
|
6627
|
+
props.extra === undefined ? null : props.extra,
|
|
6628
|
+
)
|
|
6629
|
+
}
|
|
6630
|
+
|
|
6631
|
+
/**
|
|
6632
|
+
* Loader for a block whose host-side module is missing: it answers the
|
|
6633
|
+
* documented `{available:false, reason, hint}` record without posting a
|
|
6634
|
+
* request the host cannot serve (an old host would answer 404 for every
|
|
6635
|
+
* health method, which also shows up as a browser resource error).
|
|
6636
|
+
* @param {{ reason?: unknown, hint?: unknown }} gate
|
|
6637
|
+
* @returns {() => Promise<Record<string, unknown>>}
|
|
6638
|
+
*/
|
|
6639
|
+
function gatedLoader(gate) {
|
|
6640
|
+
return () => Promise.resolve({ available: false, reason: textOf(gate.reason), hint: textOf(gate.hint) })
|
|
6641
|
+
}
|
|
6642
|
+
|
|
6643
|
+
/**
|
|
6644
|
+
* Three-state body: loading, error/unavailable, or the block's own rendering.
|
|
6645
|
+
* @param {{ t: Function, state: any, extra?: (data: any) => unknown, render: (data: any) => unknown }} props
|
|
6646
|
+
*/
|
|
6647
|
+
function BlockContent(props) {
|
|
6648
|
+
const t = props.t
|
|
6649
|
+
const state = props.state
|
|
6650
|
+
if (state.status === 'loading') return h(C.Loading, { label: t('health.loading') })
|
|
6651
|
+
if (state.status === 'error') {
|
|
6652
|
+
const error = state.error !== null && typeof state.error === 'object' ? state.error : {}
|
|
6653
|
+
return h(FailurePanel, {
|
|
6654
|
+
t,
|
|
6655
|
+
title: t('health.blockFailed'),
|
|
6656
|
+
reason: error.message,
|
|
6657
|
+
code: error.code || error.name,
|
|
6658
|
+
hint: error.hint,
|
|
6659
|
+
onRetry: state.reload,
|
|
6660
|
+
})
|
|
6661
|
+
}
|
|
6662
|
+
const data = isRecord(state.data) ? state.data : {}
|
|
6663
|
+
if (data.available === false) {
|
|
6664
|
+
return h(FailurePanel, {
|
|
6665
|
+
t,
|
|
6666
|
+
title: t('health.unavailable'),
|
|
6667
|
+
reason: data.reason,
|
|
6668
|
+
code: 'unavailable',
|
|
6669
|
+
hint: data.hint,
|
|
6670
|
+
onRetry: state.reload,
|
|
6671
|
+
extra: props.extra === undefined ? undefined : props.extra(data),
|
|
6672
|
+
})
|
|
6673
|
+
}
|
|
6674
|
+
return props.render(data)
|
|
6675
|
+
}
|
|
6676
|
+
|
|
6677
|
+
/**
|
|
6678
|
+
* Card shell: a title, a subtitle and the block's own refresh control. The
|
|
6679
|
+
* refresh buttons get one unique accessible name each.
|
|
6680
|
+
* @param {{ t: Function, title: unknown, subtitle?: unknown, loading: boolean, onRefresh: Function, refreshLabel: string, children?: unknown }} props
|
|
6681
|
+
*/
|
|
6682
|
+
function BlockCard(props) {
|
|
6683
|
+
const t = props.t
|
|
6684
|
+
return h(
|
|
6685
|
+
C.Card,
|
|
6686
|
+
{
|
|
6687
|
+
title: props.title,
|
|
6688
|
+
subtitle: props.subtitle,
|
|
6689
|
+
actions: h(
|
|
6690
|
+
C.Btn,
|
|
6691
|
+
{
|
|
6692
|
+
tone: 'ghost',
|
|
6693
|
+
icon: 'retry',
|
|
6694
|
+
onClick: props.onRefresh,
|
|
6695
|
+
disabled: props.loading === true,
|
|
6696
|
+
ariaLabel: props.refreshLabel,
|
|
6697
|
+
title: props.refreshLabel,
|
|
6698
|
+
},
|
|
6699
|
+
props.loading === true ? t('health.refreshing') : t('health.refresh'),
|
|
6700
|
+
),
|
|
6701
|
+
},
|
|
6702
|
+
props.children,
|
|
6703
|
+
)
|
|
6704
|
+
}
|
|
6705
|
+
|
|
6706
|
+
/** @param {{ label: unknown, value: unknown, hint?: unknown }} props */
|
|
6707
|
+
function StatusTile(props) {
|
|
6708
|
+
return h(
|
|
6709
|
+
'div',
|
|
6710
|
+
{ className: 'acc-card acc-stat', style: { cursor: 'default' } },
|
|
6711
|
+
h('span', { className: 'acc-stat-label' }, props.label),
|
|
6712
|
+
h('span', { className: 'acc-stat-value' }, props.value),
|
|
6713
|
+
props.hint === undefined || props.hint === null
|
|
6714
|
+
? null
|
|
6715
|
+
: h('span', { className: 'acc-stat-label', style: SMALL_STYLE }, props.hint),
|
|
6716
|
+
)
|
|
6717
|
+
}
|
|
6718
|
+
|
|
6719
|
+
/**
|
|
6720
|
+
* The mandatory limitation note of the section scan (and the settings source
|
|
6721
|
+
* note); the host text is used when it is shown as-is.
|
|
6722
|
+
* @param {{ t: Function, text: unknown }} props
|
|
6723
|
+
*/
|
|
6724
|
+
function NoteLine(props) {
|
|
6725
|
+
return h(
|
|
6726
|
+
'div',
|
|
6727
|
+
{ className: 'acc-muted', style: { ...SMALL_STYLE, ...BREAK_STYLE } },
|
|
6728
|
+
`${props.t('health.noteLabel')}: ${String(props.text)}`,
|
|
6729
|
+
)
|
|
6730
|
+
}
|
|
6731
|
+
|
|
6732
|
+
/**
|
|
6733
|
+
* Worst-severity verdict: its severity owns the tone of this notice.
|
|
6734
|
+
* @param {{ t: Function, worst: any }} props
|
|
6735
|
+
*/
|
|
6736
|
+
function VerdictNotice(props) {
|
|
6737
|
+
const t = props.t
|
|
6738
|
+
const worst = isRecord(props.worst) ? props.worst : null
|
|
6739
|
+
if (worst === null) return h(C.Notice, { tone: 'warn' }, t('health.summaryMissingWorst'))
|
|
6740
|
+
const severity = worst.severity === 'ok' || worst.severity === 'warn' || worst.severity === 'error' ? worst.severity : 'info'
|
|
6741
|
+
const tone = SEVERITY_TONE[severity] || 'info'
|
|
6742
|
+
if (severity === 'ok' || textOf(worst.id) === 'none') {
|
|
6743
|
+
return h(C.Notice, { tone }, h('span', null, h('strong', null, t('health.worst')), `: ${t('health.worstNone')}`))
|
|
6744
|
+
}
|
|
6745
|
+
return h(
|
|
6746
|
+
C.Notice,
|
|
6747
|
+
{ tone },
|
|
6748
|
+
h(
|
|
6749
|
+
'div',
|
|
6750
|
+
{ style: COLUMN_STYLE },
|
|
6751
|
+
h('span', null, h('strong', null, t('health.worst')), `: ${blockLabel(textOf(worst.id), t)} · ${severityLabel(severity, t)}`),
|
|
6752
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, t('health.worstHint')),
|
|
6753
|
+
),
|
|
6754
|
+
)
|
|
6755
|
+
}
|
|
6756
|
+
|
|
6757
|
+
/** @param {{ t: Function, data: any }} props */
|
|
6758
|
+
function SummaryBody(props) {
|
|
6759
|
+
const t = props.t
|
|
6760
|
+
const data = isRecord(props.data) ? props.data : {}
|
|
6761
|
+
const plugins = isRecord(data.plugins) ? data.plugins : {}
|
|
6762
|
+
const settings = isRecord(data.settings) ? data.settings : {}
|
|
6763
|
+
const sections = isRecord(data.sections) ? data.sections : {}
|
|
6764
|
+
const compat = isRecord(data.compat) ? data.compat : {}
|
|
6765
|
+
const anomalies = plugins.anomalies
|
|
6766
|
+
const namespaces = settings.namespaces
|
|
6767
|
+
const conflicts = sections.conflicts
|
|
6768
|
+
const compatLevel = textOf(compat.level)
|
|
6769
|
+
const readOnly = compat.readOnly
|
|
6770
|
+
const redactionVerified = settings.redactionVerified === true
|
|
6771
|
+
const generatedAt = textOf(data.generatedAt)
|
|
6772
|
+
const partial = [plugins.total, anomalies, namespaces, conflicts, sections.count, compat.level].some(
|
|
6773
|
+
(value) => value === null || value === undefined,
|
|
6774
|
+
)
|
|
6775
|
+
return h(
|
|
6776
|
+
'div',
|
|
6777
|
+
{ style: STACK_STYLE },
|
|
6778
|
+
h(VerdictNotice, { t, worst: data.worst }),
|
|
6779
|
+
h(
|
|
6780
|
+
'div',
|
|
6781
|
+
{ className: 'acc-stat-grid', role: 'group', 'aria-label': t('health.tilesAria') },
|
|
6782
|
+
h(StatusTile, {
|
|
6783
|
+
label: t('health.tile.plugins'),
|
|
6784
|
+
value: countText(plugins.total),
|
|
6785
|
+
hint:
|
|
6786
|
+
typeof anomalies === 'number' && anomalies > 0
|
|
6787
|
+
? h(C.Badge, { tone: 'warn', title: t('health.tileAnomalies', { count: anomalies }) }, t('health.tileAnomalies', { count: anomalies }))
|
|
6788
|
+
: typeof anomalies === 'number'
|
|
6789
|
+
? t('health.tileNoAnomalies')
|
|
6790
|
+
: t('common.unknown'),
|
|
6791
|
+
}),
|
|
6792
|
+
h(StatusTile, {
|
|
6793
|
+
label: t('health.tile.settings'),
|
|
6794
|
+
value: countText(namespaces),
|
|
6795
|
+
hint: h(
|
|
6796
|
+
C.Badge,
|
|
6797
|
+
{
|
|
6798
|
+
tone: redactionVerified ? 'success' : 'danger',
|
|
6799
|
+
title: t(redactionVerified ? 'health.settingsRedactionOkHint' : 'health.settingsRedactionFailHint'),
|
|
6800
|
+
},
|
|
6801
|
+
t(redactionVerified ? 'health.redacted' : 'health.notRedacted'),
|
|
6802
|
+
),
|
|
6803
|
+
}),
|
|
6804
|
+
h(StatusTile, {
|
|
6805
|
+
label: t('health.tile.sections'),
|
|
6806
|
+
value: countText(conflicts),
|
|
6807
|
+
hint: typeof sections.count === 'number' ? t('health.tileSectionsCount', { count: sections.count }) : t('common.unknown'),
|
|
6808
|
+
}),
|
|
6809
|
+
h(StatusTile, {
|
|
6810
|
+
label: t('health.tile.compat'),
|
|
6811
|
+
value: compatLevel.length > 0 ? compatLevel : EMPTY_VALUE,
|
|
6812
|
+
hint:
|
|
6813
|
+
readOnly === true
|
|
6814
|
+
? h(C.Badge, { tone: 'warn' }, t('health.readOnlyYes'))
|
|
6815
|
+
: readOnly === false
|
|
6816
|
+
? h(C.Badge, { tone: 'success' }, t('health.readOnlyNo'))
|
|
6817
|
+
: t('common.unknown'),
|
|
6818
|
+
}),
|
|
6819
|
+
),
|
|
6820
|
+
partial ? h(C.Notice, { tone: 'warn' }, t('health.summaryPartial')) : null,
|
|
6821
|
+
generatedAt.length > 0
|
|
6822
|
+
? h('div', { className: 'acc-muted', style: SMALL_STYLE }, t('health.generatedAt', { time: ACC.fmt.dateTime(generatedAt) }))
|
|
6823
|
+
: null,
|
|
6824
|
+
)
|
|
6825
|
+
}
|
|
6826
|
+
|
|
6827
|
+
/** @param {{ t: Function }} props */
|
|
6828
|
+
function SummaryCard(props) {
|
|
6829
|
+
const t = props.t
|
|
6830
|
+
const gate = isRecord(props.gate) ? props.gate : {}
|
|
6831
|
+
const blocked = gate.available === false
|
|
6832
|
+
const state = ACC.useAsync(blocked ? gatedLoader(gate) : (context) => ACC.api('health.summary', {}, context), [])
|
|
6833
|
+
return h(
|
|
6834
|
+
BlockCard,
|
|
6835
|
+
{
|
|
6836
|
+
t,
|
|
6837
|
+
title: t('health.summaryTitle'),
|
|
6838
|
+
subtitle: t('health.summarySubtitle'),
|
|
6839
|
+
loading: state.status === 'loading',
|
|
6840
|
+
onRefresh: blocked ? props.onGateRefresh : state.reload,
|
|
6841
|
+
refreshLabel: t('health.refresh.summary'),
|
|
6842
|
+
},
|
|
6843
|
+
h(BlockContent, { t, state, render: (data) => h(SummaryBody, { t, data }) }),
|
|
6844
|
+
)
|
|
6845
|
+
}
|
|
6846
|
+
|
|
6847
|
+
/** @param {{ t: Function, anomaly: any }} props */
|
|
6848
|
+
function AnomalyNotice(props) {
|
|
6849
|
+
const t = props.t
|
|
6850
|
+
const anomaly = isRecord(props.anomaly) ? props.anomaly : {}
|
|
6851
|
+
const kind = textOf(anomaly.kind)
|
|
6852
|
+
const detail = textOf(anomaly.detail)
|
|
6853
|
+
return h(
|
|
6854
|
+
C.Notice,
|
|
6855
|
+
{ tone: ANOMALY_TONE[kind] || 'warn' },
|
|
6856
|
+
h(
|
|
6857
|
+
'div',
|
|
6858
|
+
{ style: { ...COLUMN_STYLE, gap: '3px' } },
|
|
6859
|
+
h('span', null, h('strong', null, `${t('health.anomalyKindLabel')}: ${anomalyKindLabel(kind, t)}${kind.length > 0 ? ` · ${kind}` : ''}`)),
|
|
6860
|
+
detail.length > 0 ? h('div', { style: BREAK_STYLE }, detail) : null,
|
|
6861
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, `${t('health.anomalySuggestion')}: ${anomalyAction(kind, t)}`),
|
|
6862
|
+
),
|
|
6863
|
+
)
|
|
6864
|
+
}
|
|
6865
|
+
|
|
6866
|
+
/** @param {{ t: Function, data: any, onRetry?: Function }} props */
|
|
6867
|
+
function PluginsBody(props) {
|
|
6868
|
+
const t = props.t
|
|
6869
|
+
const data = isRecord(props.data) ? props.data : {}
|
|
6870
|
+
const items = Array.isArray(data.items) ? data.items : []
|
|
6871
|
+
const anomalies = Array.isArray(data.anomalies) ? data.anomalies : []
|
|
6872
|
+
const source = textOf(data.source)
|
|
6873
|
+
return h(
|
|
6874
|
+
'div',
|
|
6875
|
+
{ style: STACK_STYLE },
|
|
6876
|
+
h(
|
|
6877
|
+
'div',
|
|
6878
|
+
{ className: 'acc-row' },
|
|
6879
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, `${t('health.source')}:`),
|
|
6880
|
+
h(C.Mono, { text: source.length > 0 ? source : EMPTY_VALUE }),
|
|
6881
|
+
),
|
|
6882
|
+
items.length === 0
|
|
6883
|
+
? h(C.Empty, {
|
|
6884
|
+
title: t('health.pluginsEmpty'),
|
|
6885
|
+
hint: t('health.pluginsEmptyHint'),
|
|
6886
|
+
icon: 'inbox',
|
|
6887
|
+
action: props.onRetry ? h(C.Btn, { onClick: props.onRetry }, t('common.retry')) : null,
|
|
6888
|
+
})
|
|
6889
|
+
: h(C.Table, {
|
|
6890
|
+
columns: [
|
|
6891
|
+
{ key: 'entryId', label: t('health.pluginsColumnEntry'), truncate: true },
|
|
6892
|
+
{ key: 'moduleName', label: t('health.pluginsColumnModule'), truncate: true },
|
|
6893
|
+
{ key: 'patchId', label: t('health.pluginsColumnPatch'), truncate: true },
|
|
6894
|
+
{ key: 'readOnlyReason', label: t('health.pluginsColumnReadOnly'), truncate: true },
|
|
6895
|
+
],
|
|
6896
|
+
rows: items,
|
|
6897
|
+
empty: null,
|
|
6898
|
+
}),
|
|
6899
|
+
h(
|
|
6900
|
+
'div',
|
|
6901
|
+
{ style: STACK_STYLE },
|
|
6902
|
+
h('div', { className: 'acc-section-title' }, t('health.anomaliesTitle')),
|
|
6903
|
+
anomalies.length === 0
|
|
6904
|
+
? h(
|
|
6905
|
+
C.Notice,
|
|
6906
|
+
{ tone: 'success' },
|
|
6907
|
+
h(
|
|
6908
|
+
'div',
|
|
6909
|
+
{ style: COLUMN_STYLE },
|
|
6910
|
+
h('span', null, t('health.anomaliesNone')),
|
|
6911
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, t('health.anomaliesNoneHint')),
|
|
6912
|
+
),
|
|
6913
|
+
)
|
|
6914
|
+
: anomalies.map((anomaly, index) => h(AnomalyNotice, { key: `anomaly-${index}`, t, anomaly })),
|
|
6915
|
+
),
|
|
6916
|
+
)
|
|
6917
|
+
}
|
|
6918
|
+
|
|
6919
|
+
/** @param {{ t: Function }} props */
|
|
6920
|
+
function PluginsCard(props) {
|
|
6921
|
+
const t = props.t
|
|
6922
|
+
const gate = isRecord(props.gate) ? props.gate : {}
|
|
6923
|
+
const blocked = gate.available === false
|
|
6924
|
+
const state = ACC.useAsync(blocked ? gatedLoader(gate) : (context) => ACC.api('health.plugins', {}, context), [])
|
|
6925
|
+
return h(
|
|
6926
|
+
BlockCard,
|
|
6927
|
+
{
|
|
6928
|
+
t,
|
|
6929
|
+
title: t('health.pluginsTitle'),
|
|
6930
|
+
subtitle: t('health.pluginsSubtitle'),
|
|
6931
|
+
loading: state.status === 'loading',
|
|
6932
|
+
onRefresh: blocked ? props.onGateRefresh : state.reload,
|
|
6933
|
+
refreshLabel: t('health.refresh.plugins'),
|
|
6934
|
+
},
|
|
6935
|
+
h(BlockContent, {
|
|
6936
|
+
t,
|
|
6937
|
+
state,
|
|
6938
|
+
render: (data) => h(PluginsBody, { t, data, onRetry: state.reload }),
|
|
6939
|
+
}),
|
|
6940
|
+
)
|
|
6941
|
+
}
|
|
6942
|
+
|
|
6943
|
+
/** @param {{ t: Function, data: any, onRetry?: Function }} props */
|
|
6944
|
+
function SettingsBody(props) {
|
|
6945
|
+
const t = props.t
|
|
6946
|
+
const data = isRecord(props.data) ? props.data : {}
|
|
6947
|
+
const namespaces = Array.isArray(data.namespaces) ? data.namespaces : []
|
|
6948
|
+
const own = isRecord(data.own) ? data.own : {}
|
|
6949
|
+
const redactionVerified = data.redactionVerified === true
|
|
6950
|
+
const note = noteText('health.settingsNote', data.note, t)
|
|
6951
|
+
return h(
|
|
6952
|
+
'div',
|
|
6953
|
+
{ style: STACK_STYLE },
|
|
6954
|
+
h(
|
|
6955
|
+
'div',
|
|
6956
|
+
{ className: 'acc-row', style: { alignItems: 'flex-start' } },
|
|
6957
|
+
h(
|
|
6958
|
+
C.Badge,
|
|
6959
|
+
{
|
|
6960
|
+
tone: redactionVerified ? 'success' : 'danger',
|
|
6961
|
+
title: t(redactionVerified ? 'health.settingsRedactionOkHint' : 'health.settingsRedactionFailHint'),
|
|
6962
|
+
},
|
|
6963
|
+
t(redactionVerified ? 'health.settingsRedactionOk' : 'health.settingsRedactionFail'),
|
|
6964
|
+
),
|
|
6965
|
+
h(
|
|
6966
|
+
'span',
|
|
6967
|
+
{ className: 'acc-muted', style: { ...SMALL_STYLE, ...BREAK_STYLE } },
|
|
6968
|
+
t(redactionVerified ? 'health.settingsRedactionOkHint' : 'health.settingsRedactionFailHint'),
|
|
6969
|
+
),
|
|
6970
|
+
),
|
|
6971
|
+
h(
|
|
6972
|
+
'div',
|
|
6973
|
+
{ className: 'acc-row' },
|
|
6974
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, `${t('health.settingsOwn')}:`),
|
|
6975
|
+
h(C.Mono, { text: textOf(own.ns) || EMPTY_VALUE }),
|
|
6976
|
+
ownBadge(own.declared, t, 'health.settingsDeclared', 'health.settingsNotDeclared'),
|
|
6977
|
+
ownBadge(own.enabled, t, 'health.settingsEnabled', 'health.settingsDisabled'),
|
|
6978
|
+
),
|
|
6979
|
+
namespaces.length === 0
|
|
6980
|
+
? h(C.Empty, {
|
|
6981
|
+
title: t('health.settingsEmpty'),
|
|
6982
|
+
hint: t('health.settingsEmptyHint'),
|
|
6983
|
+
icon: 'inbox',
|
|
6984
|
+
action: props.onRetry ? h(C.Btn, { onClick: props.onRetry }, t('common.retry')) : null,
|
|
6985
|
+
})
|
|
6986
|
+
: h(C.Table, {
|
|
6987
|
+
columns: [
|
|
6988
|
+
{ key: 'ns', label: t('health.settingsColumnNs'), truncate: true },
|
|
6989
|
+
{ key: 'revision', label: t('health.settingsColumnRevision'), align: 'right' },
|
|
6990
|
+
{
|
|
6991
|
+
key: 'autoGenerate',
|
|
6992
|
+
label: t('health.settingsColumnAutoGenerate'),
|
|
6993
|
+
render: (row) =>
|
|
6994
|
+
h(C.Badge, { tone: row.autoGenerate === true ? 'info' : 'neutral' }, row.autoGenerate === true ? t('health.yes') : t('health.no')),
|
|
6995
|
+
},
|
|
6996
|
+
{
|
|
6997
|
+
key: 'secretKeys',
|
|
6998
|
+
label: t('health.settingsColumnSecretKeys'),
|
|
6999
|
+
render: (row) => {
|
|
7000
|
+
const list = Array.isArray(row.secretKeys) ? row.secretKeys : []
|
|
7001
|
+
return h(
|
|
7002
|
+
'span',
|
|
7003
|
+
{
|
|
7004
|
+
className: list.length === 0 ? 'acc-muted' : undefined,
|
|
7005
|
+
title: list.length > 0 ? list.map((entry) => textOf(entry)).join(', ') : undefined,
|
|
7006
|
+
},
|
|
7007
|
+
t('health.secretKeyCount', { count: list.length }),
|
|
7008
|
+
)
|
|
7009
|
+
},
|
|
7010
|
+
},
|
|
7011
|
+
],
|
|
7012
|
+
rows: namespaces,
|
|
7013
|
+
empty: null,
|
|
7014
|
+
}),
|
|
7015
|
+
h(NoteLine, { t, text: note }),
|
|
7016
|
+
)
|
|
7017
|
+
}
|
|
7018
|
+
|
|
7019
|
+
/** @param {{ t: Function }} props */
|
|
7020
|
+
function SettingsCard(props) {
|
|
7021
|
+
const t = props.t
|
|
7022
|
+
const gate = isRecord(props.gate) ? props.gate : {}
|
|
7023
|
+
const blocked = gate.available === false
|
|
7024
|
+
const state = ACC.useAsync(blocked ? gatedLoader(gate) : (context) => ACC.api('health.settings', {}, context), [])
|
|
7025
|
+
return h(
|
|
7026
|
+
BlockCard,
|
|
7027
|
+
{
|
|
7028
|
+
t,
|
|
7029
|
+
title: t('health.settingsTitle'),
|
|
7030
|
+
subtitle: t('health.settingsSubtitle'),
|
|
7031
|
+
loading: state.status === 'loading',
|
|
7032
|
+
onRefresh: blocked ? props.onGateRefresh : state.reload,
|
|
7033
|
+
refreshLabel: t('health.refresh.settings'),
|
|
7034
|
+
},
|
|
7035
|
+
h(BlockContent, {
|
|
7036
|
+
t,
|
|
7037
|
+
state,
|
|
7038
|
+
extra: (data) => h(NoteLine, { t, text: noteText('health.settingsNote', isRecord(data) ? data.note : undefined, t) }),
|
|
7039
|
+
render: (data) => h(SettingsBody, { t, data, onRetry: state.reload }),
|
|
7040
|
+
}),
|
|
7041
|
+
)
|
|
7042
|
+
}
|
|
7043
|
+
|
|
7044
|
+
/** @param {{ t: Function, conflict: any }} props */
|
|
7045
|
+
function ConflictNotice(props) {
|
|
7046
|
+
const t = props.t
|
|
7047
|
+
const conflict = isRecord(props.conflict) ? props.conflict : {}
|
|
7048
|
+
const kind = textOf(conflict.kind)
|
|
7049
|
+
const id = textOf(conflict.id)
|
|
7050
|
+
const owners = Array.isArray(conflict.owners) ? conflict.owners.map((owner) => textOf(owner)).filter((owner) => owner.length > 0) : []
|
|
7051
|
+
const suggestion = textOf(conflict.suggestion)
|
|
7052
|
+
return h(
|
|
7053
|
+
C.Notice,
|
|
7054
|
+
{ tone: 'warn' },
|
|
7055
|
+
h(
|
|
7056
|
+
'div',
|
|
7057
|
+
{ style: { ...COLUMN_STYLE, gap: '3px' } },
|
|
7058
|
+
h('span', null, h('strong', null, `${t('health.conflictKindLabel')}: ${conflictKindLabel(kind, t)}${kind.length > 0 ? ` · ${kind}` : ''}`), id.length > 0 ? ` · ${id}` : ''),
|
|
7059
|
+
owners.length > 0
|
|
7060
|
+
? h('span', { className: 'acc-muted', style: SMALL_STYLE }, `${t('health.conflictOwners')}: ${owners.join(', ')}`)
|
|
7061
|
+
: null,
|
|
7062
|
+
h(
|
|
7063
|
+
'span',
|
|
7064
|
+
{ style: { ...BREAK_STYLE, fontSize: '11px' } },
|
|
7065
|
+
`${t('health.conflictSuggestion')}: ${suggestion.length > 0 ? suggestion : t('health.conflictSuggestionFallback')}`,
|
|
7066
|
+
),
|
|
7067
|
+
),
|
|
7068
|
+
)
|
|
7069
|
+
}
|
|
7070
|
+
|
|
7071
|
+
/** @param {{ t: Function, data: any, onRetry?: Function }} props */
|
|
7072
|
+
function SectionsBody(props) {
|
|
7073
|
+
const t = props.t
|
|
7074
|
+
const data = isRecord(props.data) ? props.data : {}
|
|
7075
|
+
const scanned = isRecord(data.scanned) ? data.scanned : {}
|
|
7076
|
+
const sections = Array.isArray(data.sections) ? data.sections : []
|
|
7077
|
+
const conflicts = Array.isArray(data.conflicts) ? data.conflicts : []
|
|
7078
|
+
const method = textOf(data.method)
|
|
7079
|
+
const note = noteText('health.sectionsNote', data.note, t)
|
|
7080
|
+
const scannedText = t('health.sectionsScanned', { packages: countText(scanned.packages), files: countText(scanned.files) })
|
|
7081
|
+
return h(
|
|
7082
|
+
'div',
|
|
7083
|
+
{ style: STACK_STYLE },
|
|
7084
|
+
h(
|
|
7085
|
+
C.Notice,
|
|
7086
|
+
{ tone: 'info' },
|
|
7087
|
+
h(
|
|
7088
|
+
'div',
|
|
7089
|
+
{ style: COLUMN_STYLE },
|
|
7090
|
+
h('span', null, method.length > 0 ? `${scannedText} · ${method}` : scannedText),
|
|
7091
|
+
h('span', { className: 'acc-muted', style: { ...SMALL_STYLE, ...BREAK_STYLE } }, `${t('health.noteLabel')}: ${note}`),
|
|
7092
|
+
),
|
|
7093
|
+
),
|
|
7094
|
+
sections.length === 0
|
|
7095
|
+
? h(C.Empty, {
|
|
7096
|
+
title: t('health.sectionsEmpty'),
|
|
7097
|
+
hint: t('health.sectionsEmptyHint'),
|
|
7098
|
+
icon: 'diagnostics',
|
|
7099
|
+
action: props.onRetry ? h(C.Btn, { onClick: props.onRetry }, t('common.retry')) : null,
|
|
7100
|
+
})
|
|
7101
|
+
: h(C.Table, {
|
|
7102
|
+
columns: [
|
|
7103
|
+
{ key: 'id', label: t('health.sectionsColumnId'), truncate: true },
|
|
7104
|
+
{ key: 'owner', label: t('health.sectionsColumnOwner'), truncate: true },
|
|
7105
|
+
{ key: 'file', label: t('health.sectionsColumnFile'), truncate: true },
|
|
7106
|
+
],
|
|
7107
|
+
rows: sections,
|
|
7108
|
+
empty: null,
|
|
7109
|
+
}),
|
|
7110
|
+
h(
|
|
7111
|
+
'div',
|
|
7112
|
+
{ style: STACK_STYLE },
|
|
7113
|
+
h('div', { className: 'acc-section-title' }, t('health.conflictsTitle')),
|
|
7114
|
+
conflicts.length === 0
|
|
7115
|
+
? h(
|
|
7116
|
+
C.Notice,
|
|
7117
|
+
{ tone: 'success' },
|
|
7118
|
+
h(
|
|
7119
|
+
'div',
|
|
7120
|
+
{ style: COLUMN_STYLE },
|
|
7121
|
+
h('span', null, t('health.conflictsNone')),
|
|
7122
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, t('health.conflictsNoneHint')),
|
|
7123
|
+
),
|
|
7124
|
+
)
|
|
7125
|
+
: conflicts.map((conflict, index) => h(ConflictNotice, { key: `conflict-${index}`, t, conflict })),
|
|
7126
|
+
),
|
|
7127
|
+
)
|
|
7128
|
+
}
|
|
7129
|
+
|
|
7130
|
+
/** @param {{ t: Function }} props */
|
|
7131
|
+
function SectionsCard(props) {
|
|
7132
|
+
const t = props.t
|
|
7133
|
+
const gate = isRecord(props.gate) ? props.gate : {}
|
|
7134
|
+
const blocked = gate.available === false
|
|
7135
|
+
const state = ACC.useAsync(blocked ? gatedLoader(gate) : (context) => ACC.api('health.sections', {}, context), [])
|
|
7136
|
+
return h(
|
|
7137
|
+
BlockCard,
|
|
7138
|
+
{
|
|
7139
|
+
t,
|
|
7140
|
+
title: t('health.sectionsTitle'),
|
|
7141
|
+
subtitle: t('health.sectionsSubtitle'),
|
|
7142
|
+
loading: state.status === 'loading',
|
|
7143
|
+
onRefresh: blocked ? props.onGateRefresh : state.reload,
|
|
7144
|
+
refreshLabel: t('health.refresh.sections'),
|
|
7145
|
+
},
|
|
7146
|
+
h(BlockContent, {
|
|
7147
|
+
t,
|
|
7148
|
+
state,
|
|
7149
|
+
extra: (data) => h(NoteLine, { t, text: noteText('health.sectionsNote', isRecord(data) ? data.note : undefined, t) }),
|
|
7150
|
+
render: (data) => h(SectionsBody, { t, data, onRetry: state.reload }),
|
|
7151
|
+
}),
|
|
7152
|
+
)
|
|
7153
|
+
}
|
|
7154
|
+
|
|
7155
|
+
/** @param {{ t: Function, reason: any }} props */
|
|
7156
|
+
function CompatReasonRow(props) {
|
|
7157
|
+
const t = props.t
|
|
7158
|
+
const reason = isRecord(props.reason) ? props.reason : {}
|
|
7159
|
+
const severity = reason.severity === 'error' || reason.severity === 'warn' ? reason.severity : 'info'
|
|
7160
|
+
const code = textOf(reason.code)
|
|
7161
|
+
const text = textOf(reason.text)
|
|
7162
|
+
return h(
|
|
7163
|
+
C.Notice,
|
|
7164
|
+
{ tone: SEVERITY_TONE[severity] || 'info' },
|
|
7165
|
+
h(
|
|
7166
|
+
'div',
|
|
7167
|
+
{ style: { ...COLUMN_STYLE, gap: '2px' } },
|
|
7168
|
+
h(
|
|
7169
|
+
'span',
|
|
7170
|
+
null,
|
|
7171
|
+
h(C.Badge, { tone: SEVERITY_TONE[severity] || 'info' }, severityLabel(severity, t)),
|
|
7172
|
+
code.length > 0 ? h('span', { style: { marginInlineStart: '6px' } }, h(C.Mono, { text: code })) : null,
|
|
7173
|
+
),
|
|
7174
|
+
text.length > 0 ? h('span', { style: { ...BREAK_STYLE, fontSize: '11px' } }, text) : null,
|
|
7175
|
+
),
|
|
7176
|
+
)
|
|
7177
|
+
}
|
|
7178
|
+
|
|
7179
|
+
/** @param {{ t: Function, data: any }} props */
|
|
7180
|
+
function CompatBody(props) {
|
|
7181
|
+
const t = props.t
|
|
7182
|
+
const data = isRecord(props.data) ? props.data : {}
|
|
7183
|
+
const level = textOf(data.level)
|
|
7184
|
+
const version = textOf(data.version)
|
|
7185
|
+
const readOnly = data.readOnly
|
|
7186
|
+
const reasons = Array.isArray(data.reasons) ? data.reasons : []
|
|
7187
|
+
return h(
|
|
7188
|
+
'div',
|
|
7189
|
+
{ style: STACK_STYLE },
|
|
7190
|
+
h(C.KeyValues, {
|
|
7191
|
+
items: [
|
|
7192
|
+
{
|
|
7193
|
+
label: t('health.compatLevel'),
|
|
7194
|
+
value: level.length > 0 ? h(C.Badge, { tone: COMPAT_TONE[level] || 'neutral' }, level) : EMPTY_VALUE,
|
|
7195
|
+
},
|
|
7196
|
+
{
|
|
7197
|
+
label: t('health.compatVersion'),
|
|
7198
|
+
value: version.length > 0 ? h(C.Mono, { text: version }) : h('span', { className: 'acc-muted' }, t('common.unknown')),
|
|
7199
|
+
},
|
|
7200
|
+
{
|
|
7201
|
+
label: t('health.compatReadOnly'),
|
|
7202
|
+
value:
|
|
7203
|
+
readOnly === true
|
|
7204
|
+
? h(C.Badge, { tone: 'warn' }, t('health.readOnlyYes'))
|
|
7205
|
+
: readOnly === false
|
|
7206
|
+
? h(C.Badge, { tone: 'success' }, t('health.readOnlyNo'))
|
|
7207
|
+
: EMPTY_VALUE,
|
|
7208
|
+
},
|
|
7209
|
+
],
|
|
7210
|
+
}),
|
|
7211
|
+
h(
|
|
7212
|
+
'div',
|
|
7213
|
+
{ style: STACK_STYLE },
|
|
7214
|
+
h('div', { className: 'acc-section-title' }, t('health.compatReasons')),
|
|
7215
|
+
reasons.length === 0
|
|
7216
|
+
? h(
|
|
7217
|
+
C.Notice,
|
|
7218
|
+
{ tone: 'info' },
|
|
7219
|
+
h(
|
|
7220
|
+
'div',
|
|
7221
|
+
{ style: COLUMN_STYLE },
|
|
7222
|
+
h('span', null, t('health.compatReasonsNone')),
|
|
7223
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, t('health.compatReasonsNoneHint')),
|
|
7224
|
+
),
|
|
7225
|
+
)
|
|
7226
|
+
: reasons.map((reason, index) => h(CompatReasonRow, { key: `reason-${index}`, t, reason })),
|
|
7227
|
+
),
|
|
7228
|
+
)
|
|
7229
|
+
}
|
|
7230
|
+
|
|
7231
|
+
/** @param {{ t: Function }} props */
|
|
7232
|
+
function CompatCard(props) {
|
|
7233
|
+
const t = props.t
|
|
7234
|
+
const gate = isRecord(props.gate) ? props.gate : {}
|
|
7235
|
+
const blocked = gate.available === false
|
|
7236
|
+
const state = ACC.useAsync(blocked ? gatedLoader(gate) : (context) => ACC.api('health.compat', {}, context), [])
|
|
7237
|
+
return h(
|
|
7238
|
+
BlockCard,
|
|
7239
|
+
{
|
|
7240
|
+
t,
|
|
7241
|
+
title: t('health.compatTitle'),
|
|
7242
|
+
subtitle: t('health.compatSubtitle'),
|
|
7243
|
+
loading: state.status === 'loading',
|
|
7244
|
+
onRefresh: blocked ? props.onGateRefresh : state.reload,
|
|
7245
|
+
refreshLabel: t('health.refresh.compat'),
|
|
7246
|
+
},
|
|
7247
|
+
h(BlockContent, { t, state, render: (data) => h(CompatBody, { t, data }) }),
|
|
7248
|
+
)
|
|
7249
|
+
}
|
|
7250
|
+
|
|
7251
|
+
/**
|
|
7252
|
+
* Page shell. The plugin's own health endpoint is probed once to learn which
|
|
7253
|
+
* modules the running host actually loaded: a host that predates the health
|
|
7254
|
+
* module then shows the documented unavailable answer instead of posting five
|
|
7255
|
+
* requests it cannot serve.
|
|
7256
|
+
* @param {{ t: Function }} props
|
|
7257
|
+
*/
|
|
7258
|
+
function HealthPage(props) {
|
|
7259
|
+
const t = props.t
|
|
7260
|
+
const gate = ACC.useAsync((context) => ACC.health(context), [])
|
|
7261
|
+
const notice = h(C.Notice, { tone: 'info' }, t('health.readOnlyNotice'))
|
|
7262
|
+
if (gate.status === 'loading') {
|
|
7263
|
+
return h('div', { style: PAGE_STYLE, 'data-acc-page': 'health' }, notice, h(C.Loading, { label: t('health.loading') }))
|
|
7264
|
+
}
|
|
7265
|
+
if (gate.status === 'error') {
|
|
7266
|
+
const error = isRecord(gate.error) ? gate.error : {}
|
|
7267
|
+
return h(
|
|
7268
|
+
'div',
|
|
7269
|
+
{ style: PAGE_STYLE, 'data-acc-page': 'health' },
|
|
7270
|
+
notice,
|
|
7271
|
+
h(
|
|
7272
|
+
BlockCard,
|
|
7273
|
+
{
|
|
7274
|
+
t,
|
|
7275
|
+
title: t('health.hostHealthTitle'),
|
|
7276
|
+
loading: false,
|
|
7277
|
+
onRefresh: gate.reload,
|
|
7278
|
+
refreshLabel: t('health.refresh.host'),
|
|
7279
|
+
},
|
|
7280
|
+
h(FailurePanel, {
|
|
7281
|
+
t,
|
|
7282
|
+
title: t('health.blockFailed'),
|
|
7283
|
+
reason: error.message,
|
|
7284
|
+
code: error.code || error.name,
|
|
7285
|
+
hint: error.hint,
|
|
7286
|
+
onRetry: gate.reload,
|
|
7287
|
+
}),
|
|
7288
|
+
),
|
|
7289
|
+
)
|
|
7290
|
+
}
|
|
7291
|
+
const host = isRecord(gate.data) ? gate.data : {}
|
|
7292
|
+
const modules = Array.isArray(host.modules) ? host.modules : []
|
|
7293
|
+
const module = modules.find((entry) => isRecord(entry) && entry.id === 'health')
|
|
7294
|
+
const gateView =
|
|
7295
|
+
module === undefined
|
|
7296
|
+
? { available: false, reason: t('health.moduleMissingReason'), hint: t('health.moduleMissingHint') }
|
|
7297
|
+
: module.state === 'BLOCKED'
|
|
7298
|
+
? { available: false, reason: textOf(module.detail) || t('health.moduleBlockedReason'), hint: t('health.moduleBlockedHint') }
|
|
7299
|
+
: { available: true }
|
|
7300
|
+
return h(
|
|
7301
|
+
'div',
|
|
7302
|
+
{ style: PAGE_STYLE, 'data-acc-page': 'health' },
|
|
7303
|
+
notice,
|
|
7304
|
+
h(SummaryCard, { t, gate: gateView, onGateRefresh: gate.reload }),
|
|
7305
|
+
h(PluginsCard, { t, gate: gateView, onGateRefresh: gate.reload }),
|
|
7306
|
+
h(SettingsCard, { t, gate: gateView, onGateRefresh: gate.reload }),
|
|
7307
|
+
h(SectionsCard, { t, gate: gateView, onGateRefresh: gate.reload }),
|
|
7308
|
+
h(CompatCard, { t, gate: gateView, onGateRefresh: gate.reload }),
|
|
7309
|
+
)
|
|
7310
|
+
}
|
|
7311
|
+
|
|
7312
|
+
ACC.registerPage({
|
|
7313
|
+
id: 'health',
|
|
7314
|
+
titleKey: 'nav.health',
|
|
7315
|
+
descriptionKey: 'nav.desc.health',
|
|
7316
|
+
icon: 'diagnostics',
|
|
7317
|
+
order: 75,
|
|
7318
|
+
group: 'maintain',
|
|
7319
|
+
render: (props) => h(HealthPage, props),
|
|
7320
|
+
})
|
|
7321
|
+
})()
|
|
7322
|
+
;
|
|
7323
|
+
|
|
6226
7324
|
/* ---- pages/instruction.js ---- */
|
|
6227
7325
|
/* Instruction preview page (module J) — read-only view of what the model
|
|
6228
7326
|
* received.
|
|
@@ -10851,20 +11949,6 @@ ACC.l10n = (function createL10n() {
|
|
|
10851
11949
|
return h(C.Btn, { tone: 'ghost', onClick: copy, title: label, 'aria-live': 'polite' }, label)
|
|
10852
11950
|
}
|
|
10853
11951
|
|
|
10854
|
-
/** Esc collapses the open detail panel while it is open. */
|
|
10855
|
-
function useEscape(active, onEscape) {
|
|
10856
|
-
ACC.useEffect(() => {
|
|
10857
|
-
if (!active) return undefined
|
|
10858
|
-
const handler = (event) => {
|
|
10859
|
-
if (event.key !== 'Escape') return
|
|
10860
|
-
event.stopPropagation()
|
|
10861
|
-
onEscape()
|
|
10862
|
-
}
|
|
10863
|
-
document.addEventListener('keydown', handler)
|
|
10864
|
-
return () => document.removeEventListener('keydown', handler)
|
|
10865
|
-
}, [active, onEscape])
|
|
10866
|
-
}
|
|
10867
|
-
|
|
10868
11952
|
/** @param {{ value: unknown, onOpen: Function, t: Function }} props */
|
|
10869
11953
|
function SourceBadge(props) {
|
|
10870
11954
|
const source = props.value || {}
|
|
@@ -11179,7 +12263,42 @@ ACC.l10n = (function createL10n() {
|
|
|
11179
12263
|
[selected, days, agentId],
|
|
11180
12264
|
)
|
|
11181
12265
|
|
|
11182
|
-
|
|
12266
|
+
// Escape closes the host Settings dialog. Local state (an open detail row or a
|
|
12267
|
+
// non-empty search) must consume the key first: a capture-phase listener runs
|
|
12268
|
+
// before the host's document-level handler, and stopPropagation keeps it from
|
|
12269
|
+
// reaching the dialog.
|
|
12270
|
+
ACC.useEffect(() => {
|
|
12271
|
+
// The host may close the Settings dialog from any of the three key events
|
|
12272
|
+
// at any level, so the whole Escape gesture is consumed here: keydown
|
|
12273
|
+
// decides whether the page owns it, keypress/keyup follow for the same
|
|
12274
|
+
// gesture so a later phase cannot reopen the dialog's close path.
|
|
12275
|
+
let ownedByPage = false
|
|
12276
|
+
const handler = (event) => {
|
|
12277
|
+
if (event.key !== 'Escape') return
|
|
12278
|
+
const input = searchRef.current
|
|
12279
|
+
if (event.type === 'keydown') {
|
|
12280
|
+
ownedByPage = selected !== '' || search !== '' || (input !== null && document.activeElement === input)
|
|
12281
|
+
}
|
|
12282
|
+
if (!ownedByPage) return
|
|
12283
|
+
event.preventDefault()
|
|
12284
|
+
event.stopPropagation()
|
|
12285
|
+
if (event.type !== 'keydown') return
|
|
12286
|
+
if (selected !== '') {
|
|
12287
|
+
setSelected('')
|
|
12288
|
+
return
|
|
12289
|
+
}
|
|
12290
|
+
if (search !== '') {
|
|
12291
|
+
setSearch('')
|
|
12292
|
+
return
|
|
12293
|
+
}
|
|
12294
|
+
if (input !== null) input.blur()
|
|
12295
|
+
}
|
|
12296
|
+
const types = ['keydown', 'keypress', 'keyup']
|
|
12297
|
+
for (const type of types) window.addEventListener(type, handler, true)
|
|
12298
|
+
return () => {
|
|
12299
|
+
for (const type of types) window.removeEventListener(type, handler, true)
|
|
12300
|
+
}
|
|
12301
|
+
}, [selected, search])
|
|
11183
12302
|
ACC.useEffect(() => {
|
|
11184
12303
|
const onKey = (event) => {
|
|
11185
12304
|
if (event.key !== '/' || event.metaKey || event.ctrlKey || event.altKey) return
|
|
@@ -11265,7 +12384,12 @@ ACC.l10n = (function createL10n() {
|
|
|
11265
12384
|
placeholder: t('tools.searchPlaceholder'),
|
|
11266
12385
|
value: search,
|
|
11267
12386
|
onChange: (event) => setSearch(event.target.value),
|
|
11268
|
-
onKeyDown: (event) => {
|
|
12387
|
+
onKeyDown: (event) => {
|
|
12388
|
+
if (event.key !== 'Escape') return
|
|
12389
|
+
// The page-level capture handler already clears the query; keep the
|
|
12390
|
+
// dialog open if it ever arrives here first.
|
|
12391
|
+
event.preventDefault()
|
|
12392
|
+
},
|
|
11269
12393
|
'aria-label': t('tools.search'),
|
|
11270
12394
|
style: { minWidth: '180px' },
|
|
11271
12395
|
}),
|