dsh-config-manager 0.8.2 → 0.9.0

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.
Files changed (345) hide show
  1. package/lib/adapters/mcp.js +42 -13
  2. package/lib/adapters/messages.d.ts +1 -0
  3. package/lib/adapters/messages.js +2 -0
  4. package/lib/adapters/patch-key-guard.d.ts +23 -0
  5. package/lib/adapters/patch-key-guard.js +13 -0
  6. package/lib/adapters/plugin-data.d.ts +19 -5
  7. package/lib/adapters/plugin-data.js +76 -22
  8. package/lib/adapters/plugins.d.ts +14 -1
  9. package/lib/adapters/plugins.js +147 -4
  10. package/lib/cli/actions.d.ts +7 -105
  11. package/lib/cli/actions.js +16 -172
  12. package/lib/cli/control-state.d.ts +54 -0
  13. package/lib/cli/control-state.js +107 -0
  14. package/lib/cli/index.js +14 -0
  15. package/lib/cli/write-gates.d.ts +61 -0
  16. package/lib/cli/write-gates.js +110 -0
  17. package/lib/client.d.ts +104 -49
  18. package/lib/client.js +12536 -12006
  19. package/lib/core/backup.d.ts +0 -4
  20. package/lib/core/backup.js +21 -4
  21. package/lib/core/boot-rescue.d.ts +1 -1
  22. package/lib/core/boot-rescue.js +12 -1
  23. package/lib/core/boot-safety.js +37 -2
  24. package/lib/core/conflict-decisions.js +2 -1
  25. package/lib/core/exporter.js +22 -1
  26. package/lib/core/journal.d.ts +54 -4
  27. package/lib/core/journal.js +158 -35
  28. package/lib/core/local-plugin-host.d.ts +29 -0
  29. package/lib/core/local-plugin-host.js +55 -48
  30. package/lib/core/messages.d.ts +7 -0
  31. package/lib/core/messages.js +14 -0
  32. package/lib/core/migration-history.js +16 -9
  33. package/lib/core/model-tools.d.ts +2 -2
  34. package/lib/core/model-tools.js +14 -2
  35. package/lib/core/patch-secret-guard.d.ts +49 -0
  36. package/lib/core/patch-secret-guard.js +164 -0
  37. package/lib/core/reconcile.d.ts +8 -0
  38. package/lib/core/reconcile.js +18 -3
  39. package/lib/core/reinstall.d.ts +2 -0
  40. package/lib/core/reinstall.js +6 -2
  41. package/lib/core/restore.js +31 -6
  42. package/lib/core/section-sanitize.d.ts +32 -0
  43. package/lib/core/section-sanitize.js +13 -0
  44. package/lib/core/snapshot-diff.d.ts +30 -0
  45. package/lib/core/snapshot-diff.js +56 -20
  46. package/lib/core/startup-barrier.js +8 -2
  47. package/lib/core/types.d.ts +22 -0
  48. package/lib/core/update-check.js +51 -2
  49. package/lib/foreign/kernel.js +9 -2
  50. package/lib/foreign/read-claude-plugins.js +29 -11
  51. package/lib/foreign/read-dsh.js +31 -2
  52. package/lib/foreign/session-ir.js +50 -9
  53. package/lib/foreign/session-read.d.ts +8 -0
  54. package/lib/foreign/session-read.js +26 -0
  55. package/lib/index.d.ts +1 -1
  56. package/lib/index.js +1 -1
  57. package/lib/profiles/dsh-profile-io.d.ts +20 -0
  58. package/lib/profiles/dsh-profile-io.js +27 -0
  59. package/lib/profiles/dsh-profile-manager.d.ts +27 -0
  60. package/lib/profiles/dsh-profile-manager.js +45 -4
  61. package/lib/profiles/dsh-profile-runtime.d.ts +5 -1
  62. package/lib/profiles/dsh-profile-runtime.js +16 -3
  63. package/lib/profiles/process-control.d.ts +18 -1
  64. package/lib/profiles/process-control.js +25 -1
  65. package/lib/routes/profiles.js +2 -1
  66. package/lib/routes/sync.js +13 -1
  67. package/lib/schema/types.d.ts +11 -0
  68. package/lib/security/redaction.js +22 -6
  69. package/lib/sync/autosync-repeat.d.ts +27 -0
  70. package/lib/sync/autosync-repeat.js +23 -0
  71. package/lib/sync/autosync-scheduler.d.ts +34 -1
  72. package/lib/sync/autosync-scheduler.js +151 -43
  73. package/lib/sync/baseline-heal.js +7 -0
  74. package/lib/sync/baseline-record.d.ts +67 -0
  75. package/lib/sync/baseline-record.js +74 -0
  76. package/lib/sync/blob-store.js +13 -0
  77. package/lib/sync/content-diff.d.ts +39 -0
  78. package/lib/sync/content-diff.js +46 -0
  79. package/lib/sync/git/git-transport.d.ts +32 -1
  80. package/lib/sync/git/git-transport.js +146 -26
  81. package/lib/sync/github-auth.d.ts +17 -1
  82. package/lib/sync/github-auth.js +37 -1
  83. package/lib/sync/merge-apply-plan.d.ts +38 -0
  84. package/lib/sync/merge-apply-plan.js +76 -0
  85. package/lib/sync/messages.d.ts +1 -0
  86. package/lib/sync/messages.js +2 -0
  87. package/lib/sync/pending-merge.d.ts +34 -0
  88. package/lib/sync/pending-merge.js +53 -0
  89. package/lib/sync/s3/s3-transport.d.ts +14 -2
  90. package/lib/sync/s3/s3-transport.js +72 -48
  91. package/lib/sync/sync-engine.d.ts +23 -40
  92. package/lib/sync/sync-engine.js +115 -132
  93. package/lib/sync/sync-history.d.ts +7 -0
  94. package/lib/sync/sync-state.d.ts +28 -0
  95. package/lib/sync/sync-state.js +20 -0
  96. package/lib/sync/transport.d.ts +12 -3
  97. package/lib/sync/transport.js +13 -4
  98. package/lib/sync/webdav/webdav-transport.d.ts +19 -2
  99. package/lib/sync/webdav/webdav-transport.js +81 -40
  100. package/lib/ui/commands.js +5 -11
  101. package/lib/ui/dsh-profiles-view.d.ts +8 -3
  102. package/lib/ui/dsh-profiles-view.js +9 -5
  103. package/lib/ui/i18n.d.ts +2 -1
  104. package/lib/ui/i18n.js +4 -2
  105. package/lib/ui/menu-placement.js +1 -1
  106. package/lib/ui/migration-consult-view.d.ts +11 -0
  107. package/lib/ui/migration-consult-view.js +15 -0
  108. package/lib/ui/overview-view.d.ts +7 -0
  109. package/lib/ui/overview-view.js +3 -0
  110. package/lib/ui/report.d.ts +9 -0
  111. package/lib/ui/report.js +17 -4
  112. package/lib/ui/selection-model.d.ts +8 -0
  113. package/lib/ui/selection-model.js +16 -0
  114. package/lib/utils/patch-yaml.d.ts +39 -1
  115. package/lib/utils/patch-yaml.js +82 -2
  116. package/lib/utils/paths.d.ts +13 -0
  117. package/lib/utils/paths.js +35 -0
  118. package/lib/utils/workdir-lock.js +18 -3
  119. package/package.json +2 -1
  120. package/src/adapters/mcp.test.ts +29 -0
  121. package/src/adapters/mcp.ts +43 -12
  122. package/src/adapters/messages.ts +2 -0
  123. package/src/adapters/patch-key-guard.ts +29 -0
  124. package/src/adapters/plugin-data.test.ts +126 -0
  125. package/src/adapters/plugin-data.ts +97 -26
  126. package/src/adapters/plugins.test.ts +288 -0
  127. package/src/adapters/plugins.ts +141 -4
  128. package/src/cli/actions.test.ts +74 -1
  129. package/src/cli/actions.ts +27 -246
  130. package/src/cli/control-state.ts +143 -0
  131. package/src/cli/index.ts +18 -0
  132. package/src/cli/web/web.test.ts +27 -0
  133. package/src/cli/write-gates.ts +149 -0
  134. package/src/client/about/AboutPanel.tsx +7 -6
  135. package/src/client/about/release-notes-view.test.ts +17 -0
  136. package/src/client/about/release-notes-view.ts +49 -24
  137. package/src/client/chat/ChatEntryView.tsx +2 -2
  138. package/src/client/chat/rollback-entry-view.ts +6 -1
  139. package/src/client/common/CommandPalette.tsx +6 -3
  140. package/src/client/common/ConfirmDialog.tsx +29 -12
  141. package/src/client/common/ContentPicker.tsx +13 -12
  142. package/src/client/common/Modal.tsx +12 -5
  143. package/src/client/common/MoreMenu.tsx +4 -1
  144. package/src/client/common/RunsCenter.tsx +103 -32
  145. package/src/client/common/Select.tsx +2 -2
  146. package/src/client/common/floating-bounds.ts +1 -1
  147. package/src/client/common/floating-units.test.ts +1 -2
  148. package/src/client/common/plan-text-redaction.test.ts +188 -3
  149. package/src/client/common/runs-center-guard.test.ts +60 -0
  150. package/src/client/common/runs-center-view.test.ts +128 -0
  151. package/src/client/common/runs-center-view.ts +96 -0
  152. package/src/client/common/section-title-action.test.ts +66 -0
  153. package/src/client/common/ui.tsx +93 -30
  154. package/src/client/config-manager.module.css +1507 -272
  155. package/src/client/consult/ConsultCard.tsx +7 -6
  156. package/src/client/environment/EnvironmentPanel.tsx +20 -21
  157. package/src/client/environment/maintenance/DiskUsageCard.tsx +65 -91
  158. package/src/client/environment/profiles-incomplete-ui.test.ts +8 -8
  159. package/src/client/export/ExportView.tsx +7 -16
  160. package/src/client/history/HistoryPanel.tsx +88 -28
  161. package/src/client/history/history-locales.ts +3 -3
  162. package/src/client/home/BackupScheduleCard.tsx +35 -30
  163. package/src/client/home/HomePanel.tsx +45 -10
  164. package/src/client/import/ConflictList.tsx +13 -13
  165. package/src/client/import/ForeignImportView.tsx +7 -6
  166. package/src/client/import/ImportWizardView.tsx +2 -3
  167. package/src/client/import/PathMappingForm.tsx +4 -4
  168. package/src/client/import/PathPickerDialog.tsx +2 -1
  169. package/src/client/import/import-wizard-steps.tsx +51 -39
  170. package/src/client/import/use-import-wizard-controller.test.ts +129 -0
  171. package/src/client/import/use-import-wizard-controller.ts +116 -22
  172. package/src/client/library/ArtifactRow.tsx +2 -2
  173. package/src/client/library/BackupInspectView.tsx +19 -15
  174. package/src/client/library/LibraryActions.tsx +56 -16
  175. package/src/client/library/LibraryPanel.tsx +7 -7
  176. package/src/client/library/RestorePlanView.tsx +13 -8
  177. package/src/client/locales/about.ts +0 -2
  178. package/src/client/locales/backup.ts +10 -12
  179. package/src/client/locales/common.ts +2 -0
  180. package/src/client/locales/export.ts +5 -12
  181. package/src/client/locales/foreign.ts +2 -2
  182. package/src/client/locales/import.ts +3 -2
  183. package/src/client/locales/overview.ts +4 -0
  184. package/src/client/locales/profiles.ts +32 -4
  185. package/src/client/locales/restore.ts +0 -2
  186. package/src/client/locales/sessions.ts +0 -2
  187. package/src/client/locales/shell.ts +2 -2
  188. package/src/client/market/MarketPanel.tsx +38 -20
  189. package/src/client/market/MyConfigsList.tsx +34 -32
  190. package/src/client/market/MyConfigsLoginCard.tsx +12 -15
  191. package/src/client/market/MyConfigsView.tsx +5 -5
  192. package/src/client/market/MyConfigsWizard.tsx +7 -12
  193. package/src/client/market/market-locales.ts +0 -6
  194. package/src/client/market/my-configs-split.test.ts +2 -1
  195. package/src/client/nav-menu-clip-guard.test.ts +52 -0
  196. package/src/client/recovery/IncompleteCopiesSection.tsx +1 -3
  197. package/src/client/recovery/RecoveryPanel.tsx +31 -16
  198. package/src/client/recovery/RollbackCard.tsx +58 -16
  199. package/src/client/recovery/RollbackFileChanges.tsx +40 -27
  200. package/src/client/recovery/SessionHealthCard.tsx +2 -2
  201. package/src/client/recovery/SessionHealthDialog.tsx +5 -7
  202. package/src/client/recovery/SessionLayoutSection.tsx +3 -5
  203. package/src/client/recovery/recovery-locales.ts +12 -8
  204. package/src/client/run-store.test.ts +30 -0
  205. package/src/client/run-store.ts +21 -1
  206. package/src/client/sync/AddChannelCard.tsx +65 -0
  207. package/src/client/sync/AutosyncCard.tsx +182 -108
  208. package/src/client/sync/ChannelClearConfirmDialog.tsx +5 -1
  209. package/src/client/sync/ChannelConfigDialog.tsx +27 -48
  210. package/src/client/sync/MergePreviewView.tsx +3 -5
  211. package/src/client/sync/PushReportSections.tsx +35 -0
  212. package/src/client/sync/SyncChannelEntryCard.tsx +33 -24
  213. package/src/client/sync/SyncConfirmView.tsx +3 -3
  214. package/src/client/sync/SyncLogList.tsx +16 -5
  215. package/src/client/sync/SyncPanel.tsx +153 -159
  216. package/src/client/sync/SyncProbeRow.tsx +5 -7
  217. package/src/client/sync/SyncRepositoryPicker.tsx +17 -4
  218. package/src/client/sync/SyncSecuritySection.tsx +157 -0
  219. package/src/client/sync/SyncSettingsDialog.tsx +304 -0
  220. package/src/client/sync/SyncSettingsView.test.ts +26 -8
  221. package/src/client/sync/WorkDirCard.tsx +2 -4
  222. package/src/client/sync/config-clear-guard.test.ts +94 -0
  223. package/src/client/sync/config-clear-guard.ts +98 -0
  224. package/src/client/sync/config-dirty.test.ts +91 -0
  225. package/src/client/sync/config-dirty.ts +88 -0
  226. package/src/client/sync/history-model.test.ts +2 -0
  227. package/src/client/sync/history-model.ts +3 -0
  228. package/src/client/sync/merge-request.ts +20 -0
  229. package/src/client/sync/sync-api.ts +12 -0
  230. package/src/client/sync/sync-locales.ts +87 -47
  231. package/src/client/sync/sync-panel-clear.test.ts +44 -0
  232. package/src/client/sync/sync-view.test.ts +20 -0
  233. package/src/client/sync/sync-view.ts +42 -4
  234. package/src/core/backup.test.ts +61 -1
  235. package/src/core/backup.ts +21 -4
  236. package/src/core/boot-rescue.test.ts +35 -0
  237. package/src/core/boot-rescue.ts +13 -2
  238. package/src/core/boot-safety.test.ts +25 -0
  239. package/src/core/boot-safety.ts +37 -2
  240. package/src/core/conflict-decisions.ts +2 -1
  241. package/src/core/exporter.ts +21 -1
  242. package/src/core/journal.test.ts +183 -0
  243. package/src/core/journal.ts +163 -25
  244. package/src/core/local-plugin-host.test.ts +68 -2
  245. package/src/core/local-plugin-host.ts +31 -4
  246. package/src/core/messages.ts +14 -0
  247. package/src/core/migration-history.test.ts +27 -0
  248. package/src/core/migration-history.ts +12 -4
  249. package/src/core/model-tools.test.ts +67 -0
  250. package/src/core/model-tools.ts +16 -4
  251. package/src/core/patch-secret-guard.test.ts +110 -0
  252. package/src/core/patch-secret-guard.ts +176 -0
  253. package/src/core/reconcile.ts +32 -4
  254. package/src/core/reinstall.ts +8 -2
  255. package/src/core/restore.ts +32 -7
  256. package/src/core/section-sanitize.ts +37 -0
  257. package/src/core/snapshot-diff.test.ts +73 -1
  258. package/src/core/snapshot-diff.ts +66 -21
  259. package/src/core/startup-barrier.test.ts +64 -0
  260. package/src/core/startup-barrier.ts +8 -2
  261. package/src/core/types.ts +27 -1
  262. package/src/core/update-check.test.ts +40 -0
  263. package/src/core/update-check.ts +53 -2
  264. package/src/foreign/claude-code.test.ts +5 -0
  265. package/src/foreign/claude-plugins.test.ts +57 -0
  266. package/src/foreign/claude-sessions-bytes.test.ts +7 -1
  267. package/src/foreign/dsh.test.ts +23 -0
  268. package/src/foreign/kernel.ts +9 -2
  269. package/src/foreign/read-claude-plugins.ts +32 -11
  270. package/src/foreign/read-dsh.ts +33 -2
  271. package/src/foreign/session-ir.test.ts +67 -0
  272. package/src/foreign/session-ir.ts +54 -14
  273. package/src/foreign/session-read.ts +23 -0
  274. package/src/index.ts +1 -1
  275. package/src/profiles/dsh-profile-copy-rollback.test.ts +58 -4
  276. package/src/profiles/dsh-profile-io.ts +29 -0
  277. package/src/profiles/dsh-profile-manager.test.ts +30 -0
  278. package/src/profiles/dsh-profile-manager.ts +53 -5
  279. package/src/profiles/dsh-profile-runtime.test.ts +29 -7
  280. package/src/profiles/dsh-profile-runtime.ts +17 -3
  281. package/src/profiles/process-control.test.ts +97 -0
  282. package/src/profiles/process-control.ts +28 -1
  283. package/src/routes/profiles.ts +2 -1
  284. package/src/routes/sync.ts +13 -1
  285. package/src/schema/types.ts +16 -1
  286. package/src/security/redaction.test.ts +31 -0
  287. package/src/security/redaction.ts +23 -6
  288. package/src/sync/autosync-repeat.test.ts +58 -0
  289. package/src/sync/autosync-repeat.ts +55 -0
  290. package/src/sync/autosync-scheduler.test.ts +417 -0
  291. package/src/sync/autosync-scheduler.ts +154 -41
  292. package/src/sync/baseline-heal.ts +6 -0
  293. package/src/sync/baseline-record.ts +135 -0
  294. package/src/sync/blob-store.test.ts +16 -0
  295. package/src/sync/blob-store.ts +13 -0
  296. package/src/sync/content-diff.test.ts +95 -0
  297. package/src/sync/content-diff.ts +79 -0
  298. package/src/sync/git/git-transport.test.ts +151 -4
  299. package/src/sync/git/git-transport.ts +143 -27
  300. package/src/sync/github-auth.test.ts +26 -1
  301. package/src/sync/github-auth.ts +37 -1
  302. package/src/sync/merge-apply-plan.ts +117 -0
  303. package/src/sync/messages.ts +2 -0
  304. package/src/sync/pending-merge.ts +77 -0
  305. package/src/sync/s3/s3-delete-and-blob-index.test.ts +249 -0
  306. package/src/sync/s3/s3-transport.ts +76 -42
  307. package/src/sync/sync-config.test.ts +39 -12
  308. package/src/sync/sync-device-identity.test.ts +3 -0
  309. package/src/sync/sync-engine.test.ts +465 -12
  310. package/src/sync/sync-engine.ts +130 -135
  311. package/src/sync/sync-history.ts +7 -0
  312. package/src/sync/sync-state.ts +48 -0
  313. package/src/sync/transport.test.ts +13 -1
  314. package/src/sync/transport.ts +12 -4
  315. package/src/sync/webdav/webdav-delete-and-blob-index.test.ts +249 -0
  316. package/src/sync/webdav/webdav-transport.ts +86 -34
  317. package/src/ui/commands.test.ts +11 -0
  318. package/src/ui/commands.ts +5 -14
  319. package/src/ui/dsh-profiles-view.test.ts +16 -0
  320. package/src/ui/dsh-profiles-view.ts +11 -5
  321. package/src/ui/i18n.ts +4 -2
  322. package/src/ui/menu-placement.ts +1 -1
  323. package/src/ui/migration-consult-view.test.ts +20 -1
  324. package/src/ui/migration-consult-view.ts +17 -0
  325. package/src/ui/overview-view.ts +10 -0
  326. package/src/ui/report.test.ts +25 -1
  327. package/src/ui/report.ts +15 -4
  328. package/src/ui/selection-model.test.ts +15 -1
  329. package/src/ui/selection-model.ts +18 -0
  330. package/src/utils/js-yaml4.d.ts +35 -0
  331. package/src/utils/patch-yaml.test.ts +207 -1
  332. package/src/utils/patch-yaml.ts +98 -2
  333. package/src/utils/paths.test.ts +14 -1
  334. package/src/utils/paths.ts +35 -0
  335. package/src/utils/workdir-lock.test.ts +69 -0
  336. package/src/utils/workdir-lock.ts +17 -3
  337. package/lib/ui/path-mapping.d.ts +0 -38
  338. package/lib/ui/path-mapping.js +0 -75
  339. package/src/client/common/InfoHint.tsx +0 -289
  340. package/src/client/common/info-hint-guard.test.ts +0 -1119
  341. package/src/client/sync/DecryptPasswordCard.tsx +0 -48
  342. package/src/client/sync/SecurityOptionsCard.tsx +0 -97
  343. package/src/client/sync/SyncSectionPickerDialog.tsx +0 -213
  344. package/src/ui/path-mapping.test.ts +0 -67
  345. package/src/ui/path-mapping.ts +0 -103
