dsh-config-manager 0.8.2 → 0.10.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 (418) hide show
  1. package/lib/adapters/mcp.js +51 -15
  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 +204 -6
  10. package/lib/adapters/prompts.js +15 -4
  11. package/lib/adapters/test-helpers.d.ts +15 -1
  12. package/lib/adapters/test-helpers.js +11 -0
  13. package/lib/cli/actions.d.ts +7 -105
  14. package/lib/cli/actions.js +16 -172
  15. package/lib/cli/control-state.d.ts +54 -0
  16. package/lib/cli/control-state.js +107 -0
  17. package/lib/cli/help.d.ts +1 -1
  18. package/lib/cli/help.js +21 -14
  19. package/lib/cli/index.js +132 -104
  20. package/lib/cli/sessions-repair.js +58 -22
  21. package/lib/cli/web/client-script.d.ts +1 -1
  22. package/lib/cli/web/client-script.js +71 -5
  23. package/lib/cli/web/page.d.ts +9 -19
  24. package/lib/cli/web/page.js +277 -173
  25. package/lib/cli/web/routes.js +85 -25
  26. package/lib/cli/write-gates.d.ts +61 -0
  27. package/lib/cli/write-gates.js +110 -0
  28. package/lib/client.d.ts +196 -75
  29. package/lib/client.js +8139 -7487
  30. package/lib/core/backup.d.ts +0 -4
  31. package/lib/core/backup.js +21 -4
  32. package/lib/core/boot-rescue.d.ts +1 -1
  33. package/lib/core/boot-rescue.js +12 -1
  34. package/lib/core/boot-safety.js +37 -2
  35. package/lib/core/conflict-decisions.js +2 -1
  36. package/lib/core/exporter.js +22 -1
  37. package/lib/core/journal.d.ts +54 -4
  38. package/lib/core/journal.js +158 -35
  39. package/lib/core/local-plugin-host.d.ts +29 -0
  40. package/lib/core/local-plugin-host.js +55 -48
  41. package/lib/core/messages.d.ts +17 -0
  42. package/lib/core/messages.js +34 -0
  43. package/lib/core/migration-history.js +16 -9
  44. package/lib/core/model-tools.d.ts +2 -2
  45. package/lib/core/model-tools.js +20 -2
  46. package/lib/core/patch-chain.d.ts +65 -0
  47. package/lib/core/patch-chain.js +100 -0
  48. package/lib/core/patch-document.d.ts +32 -4
  49. package/lib/core/patch-document.js +48 -17
  50. package/lib/core/patch-secret-guard.d.ts +49 -0
  51. package/lib/core/patch-secret-guard.js +164 -0
  52. package/lib/core/reconcile.d.ts +8 -0
  53. package/lib/core/reconcile.js +18 -3
  54. package/lib/core/reinstall.d.ts +2 -0
  55. package/lib/core/reinstall.js +6 -2
  56. package/lib/core/restore.js +31 -6
  57. package/lib/core/section-sanitize.d.ts +32 -0
  58. package/lib/core/section-sanitize.js +13 -0
  59. package/lib/core/snapshot-diff.d.ts +30 -0
  60. package/lib/core/snapshot-diff.js +56 -20
  61. package/lib/core/startup-barrier.js +8 -2
  62. package/lib/core/types.d.ts +38 -1
  63. package/lib/core/update-check.js +51 -2
  64. package/lib/foreign/kernel.js +9 -2
  65. package/lib/foreign/read-claude-plugins.js +29 -11
  66. package/lib/foreign/read-dsh.js +31 -2
  67. package/lib/foreign/session-ir.js +50 -9
  68. package/lib/foreign/session-read.d.ts +8 -0
  69. package/lib/foreign/session-read.js +26 -0
  70. package/lib/index.d.ts +9 -4
  71. package/lib/index.js +42 -47
  72. package/lib/profiles/dsh-profile-io.d.ts +20 -0
  73. package/lib/profiles/dsh-profile-io.js +27 -0
  74. package/lib/profiles/dsh-profile-manager.d.ts +27 -0
  75. package/lib/profiles/dsh-profile-manager.js +45 -4
  76. package/lib/profiles/dsh-profile-runtime.d.ts +5 -1
  77. package/lib/profiles/dsh-profile-runtime.js +16 -3
  78. package/lib/profiles/process-control.d.ts +18 -1
  79. package/lib/profiles/process-control.js +25 -1
  80. package/lib/routes/profiles.js +2 -1
  81. package/lib/routes/sync.js +19 -1
  82. package/lib/schema/types.d.ts +11 -0
  83. package/lib/security/redaction.js +22 -6
  84. package/lib/sync/autosync-repeat.d.ts +27 -0
  85. package/lib/sync/autosync-repeat.js +23 -0
  86. package/lib/sync/autosync-scheduler.d.ts +47 -2
  87. package/lib/sync/autosync-scheduler.js +217 -53
  88. package/lib/sync/baseline-heal.js +7 -0
  89. package/lib/sync/baseline-record.d.ts +67 -0
  90. package/lib/sync/baseline-record.js +74 -0
  91. package/lib/sync/blob-store.js +13 -0
  92. package/lib/sync/content-diff.d.ts +39 -0
  93. package/lib/sync/content-diff.js +46 -0
  94. package/lib/sync/git/git-transport.d.ts +32 -1
  95. package/lib/sync/git/git-transport.js +146 -26
  96. package/lib/sync/github-auth.d.ts +17 -1
  97. package/lib/sync/github-auth.js +37 -1
  98. package/lib/sync/local-changes.d.ts +15 -0
  99. package/lib/sync/local-changes.js +39 -0
  100. package/lib/sync/merge-apply-plan.d.ts +38 -0
  101. package/lib/sync/merge-apply-plan.js +76 -0
  102. package/lib/sync/merge-keyed.d.ts +68 -0
  103. package/lib/sync/merge-keyed.js +124 -0
  104. package/lib/sync/messages.d.ts +1 -0
  105. package/lib/sync/messages.js +2 -0
  106. package/lib/sync/patch-line-identity.d.ts +19 -0
  107. package/lib/sync/patch-line-identity.js +99 -0
  108. package/lib/sync/pending-merge.d.ts +41 -0
  109. package/lib/sync/pending-merge.js +61 -0
  110. package/lib/sync/plugin-removals.d.ts +15 -15
  111. package/lib/sync/plugin-removals.js +134 -83
  112. package/lib/sync/push-skip.d.ts +55 -0
  113. package/lib/sync/push-skip.js +70 -0
  114. package/lib/sync/s3/s3-transport.d.ts +14 -2
  115. package/lib/sync/s3/s3-transport.js +72 -48
  116. package/lib/sync/sync-engine.d.ts +44 -51
  117. package/lib/sync/sync-engine.js +160 -194
  118. package/lib/sync/sync-history.d.ts +7 -0
  119. package/lib/sync/sync-state.d.ts +28 -0
  120. package/lib/sync/sync-state.js +20 -0
  121. package/lib/sync/transport.d.ts +12 -3
  122. package/lib/sync/transport.js +13 -4
  123. package/lib/sync/webdav/webdav-transport.d.ts +19 -2
  124. package/lib/sync/webdav/webdav-transport.js +81 -40
  125. package/lib/sync/workspace-merge.d.ts +8 -2
  126. package/lib/ui/artifact-view.d.ts +1 -1
  127. package/lib/ui/commands.js +5 -11
  128. package/lib/ui/dsh-profiles-view.d.ts +8 -3
  129. package/lib/ui/dsh-profiles-view.js +9 -5
  130. package/lib/ui/foreign-view.d.ts +14 -0
  131. package/lib/ui/foreign-view.js +34 -0
  132. package/lib/ui/i18n.d.ts +7 -1
  133. package/lib/ui/i18n.js +15 -2
  134. package/lib/ui/menu-placement.js +1 -1
  135. package/lib/ui/migration-consult-view.d.ts +11 -0
  136. package/lib/ui/migration-consult-view.js +15 -0
  137. package/lib/ui/overview-view.d.ts +7 -0
  138. package/lib/ui/overview-view.js +3 -0
  139. package/lib/ui/report.d.ts +9 -0
  140. package/lib/ui/report.js +17 -4
  141. package/lib/ui/selection-model.d.ts +10 -2
  142. package/lib/ui/selection-model.js +23 -3
  143. package/lib/utils/async-once.d.ts +11 -0
  144. package/lib/utils/async-once.js +15 -0
  145. package/lib/utils/patch-chain-read.d.ts +51 -0
  146. package/lib/utils/patch-chain-read.js +240 -0
  147. package/lib/utils/patch-yaml.d.ts +39 -1
  148. package/lib/utils/patch-yaml.js +82 -2
  149. package/lib/utils/paths.d.ts +13 -0
  150. package/lib/utils/paths.js +35 -0
  151. package/lib/utils/workdir-lock.js +18 -3
  152. package/package.json +3 -2
  153. package/src/adapters/mcp.test.ts +29 -0
  154. package/src/adapters/mcp.ts +52 -14
  155. package/src/adapters/messages.ts +2 -0
  156. package/src/adapters/patch-key-guard.ts +29 -0
  157. package/src/adapters/plugin-data.test.ts +126 -0
  158. package/src/adapters/plugin-data.ts +97 -26
  159. package/src/adapters/plugins.test.ts +403 -0
  160. package/src/adapters/plugins.ts +198 -8
  161. package/src/adapters/prompts.ts +15 -4
  162. package/src/adapters/test-helpers.ts +15 -1
  163. package/src/cli/actions.test.ts +74 -1
  164. package/src/cli/actions.ts +27 -246
  165. package/src/cli/control-state.ts +143 -0
  166. package/src/cli/help.ts +21 -14
  167. package/src/cli/index.ts +123 -107
  168. package/src/cli/sessions-repair.ts +55 -22
  169. package/src/cli/web/client-script.ts +71 -5
  170. package/src/cli/web/page.ts +327 -208
  171. package/src/cli/web/routes.ts +85 -25
  172. package/src/cli/web/web.test.ts +65 -0
  173. package/src/cli/write-gates.ts +149 -0
  174. package/src/client/ConfigManagerSection.tsx +8 -4
  175. package/src/client/about/AboutPanel.tsx +9 -12
  176. package/src/client/about/release-notes-view.test.ts +17 -0
  177. package/src/client/about/release-notes-view.ts +49 -24
  178. package/src/client/api.ts +2 -1
  179. package/src/client/chat/ChatEntryView.tsx +2 -2
  180. package/src/client/chat/rollback-entry-view.ts +6 -1
  181. package/src/client/common/CommandPalette.tsx +6 -3
  182. package/src/client/common/ConfirmDialog.tsx +29 -12
  183. package/src/client/common/ContentPicker.tsx +24 -24
  184. package/src/client/common/Modal.tsx +12 -5
  185. package/src/client/common/MoreMenu.tsx +4 -1
  186. package/src/client/common/RunsCenter.tsx +103 -32
  187. package/src/client/common/Select.tsx +2 -2
  188. package/src/client/common/floating-bounds.ts +1 -1
  189. package/src/client/common/floating-units.test.ts +1 -2
  190. package/src/client/common/plan-text-redaction.test.ts +190 -5
  191. package/src/client/common/runs-center-guard.test.ts +60 -0
  192. package/src/client/common/runs-center-view.test.ts +128 -0
  193. package/src/client/common/runs-center-view.ts +96 -0
  194. package/src/client/common/section-title-action.test.ts +66 -0
  195. package/src/client/common/ui.tsx +93 -30
  196. package/src/client/config-manager.module.css +1515 -270
  197. package/src/client/consult/ConsultCard.tsx +7 -6
  198. package/src/client/environment/EnvironmentPanel.tsx +22 -25
  199. package/src/client/environment/maintenance/DiskUsageCard.tsx +69 -96
  200. package/src/client/environment/profiles-incomplete-ui.test.ts +8 -8
  201. package/src/client/export/ExportView.tsx +7 -16
  202. package/src/client/history/HistoryPanel.tsx +88 -28
  203. package/src/client/history/history-locales.ts +3 -3
  204. package/src/client/home/BackupScheduleCard.tsx +77 -69
  205. package/src/client/home/HomePanel.tsx +47 -12
  206. package/src/client/import/ConflictList.tsx +13 -13
  207. package/src/client/import/ForeignImportView.tsx +67 -9
  208. package/src/client/import/ImportWizardView.tsx +4 -4
  209. package/src/client/import/PathMappingForm.tsx +36 -9
  210. package/src/client/import/PathPickerDialog.tsx +2 -1
  211. package/src/client/import/import-wizard-split.test.ts +1 -1
  212. package/src/client/import/import-wizard-steps.tsx +51 -39
  213. package/src/client/import/use-import-wizard-controller.test.ts +129 -0
  214. package/src/client/import/use-import-wizard-controller.ts +116 -22
  215. package/src/client/library/ArtifactRow.tsx +2 -2
  216. package/src/client/library/BackupInspectView.tsx +21 -15
  217. package/src/client/library/LibraryActions.tsx +116 -28
  218. package/src/client/library/LibraryPanel.tsx +14 -15
  219. package/src/client/library/RestorePlanView.tsx +13 -8
  220. package/src/client/locales/about.ts +0 -2
  221. package/src/client/locales/backup.ts +15 -12
  222. package/src/client/locales/common.ts +2 -0
  223. package/src/client/locales/export.ts +5 -12
  224. package/src/client/locales/foreign.ts +4 -2
  225. package/src/client/locales/import.ts +5 -2
  226. package/src/client/locales/overview.ts +4 -0
  227. package/src/client/locales/profiles.ts +32 -4
  228. package/src/client/locales/restore.ts +2 -2
  229. package/src/client/locales/sessions.ts +0 -2
  230. package/src/client/locales/shell.ts +2 -2
  231. package/src/client/market/MarketImportReview.tsx +4 -4
  232. package/src/client/market/MarketPanel.tsx +58 -56
  233. package/src/client/market/MyConfigsList.tsx +34 -32
  234. package/src/client/market/MyConfigsLoginCard.tsx +12 -15
  235. package/src/client/market/MyConfigsView.tsx +8 -15
  236. package/src/client/market/MyConfigsWizard.tsx +7 -12
  237. package/src/client/market/market-locales.ts +0 -6
  238. package/src/client/market/my-configs-split.test.ts +2 -1
  239. package/src/client/nav-menu-clip-guard.test.ts +52 -0
  240. package/src/client/recovery/IncompleteCopiesSection.tsx +1 -3
  241. package/src/client/recovery/RecoveryPanel.tsx +35 -22
  242. package/src/client/recovery/RollbackCard.tsx +132 -75
  243. package/src/client/recovery/RollbackFileChanges.tsx +40 -27
  244. package/src/client/recovery/SessionHealthCard.tsx +2 -2
  245. package/src/client/recovery/SessionHealthDialog.tsx +5 -7
  246. package/src/client/recovery/SessionLayoutSection.tsx +3 -5
  247. package/src/client/recovery/recovery-locales.ts +12 -8
  248. package/src/client/recovery/rollback-enabled.ts +29 -0
  249. package/src/client/recovery/use-recovery-write.ts +5 -0
  250. package/src/client/run-store.test.ts +30 -0
  251. package/src/client/run-store.ts +21 -1
  252. package/src/client/sync/AddChannelCard.tsx +65 -0
  253. package/src/client/sync/AutosyncCard.tsx +184 -108
  254. package/src/client/sync/ChannelClearConfirmDialog.tsx +5 -1
  255. package/src/client/sync/ChannelConfigDialog.tsx +27 -48
  256. package/src/client/sync/MergePreviewView.tsx +5 -7
  257. package/src/client/sync/PushPreviewCard.tsx +2 -1
  258. package/src/client/sync/PushReportSections.tsx +35 -0
  259. package/src/client/sync/SyncChannelEntryCard.tsx +33 -24
  260. package/src/client/sync/SyncConfirmView.tsx +130 -133
  261. package/src/client/sync/SyncLogList.tsx +29 -14
  262. package/src/client/sync/SyncPanel.tsx +188 -185
  263. package/src/client/sync/SyncProbeRow.tsx +5 -7
  264. package/src/client/sync/SyncRepositoryPicker.tsx +17 -4
  265. package/src/client/sync/SyncSecuritySection.tsx +157 -0
  266. package/src/client/sync/SyncSettingsDialog.tsx +293 -0
  267. package/src/client/sync/SyncSettingsView.test.ts +26 -8
  268. package/src/client/sync/WorkDirCard.tsx +2 -4
  269. package/src/client/sync/config-clear-guard.test.ts +94 -0
  270. package/src/client/sync/config-clear-guard.ts +98 -0
  271. package/src/client/sync/config-dirty.test.ts +91 -0
  272. package/src/client/sync/config-dirty.ts +88 -0
  273. package/src/client/sync/history-model.test.ts +2 -0
  274. package/src/client/sync/history-model.ts +5 -0
  275. package/src/client/sync/merge-request.ts +20 -0
  276. package/src/client/sync/sync-api.ts +13 -1
  277. package/src/client/sync/sync-locales.ts +95 -47
  278. package/src/client/sync/sync-panel-clear.test.ts +44 -0
  279. package/src/client/sync/sync-push-preview.test.ts +9 -0
  280. package/src/client/sync/sync-view.test.ts +20 -0
  281. package/src/client/sync/sync-view.ts +76 -4
  282. package/src/core/backup.test.ts +61 -1
  283. package/src/core/backup.ts +21 -4
  284. package/src/core/boot-rescue.test.ts +35 -0
  285. package/src/core/boot-rescue.ts +13 -2
  286. package/src/core/boot-safety.test.ts +25 -0
  287. package/src/core/boot-safety.ts +37 -2
  288. package/src/core/conflict-decisions.ts +2 -1
  289. package/src/core/exporter.ts +21 -1
  290. package/src/core/journal.test.ts +183 -0
  291. package/src/core/journal.ts +163 -25
  292. package/src/core/local-plugin-host.test.ts +68 -2
  293. package/src/core/local-plugin-host.ts +31 -4
  294. package/src/core/messages.ts +34 -0
  295. package/src/core/migration-history.test.ts +27 -0
  296. package/src/core/migration-history.ts +12 -4
  297. package/src/core/model-tools.test.ts +67 -0
  298. package/src/core/model-tools.ts +22 -4
  299. package/src/core/patch-chain.test.ts +83 -0
  300. package/src/core/patch-chain.ts +150 -0
  301. package/src/core/patch-document.test.ts +48 -1
  302. package/src/core/patch-document.ts +66 -15
  303. package/src/core/patch-layers.test.ts +1 -1
  304. package/src/core/patch-secret-guard.test.ts +110 -0
  305. package/src/core/patch-secret-guard.ts +176 -0
  306. package/src/core/reconcile.ts +32 -4
  307. package/src/core/reinstall.ts +8 -2
  308. package/src/core/restore.ts +32 -7
  309. package/src/core/section-sanitize.ts +37 -0
  310. package/src/core/smoke.test.ts +2 -1
  311. package/src/core/snapshot-diff.test.ts +73 -1
  312. package/src/core/snapshot-diff.ts +66 -21
  313. package/src/core/startup-barrier.test.ts +64 -0
  314. package/src/core/startup-barrier.ts +8 -2
  315. package/src/core/types.ts +43 -2
  316. package/src/core/update-check.test.ts +40 -0
  317. package/src/core/update-check.ts +53 -2
  318. package/src/foreign/claude-code.test.ts +5 -0
  319. package/src/foreign/claude-plugins.test.ts +57 -0
  320. package/src/foreign/claude-sessions-bytes.test.ts +7 -1
  321. package/src/foreign/dsh.test.ts +23 -0
  322. package/src/foreign/kernel.ts +9 -2
  323. package/src/foreign/read-claude-plugins.ts +32 -11
  324. package/src/foreign/read-dsh.ts +33 -2
  325. package/src/foreign/session-ir.test.ts +67 -0
  326. package/src/foreign/session-ir.ts +54 -14
  327. package/src/foreign/session-read.ts +23 -0
  328. package/src/index.facade.test.ts +186 -6
  329. package/src/index.ts +53 -47
  330. package/src/profiles/dsh-profile-copy-rollback.test.ts +58 -4
  331. package/src/profiles/dsh-profile-io.ts +29 -0
  332. package/src/profiles/dsh-profile-manager.test.ts +30 -0
  333. package/src/profiles/dsh-profile-manager.ts +53 -5
  334. package/src/profiles/dsh-profile-runtime.test.ts +29 -7
  335. package/src/profiles/dsh-profile-runtime.ts +17 -3
  336. package/src/profiles/process-control.test.ts +97 -0
  337. package/src/profiles/process-control.ts +28 -1
  338. package/src/routes/profiles.ts +2 -1
  339. package/src/routes/sync.ts +19 -1
  340. package/src/schema/types.ts +16 -1
  341. package/src/security/redaction.test.ts +31 -0
  342. package/src/security/redaction.ts +23 -6
  343. package/src/security/security.test.ts +1 -1
  344. package/src/sync/autosync-repeat.test.ts +58 -0
  345. package/src/sync/autosync-repeat.ts +55 -0
  346. package/src/sync/autosync-scheduler.test.ts +515 -0
  347. package/src/sync/autosync-scheduler.ts +225 -51
  348. package/src/sync/baseline-heal.ts +6 -0
  349. package/src/sync/baseline-record.ts +135 -0
  350. package/src/sync/blob-store.test.ts +16 -0
  351. package/src/sync/blob-store.ts +13 -0
  352. package/src/sync/content-diff.test.ts +95 -0
  353. package/src/sync/content-diff.ts +79 -0
  354. package/src/sync/git/git-transport.test.ts +151 -4
  355. package/src/sync/git/git-transport.ts +143 -27
  356. package/src/sync/github-auth.test.ts +26 -1
  357. package/src/sync/github-auth.ts +37 -1
  358. package/src/sync/local-changes.ts +40 -0
  359. package/src/sync/merge-apply-plan.ts +117 -0
  360. package/src/sync/merge-keyed.test.ts +167 -0
  361. package/src/sync/merge-keyed.ts +160 -0
  362. package/src/sync/messages.ts +3 -0
  363. package/src/sync/patch-line-identity.test.ts +73 -0
  364. package/src/sync/patch-line-identity.ts +105 -0
  365. package/src/sync/pending-merge.test.ts +41 -0
  366. package/src/sync/pending-merge.ts +85 -0
  367. package/src/sync/plugin-removals.test.ts +199 -39
  368. package/src/sync/plugin-removals.ts +150 -64
  369. package/src/sync/push-skip.test.ts +326 -0
  370. package/src/sync/push-skip.ts +102 -0
  371. package/src/sync/s3/s3-delete-and-blob-index.test.ts +249 -0
  372. package/src/sync/s3/s3-transport.ts +76 -42
  373. package/src/sync/sync-config.test.ts +39 -12
  374. package/src/sync/sync-device-identity.test.ts +3 -0
  375. package/src/sync/sync-engine.test.ts +465 -12
  376. package/src/sync/sync-engine.ts +189 -193
  377. package/src/sync/sync-history.ts +7 -0
  378. package/src/sync/sync-state.ts +48 -0
  379. package/src/sync/transport.test.ts +13 -1
  380. package/src/sync/transport.ts +12 -4
  381. package/src/sync/webdav/webdav-delete-and-blob-index.test.ts +249 -0
  382. package/src/sync/webdav/webdav-transport.ts +86 -34
  383. package/src/sync/workspace-merge.ts +9 -2
  384. package/src/ui/artifact-view.ts +1 -1
  385. package/src/ui/commands.test.ts +11 -0
  386. package/src/ui/commands.ts +5 -14
  387. package/src/ui/dsh-profiles-view.test.ts +16 -0
  388. package/src/ui/dsh-profiles-view.ts +11 -5
  389. package/src/ui/foreign-view.test.ts +49 -0
  390. package/src/ui/foreign-view.ts +47 -0
  391. package/src/ui/i18n.ts +15 -2
  392. package/src/ui/menu-placement.ts +1 -1
  393. package/src/ui/migration-consult-view.test.ts +20 -1
  394. package/src/ui/migration-consult-view.ts +17 -0
  395. package/src/ui/overview-view.ts +10 -0
  396. package/src/ui/report.test.ts +25 -1
  397. package/src/ui/report.ts +15 -4
  398. package/src/ui/selection-model.test.ts +29 -1
  399. package/src/ui/selection-model.ts +25 -4
  400. package/src/utils/async-once.ts +14 -0
  401. package/src/utils/js-yaml4.d.ts +35 -0
  402. package/src/utils/patch-chain-read.test.ts +171 -0
  403. package/src/utils/patch-chain-read.ts +259 -0
  404. package/src/utils/patch-yaml.test.ts +215 -3
  405. package/src/utils/patch-yaml.ts +98 -2
  406. package/src/utils/paths.test.ts +14 -1
  407. package/src/utils/paths.ts +35 -0
  408. package/src/utils/workdir-lock.test.ts +69 -0
  409. package/src/utils/workdir-lock.ts +17 -3
  410. package/lib/ui/path-mapping.d.ts +0 -38
  411. package/lib/ui/path-mapping.js +0 -75
  412. package/src/client/common/InfoHint.tsx +0 -289
  413. package/src/client/common/info-hint-guard.test.ts +0 -1119
  414. package/src/client/sync/DecryptPasswordCard.tsx +0 -48
  415. package/src/client/sync/SecurityOptionsCard.tsx +0 -97
  416. package/src/client/sync/SyncSectionPickerDialog.tsx +0 -213
  417. package/src/ui/path-mapping.test.ts +0 -67
  418. package/src/ui/path-mapping.ts +0 -103
