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.
- package/lib/adapters/mcp.js +51 -15
- package/lib/adapters/messages.d.ts +1 -0
- package/lib/adapters/messages.js +2 -0
- package/lib/adapters/patch-key-guard.d.ts +23 -0
- package/lib/adapters/patch-key-guard.js +13 -0
- package/lib/adapters/plugin-data.d.ts +19 -5
- package/lib/adapters/plugin-data.js +76 -22
- package/lib/adapters/plugins.d.ts +14 -1
- package/lib/adapters/plugins.js +204 -6
- package/lib/adapters/prompts.js +15 -4
- package/lib/adapters/test-helpers.d.ts +15 -1
- package/lib/adapters/test-helpers.js +11 -0
- package/lib/cli/actions.d.ts +7 -105
- package/lib/cli/actions.js +16 -172
- package/lib/cli/control-state.d.ts +54 -0
- package/lib/cli/control-state.js +107 -0
- package/lib/cli/help.d.ts +1 -1
- package/lib/cli/help.js +21 -14
- package/lib/cli/index.js +132 -104
- package/lib/cli/sessions-repair.js +58 -22
- package/lib/cli/web/client-script.d.ts +1 -1
- package/lib/cli/web/client-script.js +71 -5
- package/lib/cli/web/page.d.ts +9 -19
- package/lib/cli/web/page.js +277 -173
- package/lib/cli/web/routes.js +85 -25
- package/lib/cli/write-gates.d.ts +61 -0
- package/lib/cli/write-gates.js +110 -0
- package/lib/client.d.ts +196 -75
- package/lib/client.js +8139 -7487
- package/lib/core/backup.d.ts +0 -4
- package/lib/core/backup.js +21 -4
- package/lib/core/boot-rescue.d.ts +1 -1
- package/lib/core/boot-rescue.js +12 -1
- package/lib/core/boot-safety.js +37 -2
- package/lib/core/conflict-decisions.js +2 -1
- package/lib/core/exporter.js +22 -1
- package/lib/core/journal.d.ts +54 -4
- package/lib/core/journal.js +158 -35
- package/lib/core/local-plugin-host.d.ts +29 -0
- package/lib/core/local-plugin-host.js +55 -48
- package/lib/core/messages.d.ts +17 -0
- package/lib/core/messages.js +34 -0
- package/lib/core/migration-history.js +16 -9
- package/lib/core/model-tools.d.ts +2 -2
- package/lib/core/model-tools.js +20 -2
- package/lib/core/patch-chain.d.ts +65 -0
- package/lib/core/patch-chain.js +100 -0
- package/lib/core/patch-document.d.ts +32 -4
- package/lib/core/patch-document.js +48 -17
- package/lib/core/patch-secret-guard.d.ts +49 -0
- package/lib/core/patch-secret-guard.js +164 -0
- package/lib/core/reconcile.d.ts +8 -0
- package/lib/core/reconcile.js +18 -3
- package/lib/core/reinstall.d.ts +2 -0
- package/lib/core/reinstall.js +6 -2
- package/lib/core/restore.js +31 -6
- package/lib/core/section-sanitize.d.ts +32 -0
- package/lib/core/section-sanitize.js +13 -0
- package/lib/core/snapshot-diff.d.ts +30 -0
- package/lib/core/snapshot-diff.js +56 -20
- package/lib/core/startup-barrier.js +8 -2
- package/lib/core/types.d.ts +38 -1
- package/lib/core/update-check.js +51 -2
- package/lib/foreign/kernel.js +9 -2
- package/lib/foreign/read-claude-plugins.js +29 -11
- package/lib/foreign/read-dsh.js +31 -2
- package/lib/foreign/session-ir.js +50 -9
- package/lib/foreign/session-read.d.ts +8 -0
- package/lib/foreign/session-read.js +26 -0
- package/lib/index.d.ts +9 -4
- package/lib/index.js +42 -47
- package/lib/profiles/dsh-profile-io.d.ts +20 -0
- package/lib/profiles/dsh-profile-io.js +27 -0
- package/lib/profiles/dsh-profile-manager.d.ts +27 -0
- package/lib/profiles/dsh-profile-manager.js +45 -4
- package/lib/profiles/dsh-profile-runtime.d.ts +5 -1
- package/lib/profiles/dsh-profile-runtime.js +16 -3
- package/lib/profiles/process-control.d.ts +18 -1
- package/lib/profiles/process-control.js +25 -1
- package/lib/routes/profiles.js +2 -1
- package/lib/routes/sync.js +19 -1
- package/lib/schema/types.d.ts +11 -0
- package/lib/security/redaction.js +22 -6
- package/lib/sync/autosync-repeat.d.ts +27 -0
- package/lib/sync/autosync-repeat.js +23 -0
- package/lib/sync/autosync-scheduler.d.ts +47 -2
- package/lib/sync/autosync-scheduler.js +217 -53
- package/lib/sync/baseline-heal.js +7 -0
- package/lib/sync/baseline-record.d.ts +67 -0
- package/lib/sync/baseline-record.js +74 -0
- package/lib/sync/blob-store.js +13 -0
- package/lib/sync/content-diff.d.ts +39 -0
- package/lib/sync/content-diff.js +46 -0
- package/lib/sync/git/git-transport.d.ts +32 -1
- package/lib/sync/git/git-transport.js +146 -26
- package/lib/sync/github-auth.d.ts +17 -1
- package/lib/sync/github-auth.js +37 -1
- package/lib/sync/local-changes.d.ts +15 -0
- package/lib/sync/local-changes.js +39 -0
- package/lib/sync/merge-apply-plan.d.ts +38 -0
- package/lib/sync/merge-apply-plan.js +76 -0
- package/lib/sync/merge-keyed.d.ts +68 -0
- package/lib/sync/merge-keyed.js +124 -0
- package/lib/sync/messages.d.ts +1 -0
- package/lib/sync/messages.js +2 -0
- package/lib/sync/patch-line-identity.d.ts +19 -0
- package/lib/sync/patch-line-identity.js +99 -0
- package/lib/sync/pending-merge.d.ts +41 -0
- package/lib/sync/pending-merge.js +61 -0
- package/lib/sync/plugin-removals.d.ts +15 -15
- package/lib/sync/plugin-removals.js +134 -83
- package/lib/sync/push-skip.d.ts +55 -0
- package/lib/sync/push-skip.js +70 -0
- package/lib/sync/s3/s3-transport.d.ts +14 -2
- package/lib/sync/s3/s3-transport.js +72 -48
- package/lib/sync/sync-engine.d.ts +44 -51
- package/lib/sync/sync-engine.js +160 -194
- package/lib/sync/sync-history.d.ts +7 -0
- package/lib/sync/sync-state.d.ts +28 -0
- package/lib/sync/sync-state.js +20 -0
- package/lib/sync/transport.d.ts +12 -3
- package/lib/sync/transport.js +13 -4
- package/lib/sync/webdav/webdav-transport.d.ts +19 -2
- package/lib/sync/webdav/webdav-transport.js +81 -40
- package/lib/sync/workspace-merge.d.ts +8 -2
- package/lib/ui/artifact-view.d.ts +1 -1
- package/lib/ui/commands.js +5 -11
- package/lib/ui/dsh-profiles-view.d.ts +8 -3
- package/lib/ui/dsh-profiles-view.js +9 -5
- package/lib/ui/foreign-view.d.ts +14 -0
- package/lib/ui/foreign-view.js +34 -0
- package/lib/ui/i18n.d.ts +7 -1
- package/lib/ui/i18n.js +15 -2
- package/lib/ui/menu-placement.js +1 -1
- package/lib/ui/migration-consult-view.d.ts +11 -0
- package/lib/ui/migration-consult-view.js +15 -0
- package/lib/ui/overview-view.d.ts +7 -0
- package/lib/ui/overview-view.js +3 -0
- package/lib/ui/report.d.ts +9 -0
- package/lib/ui/report.js +17 -4
- package/lib/ui/selection-model.d.ts +10 -2
- package/lib/ui/selection-model.js +23 -3
- package/lib/utils/async-once.d.ts +11 -0
- package/lib/utils/async-once.js +15 -0
- package/lib/utils/patch-chain-read.d.ts +51 -0
- package/lib/utils/patch-chain-read.js +240 -0
- package/lib/utils/patch-yaml.d.ts +39 -1
- package/lib/utils/patch-yaml.js +82 -2
- package/lib/utils/paths.d.ts +13 -0
- package/lib/utils/paths.js +35 -0
- package/lib/utils/workdir-lock.js +18 -3
- package/package.json +3 -2
- package/src/adapters/mcp.test.ts +29 -0
- package/src/adapters/mcp.ts +52 -14
- package/src/adapters/messages.ts +2 -0
- package/src/adapters/patch-key-guard.ts +29 -0
- package/src/adapters/plugin-data.test.ts +126 -0
- package/src/adapters/plugin-data.ts +97 -26
- package/src/adapters/plugins.test.ts +403 -0
- package/src/adapters/plugins.ts +198 -8
- package/src/adapters/prompts.ts +15 -4
- package/src/adapters/test-helpers.ts +15 -1
- package/src/cli/actions.test.ts +74 -1
- package/src/cli/actions.ts +27 -246
- package/src/cli/control-state.ts +143 -0
- package/src/cli/help.ts +21 -14
- package/src/cli/index.ts +123 -107
- package/src/cli/sessions-repair.ts +55 -22
- package/src/cli/web/client-script.ts +71 -5
- package/src/cli/web/page.ts +327 -208
- package/src/cli/web/routes.ts +85 -25
- package/src/cli/web/web.test.ts +65 -0
- package/src/cli/write-gates.ts +149 -0
- package/src/client/ConfigManagerSection.tsx +8 -4
- package/src/client/about/AboutPanel.tsx +9 -12
- package/src/client/about/release-notes-view.test.ts +17 -0
- package/src/client/about/release-notes-view.ts +49 -24
- package/src/client/api.ts +2 -1
- package/src/client/chat/ChatEntryView.tsx +2 -2
- package/src/client/chat/rollback-entry-view.ts +6 -1
- package/src/client/common/CommandPalette.tsx +6 -3
- package/src/client/common/ConfirmDialog.tsx +29 -12
- package/src/client/common/ContentPicker.tsx +24 -24
- package/src/client/common/Modal.tsx +12 -5
- package/src/client/common/MoreMenu.tsx +4 -1
- package/src/client/common/RunsCenter.tsx +103 -32
- package/src/client/common/Select.tsx +2 -2
- package/src/client/common/floating-bounds.ts +1 -1
- package/src/client/common/floating-units.test.ts +1 -2
- package/src/client/common/plan-text-redaction.test.ts +190 -5
- package/src/client/common/runs-center-guard.test.ts +60 -0
- package/src/client/common/runs-center-view.test.ts +128 -0
- package/src/client/common/runs-center-view.ts +96 -0
- package/src/client/common/section-title-action.test.ts +66 -0
- package/src/client/common/ui.tsx +93 -30
- package/src/client/config-manager.module.css +1515 -270
- package/src/client/consult/ConsultCard.tsx +7 -6
- package/src/client/environment/EnvironmentPanel.tsx +22 -25
- package/src/client/environment/maintenance/DiskUsageCard.tsx +69 -96
- package/src/client/environment/profiles-incomplete-ui.test.ts +8 -8
- package/src/client/export/ExportView.tsx +7 -16
- package/src/client/history/HistoryPanel.tsx +88 -28
- package/src/client/history/history-locales.ts +3 -3
- package/src/client/home/BackupScheduleCard.tsx +77 -69
- package/src/client/home/HomePanel.tsx +47 -12
- package/src/client/import/ConflictList.tsx +13 -13
- package/src/client/import/ForeignImportView.tsx +67 -9
- package/src/client/import/ImportWizardView.tsx +4 -4
- package/src/client/import/PathMappingForm.tsx +36 -9
- package/src/client/import/PathPickerDialog.tsx +2 -1
- package/src/client/import/import-wizard-split.test.ts +1 -1
- package/src/client/import/import-wizard-steps.tsx +51 -39
- package/src/client/import/use-import-wizard-controller.test.ts +129 -0
- package/src/client/import/use-import-wizard-controller.ts +116 -22
- package/src/client/library/ArtifactRow.tsx +2 -2
- package/src/client/library/BackupInspectView.tsx +21 -15
- package/src/client/library/LibraryActions.tsx +116 -28
- package/src/client/library/LibraryPanel.tsx +14 -15
- package/src/client/library/RestorePlanView.tsx +13 -8
- package/src/client/locales/about.ts +0 -2
- package/src/client/locales/backup.ts +15 -12
- package/src/client/locales/common.ts +2 -0
- package/src/client/locales/export.ts +5 -12
- package/src/client/locales/foreign.ts +4 -2
- package/src/client/locales/import.ts +5 -2
- package/src/client/locales/overview.ts +4 -0
- package/src/client/locales/profiles.ts +32 -4
- package/src/client/locales/restore.ts +2 -2
- package/src/client/locales/sessions.ts +0 -2
- package/src/client/locales/shell.ts +2 -2
- package/src/client/market/MarketImportReview.tsx +4 -4
- package/src/client/market/MarketPanel.tsx +58 -56
- package/src/client/market/MyConfigsList.tsx +34 -32
- package/src/client/market/MyConfigsLoginCard.tsx +12 -15
- package/src/client/market/MyConfigsView.tsx +8 -15
- package/src/client/market/MyConfigsWizard.tsx +7 -12
- package/src/client/market/market-locales.ts +0 -6
- package/src/client/market/my-configs-split.test.ts +2 -1
- package/src/client/nav-menu-clip-guard.test.ts +52 -0
- package/src/client/recovery/IncompleteCopiesSection.tsx +1 -3
- package/src/client/recovery/RecoveryPanel.tsx +35 -22
- package/src/client/recovery/RollbackCard.tsx +132 -75
- package/src/client/recovery/RollbackFileChanges.tsx +40 -27
- package/src/client/recovery/SessionHealthCard.tsx +2 -2
- package/src/client/recovery/SessionHealthDialog.tsx +5 -7
- package/src/client/recovery/SessionLayoutSection.tsx +3 -5
- package/src/client/recovery/recovery-locales.ts +12 -8
- package/src/client/recovery/rollback-enabled.ts +29 -0
- package/src/client/recovery/use-recovery-write.ts +5 -0
- package/src/client/run-store.test.ts +30 -0
- package/src/client/run-store.ts +21 -1
- package/src/client/sync/AddChannelCard.tsx +65 -0
- package/src/client/sync/AutosyncCard.tsx +184 -108
- package/src/client/sync/ChannelClearConfirmDialog.tsx +5 -1
- package/src/client/sync/ChannelConfigDialog.tsx +27 -48
- package/src/client/sync/MergePreviewView.tsx +5 -7
- package/src/client/sync/PushPreviewCard.tsx +2 -1
- package/src/client/sync/PushReportSections.tsx +35 -0
- package/src/client/sync/SyncChannelEntryCard.tsx +33 -24
- package/src/client/sync/SyncConfirmView.tsx +130 -133
- package/src/client/sync/SyncLogList.tsx +29 -14
- package/src/client/sync/SyncPanel.tsx +188 -185
- package/src/client/sync/SyncProbeRow.tsx +5 -7
- package/src/client/sync/SyncRepositoryPicker.tsx +17 -4
- package/src/client/sync/SyncSecuritySection.tsx +157 -0
- package/src/client/sync/SyncSettingsDialog.tsx +293 -0
- package/src/client/sync/SyncSettingsView.test.ts +26 -8
- package/src/client/sync/WorkDirCard.tsx +2 -4
- package/src/client/sync/config-clear-guard.test.ts +94 -0
- package/src/client/sync/config-clear-guard.ts +98 -0
- package/src/client/sync/config-dirty.test.ts +91 -0
- package/src/client/sync/config-dirty.ts +88 -0
- package/src/client/sync/history-model.test.ts +2 -0
- package/src/client/sync/history-model.ts +5 -0
- package/src/client/sync/merge-request.ts +20 -0
- package/src/client/sync/sync-api.ts +13 -1
- package/src/client/sync/sync-locales.ts +95 -47
- package/src/client/sync/sync-panel-clear.test.ts +44 -0
- package/src/client/sync/sync-push-preview.test.ts +9 -0
- package/src/client/sync/sync-view.test.ts +20 -0
- package/src/client/sync/sync-view.ts +76 -4
- package/src/core/backup.test.ts +61 -1
- package/src/core/backup.ts +21 -4
- package/src/core/boot-rescue.test.ts +35 -0
- package/src/core/boot-rescue.ts +13 -2
- package/src/core/boot-safety.test.ts +25 -0
- package/src/core/boot-safety.ts +37 -2
- package/src/core/conflict-decisions.ts +2 -1
- package/src/core/exporter.ts +21 -1
- package/src/core/journal.test.ts +183 -0
- package/src/core/journal.ts +163 -25
- package/src/core/local-plugin-host.test.ts +68 -2
- package/src/core/local-plugin-host.ts +31 -4
- package/src/core/messages.ts +34 -0
- package/src/core/migration-history.test.ts +27 -0
- package/src/core/migration-history.ts +12 -4
- package/src/core/model-tools.test.ts +67 -0
- package/src/core/model-tools.ts +22 -4
- package/src/core/patch-chain.test.ts +83 -0
- package/src/core/patch-chain.ts +150 -0
- package/src/core/patch-document.test.ts +48 -1
- package/src/core/patch-document.ts +66 -15
- package/src/core/patch-layers.test.ts +1 -1
- package/src/core/patch-secret-guard.test.ts +110 -0
- package/src/core/patch-secret-guard.ts +176 -0
- package/src/core/reconcile.ts +32 -4
- package/src/core/reinstall.ts +8 -2
- package/src/core/restore.ts +32 -7
- package/src/core/section-sanitize.ts +37 -0
- package/src/core/smoke.test.ts +2 -1
- package/src/core/snapshot-diff.test.ts +73 -1
- package/src/core/snapshot-diff.ts +66 -21
- package/src/core/startup-barrier.test.ts +64 -0
- package/src/core/startup-barrier.ts +8 -2
- package/src/core/types.ts +43 -2
- package/src/core/update-check.test.ts +40 -0
- package/src/core/update-check.ts +53 -2
- package/src/foreign/claude-code.test.ts +5 -0
- package/src/foreign/claude-plugins.test.ts +57 -0
- package/src/foreign/claude-sessions-bytes.test.ts +7 -1
- package/src/foreign/dsh.test.ts +23 -0
- package/src/foreign/kernel.ts +9 -2
- package/src/foreign/read-claude-plugins.ts +32 -11
- package/src/foreign/read-dsh.ts +33 -2
- package/src/foreign/session-ir.test.ts +67 -0
- package/src/foreign/session-ir.ts +54 -14
- package/src/foreign/session-read.ts +23 -0
- package/src/index.facade.test.ts +186 -6
- package/src/index.ts +53 -47
- package/src/profiles/dsh-profile-copy-rollback.test.ts +58 -4
- package/src/profiles/dsh-profile-io.ts +29 -0
- package/src/profiles/dsh-profile-manager.test.ts +30 -0
- package/src/profiles/dsh-profile-manager.ts +53 -5
- package/src/profiles/dsh-profile-runtime.test.ts +29 -7
- package/src/profiles/dsh-profile-runtime.ts +17 -3
- package/src/profiles/process-control.test.ts +97 -0
- package/src/profiles/process-control.ts +28 -1
- package/src/routes/profiles.ts +2 -1
- package/src/routes/sync.ts +19 -1
- package/src/schema/types.ts +16 -1
- package/src/security/redaction.test.ts +31 -0
- package/src/security/redaction.ts +23 -6
- package/src/security/security.test.ts +1 -1
- package/src/sync/autosync-repeat.test.ts +58 -0
- package/src/sync/autosync-repeat.ts +55 -0
- package/src/sync/autosync-scheduler.test.ts +515 -0
- package/src/sync/autosync-scheduler.ts +225 -51
- package/src/sync/baseline-heal.ts +6 -0
- package/src/sync/baseline-record.ts +135 -0
- package/src/sync/blob-store.test.ts +16 -0
- package/src/sync/blob-store.ts +13 -0
- package/src/sync/content-diff.test.ts +95 -0
- package/src/sync/content-diff.ts +79 -0
- package/src/sync/git/git-transport.test.ts +151 -4
- package/src/sync/git/git-transport.ts +143 -27
- package/src/sync/github-auth.test.ts +26 -1
- package/src/sync/github-auth.ts +37 -1
- package/src/sync/local-changes.ts +40 -0
- package/src/sync/merge-apply-plan.ts +117 -0
- package/src/sync/merge-keyed.test.ts +167 -0
- package/src/sync/merge-keyed.ts +160 -0
- package/src/sync/messages.ts +3 -0
- package/src/sync/patch-line-identity.test.ts +73 -0
- package/src/sync/patch-line-identity.ts +105 -0
- package/src/sync/pending-merge.test.ts +41 -0
- package/src/sync/pending-merge.ts +85 -0
- package/src/sync/plugin-removals.test.ts +199 -39
- package/src/sync/plugin-removals.ts +150 -64
- package/src/sync/push-skip.test.ts +326 -0
- package/src/sync/push-skip.ts +102 -0
- package/src/sync/s3/s3-delete-and-blob-index.test.ts +249 -0
- package/src/sync/s3/s3-transport.ts +76 -42
- package/src/sync/sync-config.test.ts +39 -12
- package/src/sync/sync-device-identity.test.ts +3 -0
- package/src/sync/sync-engine.test.ts +465 -12
- package/src/sync/sync-engine.ts +189 -193
- package/src/sync/sync-history.ts +7 -0
- package/src/sync/sync-state.ts +48 -0
- package/src/sync/transport.test.ts +13 -1
- package/src/sync/transport.ts +12 -4
- package/src/sync/webdav/webdav-delete-and-blob-index.test.ts +249 -0
- package/src/sync/webdav/webdav-transport.ts +86 -34
- package/src/sync/workspace-merge.ts +9 -2
- package/src/ui/artifact-view.ts +1 -1
- package/src/ui/commands.test.ts +11 -0
- package/src/ui/commands.ts +5 -14
- package/src/ui/dsh-profiles-view.test.ts +16 -0
- package/src/ui/dsh-profiles-view.ts +11 -5
- package/src/ui/foreign-view.test.ts +49 -0
- package/src/ui/foreign-view.ts +47 -0
- package/src/ui/i18n.ts +15 -2
- package/src/ui/menu-placement.ts +1 -1
- package/src/ui/migration-consult-view.test.ts +20 -1
- package/src/ui/migration-consult-view.ts +17 -0
- package/src/ui/overview-view.ts +10 -0
- package/src/ui/report.test.ts +25 -1
- package/src/ui/report.ts +15 -4
- package/src/ui/selection-model.test.ts +29 -1
- package/src/ui/selection-model.ts +25 -4
- package/src/utils/async-once.ts +14 -0
- package/src/utils/js-yaml4.d.ts +35 -0
- package/src/utils/patch-chain-read.test.ts +171 -0
- package/src/utils/patch-chain-read.ts +259 -0
- package/src/utils/patch-yaml.test.ts +215 -3
- package/src/utils/patch-yaml.ts +98 -2
- package/src/utils/paths.test.ts +14 -1
- package/src/utils/paths.ts +35 -0
- package/src/utils/workdir-lock.test.ts +69 -0
- package/src/utils/workdir-lock.ts +17 -3
- package/lib/ui/path-mapping.d.ts +0 -38
- package/lib/ui/path-mapping.js +0 -75
- package/src/client/common/InfoHint.tsx +0 -289
- package/src/client/common/info-hint-guard.test.ts +0 -1119
- package/src/client/sync/DecryptPasswordCard.tsx +0 -48
- package/src/client/sync/SecurityOptionsCard.tsx +0 -97
- package/src/client/sync/SyncSectionPickerDialog.tsx +0 -213
- package/src/ui/path-mapping.test.ts +0 -67
- package/src/ui/path-mapping.ts +0 -103
|
@@ -23,7 +23,8 @@ import type { TranslateNS } from '../client-types.ts'
|
|
|
23
23
|
import {
|
|
24
24
|
Badge, Banner, Button, Card, FoldToggle, SectionTitle, Spinner, StatusDot,
|
|
25
25
|
} from '../common/ui.tsx'
|
|
26
|
-
import {
|
|
26
|
+
import { ErrorBanner } from '../common/ErrorBanner.tsx'
|
|
27
|
+
import { RefreshIcon } from '../common/Icon.tsx'
|
|
27
28
|
import { Collapse } from '../common/Motion.tsx'
|
|
28
29
|
import { DiskUsageCard } from '../environment/maintenance/DiskUsageCard.tsx'
|
|
29
30
|
import { RollbackCard } from './RollbackCard.tsx'
|
|
@@ -78,12 +79,6 @@ export interface RecoveryPanelProps {
|
|
|
78
79
|
* 两个字典的键集不通用,因此显式分开传,不做类型强转。
|
|
79
80
|
*/
|
|
80
81
|
copyT?: TranslateNS<'config-manager'>
|
|
81
|
-
/**
|
|
82
|
-
* 磁盘体检卡的 ⓘ 可访问名(第 2 块「磁盘占用与清理」)。
|
|
83
|
-
* 与 copyT 同一条理由:DiskUsageCard 的文案走 **UiT** 字典,它的 ⓘ 可访问名却住在主字典里
|
|
84
|
-
* (`common.infoHint`),本面板手上只有 recovery 字典 —— 所以由调用方显式传。
|
|
85
|
-
*/
|
|
86
|
-
infoHintLabel?: string
|
|
87
82
|
/**
|
|
88
83
|
* 磁盘体检端口(第 2 块)。
|
|
89
84
|
* 直接传 ConfigManagerApi 而不是收窄成两个方法:DiskUsageCard 的 props 就是 `api`,
|
|
@@ -216,7 +211,7 @@ function incidentStateLabel(t: TranslateNS<'config-manager-recovery'>, state: st
|
|
|
216
211
|
}
|
|
217
212
|
|
|
218
213
|
export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
219
|
-
const { recoveryApi, incidentApi, t } = props
|
|
214
|
+
const { recoveryApi, incidentApi, t, diskApi } = props
|
|
220
215
|
const [state, setState] = useState<PanelState>(initFromStore)
|
|
221
216
|
const stateRef = useRef<PanelState>(state)
|
|
222
217
|
const mountedRef = useRef(true)
|
|
@@ -369,6 +364,12 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
369
364
|
(recovery) => { patch({ status: 'ready', recovery }) },
|
|
370
365
|
() => { /* 状态刷新失败静默 */ },
|
|
371
366
|
)
|
|
367
|
+
}).catch((err) => {
|
|
368
|
+
// verify 被拒(423 mutation-locked、409、404、500 或 5 分钟客户端超时)时也必须复位:
|
|
369
|
+
// 末级 then 没有 onRejected 会让 running 永久 true,execute/retry/dismiss 三入口全被早退锁死(审计 P8-2)。
|
|
370
|
+
patch({ running: false })
|
|
371
|
+
runStore.stopRunWatch('recovery')
|
|
372
|
+
toast.error(redactErrorText(err))
|
|
372
373
|
})
|
|
373
374
|
}
|
|
374
375
|
|
|
@@ -395,6 +396,11 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
395
396
|
(recovery) => { patch({ status: 'ready', recovery }) },
|
|
396
397
|
() => { /* 静默 */ },
|
|
397
398
|
)
|
|
399
|
+
}).catch((err) => {
|
|
400
|
+
// 同 execute:verify 被拒也要复位 running/watch(审计 P8-2)。
|
|
401
|
+
patch({ running: false })
|
|
402
|
+
runStore.stopRunWatch('recovery')
|
|
403
|
+
toast.error(redactErrorText(err))
|
|
398
404
|
})
|
|
399
405
|
}
|
|
400
406
|
|
|
@@ -476,6 +482,13 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
476
482
|
<SectionTitle
|
|
477
483
|
title={t('view.recovery')}
|
|
478
484
|
subtitle={needsAttention ? t('recovery.requiredHint') : undefined}
|
|
485
|
+
action={(
|
|
486
|
+
/* 静止面板看不出「磁盘/体检/回滚」是刚才的数据还是十分钟前的:恢复页没有轮询,
|
|
487
|
+
整页只有这一处重新拉取入口(此前只能切页或刷新浏览器)。 */
|
|
488
|
+
<Button size="sm" loading={state.status === 'loading'} onClick={load}>
|
|
489
|
+
<RefreshIcon size={12} />{' '}{t('recovery.refresh')}
|
|
490
|
+
</Button>
|
|
491
|
+
)}
|
|
479
492
|
/>
|
|
480
493
|
|
|
481
494
|
{/* 事故处置:崩溃归因(上次启动没起来)+ 救援模式(先让 DSH 起得来)。
|
|
@@ -514,17 +527,14 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
514
527
|
{state.status === 'loading' && <SkeletonList label={t('recovery.loading')} />}
|
|
515
528
|
|
|
516
529
|
{state.status === 'error' && (
|
|
517
|
-
<
|
|
518
|
-
{state.error ?? t('common.unknownError')}
|
|
519
|
-
<Button variant="primary" onClick={load}>{t('common.retry')}</Button>
|
|
520
|
-
</Banner>
|
|
530
|
+
<ErrorBanner error={state.error ?? t('common.unknownError')} onRetry={load} t={diskApi.t} />
|
|
521
531
|
)}
|
|
522
532
|
|
|
523
533
|
{/* issue #56:「保护开着但已无待处理事项」——这正是 423 与空面板同时出现的死结态。
|
|
524
534
|
必须给出**可执行**的解除入口,否则用户只能去磁盘上删 transactions/safe-mode。 */}
|
|
525
535
|
{state.status === 'ready' && view?.safeModeStuck === true && (
|
|
526
536
|
<Card className={css.card}>
|
|
527
|
-
<div className={css.groupLabel}
|
|
537
|
+
<div className={css.groupLabel} title={t('recovery.safeMode.detail')}>{t('recovery.safeMode.title')}</div>
|
|
528
538
|
<div className={css.actionRow}>
|
|
529
539
|
<Button variant="danger" disabled={safeModeBusy} loading={safeModeBusy} onClick={() => { setSafeModeConfirmOpen(true) }}>
|
|
530
540
|
{safeModeBusy ? t('recovery.safeMode.busy') : t('recovery.safeMode.action')}
|
|
@@ -537,7 +547,7 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
537
547
|
不是没有(t89),那时由上面的告警条解释。2026-11-04:原 92px 虚线空框改一行状态行 ——
|
|
538
548
|
它白占的高度把磁盘 / 体检 / 回滚整块推到首屏之外。 */}
|
|
539
549
|
{state.status === 'ready' && view?.recoveryRequired !== true && view?.incompleteCopiesNotice !== 'unreadable' && (
|
|
540
|
-
<div className={css.statusLine} role="status"><StatusDot kind="ok" /><span>{t('recovery.empty')}</span></div>
|
|
550
|
+
<div className={css.statusLine + ' ' + css.recoveryEmptyBar} role="status"><StatusDot kind="ok" /><span>{t('recovery.empty')}</span></div>
|
|
541
551
|
)}
|
|
542
552
|
|
|
543
553
|
{/* issue #31:残留配置锁(非 journal 事项)——纯锁残留时 incidents 恒为空,
|
|
@@ -659,9 +669,9 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
659
669
|
<>
|
|
660
670
|
<div className={css.statRow}>
|
|
661
671
|
<span className={css.groupLabel}>{t('recovery.preview.title')}</span>
|
|
662
|
-
{/*
|
|
663
|
-
|
|
664
|
-
<
|
|
672
|
+
{/* 「只读 / 零写入 / 确认后才执行」是不可逆边界,属于决策依据 ⇒ 常驻标题后缀,
|
|
673
|
+
不藏进悬停说明(2026-11-14 用户要求:能从标题读懂的信息不进悬停)。 */}
|
|
674
|
+
<span className={css.hint}>{t('recovery.preview.hint')}</span>
|
|
665
675
|
</div>
|
|
666
676
|
{previewView.snapshotVerdict !== null && (
|
|
667
677
|
<div className={css.kvRow}>
|
|
@@ -773,8 +783,7 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
773
783
|
{rescue !== null && (
|
|
774
784
|
<Card>
|
|
775
785
|
<div className={css.statRow}>
|
|
776
|
-
<strong>{t('recovery.rescue.title')}</strong>
|
|
777
|
-
<InfoHint text={t('recovery.rescue.desc')} label={t('common.infoHint')} />
|
|
786
|
+
<strong title={t('recovery.rescue.desc')}>{t('recovery.rescue.title')}</strong>
|
|
778
787
|
<Badge kind={rescue.active ? 'warn' : 'ok'}>
|
|
779
788
|
{rescue.active ? t('recovery.rescue.activeBadge') : t('recovery.rescue.inactive')}
|
|
780
789
|
</Badge>
|
|
@@ -796,7 +805,11 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
796
805
|
/>
|
|
797
806
|
)}
|
|
798
807
|
</div>
|
|
799
|
-
{/*
|
|
808
|
+
{/* 2026-11-14(稿 P-05):代价与适用场景常显一句 —— 这是**危险动作**的后果说明,
|
|
809
|
+
不是机制背景;把它挂成悬停说明等于让用户在按下「进入救援模式」前先悬停才能知道
|
|
810
|
+
「它会停用依赖校验」。完整改写范围仍在标题的悬停说明与确认弹窗里。 */}
|
|
811
|
+
<div className={css.hint}>{t('recovery.rescue.short')}</div>
|
|
812
|
+
{/* 机制与安全说明挂在标题行的悬停说明(2026-10-12 用户要求说明性文案不进正文):
|
|
800
813
|
危险动作按钮仍在标题行永远可达,折叠体只收「已开启时的生效状态与提示」这类明细。 */}
|
|
801
814
|
<Collapse open={rescueOpen} id={RESCUE_BODY_ID}>
|
|
802
815
|
{rescue.active && (
|
|
@@ -836,7 +849,7 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
836
849
|
{/* —— 诊断三块(缺省只展开磁盘占用;另两块缺省收起,摘要与开关留在标题行)——
|
|
837
850
|
磁盘占用与清理(m-disk-usage):三条硬边界一字不动(候选集只有可重建区 + 显式勾选的过期导出;snapshots/sync 永不在候选集;
|
|
838
851
|
界面数字由渲染行现算)—— 实现全在 DiskUsageCard 与 ui/disk-usage-view.ts 里。 */}
|
|
839
|
-
<DiskUsageCard api={props.diskApi}
|
|
852
|
+
<DiskUsageCard api={props.diskApi} />
|
|
840
853
|
|
|
841
854
|
{/* T5:会话体检(只读)—— 与「我的对话去哪了」是同一件事,故与事故恢复同屏(卡内缺省收起) */}
|
|
842
855
|
<SessionHealthCard recoveryApi={recoveryApi} t={t} copyT={props.copyT} diskApi={props.diskApi} />
|
|
@@ -845,7 +858,7 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
845
858
|
它要解决的正是同一件事(事故后把工作区与会话退回某个时刻),且时间线按会话分组,
|
|
846
859
|
与会话体检的分组口径一致;会话回退只 fork 子会话,原会话日志只读。
|
|
847
860
|
卡内缺省收起:这是维护页最长的一块(台账 + 预览),入口与摘要留在标题行。 */}
|
|
848
|
-
<RollbackCard recoveryApi={recoveryApi} t={t} />
|
|
861
|
+
<RollbackCard recoveryApi={recoveryApi} t={t} uiT={diskApi.t} />
|
|
849
862
|
|
|
850
863
|
{/* 执行恢复二次确认(破坏性操作) */}
|
|
851
864
|
<ConfirmDialog
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* 业务判定全在 \`src/ui/rollback-view.ts\`(框架无关、node 可测);本组件只做装配与交互状态。
|
|
16
16
|
* 禁止组件直接 fetch:一律走 \`RecoveryApi\`(\`RecoveryPort & Partial<RollbackPointPort>\`)。
|
|
17
17
|
*/
|
|
18
|
-
import { useEffect, useRef, useState } from 'react'
|
|
18
|
+
import { useEffect, useId, useRef, useState } from 'react'
|
|
19
|
+
import { liveUiT, type UiT } from '../../ui/i18n.ts'
|
|
19
20
|
import type { RecoveryPort } from '../../ui/types.ts'
|
|
20
21
|
import type { TranslateNS } from '../client-types.ts'
|
|
21
22
|
import {
|
|
@@ -56,10 +57,10 @@ import type {
|
|
|
56
57
|
RollbackRewindResult,
|
|
57
58
|
} from '../../ui/rollback-view.ts'
|
|
58
59
|
import { redact } from '../../security/redaction.ts'
|
|
59
|
-
import { Badge, Banner, Button, Card, Checkbox, Empty, IconButton, SectionTitle, Spinner } from '../common/ui.tsx'
|
|
60
|
-
import {
|
|
60
|
+
import { Badge, Banner, Button, Card, Checkbox, Empty, IconButton, SectionTitle, Spinner, Switch } from '../common/ui.tsx'
|
|
61
|
+
import { ErrorBanner } from '../common/ErrorBanner.tsx'
|
|
62
|
+
import { Select } from '../common/Select.tsx'
|
|
61
63
|
import { Icon } from '../common/Icon.tsx'
|
|
62
|
-
import { InfoHint } from '../common/InfoHint.tsx'
|
|
63
64
|
import { Modal } from '../common/Modal.tsx'
|
|
64
65
|
import { ConfirmDialog } from '../common/ConfirmDialog.tsx'
|
|
65
66
|
import { toast } from '../common/toast-store.ts'
|
|
@@ -68,7 +69,12 @@ import { resetChatPointCache } from '../chat/chat-entry-view.ts'
|
|
|
68
69
|
import { readRollbackPreviewFiles, readRollbackPreviewRemovals } from '../chat/rollback-entry-view.ts'
|
|
69
70
|
import { formatSessionBytes } from '../../ui/session-inventory-view.ts'
|
|
70
71
|
import { rollbackEntryVisible } from '../../ui/rollback-view.ts'
|
|
71
|
-
import {
|
|
72
|
+
import {
|
|
73
|
+
consumeRollbackLedgerOpen,
|
|
74
|
+
setRollbackEntryEnabled,
|
|
75
|
+
subscribeRollbackLedgerOpen,
|
|
76
|
+
} from './rollback-enabled.ts'
|
|
77
|
+
import { WRITE_KEY, useRecoveryWriteKey, withRecoveryWrite } from './use-recovery-write.ts'
|
|
72
78
|
import { RollbackDiffPane, type RollbackDiffState } from './RollbackDiffPane.tsx'
|
|
73
79
|
import { RollbackFileChanges, type RollbackFileViewEntry } from './RollbackFileChanges.tsx'
|
|
74
80
|
import css from '../config-manager.module.css'
|
|
@@ -77,6 +83,7 @@ export interface RollbackCardProps {
|
|
|
77
83
|
/** recovery 端口(rollback-points 方法为 Partial:宿主旧版可能没有这一族)。 */
|
|
78
84
|
recoveryApi: RecoveryPort & Partial<RollbackPointPort>
|
|
79
85
|
t: TranslateNS<'config-manager-recovery'>
|
|
86
|
+
uiT?: UiT
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
/** 宿主错误文本渲染前统一过 redact(AGENTS.md UI 硬性规则 7)。 */
|
|
@@ -99,7 +106,8 @@ function apiCodeOf(err: unknown): string | null {
|
|
|
99
106
|
return typeof code === 'string' && code !== '' ? code : null
|
|
100
107
|
}
|
|
101
108
|
|
|
102
|
-
export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
109
|
+
export function RollbackCard({ recoveryApi, t, uiT = liveUiT }: RollbackCardProps) {
|
|
110
|
+
const autoSwitchId = useId()
|
|
103
111
|
/** 动态字典键(机器码 / 段名拼出来的 key)在这里**集中收窄一次** —— 视图模型已保证未知码回落 unknown 键。 */
|
|
104
112
|
const dyn = (key: string): Parameters<typeof t>[0] => key as Parameters<typeof t>[0]
|
|
105
113
|
|
|
@@ -119,7 +127,8 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
119
127
|
const [error, setError] = useState<string | null>(null)
|
|
120
128
|
const [list, setList] = useState<RollbackListResult | null>(null)
|
|
121
129
|
const [actionError, setActionError] = useState<string | null>(null)
|
|
122
|
-
const
|
|
130
|
+
const writeKey = useRecoveryWriteKey()
|
|
131
|
+
const busy = writeKey === WRITE_KEY.rollbackRewind || writeKey === WRITE_KEY.rollbackDelete
|
|
123
132
|
const [target, setTarget] = useState<RollbackPointRowView | null>(null)
|
|
124
133
|
const [preview, setPreview] = useState<RollbackPreviewResult | null>(null)
|
|
125
134
|
const [previewLoading, setPreviewLoading] = useState(false)
|
|
@@ -140,7 +149,10 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
140
149
|
}, [])
|
|
141
150
|
|
|
142
151
|
/** 台账弹窗的开关(2026-10-12:本卡退出折叠,台账整块进弹窗,且只在打开时挂载) */
|
|
143
|
-
const [open, setOpen] = useState(
|
|
152
|
+
const [open, setOpen] = useState(() => consumeRollbackLedgerOpen())
|
|
153
|
+
useEffect(() => subscribeRollbackLedgerOpen(() => {
|
|
154
|
+
if (consumeRollbackLedgerOpen()) setOpen(true)
|
|
155
|
+
}), [])
|
|
144
156
|
/**
|
|
145
157
|
* 弹窗左侧选中的对话(键 = sessionId;缺 id 的记录归入 `__unknown__` 组)。
|
|
146
158
|
* 存**键**而不是对象:刷新后台账会换一批对象,键仍能对上;键失效时自动回落到第一条
|
|
@@ -155,11 +167,11 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
155
167
|
/** 「刷新」在途:**保留旧内容**,只把刷新按钮置为在途(见 load 的 keep 语义) */
|
|
156
168
|
const [refreshing, setRefreshing] = useState(false)
|
|
157
169
|
/** 开关(issue #88)在途:置灰防重复点击,但不改开关的显示值(值只在宿主确认后变) */
|
|
158
|
-
const
|
|
170
|
+
const prefsBusy = writeKey === WRITE_KEY.rollbackPrefs
|
|
159
171
|
/** 清理台账(issue #89):确认弹窗 / 勾选 / 结果文案 */
|
|
160
172
|
const [cleanupOpen, setCleanupOpen] = useState(false)
|
|
161
173
|
const [cleanupGuards, setCleanupGuards] = useState(false)
|
|
162
|
-
const
|
|
174
|
+
const cleanupBusy = writeKey === WRITE_KEY.rollbackPurge
|
|
163
175
|
const [cleanupNote, setCleanupNote] = useState<string | null>(null)
|
|
164
176
|
|
|
165
177
|
const fail = (err: unknown): void => {
|
|
@@ -262,11 +274,12 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
262
274
|
}
|
|
263
275
|
|
|
264
276
|
const rewind = (): void => {
|
|
265
|
-
|
|
277
|
+
const restoreFn = recoveryApi.restoreRollbackPoint
|
|
278
|
+
if (restoreFn === undefined || target === null || busy) return
|
|
279
|
+
const pointId = target.id
|
|
266
280
|
setConfirmOpen(false)
|
|
267
|
-
setBusy(true)
|
|
268
281
|
setActionError(null)
|
|
269
|
-
|
|
282
|
+
void withRecoveryWrite(WRITE_KEY.rollbackRewind, () => restoreFn.call(recoveryApi, pointId, {
|
|
270
283
|
// fail-closed:这里恒为 true(用户刚在 danger 弹窗里点过确认),API 侧不自动置真
|
|
271
284
|
userConfirmed: true,
|
|
272
285
|
mode,
|
|
@@ -274,30 +287,28 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
274
287
|
allowPartial,
|
|
275
288
|
// 全选(或清单为空)⇒ onlyPaths 为 null ⇒ 不传字段,走既有全量口径
|
|
276
289
|
...(onlyPaths === null ? {} : { onlyPaths }),
|
|
277
|
-
}).then(
|
|
290
|
+
})).then(
|
|
278
291
|
(res) => {
|
|
279
292
|
if (!mounted.current) return
|
|
280
|
-
setBusy(false)
|
|
281
293
|
setResult(res)
|
|
282
294
|
const outcome = rollbackOutcome(res.outcome)
|
|
283
295
|
if (outcome.badgeKind === 'ok') toast.ok(t(dyn(outcome.key)))
|
|
284
296
|
else toast.warn(t(dyn(outcome.key)))
|
|
285
297
|
load()
|
|
286
298
|
},
|
|
287
|
-
(err: unknown) => { if (mounted.current)
|
|
299
|
+
(err: unknown) => { if (mounted.current) fail(err) },
|
|
288
300
|
)
|
|
289
301
|
}
|
|
290
302
|
|
|
291
303
|
const remove = (): void => {
|
|
292
|
-
|
|
304
|
+
const removeFn = recoveryApi.removeRollbackPoint
|
|
305
|
+
if (removeFn === undefined || deleteTarget === null || busy) return
|
|
293
306
|
const id = deleteTarget.id
|
|
294
307
|
setDeleteTarget(null)
|
|
295
|
-
setBusy(true)
|
|
296
308
|
setActionError(null)
|
|
297
|
-
|
|
309
|
+
void withRecoveryWrite(WRITE_KEY.rollbackDelete, () => removeFn.call(recoveryApi, id, true)).then(
|
|
298
310
|
(res) => {
|
|
299
311
|
if (!mounted.current) return
|
|
300
|
-
setBusy(false)
|
|
301
312
|
if (res.ok) {
|
|
302
313
|
toast.ok(t('rollback.delete.done'))
|
|
303
314
|
// C7:删掉的点可能正是聊天入口缓存里那条 → 清掉,否则 30 s 内入口仍按旧列表判「可点」,
|
|
@@ -308,7 +319,7 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
308
319
|
}
|
|
309
320
|
setActionError(t(dyn(rollbackCodeKey(res.code))))
|
|
310
321
|
},
|
|
311
|
-
(err: unknown) => { if (mounted.current)
|
|
322
|
+
(err: unknown) => { if (mounted.current) fail(err) },
|
|
312
323
|
)
|
|
313
324
|
}
|
|
314
325
|
|
|
@@ -317,20 +328,19 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
317
328
|
* 显示值仍以宿主回传的磁盘真值为准(不是把我们传下去的那个值当真)。
|
|
318
329
|
*/
|
|
319
330
|
const togglePrefs = (next: boolean): void => {
|
|
320
|
-
|
|
321
|
-
|
|
331
|
+
const setEnabledFn = recoveryApi.setRollbackEnabled
|
|
332
|
+
if (typeof setEnabledFn !== 'function' || prefsBusy) return
|
|
322
333
|
setActionError(null)
|
|
323
|
-
|
|
334
|
+
void withRecoveryWrite(WRITE_KEY.rollbackPrefs, () => setEnabledFn.call(recoveryApi, next)).then(
|
|
324
335
|
(res) => {
|
|
325
336
|
if (!mounted.current) return
|
|
326
|
-
setPrefsBusy(false)
|
|
327
337
|
setList((prev) => (prev === null ? prev : {
|
|
328
338
|
...prev,
|
|
329
339
|
storage: { ...prev.storage, rollbackEnabled: res.rollbackEnabled, rollbackActive: res.rollbackActive },
|
|
330
340
|
}))
|
|
331
341
|
setRollbackEntryEnabled(res.rollbackEnabled === true)
|
|
332
342
|
},
|
|
333
|
-
(err: unknown) => { if (mounted.current)
|
|
343
|
+
(err: unknown) => { if (mounted.current) fail(err) },
|
|
334
344
|
)
|
|
335
345
|
}
|
|
336
346
|
|
|
@@ -340,13 +350,12 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
340
350
|
* 删了 0 个 = 「没有可删的」,不是失败:三态如实分派。
|
|
341
351
|
*/
|
|
342
352
|
const purge = (): void => {
|
|
343
|
-
|
|
344
|
-
|
|
353
|
+
const purgeFn = recoveryApi.purgeRollbackPoints
|
|
354
|
+
if (typeof purgeFn !== 'function' || cleanupBusy) return
|
|
345
355
|
setActionError(null)
|
|
346
|
-
|
|
356
|
+
void withRecoveryWrite(WRITE_KEY.rollbackPurge, () => purgeFn.call(recoveryApi, { includeGuards: cleanupGuards })).then(
|
|
347
357
|
(res) => {
|
|
348
358
|
if (!mounted.current) return
|
|
349
|
-
setCleanupBusy(false)
|
|
350
359
|
setCleanupOpen(false)
|
|
351
360
|
const removed = res.removedRecords ?? 0
|
|
352
361
|
setCleanupNote(removed === 0
|
|
@@ -356,7 +365,7 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
356
365
|
if (removed > 0) resetChatPointCache()
|
|
357
366
|
load({ keep: true })
|
|
358
367
|
},
|
|
359
|
-
(err: unknown) => { if (mounted.current) {
|
|
368
|
+
(err: unknown) => { if (mounted.current) { setCleanupOpen(false); fail(err) } },
|
|
360
369
|
)
|
|
361
370
|
}
|
|
362
371
|
|
|
@@ -423,24 +432,24 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
423
432
|
return (
|
|
424
433
|
<>
|
|
425
434
|
<Card>
|
|
426
|
-
{/* 卡头:标题 +
|
|
435
|
+
{/* 卡头:标题 + 悬停说明(说明性文案挂在标题的 title 上,不再另起一行副标题)。
|
|
427
436
|
2026-10-12 同一轮用户要求:本卡**退出折叠** —— 摘要与入口常驻可见,台账整块搬进弹窗。 */}
|
|
428
|
-
<SectionTitle title={t('rollback.title')}
|
|
437
|
+
<SectionTitle title={t('rollback.title')} tooltip={t('rollback.desc')} />
|
|
429
438
|
|
|
430
439
|
{!hasApi && <Banner kind="warn">{t('rollback.apiMissing')}</Banner>}
|
|
431
440
|
|
|
432
441
|
{/* issue #88:总开关。它**必须常驻可见** —— 关掉之后,用户还得有地方能把它打开。
|
|
433
442
|
关闭语义 = 不订阅会话事件、不写台账、聊天入口收起(文案逐条对应代码,不含糊)。 */}
|
|
434
443
|
{hasPrefsApi && (
|
|
435
|
-
<div className={css.actionRowTop}>
|
|
436
|
-
<
|
|
437
|
-
|
|
444
|
+
<div className={css.actionRowTop} title={t('rollback.switch.hint')}>
|
|
445
|
+
<Switch
|
|
446
|
+
id={autoSwitchId}
|
|
438
447
|
checked={prefsEnabled === true}
|
|
439
448
|
disabled={prefsBusy || busy || prefsEnabled === null}
|
|
440
449
|
onChange={togglePrefs}
|
|
441
450
|
label={t('rollback.switch.label')}
|
|
442
451
|
/>
|
|
443
|
-
<
|
|
452
|
+
<label className={css.toggleLabel} htmlFor={autoSwitchId}>{t('rollback.switch.label')}</label>
|
|
444
453
|
{/* 三态不再各占一行解释:提示做成开关**旁边**的状态徽章,分歧态再给一次点击就生效的动作。
|
|
445
454
|
「还没读到」= info 徽章(开关此时同时禁用);「磁盘开着但本进程没生效」= warn 徽章 + 立即生效。 */}
|
|
446
455
|
{hasPrefsApi && prefsEnabled === null && <Badge kind="info">{t('rollback.switch.reading')}</Badge>}
|
|
@@ -465,13 +474,21 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
465
474
|
</>
|
|
466
475
|
)}
|
|
467
476
|
|
|
468
|
-
{
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
477
|
+
{/* 加载态 = 就绪态的**同一行几何**(摘要文字 + 行尾两颗按钮)。
|
|
478
|
+
2026-11-14 用户反馈:旧骨架是三张 SkeletonList 卡(≈210px),就绪态只有一行工具栏
|
|
479
|
+
(≈26px)⇒ 卡片从 210 缩到 ~100,环境页整页往上跳。容器复用 .rollbackToolbar,
|
|
480
|
+
只有占位条尺寸是骨架自己的。 */}
|
|
481
|
+
{status === 'loading' && (
|
|
482
|
+
<div className={css.rollbackToolbar} role="status" aria-busy="true" aria-label={t('recovery.loading')}>
|
|
483
|
+
<span className={css.skeletonBar + ' ' + css.rollbackSkeletonSummary} />
|
|
484
|
+
<span className={css.statusSpacer} />
|
|
485
|
+
<span className={css.skeletonBar + ' ' + css.rollbackSkeletonButton} />
|
|
486
|
+
<span className={css.skeletonBar + ' ' + css.rollbackSkeletonButton} />
|
|
473
487
|
</div>
|
|
474
488
|
)}
|
|
489
|
+
{status === 'error' && (
|
|
490
|
+
<ErrorBanner error={error !== null ? error : t('rollback.apiMissing')} onRetry={() => { void load() }} t={uiT} />
|
|
491
|
+
)}
|
|
475
492
|
|
|
476
493
|
{status === 'ready' && (
|
|
477
494
|
<>
|
|
@@ -539,23 +556,56 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
539
556
|
closeLabel={t('common.close')}
|
|
540
557
|
trailing={(
|
|
541
558
|
<span className={css.shHeaderTrailing}>
|
|
542
|
-
{/* 留存/淘汰口径属机制说明 →
|
|
559
|
+
{/* 留存/淘汰口径属机制说明 → 挂在刷新按钮的 title 上(DESIGN.md §7「说明性文案分层」):屏上只留数字摘要,
|
|
543
560
|
20/50/救援点上限这些细节一个字不改,仍在同一条字典键里。 */}
|
|
544
|
-
<
|
|
545
|
-
|
|
561
|
+
<Button
|
|
562
|
+
size="sm"
|
|
563
|
+
variant="ghost"
|
|
564
|
+
disabled={busy || refreshing}
|
|
565
|
+
loading={refreshing}
|
|
566
|
+
onClick={() => { load({ keep: true }) }}
|
|
567
|
+
title={t('rollback.retention.hint', {
|
|
546
568
|
perSession: ROLLBACK_MAX_POINTS_PER_SESSION,
|
|
547
569
|
total: ROLLBACK_MAX_POINTS_TOTAL,
|
|
548
570
|
guardsPerSession: ROLLBACK_MAX_POINTS_GUARDS_PER_SESSION,
|
|
549
571
|
guards: ROLLBACK_MAX_POINTS_GUARDS_TOTAL,
|
|
550
572
|
})}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
573
|
+
>
|
|
574
|
+
{t('rollback.refresh')}
|
|
575
|
+
</Button>
|
|
554
576
|
</span>
|
|
555
577
|
)}
|
|
556
578
|
/>
|
|
557
579
|
<Modal.Body scroll>
|
|
558
|
-
{
|
|
580
|
+
{/* 加载态照抄台账几何(工具栏 + 锁高 340px 的左右分栏),数据到货时弹窗高度不变。 */}
|
|
581
|
+
{status === 'loading' && (
|
|
582
|
+
<div role="status" aria-busy="true" aria-label={t('recovery.loading')}>
|
|
583
|
+
<div className={css.rollbackToolbar}>
|
|
584
|
+
<span className={css.skeletonBar + ' ' + css.rollbackSkeletonSummary} />
|
|
585
|
+
<span className={css.statusSpacer} />
|
|
586
|
+
<span className={css.skeletonBar + ' ' + css.rollbackSkeletonButton} />
|
|
587
|
+
</div>
|
|
588
|
+
<div className={css.rollbackLedger} aria-hidden="true">
|
|
589
|
+
<div className={css.rollbackSessions}>
|
|
590
|
+
{[0, 1, 2].map((i) => (
|
|
591
|
+
<span key={i} className={css.skeletonBar + ' ' + css.rollbackSkeletonSession} />
|
|
592
|
+
))}
|
|
593
|
+
</div>
|
|
594
|
+
<div className={css.rollbackLedgerMain}>
|
|
595
|
+
<div className={css.rollbackGroup}>
|
|
596
|
+
<div className={css.rollbackGroupHead}>
|
|
597
|
+
<span className={css.skeletonBar + ' ' + css.historySkeletonSections} />
|
|
598
|
+
</div>
|
|
599
|
+
<div className={css.rollbackPointsScroll}>
|
|
600
|
+
{[0, 1, 2].map((i) => (
|
|
601
|
+
<span key={i} className={css.skeletonBar + ' ' + css.rollbackSkeletonPoint} />
|
|
602
|
+
))}
|
|
603
|
+
</div>
|
|
604
|
+
</div>
|
|
605
|
+
</div>
|
|
606
|
+
</div>
|
|
607
|
+
</div>
|
|
608
|
+
)}
|
|
559
609
|
{status === 'error' && (
|
|
560
610
|
<div className={css.actionRow}>
|
|
561
611
|
<Banner kind="error">{error !== null ? error : t('rollback.apiMissing')}</Banner>
|
|
@@ -689,12 +739,13 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
689
739
|
)}
|
|
690
740
|
|
|
691
741
|
{/* 预览 / 回退(同一弹窗:先只读预览 + 三选一范围,执行后就地显示逐段结果) */}
|
|
742
|
+
{/* 「只读 / 零写入」常驻标题右侧(原 ⓘ 的位置):这是「点了也不会改动磁盘」的唯一提示 */}
|
|
692
743
|
<Modal open={target !== null} onClose={closePreview} title={t('rollback.preview')} wide busy={busy}>
|
|
693
744
|
<Modal.Header
|
|
694
745
|
title={t('rollback.preview.title')}
|
|
695
746
|
onClose={closePreview}
|
|
696
747
|
closeLabel={t('common.close')}
|
|
697
|
-
trailing={<
|
|
748
|
+
trailing={<span className={css.hint}>{t('rollback.preview.hint')}</span>}
|
|
698
749
|
/>
|
|
699
750
|
<Modal.Body scroll>
|
|
700
751
|
{previewLoading && <Spinner label={t('rollback.preview.loading')} />}
|
|
@@ -744,7 +795,7 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
744
795
|
</span>
|
|
745
796
|
</span>
|
|
746
797
|
</div>
|
|
747
|
-
<div className={css.planScroll}>
|
|
798
|
+
<div className={`${css.planScroll} ${css.planScrollPadded}`}>
|
|
748
799
|
<RollbackFileChanges
|
|
749
800
|
files={previewFiles}
|
|
750
801
|
removals={previewRemovals}
|
|
@@ -774,21 +825,20 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
774
825
|
)}
|
|
775
826
|
|
|
776
827
|
{/* 三选一:范围(不可用的组合直接禁用,绝不发一个注定失败的请求) */}
|
|
777
|
-
<
|
|
828
|
+
<div className={css.field}>
|
|
778
829
|
<span className={css.fieldLabel}>{t('rollback.mode.label')}</span>
|
|
779
|
-
<
|
|
780
|
-
className={css.input}
|
|
830
|
+
<Select
|
|
781
831
|
value={mode}
|
|
782
832
|
disabled={busy}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
{ROLLBACK_MODES.map((option) => (
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
))}
|
|
790
|
-
|
|
791
|
-
</
|
|
833
|
+
ariaLabel={t('rollback.mode.label')}
|
|
834
|
+
onChange={(next) => { setMode(next as RollbackMode) }}
|
|
835
|
+
options={ROLLBACK_MODES.map((option) => ({
|
|
836
|
+
value: option,
|
|
837
|
+
label: t(dyn(rollbackModeKey(option))),
|
|
838
|
+
disabled: !rollbackModeAvailable(option, verdict.segments),
|
|
839
|
+
}))}
|
|
840
|
+
/>
|
|
841
|
+
</div>
|
|
792
842
|
|
|
793
843
|
{verdict.incomplete && (
|
|
794
844
|
<Checkbox checked={allowPartial} disabled={busy} onChange={setAllowPartial} label={t('rollback.rewind.allowPartial')} />
|
|
@@ -798,14 +848,6 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
798
848
|
{!verdict.canRestore && verdict.reasonKey !== null && (
|
|
799
849
|
<div className={css.warnText}>{t(dyn(verdict.reasonKey))}</div>
|
|
800
850
|
)}
|
|
801
|
-
|
|
802
|
-
{/* 动作顺序与 MergeModal 同口径(DESIGN §9):**取消在左、主操作在右**。
|
|
803
|
-
以前危险操作在左、取消在右 —— 两个弹窗的「取消」位置相反,用户会点错。 */}
|
|
804
|
-
<div className={css.actionRow}>
|
|
805
|
-
<Button disabled={busy} onClick={closePreview}>{t('common.cancel')}</Button>
|
|
806
|
-
<span className={css.statusSpacer} />
|
|
807
|
-
<Button variant="danger" disabled={busy || !canRewind || selectionBlocked} loading={busy} onClick={() => { setConfirmOpen(true) }}>{t('rollback.rewind')}</Button>
|
|
808
|
-
</div>
|
|
809
851
|
</>
|
|
810
852
|
)}
|
|
811
853
|
|
|
@@ -876,13 +918,28 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
876
918
|
{rollbackGuidanceRows(result.guidance).map((row) => (
|
|
877
919
|
<div key={row.key + (row.detail ?? '')} className={css.hint}>{t(dyn(row.key))}{row.detail !== null ? ' — ' + row.detail : ''}</div>
|
|
878
920
|
))}
|
|
879
|
-
{actionError !== null && <
|
|
880
|
-
<div className={css.actionRow}>
|
|
881
|
-
<Button onClick={closePreview}>{t('common.close')}</Button>
|
|
882
|
-
</div>
|
|
921
|
+
{actionError !== null && <ErrorBanner error={actionError} t={uiT} />}
|
|
883
922
|
</>
|
|
884
923
|
)}
|
|
885
924
|
</Modal.Body>
|
|
925
|
+
<Modal.Footer>
|
|
926
|
+
{result === null && (
|
|
927
|
+
<>
|
|
928
|
+
<Button disabled={busy} onClick={closePreview}>{t('common.cancel')}</Button>
|
|
929
|
+
{preview !== null && (
|
|
930
|
+
<>
|
|
931
|
+
<span className={css.statusSpacer} />
|
|
932
|
+
<Button variant="danger" disabled={busy || !canRewind || selectionBlocked} loading={busy} onClick={() => { setConfirmOpen(true) }}>
|
|
933
|
+
{t('rollback.rewind')}
|
|
934
|
+
</Button>
|
|
935
|
+
</>
|
|
936
|
+
)}
|
|
937
|
+
</>
|
|
938
|
+
)}
|
|
939
|
+
{result !== null && (
|
|
940
|
+
<Button onClick={closePreview}>{t('common.close')}</Button>
|
|
941
|
+
)}
|
|
942
|
+
</Modal.Footer>
|
|
886
943
|
</Modal>
|
|
887
944
|
|
|
888
945
|
{/* 回退二次确认(破坏性:覆盖工作区记录在案的路径 + fork 子会话;原会话日志不改写) */}
|