@@ -22,6 +22,7 @@ import type { BrowseErrorCode, BrowseResult } from '../../core/path-browse.ts'
22
22
  import type { ConfigManagerApi } from '../api.ts'
23
23
  import type { TranslateNS } from '../client-types.ts'
24
24
  import { Modal } from '../common/Modal.tsx'
25
+ import { redact } from '../../security/redaction.ts'
25
26
  import { Banner, Button, Spinner } from '../common/ui.tsx'
26
27
  import { FileIcon, FolderIcon } from '../common/Icon.tsx'
27
28
  import css from '../config-manager.module.css'
@@ -100,7 +101,7 @@ export function PathPickerDialog({ open, api, t, startPath, onPick, onClose }: P
100
101
  },
101
102
  (error: unknown) => {
102
103
  if (!alive) return
103
- setState({ kind: 'failed', detail: error instanceof Error ? error.message : String(error) })
104
+ setState({ kind: 'failed', detail: redact(error instanceof Error ? error.message : String(error)) })
104
105
  },
105
106
  )
106
107
  return () => { alive = false }
@@ -17,7 +17,7 @@ import {
17
17
  Badge, Banner, Button, Card, Checkbox, Empty, SectionTitle,
18
18
  } from '../common/ui.tsx'
19
19
  import { Skeleton } from '../common/Skeleton.tsx'