@@ -13,12 +13,13 @@ import type { ReactNode } from 'react'
13
13
  import { useEffect } from 'react'
14
14
 
15
15
  import { redact } from '../../security/redaction.ts'
16
- import { Badge, Banner, Button } from '../common/ui.tsx'
16
+ import { Badge, Banner, Button, Checkbox } from '../common/ui.tsx'
17
+ import { Modal } from '../common/Modal.tsx'
17
18
  import { Skeleton } from '../common/Skeleton.tsx'
18
19
  import { toast } from '../common/toast-store.ts'
19
20
  import { ConsultCard } from '../consult/ConsultCard.tsx'
20
21
  import type { ConsultReport } from '../../core/migration-consult.ts'
21
- import type { SyncApi, SyncConfirmItem } from './sync-api.ts'
22
+ import type { SyncApi, SyncConfirmItem, SyncPushPayload } from './sync-api.ts'
22
23
  import {
23
24
  buildAdoptions, confirmListSummary, hasBulkDecidable, isBulkDecidable, keepLocalAll, kindLabel, reviewItems, severityLabel,
24
25
  summarizeConfirmItems, useRemoteAll, type BulkDecision, type SyncConflictResolution,
@@ -61,6 +62,10 @@ export interface SyncConfirmViewProps {
61
62
  onCancel: () => void
62
63
  /** 回滚成功后回调(清空 lastRestoreId)。 */
63
64
  onRollbackDone?: () => void
65
+ /** 当前通道的远端连接参数(供 consult 远端快照定位通道) */
66
+ remoteChannelBody?: SyncPushPayload
67
+ /** 分区可读名映射(避免直接渲染裸 SectionId) */
68
+ sectionName?: (id: string) => string
64
69
  }
65
70
 
66
71
  /** 冲突解决方式:与导入恢复向导一致的两项(保留当前 / 使用备份)。 */
@@ -73,7 +78,7 @@ interface ItemState {
73
78
  }
74
79
 
75
80
  export function SyncConfirmView(props: SyncConfirmViewProps): ReactNode {
76
- const { api, syncSessionId, snapshotId, items, needsReview, compatibility, t, decisions, onDecisionsChange, onCancel, onRollbackDone } = props;
81
+ const { api, syncSessionId, snapshotId, items, needsReview, compatibility, t, decisions, onDecisionsChange, onCancel, onRollbackDone, remoteChannelBody, sectionName } = props;
77
82
  // 逐项决策状态(受控:来自 props.decisions;null 时按 defaultAdopt 初始化;持久化决策覆盖同名项)
78
83
  const states = useMemo<Record<string, ItemState>>(() => {
79
84
  const base: Record<string, ItemState> = {};
@@ -98,7 +103,7 @@ export function SyncConfirmView(props: SyncConfirmViewProps): ReactNode {
98
103
  useEffect(() => {
99
104
  let cancelled = false;
100
105
  setConsultLoading(true);
101
- api.consult({ type: 'remote-snapshot', id: snapshotId, snapshotId })
106
+ api.consult({ ...(remoteChannelBody ?? {}), type: 'remote-snapshot', id: snapshotId, snapshotId })
102
107
  .then((report) => { if (!cancelled) setConsultReport(report); })
103
108
  .catch(() => { if (!cancelled) setConsultReport(null); })
104
109
  .finally(() => { if (!cancelled) setConsultLoading(false); });
@@ -184,7 +189,7 @@ export function SyncConfirmView(props: SyncConfirmViewProps): ReactNode {
184
189
  }
185
190
  } catch (err) {
186
191
  setPhase('failed');
187
- setError(err instanceof Error ? err.message : String(err));
192
+ setError(redact(err instanceof Error ? err.message : String(err)));
188
193
  }
189
194
  };
190
195
 
@@ -220,7 +225,7 @@ export function SyncConfirmView(props: SyncConfirmViewProps): ReactNode {
220
225
  }
221
226
  } catch (err) {
222
227
  setPhase('failed');
223
- setError(err instanceof Error ? err.message : String(err));
228
+ setError(redact(err instanceof Error ? err.message : String(err)));
224
229
  }
225
230
  };
226
231
 
@@ -228,134 +233,116 @@ export function SyncConfirmView(props: SyncConfirmViewProps): ReactNode {
228
233
 
229
234
  if (items.length === 0) {
230
235
  return (
231
- <div className={css.blockStack}>
232
- <Banner kind="ok">{t('syncflow.empty')}</Banner>
233
- <div className={css.actionRow}>
236
+ <>
237
+ <Modal.Body scroll style={{ maxHeight: '72vh' }}>
238
+ <div className={css.blockStack}>
239
+ <Banner kind="ok">{t('syncflow.empty')}</Banner>
240
+ </div>
241
+ </Modal.Body>
242
+ <Modal.Footer>
234
243
  <Button disabled={busy} onClick={() => { void runCancel() }}>
235
244
  {t('common.close')}
236
245
  </Button>
237
- </div>
238
- </div>
246
+ </Modal.Footer>
247
+ </>
239
248
  );
240
249
  }
241
250
 
242
251
  return (
243
- <div className={css.blockStack}>
244
- {/* 状态与计数一律徽章,不再先来一条整句 Banner:此前 Banner 与下面的徽章把「共 N 项差异」
245
- 在同一屏里说了两遍。映射用 src/ui 的纯函数(等级 + 语义色),文案走 sync 字典 —— 不在这里另写分级规则。 */}
246
- <div className={css.statRow}>
247
- {compatibility !== undefined && (
248
- <Badge kind={compatibilityBadgeKind(compatibilityLevel(compatibility))}>
249
- {t(SYNC_COMPAT_KEYS[compatibilityLevel(compatibility)])}
250
- </Badge>
251
- )}
252
- {needsReview && <Badge kind="warn">{t('syncflow.needsReviewBadge')}</Badge>}
253
- {/* 一个徽章给两个数字:本次会导入几项 / 差异几项(原来的「共 N 项差异」与此重复) */}
254
- <Badge kind="ok">{t('syncflow.adoptRemote')} {summary.adopted}/{summary.total}</Badge>
255
- {summary.error > 0 && <Badge kind="error">{severityLabel('error', api.t)} × {summary.error}</Badge>}
256
- {summary.warning > 0 && <Badge kind="warn">{severityLabel('warning', api.t)} × {summary.warning}</Badge>}
257
- </div>
258
-
259
- {/* 列表图例(合成一行):勾选框怎么读 + 列表为什么比全量短。两件事都在解释下面这张列表,
260
- 各占一段只会把列表推到更低处。autoCount=0 时后半句不显示(没有差集可交代)。 */}
261
- <div className={css.hint}>
262
- {t('syncflow.adoptHint')}
263
- {listSummary.autoCount > 0 && (
264
- <> · {t('syncflow.listScope', { review: String(listSummary.reviewCount), auto: String(listSummary.autoCount) })}</>
265
- )}
266
- </div>
252
+ <>
253
+ <Modal.Body scroll style={{ maxHeight: '72vh' }}>
254
+ <div className={css.blockStack}>
255
+ {/* 状态与计数一律徽章,不再先来一条整句 Banner:此前 Banner 与下面的徽章把「共 N 项差异」
256
+ 在同一屏里说了两遍。映射用 src/ui 的纯函数(等级 + 语义色),文案走 sync 字典 —— 不在这里另写分级规则。 */}
257
+ <div className={css.statRow}>
258
+ {compatibility !== undefined && (
259
+ <Badge kind={compatibilityBadgeKind(compatibilityLevel(compatibility))}>
260
+ {t(SYNC_COMPAT_KEYS[compatibilityLevel(compatibility)])}
261
+ </Badge>
262
+ )}
263
+ {needsReview && <Badge kind="warn">{t('syncflow.needsReviewBadge')}</Badge>}
264
+ {/* 一个徽章给两个数字:本次会导入几项 / 差异几项(原来的「共 N 项差异」与此重复) */}
265
+ <Badge kind="ok">{t('syncflow.adoptRemote')} {summary.adopted}/{summary.total}</Badge>
266
+ {summary.error > 0 && <Badge kind="error">{severityLabel('error', api.t)} × {summary.error}</Badge>}
267
+ {summary.warning > 0 && <Badge kind="warn">{severityLabel('warning', api.t)} × {summary.warning}</Badge>}
268
+ </div>
267
269
 
268
- {/* 批量决策(快捷方式,一律 ghost —— primary 只留给弹窗底部真正的主操作「确认导入」)。
269
- 作用范围标在按钮行尾:能批量决策几项、错误项为什么只能逐项处理。 */}
270
- <div className={css.actionRow}>
271
- <Button variant="ghost" disabled={busy || !bulkDecidable} onClick={() => { applyBulkDecision(keepLocalAll(items)) }}>
272
- {t('syncflow.keepLocalAll')}
273
- </Button>
274
- <Button variant="ghost" disabled={busy || !bulkDecidable} onClick={() => { applyBulkDecision(useRemoteAll(items)) }}>
275
- {t('syncflow.useRemoteAll')}
276
- </Button>
277
- <span className={css.hint}>
278
- {t('syncflow.bulkHint', { n: String(bulkCount) })}
279
- {summary.error > 0 && <> · {t('syncflow.bulkErrorNote')}</>}
280
- </span>
281
- </div>
270
+ {/* 列表图例(合成一行):勾选框怎么读 + 列表为什么比全量短。两件事都在解释下面这张列表,
271
+ 各占一段只会把列表推到更低处。autoCount=0 时后半句不显示(没有差集可交代)。 */}
272
+ <div className={css.hint}>
273
+ {t('syncflow.adoptHint')}
274
+ {listSummary.autoCount > 0 && (
275
+ <> · {t('syncflow.listScope', { review: String(listSummary.reviewCount), auto: String(listSummary.autoCount) })}</>
276
+ )}
277
+ </div>
282
278
 
283
- {/* 逐项差异列表(仅需人工决策的项);固定容器限高 + 内部滚动,防止整页被拉长 */}
284
- <div className={css.confirmScroll}>
285
- <div className={css.reportList}>
286
- {displayItems.map((it) => {
287
- const st = states[it.itemId] ?? { adopted: it.defaultAdopt };
288
- const isConflict = it.kind === 'Conflict';
289
- return (
290
- <div key={it.itemId} className={css.confirmItem}>
291
- {/* 首行 = 勾选 + 类型 + 级别 + 描述;冲突的解决方式另起一行 ——
292
- 此前它们挤在同一个 flex 行里,描述被压成窄列、勾选框被撑高的冲突块顶到垂直居中。 */}
293
- <div className={css.confirmItemHead}>
294
- <label className={css.checkboxRow}>
295
- <input
296
- type="checkbox"
297
- checked={st.adopted}
298
- disabled={busy}
299
- onChange={(e) => { setAdopted(it.itemId, e.target.checked) }}
300
- />
301
- <span>{kindLabel(it.kind, api.t)}</span>
302
- </label>
303
- <Badge kind={it.severity === 'error' ? 'error' : it.severity === 'warning' ? 'warn' : 'info'}>
304
- {severityLabel(it.severity, api.t)}
305
- </Badge>
306
- {/* 同步差异项描述由宿主/引擎拼装,可能含本地配置值 → 渲染前过 redact(安全自查) */}
307
- <span className={css.confirmItemDesc}>{redact(it.description)}</span>
308
- </div>
309
- {isConflict && (
310
- <ConflictResolver
311
- item={it}
312
- resolution={st.resolution}
313
- busy={busy}
314
- t={t}
315
- onResolve={(r) => { setResolution(it.itemId, r) }}
316
- />
317
- )}
318
- </div>
319
- );
320
- })}
321
- </div>
322
- </div>
279
+ {/* 批量决策(快捷方式,一律 ghost —— primary 只留给弹窗底部真正的主操作「确认导入」)。
280
+ 作用范围标在按钮行尾:能批量决策几项、错误项为什么只能逐项处理。 */}
281
+ <div className={css.actionRow}>
282
+ <Button variant="ghost" disabled={busy || !bulkDecidable} onClick={() => { applyBulkDecision(keepLocalAll(items)) }}>
283
+ {t('syncflow.keepLocalAll')}
284
+ </Button>
285
+ <Button variant="ghost" disabled={busy || !bulkDecidable} onClick={() => { applyBulkDecision(useRemoteAll(items)) }}>
286
+ {t('syncflow.useRemoteAll')}
287
+ </Button>
288
+ <span className={css.hint}>
289
+ {t('syncflow.bulkHint', { n: String(bulkCount) })}
290
+ {summary.error > 0 && <> · {t('syncflow.bulkErrorNote')}</>}
291
+ </span>
292
+ </div>
323
293
 
324
- {/* Phase 7 迁移前咨询卡(只读健康评分 + 建议) */}
325
- {consultLoading && <Skeleton shape="line" count={5} label={api.t('consult.loading')} />}
326
- {consultReport !== null && <ConsultCard report={consultReport} t={api.t} />}
294
+ {/* 逐项差异列表(仅需人工决策的项);固定容器限高 + 内部滚动,防止整页被拉长 */}
295
+ <div className={css.confirmScroll}>
296
+ <div className={css.reportList}>
297
+ {displayItems.map((it) => {
298
+ const st = states[it.itemId] ?? { adopted: it.defaultAdopt };
299
+ const isConflict = it.kind === 'Conflict';
300
+ return (
301
+ <div key={it.itemId} className={css.confirmItem}>
302
+ {/* 首行 = 勾选 + 类型 + 级别 + 描述;冲突的解决方式另起一行 ——
303
+ 此前它们挤在同一个 flex 行里,描述被压成窄列、勾选框被撑高的冲突块顶到垂直居中。 */}
304
+ <div className={css.confirmItemHead}>
305
+ <Checkbox
306
+ checked={st.adopted}
307
+ disabled={busy}
308
+ onChange={(checked) => { setAdopted(it.itemId, checked) }}
309
+ label={kindLabel(it.kind, api.t)}
310
+ />
311
+ <Badge kind={it.severity === 'error' ? 'error' : it.severity === 'warning' ? 'warn' : 'info'}>
312
+ {severityLabel(it.severity, api.t)}
313
+ </Badge>
314
+ {/* 同步差异项描述由宿主/引擎拼装,可能含本地配置值 → 渲染前过 redact(安全自查) */}
315
+ <span className={css.confirmItemDesc}>{redact(it.description)}</span>
316
+ </div>
317
+ {isConflict && (
318
+ <ConflictResolver
319
+ item={it}
320
+ resolution={st.resolution}
321
+ busy={busy}
322
+ t={t}
323
+ onResolve={(r) => { setResolution(it.itemId, r) }}
324
+ />
325
+ )}
326
+ </div>
327
+ );
328
+ })}
329
+ </div>
330
+ </div>
327
331
 
328
- {error !== null && <Banner kind="error">{error}</Banner>}
332
+ {/* Phase 7 迁移前咨询卡(只读健康评分 + 建议) */}
333
+ {consultLoading && <Skeleton shape="line" count={5} label={api.t('consult.loading')} />}
334
+ {consultReport !== null && <ConsultCard report={consultReport} t={api.t} />}
329
335
 
330
- {/* 确认导入 / 取消 */}
331
- {phase === 'idle' && (
332
- <div className={css.actionRow}>
333
- <Button variant="primary" disabled={busy || summary.adopted === 0} onClick={() => { void runApply() }}>
334
- {t('syncflow.confirmImport')}
335
- </Button>
336
- <Button disabled={busy} onClick={() => { void runCancel() }}>
337
- {t('syncflow.cancel')}
338
- </Button>
339
- </div>
340
- )}
336
+ {error !== null && <Banner kind="error">{error}</Banner>}
341
337
 
342
- {/* 执行结果 */}
343
- {(phase === 'done' || phase === 'failed') && applyResult !== null && (
344
- <>
345
- <ApplyResultCard result={applyResult} busy={busy} t={t} onRollback={runRollback} />
346
- <div className={css.actionRow + ' ' + css.actionRowSpaced}>
347
- <Button variant="primary" disabled={busy} onClick={() => { onCancel() }}>
348
- {t('common.close')}
349
- </Button>
350
- </div>
351
- </>
352
- )}
353
- {(phase === 'done' || phase === 'failed') && applyResult === null && (
354
- <>
355
- {/* 诚实性(2026-10):回滚未完成(full=false)时逐条列出未恢复项与人工提示,
356
- 绝不用「已回滚」这一句话盖过去。完整回滚仍走 Toast(见 runRollback)。 */}
357
- {rollbackResult !== null && rollbackResult.full === false && (
338
+ {/* 执行结果 */}
339
+ {(phase === 'done' || phase === 'failed') && applyResult !== null && (
340
+ <ApplyResultCard result={applyResult} busy={busy} t={t} sectionName={sectionName} onRollback={runRollback} />
341
+ )}
342
+ {(phase === 'done' || phase === 'failed') && applyResult === null && rollbackResult !== null && rollbackResult.full === false && (
358
343
  <>
344
+ {/* 诚实性(2026-10):回滚未完成(full=false)时逐条列出未恢复项与人工提示,
345
+ 绝不用「已回滚」这一句话盖过去。完整回滚仍走 Toast(见 runRollback)。 */}
359
346
  <Banner kind="error">
360
347
  {t('syncflow.rollbackIncomplete', { n: String((rollbackResult.failed ?? []).length) })}
361
348
  </Banner>
@@ -374,17 +361,26 @@ export function SyncConfirmView(props: SyncConfirmViewProps): ReactNode {
374
361
  )}
375
362
  </>
376
363
  )}
377
- {/* R-04:回滚成功的 ok Banner 已改为 Toast(见 runRollback)。此处仅保留收尾「关闭」按钮;
378
- 一并消除了原实现在 runApply 抛错(phase=failed 且 applyResult 仍为 null)时
379
- 误显示「已回滚到应用前」的问题 —— 那种情况下方 error Banner 才是唯一事实。 */}
380
- <div className={css.actionRow + ' ' + css.actionRowSpaced}>
381
- <Button variant="primary" disabled={busy} onClick={() => { onCancel() }}>
382
- {t('common.close')}
364
+ </div>
365
+ </Modal.Body>
366
+ <Modal.Footer>
367
+ {(phase === 'idle' || phase === 'applying' || phase === 'cancelling') && (
368
+ <>
369
+ <Button variant="primary" loading={phase === 'applying'} disabled={busy || summary.adopted === 0} onClick={() => { void runApply() }}>
370
+ {t('syncflow.confirmImport')}
383
371
  </Button>
384
- </div>
385
- </>
386
- )}
387
- </div>
372
+ <Button disabled={busy} onClick={() => { void runCancel() }}>
373
+ {t('syncflow.cancel')}
374
+ </Button>
375
+ </>
376
+ )}
377
+ {(phase === 'done' || phase === 'failed') && (
378
+ <Button variant="primary" disabled={busy} onClick={() => { onCancel() }}>
379
+ {t('common.close')}
380
+ </Button>
381
+ )}
382
+ </Modal.Footer>
383
+ </>
388
384
  );
389
385
  }
390
386
 
@@ -444,10 +440,11 @@ interface ApplyResultCardProps {
444
440
  result: ApplyItemsResponse
445
441
  busy: boolean
446
442
  t: TranslateNS<'config-manager-sync'>
443
+ sectionName?: (id: string) => string
447
444
  onRollback: (restoreId: string) => Promise<void>
448
445
  }
449
446
 
450
- function ApplyResultCard({ result, busy, t, onRollback }: ApplyResultCardProps): ReactNode {
447
+ function ApplyResultCard({ result, busy, t, sectionName, onRollback }: ApplyResultCardProps): ReactNode {
451
448
  const ok = result.ok;
452
449
  /** issue #56:未生效项(warning)= 非致命但确实没写进去(旧宿主无字段 → 空数组) */
453
450
  const ineffective = result.ineffective ?? [];
@@ -482,7 +479,7 @@ function ApplyResultCard({ result, busy, t, onRollback }: ApplyResultCardProps):
482
479
  <div>
483
480
  <span className={css.fieldLabel}>{t('syncflow.importedSections')}</span>
484
481
  <div className={css.statRow}>
485
- {result.applied.map((sid) => <Badge key={sid} kind="ok">{sid}</Badge>)}
482
+ {result.applied.map((sid) => <Badge key={sid} kind="ok">{sectionName !== undefined ? sectionName(sid) : sid}</Badge>)}
486
483
  </div>
487
484
  </div>
488
485
  )}
@@ -490,7 +487,7 @@ function ApplyResultCard({ result, busy, t, onRollback }: ApplyResultCardProps):
490
487
  <div>
491
488
  <span className={css.fieldLabel}>{t('syncflow.importWarnings')}</span>
492
489
  <ul className={css.warnList}>
493
- {result.warnings.map((w, i) => <li key={i}>{w}</li>)}
490
+ {result.warnings.map((w, i) => <li key={i}>{redact(w)}</li>)}
494
491
  </ul>
495
492
  </div>
496
493
  )}
@@ -20,7 +20,8 @@ import {
20
20
  projectSyncHistoryEntries, summarizeSyncHistory,
21
21
  } from './history-model.ts'
22
22
  import type { TranslateNS } from '../client-types.ts'
23
- import { Badge, Card, SectionTitle } from '../common/ui.tsx'
23
+ import { Badge, Button, Card, Empty, SectionTitle } from '../common/ui.tsx'
24
+ import { RefreshIcon } from '../common/Icon.tsx'
24
25
  import { SkeletonTable } from '../common/Skeleton.tsx'
25
26
  import { ErrorBanner } from '../common/ErrorBanner.tsx'
26
27
  import css from '../config-manager.module.css'
@@ -28,13 +29,15 @@ import css from '../config-manager.module.css'
28
29
  export interface SyncLogListProps {
29
30
  api: SyncApi
30
31
  t: TranslateNS<'config-manager-sync'>
32
+ /** 分区可读名映射(避免直接渲染裸 SectionId) */
33
+ sectionName?: (id: string) => string
31
34
  }
32
35
 
33
- export function SyncLogList({ api, t }: SyncLogListProps): ReactNode {
36
+ export function SyncLogList({ api, t, sectionName }: SyncLogListProps): ReactNode {
34
37
  const [loading, setLoading] = useState(true)
35
38
  const [error, setError] = useState<string | null>(null)
36
39
  const [entries, setEntries] = useState<SyncHistoryEntry[]>([])
37
- /** 重试计数(错误态点「重试」递增 → 重新加载) */
40
+ /** 重载计数(错误态「重试」与卡头「刷新」都递增 → 重新拉一次 /sync/history) */
38
41
  const [reloadKey, setReloadKey] = useState(0)
39
42
 
40
43
  useEffect(() => {
@@ -61,7 +64,8 @@ export function SyncLogList({ api, t }: SyncLogListProps): ReactNode {
61
64
  const rows = useMemo(() => projectSyncHistoryEntries(entries), [entries])
62
65
  const stats = useMemo(() => summarizeSyncHistory(rows), [rows])
63
66
 
64
- if (loading) return <SkeletonTable label={t('common.loading')} />
67
+ // 骨架只在「还没有任何行」时占位:手动刷新不该把整张卡换成骨架(用户会以为列表没了)
68
+ if (loading && entries.length === 0) return <SkeletonTable label={t('common.loading')} />
65
69
  if (error !== null) {
66
70
  return (
67
71
  <ErrorBanner
@@ -74,18 +78,27 @@ export function SyncLogList({ api, t }: SyncLogListProps): ReactNode {
74
78
  }
75
79
  if (rows.length === 0) {
76
80
  return (
77
- <Card>
78
- <strong>{t('history.empty')}</strong>
79
- <p>{t('history.emptyHint')}</p>
81
+ <Card className={css.fillCard}>
82
+ <Empty>
83
+ <strong>{t('history.empty')}</strong>
84
+ <p>{t('history.emptyHint')}</p>
85
+ </Empty>
80
86
  </Card>
81
87
  )
82
88
  }
83
89
 
84
90
  return (
85
- <Card>
91
+ <Card className={css.fillCard}>
86
92
  {/* 条数只在下面那排统计徽章里给一次:标题里的 (12) 与「共 12 条」是同一个数,
87
93
  两处并列时用户要先比对才敢确定它们说的是同一件事 */}
88
- <SectionTitle title={t('history.title')} />
94
+ {/* 刷新走 SectionTitle 的 action 槽:它渲在标题同一行的右侧(内部自带推右的 spacer),
95
+ 垂直居中跟标题一致。 */}
96
+ <SectionTitle
97
+ title={t('history.title')}
98
+ action={<Button size="sm" loading={loading} onClick={() => { setReloadKey((k) => k + 1) }}>
99
+ <RefreshIcon size={12} />{' '}{t('history.refresh')}
100
+ </Button>}
101
+ />
89
102
  {/* 头部统计摘要(先扫结论);失败/跳过仅在存在时出现,并给语义色 */}
90
103
  <div className={css.statRow} aria-label={t('history.stats.summary')}>
91
104
  <Badge kind="info">{t('history.stats.total', { count: String(stats.total) })}</Badge>
@@ -105,7 +118,7 @@ export function SyncLogList({ api, t }: SyncLogListProps): ReactNode {
105
118
  <tbody>
106
119
  {rows.map((r) => {
107
120
  if (r.kind === 'autosync' && r.autosync !== undefined) {
108
- return <AutosyncRow key={r.id} entry={r.autosync} t={t} />
121
+ return <AutosyncRow key={r.id} entry={r.autosync} t={t} sectionName={sectionName} />
109
122
  }
110
123
  return <OperationRow key={r.id} row={r} t={t} />
111
124
  })}
@@ -143,7 +156,7 @@ function OperationRow({ row, t }: { row: SyncHistoryEntry; t: TranslateNS<'confi
143
156
  * 自动同步行:引擎自己跑的同步(push / pull 成对),与人为操作区分开。
144
157
  * 全部取值来自 `projectAutosyncEntry` 的投影 —— 本组件不自己拼文案。
145
158
  */
146
- function AutosyncRow({ entry, t }: { entry: AutosyncHistoryEntry; t: TranslateNS<'config-manager-sync'> }): ReactNode {
159
+ function AutosyncRow({ entry, t, sectionName }: { entry: AutosyncHistoryEntry; t: TranslateNS<'config-manager-sync'>; sectionName?: (id: string) => string }): ReactNode {
147
160
  const row = projectAutosyncEntry(entry, t)
148
161
  return (
149
162
  <tr>
@@ -177,7 +190,7 @@ function AutosyncRow({ entry, t }: { entry: AutosyncHistoryEntry; t: TranslateNS
177
190
  <div>
178
191
  <span className={css.fieldLabel}>{t('history.autosyncConflicted', { sections: '' })}</span>
179
192
  <div className={css.statRow}>
180
- {row.conflictedSections.map((sid) => <Badge key={sid} kind="warn">{sid}</Badge>)}
193
+ {row.conflictedSections.map((sid) => <Badge key={sid} kind="warn">{sectionName !== undefined ? sectionName(sid) : sid}</Badge>)}
181
194
  </div>
182
195
  </div>
183
196
  )}
@@ -185,7 +198,7 @@ function AutosyncRow({ entry, t }: { entry: AutosyncHistoryEntry; t: TranslateNS
185
198
  <div>
186
199
  <span className={css.fieldLabel}>{t('history.autosyncApplied', { sections: '' })}</span>
187
200
  <div className={css.statRow}>
188
- {row.appliedSections.map((sid) => <Badge key={sid} kind="ok">{sid}</Badge>)}
201
+ {row.appliedSections.map((sid) => <Badge key={sid} kind="ok">{sectionName !== undefined ? sectionName(sid) : sid}</Badge>)}
189
202
  </div>
190
203
  </div>
191
204
  )}
@@ -197,9 +210,11 @@ function AutosyncRow({ entry, t }: { entry: AutosyncHistoryEntry; t: TranslateNS
197
210
  )
198
211
  }
199
212
 
200
- /** 通道徽章:git → GitHub,webdav → WebDAV;未知/缺失不渲染(不猜)。 */
213
+ /** 通道徽章:git → GitHub,webdav → WebDAV,s3 → S3,gist → Gist;未知/缺失不渲染(不猜)。 */
201
214
  function ChannelBadge({ transport, t }: { transport?: string; t: TranslateNS<'config-manager-sync'> }): ReactNode {
202
215
  if (transport === 'git') return <Badge kind="info">{t('history.channelGit')}</Badge>
203
216
  if (transport === 'webdav') return <Badge kind="info">{t('history.channelWebdav')}</Badge>
217
+ if (transport === 's3') return <Badge kind="info">{t('history.channelS3')}</Badge>
218
+ if (transport === 'gist') return <Badge kind="info">{t('history.channelGist')}</Badge>
204
219
  return null
205
220
  }