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
@@ -16,7 +16,6 @@ import { useState } from 'react'
16
16
  import type { TranslateNS } from '../client-types.ts'
17
17
  import type { SyncApi, SyncStatusResponse } from './sync-api.ts'
18
18
  import { Badge, Button, Card } from '../common/ui.tsx'
19
- import { InfoHint } from '../common/InfoHint.tsx'
20
19
  import { ConfirmDialog } from '../common/ConfirmDialog.tsx'
21
20
  import { toast } from '../common/toast-store.ts'
22
21
  import { redact } from '../../security/redaction.ts'
@@ -76,7 +75,7 @@ export function WorkDirCard({ t, api, workDir, busy, onChanged }: {
76
75
 
77
76
  return (
78
77
  <Card>
79
- <span className={css.groupLabel}>{t('workdir.title')} <InfoHint text={t('workdir.hint')} label={t('common.infoHint')} /></span>
78
+ <span className={css.groupLabel} title={t('workdir.hint')}>{t('workdir.title')}</span>
80
79
  {stateKey !== null && badgeKind !== null && (
81
80
  <div className={css.statRow}>
82
81
  <Badge kind={badgeKind}>{t(stateKey)}</Badge>
@@ -122,10 +121,9 @@ export function WorkDirCard({ t, api, workDir, busy, onChanged }: {
122
121
  )}
123
122
  {canAdoptWorkdir(workDir) && (
124
123
  <>
125
- <Button disabled={busy || pending !== null} loading={pending === 'adopt'} onClick={() => { void reset('adopt') }}>
124
+ <Button disabled={busy || pending !== null} loading={pending === 'adopt'} onClick={() => { void reset('adopt') }} title={t('workdir.adoptHint')}>
126
125
  {t('workdir.adopt')}
127
126
  </Button>
128
- <InfoHint text={t('workdir.adoptHint')} label={t('common.infoHint')} />
129
127
  </>
130
128
  )}
131
129
  {canRecloneWorkdir(workDir) && (
@@ -0,0 +1,94 @@
1
+ /**
2
+ * 断开通道的时序守卫(./config-clear-guard.ts)。
3
+ *
4
+ * 真机背景(P9-5):断开时的在途 saveConfig 取消不掉,回执晚回来会把刚清空的配置合并回来;
5
+ * 宿主侧 save 晚于 clear 到达时配置也会回魂。这里钉住三条口径:
6
+ * ① 世代不等 ⇒ 回执整体丢弃(不写回任何字段);
7
+ * ② 断开前先取消防抖/丢排队载荷再等在途落定,超时**拒绝断开**(prepareClear);
8
+ * ③ 不再有「断开后自愈 clear」——反方实测它会把用户随后保存成功的新配置连凭据一起删掉。
9
+ */
10
+ import test from 'node:test';
11
+ import assert from 'node:assert/strict';
12
+
13
+ import {
14
+ CLEAR_QUIESCENT_POLL_MS, CLEAR_QUIESCENT_TIMEOUT_MS, clearedChannelFormFields,
15
+ prepareClear, shouldDiscardSaveResult, waitForQuiescence,
16
+ } from './config-clear-guard.ts';
17
+
18
+ test('C-1 shouldDiscardSaveResult:世代不同即丢弃,相同则写回', () => {
19
+ assert.equal(shouldDiscardSaveResult(0, 0), false);
20
+ assert.equal(shouldDiscardSaveResult(3, 3), false);
21
+ assert.equal(shouldDiscardSaveResult(0, 1), true);
22
+ assert.equal(shouldDiscardSaveResult(2, 1), true);
23
+ });
24
+
25
+ test('C-2 prepareClear:先撤未发出的输入,再放行', async () => {
26
+ let cancelled = 0;
27
+ let busy = false;
28
+ await prepareClear({ cancelPendingSave: () => { cancelled += 1; busy = false }, isBusy: () => busy, busyMessage: 'busy' });
29
+ assert.equal(cancelled, 1, '必须先撤掉防抖 timer + 排队载荷(600ms 到点会把旧值发回宿主)');
30
+ });
31
+
32
+ test('C-2b prepareClear:在途保存超时 ⇒ 抛错拒绝断开(不带着在途 save 去 clear)', async () => {
33
+ await assert.rejects(
34
+ () => prepareClear({ cancelPendingSave: () => {}, isBusy: () => true, busyMessage: 'still-saving', timeoutMs: 30, pollMs: 5 }),
35
+ /still-saving/,
36
+ );
37
+ });
38
+
39
+ test('C-2c prepareClear:在途保存落地后放行', async () => {
40
+ let busy = true;
41
+ const wait = prepareClear({ cancelPendingSave: () => {}, isBusy: () => busy, busyMessage: 'still-saving', timeoutMs: 500, pollMs: 5 });
42
+ setTimeout(() => { busy = false }, 20);
43
+ await wait;
44
+ });
45
+
46
+ test('C-2d prepareClear 每轮重新问 isBusy(队列整体替换后不能读旧快照)', async () => {
47
+ let queue = { inFlight: true, pending: null as unknown };
48
+ const wait = prepareClear({ cancelPendingSave: () => { queue = { ...queue, pending: null } }, isBusy: () => queue.inFlight, busyMessage: 'still-saving', timeoutMs: 500, pollMs: 5 });
49
+ setTimeout(() => { queue = { inFlight: false, pending: null } }, 20); // 模拟 saveQueueRef.current = settled.state
50
+ await wait; // 若实现读的是入参快照,这里会超时抛错
51
+ });
52
+
53
+ test('C-3 waitForQuiescence:空闲立刻放行', async () => {
54
+ assert.equal(await waitForQuiescence(() => false), true);
55
+ });
56
+
57
+ test('C-4 waitForQuiescence:在途请求落地后放行', async () => {
58
+ let busy = true;
59
+ const wait = waitForQuiescence(() => busy, { timeoutMs: 500, pollMs: 5 });
60
+ setTimeout(() => { busy = false }, 20);
61
+ assert.equal(await wait, true);
62
+ });
63
+
64
+ test('C-5 waitForQuiescence:超时返回 false(放行由调用方决定:prepareClear 据此拒绝断开)', async () => {
65
+ assert.equal(await waitForQuiescence(() => true, { timeoutMs: 30, pollMs: 5 }), false);
66
+ });
67
+
68
+ test('C-6 超时/轮询常量有界(不是 0,也不会把用户卡太久)', () => {
69
+ assert.ok(CLEAR_QUIESCENT_TIMEOUT_MS > 0 && CLEAR_QUIESCENT_TIMEOUT_MS <= 5000);
70
+ assert.ok(CLEAR_QUIESCENT_POLL_MS > 0 && CLEAR_QUIESCENT_POLL_MS < CLEAR_QUIESCENT_TIMEOUT_MS);
71
+ });
72
+
73
+ test('C-7 clearedChannelFormFields:只清本通道的表单残留', () => {
74
+ assert.deepEqual(clearedChannelFormFields('git'), { repoUrl: '', token: '' });
75
+ assert.deepEqual(clearedChannelFormFields('webdav'), {
76
+ webdavUrl: '', webdavUsername: '', webdavPassword: '',
77
+ });
78
+ const s3 = clearedChannelFormFields('s3');
79
+ assert.equal(s3.s3Endpoint, '');
80
+ assert.equal(s3.s3AccessKeyId, '');
81
+ assert.equal(s3.s3Secret, '');
82
+ assert.equal(s3.s3PathStyle, false);
83
+ assert.equal(s3.s3Provider, 's3', '云端点通道断开后回落默认厂商');
84
+ assert.equal('repoUrl' in s3, false, '不得顺带清别的通道');
85
+ assert.deepEqual(clearedChannelFormFields('gist'), {
86
+ gistId: '', gistApiBaseUrl: '', gistFilePrefix: '', gistToken: '',
87
+ });
88
+ });
89
+
90
+ test('C-8 clearedChannelFormFields 返回副本:调用方改不污染映像表', () => {
91
+ const first = clearedChannelFormFields('git');
92
+ first.repoUrl = 'polluted';
93
+ assert.equal(clearedChannelFormFields('git').repoUrl, '');
94
+ });
@@ -0,0 +1,98 @@
1
+ /**
2
+ * 断开通道时的时序守卫(纯函数 + 一个轮询等待;node 可测)。
3
+ *
4
+ * 真机缺陷 P9-5:断开流程 = 确认弹窗 → api.clearChannel(channel) → onChannelCleared 收尾。
5
+ * 清空本身是确定成功的,但**在途的 saveConfig 取消不掉**:它的回执晚回来会把刚清空的
6
+ * 表单值合并回来;宿主侧若 save 晚于 clear 到达,配置也会在宿主上回魂(宿主写配置是无锁读改写)。
7
+ *
8
+ * 两道闸(反方复核后收紧;原先还有一道「断开后没再编辑就补一次 clear」的自愈,实测会把用户
9
+ * 随后保存成功的新配置连同凭据一起删掉,已删):
10
+ * ① 断开前 prepareClear:取消防抖 → 丢弃排队载荷 → 等在途保存落定;超时**拒绝断开**(不制造假象);
11
+ * ② 发请求前记下「断开世代」,回执回来时世代变了就整体丢弃,且不再碰保存队列(那已属于新保存)。
12
+ */
13
+ import { DEFAULT_S3_PROVIDER } from '../../ui/sync-settings-view.ts'
14
+ import type { SyncChannel } from './sync-view.ts'
15
+
16
+ /** 等保存队列静默的上限:超时**拒绝断开**(宁可让用户重试,也不造「已断开」的假象)。 */
17
+ export const CLEAR_QUIESCENT_TIMEOUT_MS = 5000
18
+ /** 静默等待的轮询间隔。 */
19
+ export const CLEAR_QUIESCENT_POLL_MS = 100
20
+
21
+ /** 回执的发送世代 ≠ 当前世代 ⇒ 这次回执描述的是「已被断开的通道」,一个字段都不许写回。 */
22
+ export function shouldDiscardSaveResult(sendEpoch: number, currentEpoch: number): boolean {
23
+ return sendEpoch !== currentEpoch
24
+ }
25
+
26
+ /**
27
+ * 断开前的收尾:丢掉该通道还没发出去的输入(防抖 timer + 排队载荷),再等在途保存落定。
28
+ * 超时抛错 ⇒ 调用方(确认弹窗)提示重试并保持打开,绝不带着在途 save 去 clear。
29
+ */
30
+ export async function prepareClear(input: {
31
+ cancelPendingSave: () => void
32
+ /** 必须是 getter:保存队列在等待期间会被整体替换(saveQueueRef.current = ...),快照对象永远读到旧的 inFlight。 */
33
+ isBusy: () => boolean
34
+ busyMessage: string
35
+ timeoutMs?: number
36
+ pollMs?: number
37
+ }): Promise<void> {
38
+ input.cancelPendingSave()
39
+ if (!(await waitForQuiescence(input.isBusy, input))) throw new Error(input.busyMessage)
40
+ }
41
+
42
+ /**
43
+ * 等 isBusy() 变 false(轮询,不改状态、不持有资源)。
44
+ * @returns true = 已静默;false = 超时(调用方决定怎么处理;prepareClear 据此拒绝断开)
45
+ */
46
+ export function waitForQuiescence(
47
+ isBusy: () => boolean,
48
+ opts: { timeoutMs?: number; pollMs?: number } = {},
49
+ ): Promise<boolean> {
50
+ const timeoutMs = opts.timeoutMs ?? CLEAR_QUIESCENT_TIMEOUT_MS
51
+ const pollMs = opts.pollMs ?? CLEAR_QUIESCENT_POLL_MS
52
+ if (!isBusy()) return Promise.resolve(true)
53
+ return new Promise<boolean>((resolve) => {
54
+ const deadline = Date.now() + timeoutMs
55
+ const tick = (): void => {
56
+ if (!isBusy()) { resolve(true); return }
57
+ if (Date.now() >= deadline) { resolve(false); return }
58
+ setTimeout(tick, pollMs)
59
+ }
60
+ setTimeout(tick, pollMs)
61
+ })
62
+ }
63
+
64
+ /** 断开成功后要清掉的本机表单残留(只删该通道的地址 / 凭据输入;其他通道原样)。 */
65
+ export interface ClearedFormFields {
66
+ repoUrl?: string
67
+ token?: string
68
+ webdavUrl?: string
69
+ webdavUsername?: string
70
+ webdavPassword?: string
71
+ s3Provider?: string
72
+ s3Endpoint?: string
73
+ s3Region?: string
74
+ s3Bucket?: string
75
+ s3Prefix?: string
76
+ s3AccessKeyId?: string
77
+ s3PathStyle?: boolean
78
+ s3Secret?: string
79
+ gistId?: string
80
+ gistApiBaseUrl?: string
81
+ gistFilePrefix?: string
82
+ gistToken?: string
83
+ }
84
+
85
+ /** 每通道的「清空后表单」映像(返回副本,调用方改了也不污染这张表)。 */
86
+ const CLEARED_FIELDS: Record<SyncChannel, ClearedFormFields> = {
87
+ git: { repoUrl: '', token: '' },
88
+ webdav: { webdavUrl: '', webdavUsername: '', webdavPassword: '' },
89
+ s3: {
90
+ s3Provider: DEFAULT_S3_PROVIDER, s3Endpoint: '', s3Region: '', s3Bucket: '', s3Prefix: '',
91
+ s3AccessKeyId: '', s3PathStyle: false, s3Secret: '',
92
+ },
93
+ gist: { gistId: '', gistApiBaseUrl: '', gistFilePrefix: '', gistToken: '' },
94
+ }
95
+
96
+ export function clearedChannelFormFields(channel: SyncChannel): ClearedFormFields {
97
+ return { ...CLEARED_FIELDS[channel] }
98
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * 配置表单的 dirty 保护(./config-dirty.ts)。
3
+ *
4
+ * 真机背景(P9-4):loadStatus 无条件回填会在用户打字时(600ms 防抖未到)把输入抹回宿主旧值。
5
+ * 这里钉住三条不可放宽的口径:
6
+ * ① dirty 集合由**用户实际改过的键**动态构成(不硬编码字段白名单,新增字段自动受保护);
7
+ * ② 回填只跳过 dirty 命中键,非 dirty 键照旧写入;
8
+ * ③ 纯函数:不修改入参,返回新对象 / 新 Set。
9
+ */
10
+ import test from 'node:test';
11
+ import assert from 'node:assert/strict';
12
+
13
+ import {
14
+ clearDirtyFields, formPatchFromStatus, markDirty, pruneDirtyFields, resetDirty,
15
+ } from './config-dirty.ts';
16
+ import type { StatusFormSource } from './config-dirty.ts';
17
+
18
+ test('D-1 markDirty 并入用户改过的键,且不改入参', () => {
19
+ const before = new Set(['repoUrl']);
20
+ const next = markDirty(before, ['gitSubdir', 'repoUrl']);
21
+ assert.deepEqual([...next], ['repoUrl', 'gitSubdir']);
22
+ assert.deepEqual([...before], ['repoUrl']);
23
+ assert.notEqual(next, before, 'dirty 集合必须整体替换(ref 赋值依赖新引用)');
24
+ });
25
+
26
+ test('D-2 markDirty 空 keys 返回等价副本(不动原集合)', () => {
27
+ const before = new Set(['webdavUrl']);
28
+ const next = markDirty(before, []);
29
+ assert.deepEqual([...next], ['webdavUrl']);
30
+ assert.notEqual(next, before);
31
+ });
32
+
33
+ test('D-3 pruneDirtyFields 丢掉 dirty 命中键,保留其余键且不改入参', () => {
34
+ const patch = { repoUrl: 'https://example.invalid/r.git', gitSubdir: 'sub', token: 't' };
35
+ const out = pruneDirtyFields(patch, new Set(['repoUrl']));
36
+ assert.deepEqual(out, { gitSubdir: 'sub', token: 't' });
37
+ assert.deepEqual(patch, { repoUrl: 'https://example.invalid/r.git', gitSubdir: 'sub', token: 't' });
38
+ assert.notEqual(out, patch);
39
+ });
40
+
41
+ test('D-4 pruneDirtyFields 空 dirty = 全量保留;dirty 全命中 = 空补丁', () => {
42
+ const patch = { a: 1, b: 'x' };
43
+ assert.deepEqual(pruneDirtyFields(patch, new Set()), { a: 1, b: 'x' });
44
+ assert.deepEqual(pruneDirtyFields(patch, new Set(['a', 'b'])), {});
45
+ });
46
+
47
+ test('D-5 clearDirtyFields 只撤销指定键(其余保持 dirty)', () => {
48
+ const dirty = new Set(['repoUrl', 'gitSubdir', 'webdavUrl']);
49
+ const next = clearDirtyFields(dirty, ['repoUrl', 'gitSubdir']);
50
+ assert.deepEqual([...next], ['webdavUrl']);
51
+ assert.deepEqual([...dirty], ['repoUrl', 'gitSubdir', 'webdavUrl'], '入参不得被修改');
52
+ });
53
+
54
+ test('D-6 resetDirty 返回空集合', () => {
55
+ assert.equal(resetDirty().size, 0);
56
+ });
57
+
58
+ const status: StatusFormSource = {
59
+ repoUrl: 'https://host.invalid/repo.git',
60
+ subdir: 'nested',
61
+ webdav: { url: 'https://dav.invalid/dav', username: 'alice' },
62
+ s3: {
63
+ provider: 'r2', endpoint: 'https://s3.invalid', region: 'auto', bucket: 'b',
64
+ prefix: 'p', accessKeyId: 'AKID', pathStyle: true,
65
+ },
66
+ gist: { gistId: 'g1', apiBaseUrl: 'https://api.invalid', filePrefix: 'dcm-' },
67
+ };
68
+
69
+ test('D-7 formPatchFromStatus:dirty 命中键不被宿主旧值覆盖,其余字段照旧回填', () => {
70
+ const out = formPatchFromStatus(status, new Set(['repoUrl', 'webdavUsername']));
71
+ assert.equal('repoUrl' in out, false, '用户正在输入的键必须缺席(否则会覆盖输入)');
72
+ assert.equal('webdavUsername' in out, false);
73
+ assert.equal(out.gitSubdir, 'nested');
74
+ assert.equal(out.webdavUrl, 'https://dav.invalid/dav');
75
+ assert.equal(out.s3Bucket, 'b');
76
+ assert.equal(out.s3PathStyle, true);
77
+ assert.equal(out.gistFilePrefix, 'dcm-');
78
+ });
79
+
80
+ test('D-8 formPatchFromStatus:dirty 为空 = 全量回填;缺失视图按空值回填,且绝不带密钥字段', () => {
81
+ const full = formPatchFromStatus(status, new Set());
82
+ assert.equal(full.repoUrl, 'https://host.invalid/repo.git');
83
+ const empty = formPatchFromStatus({}, new Set());
84
+ assert.deepEqual(empty, {
85
+ repoUrl: '', gitSubdir: '', webdavUrl: '', webdavUsername: '',
86
+ s3Provider: 's3', s3Endpoint: '', s3Region: '', s3Bucket: '', s3Prefix: '',
87
+ s3AccessKeyId: '', s3PathStyle: false, gistId: '', gistApiBaseUrl: '', gistFilePrefix: '',
88
+ });
89
+ assert.equal('s3Secret' in empty, false);
90
+ assert.equal('gistToken' in empty, false, '密钥字段永不参与回填(宿主也不回传值)');
91
+ });
@@ -0,0 +1,88 @@
1
+ /**
2
+ * 通道配置表单的「用户正在输入」保护(纯函数,node 可测)。
3
+ *
4
+ * 真机缺陷 P9-4:loadStatus 是无条件回填 —— 挂载、GitHub 登录成功、断开通道、
5
+ * 合并 / 回滚完成、工作副本变更都会重拉 /sync/status 并把宿主值写进表单。
6
+ * 用户在输入框里打的字(600ms 自动保存防抖还没到)就这样被静默抹掉,输入框自己变回去。
7
+ *
8
+ * 口径(不得放宽):
9
+ * ① **不硬编码字段白名单**:dirty 集合由用户**实际改过**的键(onFormChange 的 Object.keys(p))
10
+ * 动态构成,将来新增表单字段自动受保护;
11
+ * ② 回填只跳过 dirty 里出现的键;channel / statusInfo / catalog / 快照列表等非表单键不经此处,
12
+ * 照旧写入;
13
+ * ③ 宿主回执(保存成功)即权威:落盘后整体 resetDirty(),之后的刷新可以正常回填。
14
+ */
15
+ import { cloudFormFromStatus } from '../../ui/sync-settings-view.ts'
16
+ import type { CloudFormBackfill, CloudStatusLike } from '../../ui/sync-settings-view.ts'
17
+
18
+ /**
19
+ * 把用户改动过的键并入 dirty 集合。返回**新 Set**(不改入参,调用方用 ref 整体替换);
20
+ * 空 keys 也返回等价副本 —— 恒返回新引用,调用点的赋值语句无需分支。
21
+ */
22
+ export function markDirty(dirty: ReadonlySet<string>, keys: readonly string[]): Set<string> {
23
+ const next = new Set(dirty)
24
+ for (const key of keys) next.add(key)
25
+ return next
26
+ }
27
+
28
+ /**
29
+ * 丢掉补丁里**用户正在输入**的键(dirty 命中即剔除)。
30
+ * 返回新对象、不修改入参;非 dirty 键与键序保持原样。
31
+ */
32
+ export function pruneDirtyFields<T extends object>(
33
+ patch: T,
34
+ dirty: ReadonlySet<string>,
35
+ ): Partial<T> {
36
+ const out: Record<string, unknown> = {}
37
+ for (const [key, value] of Object.entries(patch)) {
38
+ if (!dirty.has(key)) out[key] = value
39
+ }
40
+ // Object.entries 丢掉了键的精确类型;这里只可能少键、不会多键或换类型,故用 Partial 表达
41
+ return out as Partial<T>
42
+ }
43
+
44
+ /** 只撤销**指定字段**的 dirty(该字段的写入已被宿主确认时用;整体落地见 resetDirty)。 */
45
+ export function clearDirtyFields(dirty: ReadonlySet<string>, keys: readonly string[]): Set<string> {
46
+ const next = new Set(dirty)
47
+ for (const key of keys) next.delete(key)
48
+ return next
49
+ }
50
+
51
+ /** 清空 dirty(断开通道 / 宿主回执落地 / 切换激活通道时调用)。 */
52
+ export function resetDirty(): Set<string> {
53
+ return new Set<string>()
54
+ }
55
+
56
+ /** /sync/status 里参与表单回填的字段(= 全部非密表单字段)。 */
57
+ export interface StatusFormFields extends CloudFormBackfill {
58
+ /** git 通道:仓库地址 + 子目录前缀 */
59
+ repoUrl: string
60
+ gitSubdir: string
61
+ /** webdav 通道:地址 + 用户名(口令永不回传) */
62
+ webdavUrl: string
63
+ webdavUsername: string
64
+ }
65
+
66
+ /** 回填来源:/sync/status 的非密视图(云端点部分与 ui 层的 CloudStatusLike 共用)。 */
67
+ export type StatusFormSource = CloudStatusLike & {
68
+ repoUrl?: string
69
+ subdir?: string
70
+ webdav?: { url?: string; username?: string }
71
+ }
72
+
73
+ /**
74
+ * /sync/status → 表单回填补丁,**丢掉用户正在输入的键**(P9-4 的唯一入口)。
75
+ * 密钥类字段不在返回里(宿主本来就不回传值,只回 configured 布尔)。
76
+ */
77
+ export function formPatchFromStatus(
78
+ info: StatusFormSource,
79
+ dirty: ReadonlySet<string>,
80
+ ): Partial<StatusFormFields> {
81
+ return pruneDirtyFields<StatusFormFields>({
82
+ repoUrl: info.repoUrl ?? '',
83
+ gitSubdir: info.subdir ?? '',
84
+ webdavUrl: info.webdav?.url ?? '',
85
+ webdavUsername: info.webdav?.username ?? '',
86
+ ...cloudFormFromStatus(info),
87
+ }, dirty)
88
+ }
@@ -276,6 +276,8 @@ test('issue #79:skipReasonKey —— 新旧码都映射到字典键,未知
276
276
  assert.equal(skipReasonKey('mutation-lock-stale'), 'history.autosyncReasonLockStale');
277
277
  assert.equal(skipReasonKey('mutation-lock-unavailable'), 'history.autosyncReasonLockUnavailable');
278
278
  assert.equal(skipReasonKey('mutation-safe-mode'), 'history.autosyncReasonSafeMode');
279
+ // issue #136:下行告警 ≠ 冲突 —— 两类降级各说各的,不能共用「冲突」文案
280
+ assert.equal(skipReasonKey('warning'), 'history.autosyncReasonWarning');
279
281
  assert.equal(skipReasonKey('future-code-from-newer-host'), null, '未知码不猜');
280
282
  assert.equal(skipReasonKey(undefined), null);
281
283
  });
@@ -114,6 +114,9 @@ export function skipReasonKey(reason: string | undefined): SyncKey | null {
114
114
  // 0.4.1:推送前收养了本机自己推的远端快照(上次推送在写基线前被打断)—— 结果仍是 success,
115
115
  // 这条原因只是把「基线是被修好的」讲明白。
116
116
  case 'baseline-adopted': return 'history.autosyncReasonBaselineAdopted';
117
+ // issue #136:下行有告警(内容没全落地)但没有叶级冲突 —— 与「冲突待裁决」必须分开说,
118
+ // 否则界面把插件安装失败之类的事情也说成冲突,且待确认分区计数被虚增。
119
+ case 'warning': return 'history.autosyncReasonWarning';
117
120
  // 未知原因:没有字典键(调用方决定回退策略)
118
121
  default: return null;
119
122
  }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * 首页「待裁决」活动行 → 同步页裁决视图的一次性信号。
3
+ *
4
+ * 为什么不做进 run-store:它跨越的是「首页 → 同步页」这一个动作,不是需要渲染或落盘的 UI 状态。
5
+ * 放进 store 就得同时处理持久化白名单、旧存档迁移与刷新重放 —— 而一个过期的请求会在用户
6
+ * 根本没点的情况下自己弹出合并裁决弹窗。模块级一个数字足够:写入一次、取走即清空。
7
+ */
8
+ let pending = 0
9
+
10
+ /** 记下一次「去打开裁决」的请求(重复点击以最后一次为准)。 */
11
+ export function requestMergeDecision(): void {
12
+ pending = Date.now()
13
+ }
14
+
15
+ /** 取走待处理请求:返回毫秒戳(> 0)表示确有请求,取走后不再重放;0 = 没有请求。 */
16
+ export function consumeMergeDecision(): number {
17
+ const request = pending
18
+ pending = 0
19
+ return request
20
+ }
@@ -104,6 +104,13 @@ export interface SyncStatusResponse {
104
104
  autosync?: AutosyncStatusResponse;
105
105
  /** 全部通道的自动同步状态(git/webdav 各自独立;UI 按当前 tab 取对应通道) */
106
106
  autosyncByChannel?: Record<SyncTransportType, AutosyncStatusResponse>;
107
+ /**
108
+ * P2(2026-11-14 真机事故):等人裁决的冲突分区。
109
+ * 自动同步撞上「远端已推进 + 分区冲突」时,宿主把冲突分区落进 sync-state.pendingMerge;
110
+ * 有值 = 同步并没有坏,只是有人在等你确认那几个分区(首页「待裁决」行据此跳同步页)。
111
+ * **永不携带远端快照 id**(与 hasBaseline 同一纪律);since = 这件事第一次挂住的时刻。
112
+ */
113
+ pendingMerge?: { sections: string[]; since: string };
107
114
  /**
108
115
  * issue #79:git 工作副本与配置地址的关系(host 只读自检)。
109
116
  * - `{ facts }` = 自检成功(origin 是否已跟随 repoUrl)
@@ -258,6 +265,11 @@ export interface SyncPushPayload {
258
265
  encryptPassword?: string;
259
266
  /** 导出真实凭据值(必须同时 encrypt=true,否则 Host 拒绝:密钥绝不明文进同步通道) */
260
267
  includeSecrets?: boolean;
268
+ /**
269
+ * issue #140:强制推送 —— 内容与远端最新快照一致时**也**新建快照。
270
+ * 缺省 false = 内容没变就跳过(不 upload、不建目录,报告 skipped:'unchanged')。
271
+ */
272
+ force?: boolean;
261
273
  /* ---------------- 云端点通道(s3 / gist)字段:与宿主 parseSyncBody 的扁平形状一致 ---------------- */
262
274
  /** s3:具体兼容商(s3 / oss / cos / minio / kodo) */
263
275
  provider?: string;