20
- import { InfoHint } from '../common/InfoHint.tsx'
20
+ import { ImportIcon } from '../common/Icon.tsx'
21
21
  import { ErrorBanner, ErrorList } from '../common/ErrorBanner.tsx'
22
22
  import { CopyButton } from '../common/CopyButton.tsx'
23
23
  import {
@@ -101,7 +101,7 @@ export function SelectStep(props: {
101
101
  const { fileInput, selectModel, uploading, error, onCancel, onPickFile, onReset, apiT, t } = props
102
102
  return (
103
103
  <div className={`${css.viewBody} ${css.sparseFill}`}>
104
- <SectionTitle title={t('import.select.title')} info={<InfoHint text={t('import.select.hint')} label={t('common.infoHint')} />} />
104
+ <SectionTitle title={t('import.select.title')} tooltip={t('import.select.hint')} />
105
105
  <input
106
106
  ref={fileInput}
107
107
  type="file"
@@ -113,6 +113,18 @@ export function SelectStep(props: {
113
113
  void onPickFile(file)
114
114
  }}
115
115
  />
116
+ {/* 投放容器(W3 R-1):只承载图标与主按钮,不做拖拽(宿主没有 drop 能力,
117
+ 写「拖拽到此处」就是承诺做不到的事);点击目标仍是那颗唯一的主按钮。 */}
118
+ <div className={css.dropZone}>
119
+ <ImportIcon size={22} className={css.dropZoneIcon} />
120
+ <Button
121
+ variant="primary"
122
+ loading={uploading}
123
+ onClick={() => { fileInput.current?.click() }}
124
+ >
125
+ {t(browseLabelKey(selectModel.selectedName !== null))}
126
+ </Button>
127
+ </div>
116
128
  {selectModel.selectedName !== null && (
117
129
  /* 已选文件是**值**,不是说明:用徽章承载(原先是一句「已选择:xxx」),
118
130
  data-testid 保持不变以便既有守卫继续定位。 */
@@ -120,20 +132,13 @@ export function SelectStep(props: {
120
132
  <Badge kind="info">{t('import.select.file', { name: selectModel.selectedName })}</Badge>
121
133
  </div>
122
134
  )}
123
- <div className={css.actionRow} style={{ marginBottom: 0 }}>
124
- {selectModel.selectedName !== null && (
135
+ {selectModel.selectedName !== null && (
136
+ <div className={css.actionRow} style={{ marginBottom: 0 }}>
125
137
  <Button variant="ghost" onClick={onCancel}>
126
138
  {t('import.select.cancel')}
127
139
  </Button>
128
- )}
129
- <Button
130
- variant="primary"
131
- loading={uploading}
132
- onClick={() => { fileInput.current?.click() }}
133
- >
134
- {t(browseLabelKey(selectModel.selectedName !== null))}
135
- </Button>
136
- </div>
140
+ </div>
141
+ )}
137
142
  {error !== null && <ErrorBanner error={error} onRetry={onReset} t={apiT} />}
138
143
  </div>
139
144
  )
@@ -170,10 +175,10 @@ export function ConsultStage(props: {
170
175
  const { consultLoading, consultReport, error, onNext, onReset, apiT, t } = props
171
176
  return (
172
177
  <div className={css.viewBody}>
173
- <SectionTitle title={t('import.preview.title')} info={<InfoHint text={t('import.consult.hint')} label={t('common.infoHint')} />} />
178
+ <SectionTitle title={t('import.preview.title')} tooltip={t('import.consult.hint')} />
174
179
  {consultLoading && <Skeleton shape="line" count={5} label={apiT('consult.loading')} />}
175
180
  {consultReport !== null && <ConsultCard report={consultReport} t={apiT} />}
176
- {!consultLoading && consultReport === null && (
181
+ {!consultLoading && consultReport === null && error === null && (
177
182
  <Banner kind="info">{t('import.consult.unavailable')}</Banner>
178
183
  )}
179
184
  {error !== null && <ErrorBanner error={error} onRetry={onNext} t={apiT} />}
@@ -201,27 +206,34 @@ export function DecryptArchiveStep(props: {
201
206
  const { password, onPasswordChange, unlockError, unlocking, onUnlock, onReset, apiT, t } = props
202
207
  return (
203
208
  <div className={css.viewBody}>
204
- <SectionTitle title={t('import.decryptArchive.title')} info={<InfoHint text={t('import.decryptArchive.hint')} label={t('common.infoHint')} />} />
205
- <input
206
- type="password"
207
- className={css.input}
208
- autoComplete="off"
209
- placeholder={t('import.decryptArchive.passwordPlaceholder')}
210
- value={password}
211
- onChange={(e: ChangeEvent<HTMLInputElement>) => { onPasswordChange(e.target.value) }}
212
- />
213
- {unlockError !== null && <ErrorBanner error={unlockError} t={apiT} />}
214
- <div className={css.actionRow}>
215
- <Button variant="ghost" onClick={onReset}>{t('import.select.reselect')}</Button>
216
- <Button
217
- variant="primary"
218
- loading={unlocking}
219
- disabled={password === ''}
220
- onClick={onUnlock}
221
- >
222
- {t('import.decryptArchive.unlock')}
223
- </Button>
224
- </div>
209
+ {/* 解锁卡(W3 R-3):徽章 / 标题 / 密码 / 动作收进同一张卡,屏幕上只剩一个黑底主按钮。
210
+ 机制句只进标题 title(DESIGN §7:说明性文案不进正文)。 */}
211
+ <Card className={css.optionsCard}>
212
+ <div className={css.statRow}>
213
+ <Badge kind="error">🔒 {t('import.decrypt.badge')}</Badge>
214
+ </div>
215
+ <SectionTitle title={t('import.decryptArchive.title')} tooltip={t('import.decryptArchive.hint')} />
216
+ <input
217
+ type="password"
218
+ className={css.input}
219
+ autoComplete="off"
220
+ placeholder={t('import.decryptArchive.passwordPlaceholder')}
221
+ value={password}
222
+ onChange={(e: ChangeEvent<HTMLInputElement>) => { onPasswordChange(e.target.value) }}
223
+ />
224
+ {unlockError !== null && <ErrorBanner error={unlockError} t={apiT} />}
225
+ <div className={css.actionRow} style={{ marginBottom: 0 }}>
226
+ <Button variant="ghost" onClick={onReset}>{t('import.select.reselect')}</Button>
227
+ <Button
228
+ variant="primary"
229
+ loading={unlocking}
230
+ disabled={password === ''}
231
+ onClick={onUnlock}
232
+ >
233
+ {t('import.decryptArchive.unlock')}
234
+ </Button>
235
+ </div>
236
+ </Card>
225
237
  </div>
226
238
  )
227
239
  }
@@ -237,7 +249,7 @@ export function ConflictsStage(props: {
237
249
  const { collector, onChanged, onBack, onNext, t } = props
238
250
  return (
239
251
  <div className={css.viewBody}>
240
- <SectionTitle title={t('import.conflicts.title')} info={<InfoHint text={t('import.conflicts.hint')} label={t('common.infoHint')} />} />
252
+ <SectionTitle title={t('import.conflicts.title')} />
241
253
  <ConflictList
242
254
  collector={collector}
243
255
  t={t}
@@ -267,7 +279,7 @@ export function PathMappingStage(props: {
267
279
  const { issues, mappings, onMappingsChange, onBack, onNext, t, api } = props
268
280
  return (
269
281
  <div className={css.viewBody}>
270
- <SectionTitle title={t('import.paths.title')} info={<InfoHint text={t('import.paths.hint')} label={t('common.infoHint')} />} />
282
+ <SectionTitle title={t('import.paths.title')} tooltip={t('import.paths.hint')} />
271
283
  <PathMappingForm issues={issues} initial={mappings} t={t} onChange={onMappingsChange} api={api} />
272
284
  <div className={css.actionRow}>
273
285
  <Button variant="ghost" onClick={onBack}>{t('common.back')}</Button>
@@ -289,7 +301,7 @@ export function SecretsStage(props: {
289
301
  const { missing, value, onValueChange, onBack, onNext, t } = props
290
302
  return (
291
303
  <div className={css.viewBody}>
292
- <SectionTitle title={t('import.secrets.title')} info={<InfoHint text={t('import.secrets.hint')} label={t('common.infoHint')} />} />
304
+ <SectionTitle title={t('import.secrets.title')} tooltip={t('import.secrets.hint')} />
293
305
  <SecretsForm
294
306
  missing={missing}
295
307
  value={value}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * 导入向导控制器的两处事务语义(审计 P9-7 / P9-8)。
3
+ *
4
+ * 为什么测纯函数而不是 hook:仓库没有组件测试环境(AGENTS.md:逻辑提炼到可 node 跑的函数)。
5
+ * 于是把「解锁 → 继续分析」写成注入端口的异步事务、把「咨询失败 → 文案」写成纯函数,
6
+ * 这里直接跑它们;再用一条源码断言锁住 hook 里**确实调用了**这两处(纯函数测绿但没接线 = 白测)。
7
+ */
8
+ import test from 'node:test'
9
+ import assert from 'node:assert/strict'
10
+ import fs from 'node:fs'
11
+ import { fileURLToPath } from 'node:url'
12
+
13
+ import { ConfigManagerApiError } from '../common/http.ts'
14
+ import {
15
+ consultFailureError,
16
+ unlockArchiveThenAnalyze,
17
+ type ArchiveUnlockFlow,
18
+ } from './use-import-wizard-controller.ts'
19
+
20
+ /** 被实测的接线源码(断言 hook 里确实调用了下面两个纯函数) */
21
+ const CONTROLLER = fileURLToPath(new URL('./use-import-wizard-controller.ts', import.meta.url))
22
+
23
+ /* ---------------------------------------------------------------- P9-7 ---- */
24
+
25
+ test('P9-7 consultFailureError:404 = 宿主不支持(null),其余失败 = 可读消息', () => {
26
+ // 404:老宿主没有 /consult 路由 —— 界面继续按「宿主不支持」渲染 info 横幅,不制造错误
27
+ assert.equal(consultFailureError(new ConfigManagerApiError('Not Found', 404)), null)
28
+ assert.equal(
29
+ consultFailureError(new ConfigManagerApiError('404 no route', 404, 'not-found')),
30
+ null,
31
+ '带 code 的 404 同样是「不支持」',
32
+ )
33
+ // 其它状态码:必须变成可见错误(此前 catch 只 setConsultReport(null) ⇒ 用户看到「没有结论」)
34
+ assert.equal(consultFailureError(new ConfigManagerApiError('boom', 500)), 'boom')
35
+ assert.equal(consultFailureError(new ConfigManagerApiError('timeout', 504)), 'timeout')
36
+ // 无 status(网络层 / 解析失败)
37
+ assert.equal(consultFailureError(new Error('fetch failed')), 'fetch failed')
38
+ // 非 Error 值兜底为字符串,不能变成 undefined / [object Object]
39
+ assert.equal(consultFailureError('plain text'), 'plain text')
40
+ assert.equal(consultFailureError(undefined), 'undefined')
41
+ })
42
+
43
+ test('P9-7 接线:consult 失败时把消息写进 import.error(而不是只清空报告)', () => {
44
+ const src = fs.readFileSync(CONTROLLER, 'utf8')
45
+ assert.match(src, /const message = consultFailureError\(err\)/, 'catch 必须经 consultFailureError 分档')
46
+ assert.match(src, /if \(message !== null\) \{\s*runStore\.patch\(\{ import: \{ error: message \} \}\)/, '非 404 失败必须写 import.error 供 ErrorBanner 渲染')
47
+ })
48
+
49
+ /* ---------------------------------------------------------------- P9-8 ---- */
50
+
51
+ interface Trace {
52
+ calls: string[]
53
+ }
54
+
55
+ function flow(
56
+ trace: Trace,
57
+ opts: {
58
+ unlockFails?: boolean
59
+ analyzeFails?: boolean
60
+ /** 第 n 次调用 cancelled() 的返回值(默认恒 false) */
61
+ cancelledAt?: (call: number) => boolean
62
+ } = {},
63
+ ): ArchiveUnlockFlow<string> {
64
+ let cancelledCalls = 0
65
+ return {
66
+ unlock: async () => {
67
+ trace.calls.push('unlock')
68
+ if (opts.unlockFails === true) throw new Error('密码错误')
69
+ return { refs: ['a', 'b'] }
70
+ },
71
+ commitUnlocked: (refs) => { trace.calls.push('commit:' + refs.join(',')) },
72
+ analyze: async () => {
73
+ trace.calls.push('analyze')
74
+ if (opts.analyzeFails === true) throw new Error('ZIP 解析失败')
75
+ return null
76
+ },
77
+ rollbackUnlocked: () => { trace.calls.push('rollback') },
78
+ cancelled: () => {
79
+ cancelledCalls += 1
80
+ return opts.cancelledAt === undefined ? false : opts.cancelledAt(cancelledCalls)
81
+ },
82
+ }
83
+ }
84
+
85
+ test('P9-8 unlockArchiveThenAnalyze:成功路径按 解锁 → 提交 → 分析 顺序进行,不回滚', async () => {
86
+ const trace: Trace = { calls: [] }
87
+ const outcome = await unlockArchiveThenAnalyze(flow(trace))
88
+ assert.deepEqual(outcome, { status: 'ok' })
89
+ assert.deepEqual(trace.calls, ['unlock', 'commit:a,b', 'analyze'])
90
+ })
91
+
92
+ test('P9-8 unlockArchiveThenAnalyze:解锁成功但 selectZip 抛错 ⇒ 回滚已提交的解锁态', async () => {
93
+ const trace: Trace = { calls: [] }
94
+ const outcome = await unlockArchiveThenAnalyze(flow(trace, { analyzeFails: true }))
95
+ // 这就是审计的根因场景:archiveUnlocked 已 true 而 phase 停在 decrypt-archive
96
+ assert.deepEqual(outcome, { status: 'failed', message: 'ZIP 解析失败', unlocked: true })
97
+ assert.deepEqual(trace.calls, ['unlock', 'commit:a,b', 'analyze', 'rollback'], '提交过就必须回滚,且只回滚一次')
98
+ })
99
+
100
+ test('P9-8 unlockArchiveThenAnalyze:解锁本身失败 ⇒ 不提交、不回滚', async () => {
101
+ const trace: Trace = { calls: [] }
102
+ const outcome = await unlockArchiveThenAnalyze(flow(trace, { unlockFails: true }))
103
+ assert.deepEqual(outcome, { status: 'failed', message: '密码错误', unlocked: false })
104
+ assert.deepEqual(trace.calls, ['unlock'], '没提交过的解锁态没有可回滚的东西')
105
+ })
106
+
107
+ test('P9-8 unlockArchiveThenAnalyze:解锁期间向导被重置 ⇒ 丢弃结果,不提交', async () => {
108
+ const trace: Trace = { calls: [] }
109
+ const outcome = await unlockArchiveThenAnalyze(flow(trace, { cancelledAt: (n) => n === 1 }))
110
+ assert.deepEqual(outcome, { status: 'cancelled' })
111
+ assert.deepEqual(trace.calls, ['unlock'], 'reset 已清空状态,再提交会污染新一轮导入')
112
+ })
113
+
114
+ test('P9-8 unlockArchiveThenAnalyze:分析失败时若向导已被重置 ⇒ 不回滚(不覆盖新一轮)', async () => {
115
+ const trace: Trace = { calls: [] }
116
+ // 第 1 次(提交前)false,第 2 次(catch 里)true —— 用户恰在 analyze 期间点了重新选择
117
+ const outcome = await unlockArchiveThenAnalyze(flow(trace, { analyzeFails: true, cancelledAt: (n) => n === 2 }))
118
+ assert.deepEqual(outcome, { status: 'cancelled' })
119
+ assert.deepEqual(trace.calls, ['unlock', 'commit:a,b', 'analyze'], '回滚会把已重置的向导再拽回 decrypt-archive')
120
+ })
121
+
122
+ test('P9-8 接线:onUnlockArchive 使用事务,且回滚同时写 wizard 与 store 两份状态', () => {
123
+ const src = fs.readFileSync(CONTROLLER, 'utf8')
124
+ assert.match(src, /const outcome = await unlockArchiveThenAnalyze\(\{/, 'onUnlockArchive 必须走事务,而不是 try 里直接 patch')
125
+ // 回滚块:wizard 侧(setDecryptPassword('') / setArchiveEncrypted(true, …))+ store 侧四个字段
126
+ assert.match(src, /wizard\.setArchiveEncrypted\(true, encryptedPath\)/, '回滚必须把 wizard 恢复成「加密未解锁」')
127
+ assert.match(src, /archiveUnlocked: false,[\s\S]{0,120}phase: 'decrypt-archive'/, '回滚必须把 phase 退回 decrypt-archive(与 archiveUnlocked 一致)')
128
+ assert.match(src, /if \(outcome\.status === 'failed'\) \{/, '失败必须走可见错误(archiveUnlockError)')
129
+ })
@@ -31,6 +31,71 @@ import { ConfigManagerApiError } from '../common/http.ts'
31
31
  // 直接报 "missed the module table",整个插件不加载(仓库既有铁律 + 本轮实测)。
32
32
  import { ENCRYPTED_CONTAINER_CODE } from '../../utils/shared-constants.ts'
33
33
 
34
+ /**
35
+ * 迁移前咨询失败 → 界面文案(纯函数,node 可测)。
36
+ *
37
+ * 两种「没有报告」必须分开(审计 P9-7):
38
+ * - 404 = 宿主没有 `/consult` 路由(老宿主/老插件)→ null,界面继续按「宿主不支持」渲染
39
+ * info 横幅,不制造错误;
40
+ * - 其它失败(5xx / 超时 / 断网 / 响应解析失败)→ 返回可读消息,交给 ErrorBanner。
41
+ * 此前 catch 只 setConsultReport(null),用户看到的是「没有结论」而不是「咨询失败」。
42
+ */
43
+ export function consultFailureError(err: unknown): string | null {
44
+ if (err instanceof ConfigManagerApiError && err.status === 404) return null
45
+ return err instanceof Error ? err.message : String(err)
46
+ }
47
+
48
+ /** 解锁加密容器的端口(注入以便 node 直接测事务语义,不依赖 React / store)。 */
49
+ export interface ArchiveUnlockFlow<Ref> {
50
+ /** 解密容器 → 明文 ZIP + 被解出的凭据覆盖清单 refs */
51
+ unlock: () => Promise<{ refs: readonly Ref[] }>
52
+ /** 解锁成功后的中间态写回(archiveUnlocked / decryptPassword / decryptRefs) */
53
+ commitUnlocked: (refs: readonly Ref[]) => void
54
+ /** 解锁成功后的下一步(selectZip → analyze → 兼容性) */
55
+ analyze: () => Promise<unknown>
56
+ /** 回滚已提交的解锁态(只会在「已提交」之后被调用) */
57
+ rollbackUnlocked: () => void
58
+ /** 向导已被用户重置:在途结果整体丢弃,不写任何状态 */
59
+ cancelled: () => boolean
60
+ }
61
+
62
+ export type ArchiveUnlockOutcome =
63
+ | { status: 'ok' }
64
+ | { status: 'cancelled' }
65
+ | { status: 'failed'; message: string; unlocked: boolean }
66
+
67
+ /**
68
+ * 「解锁 → 继续分析」事务(审计 P9-8)。
69
+ *
70
+ * 根因:解锁成功后先写 archiveUnlocked=true,再调 selectZip;后者抛错时 catch 只写 error,
71
+ * 于是 archiveUnlocked=true 而 phase 仍停在 decrypt-archive —— 界面判定「已解锁」,
72
+ * 用户却停在解锁页,重输密码也不会重新解锁(wizard 里解锁已经成功过一次)。
73
+ * 这里把「已提交 → 后续失败必须回滚」写成事务,回滚内容由调用方给出(store 与 wizard 两份状态)。
74
+ */
75
+ export async function unlockArchiveThenAnalyze<Ref>(
76
+ flow: ArchiveUnlockFlow<Ref>,
77
+ ): Promise<ArchiveUnlockOutcome> {
78
+ let unlocked = false
79
+ try {
80
+ const { refs } = await flow.unlock()
81
+ if (flow.cancelled()) return { status: 'cancelled' }
82
+ flow.commitUnlocked(refs)
83
+ unlocked = true
84
+ await flow.analyze()
85
+ if (flow.cancelled()) return { status: 'cancelled' }
86
+ return { status: 'ok' }
87
+ } catch (err) {
88
+ // 用户已重置向导:resetWizard 已清空两份状态,再回滚只会覆盖新一轮导入
89
+ if (flow.cancelled()) return { status: 'cancelled' }
90
+ if (unlocked) flow.rollbackUnlocked()
91
+ return {
92
+ status: 'failed',
93
+ message: err instanceof Error ? err.message : String(err),
94
+ unlocked,
95
+ }
96
+ }
97
+ }
98
+
34
99
  export function useImportWizardController(api: ConfigManagerApi, t: TranslateNS<'config-manager'>) {
35
100
 
36
101
  // m2:状态统一来自模块级 store;控制器实例由 store 缓存复用(不重建)
@@ -302,14 +367,24 @@ export function useImportWizardController(api: ConfigManagerApi, t: TranslateNS<
302
367
  }, [api])
303
368
 
304
369
  /** Phase 7 迁移前咨询:预览步对当前 ZIP 生成咨询报告(只读,零写入)。
305
- * zipPath 变化 / 进入 preview 步时重新获取;失败静默(咨询是建议性,不阻断导入)。 */
370
+ * zipPath 变化 / 进入 preview 步时重新获取。失败**不再静默**(审计 P9-7):
371
+ * 「宿主不支持」= 404,仍按 info 横幅说明;其它失败写 import.error 走 ErrorBanner,
372
+ * 用户看到的是「咨询失败」而不是「没有结论」。咨询本身是建议性的,不阻断导入。 */
306
373
  useEffect(() => {
307
374
  if (step !== 'preview' || imp.zipPath === null) return
308
375
  let cancelled = false
309
376
  setConsultLoading(true)
310
377
  api.consult({ type: 'export-zip', id: imp.zipPath })
311
378
  .then((report) => { if (!cancelled) setConsultReport(report) })
312
- .catch(() => { if (!cancelled) setConsultReport(null) })
379
+ .catch((err: unknown) => {
380
+ if (cancelled) return
381
+ setConsultReport(null)
382
+ const message = consultFailureError(err)
383
+ if (message !== null) {
384
+ runStore.patch({ import: { error: message } })
385
+ runStore.syncWizard()
386
+ }
387
+ })
313
388
  .finally(() => { if (!cancelled) setConsultLoading(false) })
314
389
  return () => { cancelled = true }
315
390
  }, [step, imp.zipPath, api])
@@ -401,36 +476,55 @@ export function useImportWizardController(api: ConfigManagerApi, t: TranslateNS<
401
476
  // 竞态守卫:解锁/继续分析期间用户可能点「重新选择」(resetWizard 递增 pickGeneration),
402
477
  // 此时丢弃在途结果,防止晚到的 selectZip 把已重置的向导推进到 compatibility。
403
478
  const generation = pickGeneration.current
479
+ const encryptedPath = imp.zipPath
404
480
  setUnlocking(true)
405
481
  setArchiveUnlockError(null)
406
482
  try {
407
- const { refs } = await wizard.unlockArchive(imp.zipPath, archivePassword)
408
- if (generation !== pickGeneration.current) return
409
- // 容器密码即内部凭据解密密码:交给向导(execute 时解密 secrets.enc 用)
410
- wizard.setDecryptPassword(archivePassword)
411
- // refs 为解锁时顺带解出的凭据覆盖清单(非值):secrets 阶段据此剔除已恢复项
412
- runStore.patch({
413
- import: {
414
- archiveUnlocked: true,
415
- decryptPassword: archivePassword,
416
- decryptRefs: refs,
483
+ const outcome = await unlockArchiveThenAnalyze({
484
+ unlock: () => wizard.unlockArchive(encryptedPath, archivePassword),
485
+ commitUnlocked: (refs) => {
486
+ // 容器密码即内部凭据解密密码:交给向导(execute 时解密 secrets.enc 用)
487
+ wizard.setDecryptPassword(archivePassword)
488
+ // refs 为解锁时顺带解出的凭据覆盖清单(非值):secrets 阶段据此剔除已恢复项
489
+ runStore.patch({
490
+ import: {
491
+ archiveUnlocked: true,
492
+ decryptPassword: archivePassword,
493
+ decryptRefs: [...refs],
494
+ },
495
+ })
496
+ runStore.syncWizard()
497
+ },
498
+ analyze: () => wizard.selectZip(encryptedPath),
499
+ rollbackUnlocked: () => {
500
+ // 两份状态必须同时回到「未解锁」:wizard 内部标志决定后续请求的真实行为,
501
+ // store 决定界面判定;只回滚一边 = 两边继续互相矛盾(审计 P9-8)。
502
+ wizard.setDecryptPassword('')
503
+ wizard.setArchiveEncrypted(true, encryptedPath)
504
+ runStore.patch({
505
+ import: {
506
+ archiveUnlocked: false,
507
+ decryptPassword: '',
508
+ decryptRefs: [],
509
+ phase: 'decrypt-archive',
510
+ },
511
+ })
512
+ runStore.syncWizard()
417
513
  },
514
+ cancelled: () => generation !== pickGeneration.current,
418
515
  })
419
- runStore.syncWizard()
420
- // 解锁成功:继续「选 ZIP → 分析 → 兼容性」流程(selectZip 内部步进到 compatibility)
421
- const analysis = await wizard.selectZip(imp.zipPath!)
422
- void analysis
423
- if (generation !== pickGeneration.current) return
516
+ if (outcome.status === 'cancelled') return
517
+ if (outcome.status === 'failed') {
518
+ setArchiveUnlockError(outcome.message)
519
+ runStore.patch({ import: { error: outcome.message } })
520
+ runStore.syncWizard()
521
+ return
522
+ }
424
523
  runStore.syncWizard()
425
524
  // 解锁后 phase 不再停留在 decrypt-archive,否则 preview 页会被解锁页劫持。
426
525
  // 用最新 store 快照计算下一阶段:decrypt-archive 已解锁(archiveUnlocked=true)
427
526
  // 不再适用,nextFlowPhase 取第一项——conflicts、path-mapping、secrets 或 confirm。
428
527
  runStore.patch({ import: { phase: 'preview' } })
429
- } catch (err) {
430
- if (generation !== pickGeneration.current) return
431
- setArchiveUnlockError(err instanceof Error ? err.message : String(err))
432
- runStore.patch({ import: { error: err instanceof Error ? err.message : String(err) } })
433
- runStore.syncWizard()
434
528
  } finally {
435
529
  setUnlocking(false)
436
530
  }
@@ -74,7 +74,7 @@ export interface ArtifactRowViewProps {
74
74
  * (旧快照没有来源,绝不显示空档案名或「未标注」徽章)。`hint` 只在「与当前档案不同」时给,
75
75
  * 徽章本体只写档案名,差异语不重复表达。
76
76
  */
77
- originBadge?: { label: string; hint?: string; kind: 'info' | 'warn' } | undefined
77
+ originBadge?: { label: string; kind: 'info' | 'warn' } | undefined
78
78
  }
79
79
 
80
80
  export function ArtifactRowView({
@@ -139,7 +139,7 @@ export function ArtifactRowView({
139
139
  ))}
140
140
  {/* 来源档案排在状态徽章之后:先读「这行现在是什么状态」,再读「它来自哪个档案」 */}
141
141
  {originBadge !== undefined && (
142
- <Badge kind={originBadge.kind} title={originBadge.hint}>{originBadge.label}</Badge>
142
+ <Badge kind={originBadge.kind}>{originBadge.label}</Badge>
143
143
  )}
144
144
  </div>
145
145
  )}
@@ -39,7 +39,7 @@ export function BackupInspectView({ result, t }: BackupInspectViewProps) {
39
39
  <div className={css.groupLabel}>{t('backupFiles.inspectSections')}</div>
40
40
  <div className={css.statRow}>
41
41
  {sections.map((s) => (
42
- <Badge key={s.section} kind="info">{s.section}: {s.count}</Badge>
42
+ <Badge key={s.section} kind="info" className={css.inspectBadge}>{s.section}: {s.count}</Badge>
43
43
  ))}
44
44
  </div>
45
45
  </div>
@@ -48,12 +48,13 @@ export function BackupInspectView({ result, t }: BackupInspectViewProps) {
48
48
  <div className={css.inspectGroup}>
49
49
  <div className={css.groupLabel}>{t('backupFiles.inspectDiff')}</div>
50
50
  <div className={css.statRow}>
51
- {summary.willChange > 0 && <Badge kind="info">{t('import.preview.willChange', { count: String(summary.willChange) })}</Badge>}
52
- {summary.unchanged > 0 && <Badge kind="ok">{t('import.preview.unchanged', { count: String(summary.unchanged) })}</Badge>}
53
- {summary.conflicts > 0 && <Badge kind="error">{t('import.preview.conflicts', { count: String(summary.conflicts) })}</Badge>}
54
- {summary.secretsNeeded > 0 && <Badge kind="warn">{t('import.preview.secrets', { count: String(summary.secretsNeeded) })}</Badge>}
55
- {summary.pathMappingsNeeded > 0 && <Badge kind="warn">{t('import.preview.paths', { count: String(summary.pathMappingsNeeded) })}</Badge>}
56
- {summary.needsRestart && <Badge kind="warn">{t('report.needsRestart')}</Badge>}
51
+ {/* 徽章统一叠屏私有的 .inspectBadge:只加同色 15% 细描边(稿 D-05:142-159),本体的四态色不动 */}
52
+ {summary.willChange > 0 && <Badge kind="info" className={css.inspectBadge}>{t('import.preview.willChange', { count: String(summary.willChange) })}</Badge>}
53
+ {summary.unchanged > 0 && <Badge kind="ok" className={css.inspectBadge}>{t('import.preview.unchanged', { count: String(summary.unchanged) })}</Badge>}
54
+ {summary.conflicts > 0 && <Badge kind="error" className={css.inspectBadge}>{t('import.preview.conflicts', { count: String(summary.conflicts) })}</Badge>}
55
+ {summary.secretsNeeded > 0 && <Badge kind="warn" className={css.inspectBadge}>{t('import.preview.secrets', { count: String(summary.secretsNeeded) })}</Badge>}
56
+ {summary.pathMappingsNeeded > 0 && <Badge kind="warn" className={css.inspectBadge}>{t('import.preview.paths', { count: String(summary.pathMappingsNeeded) })}</Badge>}
57
+ {summary.needsRestart && <Badge kind="warn" className={css.inspectBadge}>{t('report.needsRestart')}</Badge>}
57
58
  </div>
58
59
  </div>
59
60
 
@@ -62,19 +63,22 @@ export function BackupInspectView({ result, t }: BackupInspectViewProps) {
62
63
  <div className={css.inspectGroup}>
63
64
  <div className={css.groupLabel}>{t('backupFiles.inspectItems')}</div>
64
65
  {groups.map((group) => (
65
- <div key={group.key} className={css.inspectGroup}>
66
+ <div key={group.key} className={css.inspectSubGroup}>
66
67
  <div className={css.groupHeader}>
67
68
  <span className={css.groupLabel}>{t(groupLabelKey(group.key))}</span>
68
- <Badge kind={group.kind}>{String(group.items.length)}</Badge>
69
+ <Badge kind={group.kind} className={css.inspectBadge}>{String(group.items.length)}</Badge>
69
70
  </div>
70
- <div className={css.reportScroll}>
71
+ <div className={css.reportScroll + ' ' + css.inspectItemsScroll}>
71
72
  <ul className={css.reportList}>
72
73
  {group.items.map((item) => (
73
- <li key={item.id}>
74
- {/* 逐项不再重复 kind:分组标题已按 kind 命名,裸枚举值(Create/Skip…)没有第二种说法。
75
- 前导 {' '} 是 plan-text-redaction 逐字锚点的一部分,别删(见该表 snapshot-inspect-description)。
76
- 差异查看的计划项文本由宿主拼装 → 渲染前过 redact(安全自查) */}
77
- {' '}{item.adapter}: {redact(item.description)}
74
+ /* 条目三段(稿 D-05:170-181):圆点 + 等宽彩色 adapter + 描述。
75
+ 逐项不再重复 kind:分组标题已按 kind 命名,裸枚举值(Create/Skip…)没有第二种说法。
76
+ 描述由宿主拼装 → 渲染前过 redact;plan-text-redaction 的 snapshot-inspect-description
77
+ 在同一次提交里同步改成这里的锚点(见该表)。 */
78
+ <li key={item.id} className={css.inspectItem}>
79
+ <span className={css.inspectDot} aria-hidden="true" />
80
+ <span className={css.mono + ' ' + css.inspectAdapter}>{item.adapter}:</span>
81
+ <span className={css.inspectDesc}>{redact(item.description)}</span>
78
82
  </li>
79
83
  ))}
80
84
  </ul>