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
|
@@ -108,6 +108,10 @@ export function RollbackFileChanges({ files, removals, rt, view, renderFileIcon,
|
|
|
108
108
|
// 勾选与归属都用集合查(清单可达几百条,逐条 includes 是 O(n²))
|
|
109
109
|
const selectedSet = selection === undefined ? null : new Set(selection.selected)
|
|
110
110
|
const foreignSet = selection === undefined ? null : new Set(selection.foreign)
|
|
111
|
+
/** 给了 selection 的行多出「勾选」这一格 ⇒ 版式从三列变四列(见 CSS 的 .rollbackFileRowSelectable)。
|
|
112
|
+
* 两种行必须都用这个类:改动行有勾选框,删除行**没有**(删除集不在可勾选范围内,它没有
|
|
113
|
+
* 「看差异」也不该有「这次别动它」——勾了也没处生效),但要占同一格,否则图标左右错位。 */
|
|
114
|
+
const selectable = selection !== undefined && selectedSet !== null
|
|
111
115
|
return (
|
|
112
116
|
<div className={css.rollbackFileList} role="list">
|
|
113
117
|
{files.map((file, index) => {
|
|
@@ -122,7 +126,7 @@ export function RollbackFileChanges({ files, removals, rt, view, renderFileIcon,
|
|
|
122
126
|
return (
|
|
123
127
|
<div
|
|
124
128
|
key={rollbackPreviewFileKey(file.path, file.added, file.removed, index)}
|
|
125
|
-
className={css.rollbackFileRow}
|
|
129
|
+
className={selectable ? `${css.rollbackFileRow} ${css.rollbackFileRowSelectable}` : css.rollbackFileRow}
|
|
126
130
|
role="listitem"
|
|
127
131
|
data-kind={previewFileStatusKnown(file.status) ? file.status : undefined}
|
|
128
132
|
>
|
|
@@ -142,28 +146,32 @@ export function RollbackFileChanges({ files, removals, rt, view, renderFileIcon,
|
|
|
142
146
|
<span className={css.rollbackFileIcon} aria-hidden="true">
|
|
143
147
|
<RollbackFileIcon path={file.path} size={14} render={renderFileIcon} />
|
|
144
148
|
</span>
|
|
145
|
-
{/*
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
149
|
+
{/* 路径格 = 主标签(目录弱化 + 基名主色)+ 归属提示,**合成一格**:两者原先是并列的
|
|
150
|
+
grid 子项,多出来的那一项会把统计列挤到隐式第二行(2026-11-14 用户截图:±行数掉到
|
|
151
|
+
勾选框下面、清单读不成四列)。给了 `view` 时主标签**本身就是那颗按钮**
|
|
152
|
+
(2026-10-12 用户要求:不要尾部的独立「查看」按钮,点文件名直接跳);
|
|
153
|
+
为什么按钮不是整行:整行做热区会把右侧 `+N −M` 也变成可点区域。
|
|
154
|
+
完整路径仍在 title 里。 */}
|
|
155
|
+
<span className={css.rollbackFilePathCell}>
|
|
156
|
+
{view === undefined ? (
|
|
157
|
+
<span className={`${css.rollbackFilePath} ${css.mono}`} title={file.path}>{label}</span>
|
|
158
|
+
) : (
|
|
159
|
+
<button
|
|
160
|
+
type="button"
|
|
161
|
+
className={`${css.rollbackFilePath} ${css.mono}`}
|
|
162
|
+
title={file.path}
|
|
163
|
+
aria-label={view.hint(file.path)}
|
|
164
|
+
disabled={view.disabled}
|
|
165
|
+
onClick={() => { view.onView(file.path) }}
|
|
166
|
+
>
|
|
167
|
+
{label}
|
|
168
|
+
</button>
|
|
169
|
+
)}
|
|
170
|
+
{/* 归属提示(B):这一行在留点之后是**别的对话**写的 —— 默认没勾它,勾上就会覆盖对方的改动。 */}
|
|
171
|
+
{selection !== undefined && foreignSet !== null && foreignSet.has(file.path) && (
|
|
172
|
+
<span className={css.hint} data-foreign="true">{selection.foreignLabel}</span>
|
|
173
|
+
)}
|
|
174
|
+
</span>
|
|
167
175
|
{/* ±行数紧跟文件名(统计列右对齐、列宽固定):三种取值的右缘对齐成一条竖线。 */}
|
|
168
176
|
<span className={css.rollbackFileStat}>
|
|
169
177
|
<FileStat
|
|
@@ -184,17 +192,22 @@ export function RollbackFileChanges({ files, removals, rt, view, renderFileIcon,
|
|
|
184
192
|
return (
|
|
185
193
|
<div
|
|
186
194
|
key={'remove:' + rollbackPreviewFileKey(path, null, null, index)}
|
|
187
|
-
className={css.rollbackFileRow}
|
|
195
|
+
className={selectable ? `${css.rollbackFileRow} ${css.rollbackFileRowSelectable}` : css.rollbackFileRow}
|
|
188
196
|
role="listitem"
|
|
189
197
|
data-kind="delete"
|
|
190
198
|
>
|
|
199
|
+
{/* 勾选格的**占位**(删除行不可勾:它不在可勾选集合里,见 rollbackSelectionRows)——
|
|
200
|
+
不占这一格,图标就会落到第一列,与上面的改动行左右错开一格。 */}
|
|
201
|
+
{selectable && <span className={css.rollbackFileToggleSlot} aria-hidden="true" />}
|
|
191
202
|
<span className={css.rollbackFileIcon} aria-hidden="true">
|
|
192
203
|
<RollbackFileIcon path={path} size={14} render={renderFileIcon} />
|
|
193
204
|
</span>
|
|
194
205
|
{/* 删除行**不是按钮**(纯文本):见文件头「诚实边界」第 1 条。 */}
|
|
195
|
-
<span className={
|
|
196
|
-
|
|
197
|
-
|
|
206
|
+
<span className={css.rollbackFilePathCell}>
|
|
207
|
+
<span className={`${css.rollbackFilePath} ${css.mono}`} title={path}>
|
|
208
|
+
{dir !== '' && <span className={css.rollbackFileDir}>{dir}</span>}
|
|
209
|
+
{base || rollbackPreviewFileLabel(path)}
|
|
210
|
+
</span>
|
|
198
211
|
</span>
|
|
199
212
|
<span className={css.rollbackFileStat}>
|
|
200
213
|
<span className={css.rollbackDeleted}>{rt(rk('rollback.preview.file.deleted'))}</span>
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import { useEffect, useRef, useState } from 'react'
|
|
10
10
|
import type { TranslateNS } from '../client-types.ts'
|
|
11
11
|
import { Badge, Button, Card } from '../common/ui.tsx'
|
|
12
|
-
import { InfoHint } from '../common/InfoHint.tsx'
|
|
13
12
|
import { sessionHealthSummaryView, sessionRepairEntries, type SessionHealthResponse } from '../../ui/session-inventory-view.ts'
|
|
14
13
|
import type { SessionExportProbe } from '../session-export/session-export-view.ts'
|
|
15
14
|
import type { LayoutRecoveryApi } from './recovery-api.ts'
|
|
@@ -92,7 +91,8 @@ export function SessionHealthCard({ recoveryApi, t, copyT, diskApi }: SessionHea
|
|
|
92
91
|
<strong>{t('sessions.title')}</strong>
|
|
93
92
|
{/* 徽章语义:扫描只读;修复是显式动作(预览 → 确认 → 自动备份 → 可回滚) */}
|
|
94
93
|
<Badge kind="info">{t('sessions.readOnly')}</Badge>
|
|
95
|
-
|
|
94
|
+
{/* 2026-11-14:原来这里还挂一颗 ⓘ 复述「扫什么 / 四档 / 能修哪两类」——
|
|
95
|
+
与体检弹窗标题行那颗同键同文,卡片只留入口不需要再讲一遍机制。 */}
|
|
96
96
|
<span className={css.statusSpacer} />
|
|
97
97
|
</div>
|
|
98
98
|
{/* T10:结果全部搬进独立弹窗 —— 卡片只留入口与一行摘要,绝不把上千行塞进设置页。
|
|
@@ -13,7 +13,6 @@ import { Badge, Banner, Button, Empty, IconButton, Spinner, StatusDot } from '..
|
|
|
13
13
|
import { Modal } from '../common/Modal.tsx'
|
|
14
14
|
import { Icon } from '../common/Icon.tsx'
|
|
15
15
|
import { CopyButton } from '../common/CopyButton.tsx'
|
|
16
|
-
import { InfoHint } from '../common/InfoHint.tsx'
|
|
17
16
|
import { SkeletonTable } from '../common/Skeleton.tsx'
|
|
18
17
|
import { ConfirmDialog } from '../common/ConfirmDialog.tsx'
|
|
19
18
|
import { toast } from '../common/toast-store.ts'
|
|
@@ -303,8 +302,7 @@ export function SessionHealthDialog(props: SessionHealthDialogProps) {
|
|
|
303
302
|
closeLabel={t('common.close')}
|
|
304
303
|
trailing={(
|
|
305
304
|
<span className={css.shHeaderTrailing}>
|
|
306
|
-
{/* 机制说明(扫什么 / 四档严重级 / 哪些能在应用内修)——
|
|
307
|
-
<InfoHint text={t('sessions.desc')} label={t('common.infoHint')} />
|
|
305
|
+
{/* 机制说明(扫什么 / 四档严重级 / 哪些能在应用内修)—— 与入口卡片同一条键,挂在这颗扫描按钮的 title 上 */}
|
|
308
306
|
{/* 主操作搬进标题行:旧实现是正文左上角孤零零一颗按钮(要先滚过摘要才找得到) */}
|
|
309
307
|
<Button
|
|
310
308
|
size="sm"
|
|
@@ -312,6 +310,7 @@ export function SessionHealthDialog(props: SessionHealthDialogProps) {
|
|
|
312
310
|
loading={loading}
|
|
313
311
|
disabled={loading}
|
|
314
312
|
onClick={onScan}
|
|
313
|
+
title={t('sessions.desc')}
|
|
315
314
|
>
|
|
316
315
|
{loading ? t('sessions.scanning') : response === null ? t('sessions.scan') : t('sessions.rescan')}
|
|
317
316
|
</Button>
|
|
@@ -383,11 +382,10 @@ export function SessionHealthDialog(props: SessionHealthDialogProps) {
|
|
|
383
382
|
|
|
384
383
|
{/* ② 需要处理的会话:列表与「一键修复全部」同屏,动作恒在区块头右侧 */}
|
|
385
384
|
<div className={css.shSectionHead}>
|
|
386
|
-
{/* 操作说明属说明性文案 →
|
|
385
|
+
{/* 操作说明属说明性文案 → 完整句进悬停 title(DESIGN §7);「可应用内修复 N 条」这种
|
|
387
386
|
计数句已删(右上按钮本身就带同一个计数)。 */}
|
|
388
|
-
<span className={css.shSectionTitle}>
|
|
387
|
+
<span className={css.shSectionTitle} title={summary.repairable > 0 ? t('sessions.repair.available', { count: String(summary.repairable) }) : t('sessions.repair.none')}>
|
|
389
388
|
{t('sessions.section.attention')}
|
|
390
|
-
<InfoHint text={summary.repairable > 0 ? t('sessions.repair.available', { count: String(summary.repairable) }) : t('sessions.repair.none')} label={t('common.infoHint')} />
|
|
391
389
|
</span>
|
|
392
390
|
<Badge kind={rows.length > 0 ? 'warn' : 'ok'}>{String(rows.length)}</Badge>
|
|
393
391
|
{summary.repairable > 0 && (
|
|
@@ -590,7 +588,7 @@ export function SessionHealthDialog(props: SessionHealthDialogProps) {
|
|
|
590
588
|
|
|
591
589
|
{/* 应用内不动的问题类别:离线出路(命令逐条可复制) */}
|
|
592
590
|
<div className={css.shSectionHead}>
|
|
593
|
-
<span className={css.shSectionTitle}
|
|
591
|
+
<span className={css.shSectionTitle} title={t('sessions.repair.desc')}>{t('sessions.repair.title')}</span>
|
|
594
592
|
</div>
|
|
595
593
|
<ul className={css.shCommands}>
|
|
596
594
|
{sessionRepairCommands().map((entry) => (
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import { useState } from 'react'
|
|
10
10
|
import type { TranslateNS } from '../client-types.ts'
|
|
11
11
|
import { Badge, Banner, Button, StatusDot } from '../common/ui.tsx'
|
|
12
|
-
import { InfoHint } from '../common/InfoHint.tsx'
|
|
13
12
|
import {
|
|
14
13
|
sessionLayoutApplyItems,
|
|
15
14
|
sessionLayoutCandidates,
|
|
@@ -136,14 +135,13 @@ export function SessionLayoutSection({ recoveryApi, t, response, onScan }: Sessi
|
|
|
136
135
|
if (sectionState === 'hidden') return null
|
|
137
136
|
|
|
138
137
|
// 本档是否真的有可执行的动作:空档时机制散文与运行时告警整段不渲染(DESIGN.md §7 文案分层),
|
|
139
|
-
//
|
|
138
|
+
// 说明走悬停 title;安全口径(运行时写入门 / 隔离目录不删会话)只在真会写盘时常驻。
|
|
140
139
|
const actionable = sectionState !== 'empty'
|
|
141
140
|
|
|
142
141
|
return (
|
|
143
142
|
<div className={css.card}>
|
|
144
143
|
<div className={css.shSectionHead}>
|
|
145
|
-
<span className={css.groupLabel}>{t('sessions.layout.title')}</span>
|
|
146
|
-
<InfoHint text={t('sessions.layout.desc')} label={t('common.infoHint')} />
|
|
144
|
+
<span className={css.groupLabel} title={t('sessions.layout.desc')}>{t('sessions.layout.title')}</span>
|
|
147
145
|
</div>
|
|
148
146
|
{/* 与离线 CLI 的差异(它要求先停 DSH):真会写盘时才占据屏幕(安全告警类,必须可见) */}
|
|
149
147
|
{actionable && <Banner kind="warn">{t('sessions.layout.runtimeNote')}</Banner>}
|
|
@@ -178,7 +176,7 @@ export function SessionLayoutSection({ recoveryApi, t, response, onScan }: Sessi
|
|
|
178
176
|
<div className={css.shPanel}>
|
|
179
177
|
<div className={css.shPanelHead}>
|
|
180
178
|
<span className={css.shPanelTitle}>{t('sessions.layout.planTitle')}</span>
|
|
181
|
-
<
|
|
179
|
+
<span className={css.hint}>{t('sessions.layout.planReadOnly')}</span>
|
|
182
180
|
</div>
|
|
183
181
|
<div className={css.statRow}>
|
|
184
182
|
<Badge kind="info">{t('sessions.layout.summary', { move: String(plan.summary.move), quarantine: String(plan.summary.quarantine) })}</Badge>
|
|
@@ -79,7 +79,7 @@ export const zh = {
|
|
|
79
79
|
'recovery.environment.incompatible': '环境不匹配(可能来自其他机器/安装)',
|
|
80
80
|
// 预览
|
|
81
81
|
'recovery.preview.title': '恢复预览',
|
|
82
|
-
'recovery.preview.hint': '
|
|
82
|
+
'recovery.preview.hint': '只读预览 · 零写入 · 确认后才执行恢复',
|
|
83
83
|
'recovery.preview.loading': '正在生成预览…',
|
|
84
84
|
// 确认
|
|
85
85
|
'recovery.confirm.title': '确认恢复',
|
|
@@ -130,6 +130,8 @@ export const zh = {
|
|
|
130
130
|
'recovery.crash.advice.check-patch-tree': '进入救援模式后逐个禁用插件排查',
|
|
131
131
|
'recovery.rescue.title': '救援模式',
|
|
132
132
|
'recovery.rescue.desc': 'DSH 因插件起不来时,把插件挂载收窄到「DSH 核心 + 本插件」:改写两层 cordis.patch.yml,并把 dsh.profile.bundles 里的其它用户插件临时移出。不卸载任何包,退出时从备份完整还原。',
|
|
133
|
+
'recovery.rescue.short': '停用依赖校验,仅在插件自身无法启动时使用',
|
|
134
|
+
'recovery.refresh': '刷新',
|
|
133
135
|
'recovery.rescue.inactive': '救援模式未开启',
|
|
134
136
|
'recovery.rescue.activeBadge': '已开启',
|
|
135
137
|
'recovery.rescue.active': '救援模式已开启({time})—— 请重启 DSH 使其生效。',
|
|
@@ -291,7 +293,7 @@ export const zh = {
|
|
|
291
293
|
'rollback.title': '工作区 + 会话回滚',
|
|
292
294
|
'rollback.desc': '每个回合结束自动留一个回滚点:工作区快照 + 会话游标,不需要手动拍点。回退只覆盖该点记录在案的工作区路径,并删除「能证明是留点之后新建」且通过安全判据的路径(.git / node_modules / 插件数据区 / 超出单文件上限一律拒删;留点时被预算挡下的既有文件也在证明名单里,不会被当成新建;证明名单本身不完整时一条都不删);会话回退在目标回合之前的稳定边界 fork 一个新子会话,原会话日志只读、绝不被改写。',
|
|
293
295
|
'rollback.list.empty': '还没有回滚点',
|
|
294
|
-
/* 2026-10-11 布局重构:工具栏只放数字摘要 + 刷新按钮;留存/淘汰口径仍在 rollback.retention.hint
|
|
296
|
+
/* 2026-10-11 布局重构:工具栏只放数字摘要 + 刷新按钮;留存/淘汰口径仍在 rollback.retention.hint(2026-11-14 起挂在该按钮的悬停 title 上)。 */
|
|
295
297
|
'rollback.summary': '共 {points} 个回滚点 · {sessions} 个会话',
|
|
296
298
|
'rollback.refresh': '刷新',
|
|
297
299
|
// 台账弹窗(2026-10-12:卡不再折叠,台账整块搬进按会话分组的弹窗)
|
|
@@ -403,7 +405,7 @@ export const zh = {
|
|
|
403
405
|
/* 2026-10-10 用户第三条:预览对话框改简洁版,标题就叫「回退预览」(不再带副标题)。
|
|
404
406
|
这个键只被两处预览界面使用(聊天入口的预览对话框 + 设置页回滚卡的预览弹窗),改的是同一句话。 */
|
|
405
407
|
'rollback.preview.title': '回退预览',
|
|
406
|
-
'rollback.preview.hint': '
|
|
408
|
+
'rollback.preview.hint': '只读预览 · 零写入 · 确认后才执行回退',
|
|
407
409
|
'rollback.preview.loading': '正在生成预览…',
|
|
408
410
|
'rollback.preview.empty': '该回滚点没有可回退的内容。',
|
|
409
411
|
'rollback.preview.none': '该点没有可回退的内容',
|
|
@@ -552,7 +554,7 @@ export const zh = {
|
|
|
552
554
|
'sessions.layout.planEmpty': '计划里没有需要执行的动作。',
|
|
553
555
|
'sessions.layout.apiMissing': '当前接口不支持布局归位(缺少 layoutRepairSessions);请更新插件后重试 —— 本机未做任何改动。',
|
|
554
556
|
'sessions.layout.planTitle': '布局归位计划(只读,尚未改动任何文件)',
|
|
555
|
-
'sessions.layout.planReadOnly': '
|
|
557
|
+
'sessions.layout.planReadOnly': '只读预览 · 零写入',
|
|
556
558
|
// 空态:入口在扫过之后始终可见,本机没有这一档时必须自己说明白(否则用户以为功能不存在)
|
|
557
559
|
'sessions.layout.noCandidates': '本机没有需要归位或隔离的会话。',
|
|
558
560
|
'sessions.layout.summary': '归位 {move} · 隔离 {quarantine}',
|
|
@@ -659,7 +661,7 @@ export const en: Record<keyof typeof zh, string> = {
|
|
|
659
661
|
'recovery.environment.compatible': 'Environment matches',
|
|
660
662
|
'recovery.environment.incompatible': 'Environment mismatch (may be from another machine / install)',
|
|
661
663
|
'recovery.preview.title': 'Recovery preview',
|
|
662
|
-
'recovery.preview.hint': 'Read-only preview
|
|
664
|
+
'recovery.preview.hint': 'Read-only preview · zero writes · recovery runs after you confirm',
|
|
663
665
|
'recovery.preview.loading': 'Generating preview…',
|
|
664
666
|
'recovery.confirm.title': 'Confirm recovery',
|
|
665
667
|
'recovery.confirm.message': 'Recovery / rollback is a dangerous operation. Confirm execution? Current files are backed up to a safe location first.',
|
|
@@ -703,6 +705,8 @@ export const en: Record<keyof typeof zh, string> = {
|
|
|
703
705
|
'recovery.crash.advice.check-patch-tree': 'Enter rescue mode, then bisect by disabling plugins',
|
|
704
706
|
'recovery.rescue.title': 'Rescue mode',
|
|
705
707
|
'recovery.rescue.desc': 'When DSH will not boot because of plugins, this narrows plugin mounting to DSH core + this plugin: it rewrites both cordis.patch.yml layers and moves every other user plugin out of dsh.profile.bundles. No package is uninstalled, and exiting restores everything from backup.',
|
|
708
|
+
'recovery.rescue.short': 'Skips dependency validation — use only when the plugin itself cannot start',
|
|
709
|
+
'recovery.refresh': 'Refresh',
|
|
706
710
|
'recovery.rescue.inactive': 'Rescue mode off',
|
|
707
711
|
'recovery.rescue.activeBadge': 'ON',
|
|
708
712
|
'recovery.rescue.active': 'Rescue mode is ON ({time}) — restart DSH to apply.',
|
|
@@ -862,7 +866,7 @@ export const en: Record<keyof typeof zh, string> = {
|
|
|
862
866
|
'rollback.desc': 'A rollback point is kept automatically at the end of every turn: a workspace snapshot plus the session cursor -- there is no manual capture form. A rewind only overwrites the workspace paths that point recorded, and deletes the paths proven to have been created after that point which pass the safety rules (.git / node_modules / the plugin data directory / oversized files are always refused; files that already existed but were passed over by the budget are in the proof list too, so they are never mistaken for new ones; nothing is removed while the proof list itself is incomplete). Session rollback forks a new child session at the stable boundary before the target turn, and the original session log stays read-only and is never rewritten.',
|
|
863
867
|
'rollback.list.empty': 'No rollback points yet',
|
|
864
868
|
/* 2026-10-11 layout refactor: the toolbar keeps only the numeric summary + refresh;
|
|
865
|
-
retention/pruning wording stays in rollback.retention.hint (now
|
|
869
|
+
retention/pruning wording stays in rollback.retention.hint (now on the button's hover title). */
|
|
866
870
|
'rollback.summary': '{points} rollback points · {sessions} sessions',
|
|
867
871
|
'rollback.refresh': 'Refresh',
|
|
868
872
|
// Rollback-point ledger dialog (2026-10-12: the card no longer folds; the ledger lives in this dialog, grouped by session)
|
|
@@ -968,7 +972,7 @@ export const en: Record<keyof typeof zh, string> = {
|
|
|
968
972
|
'rollback.warn.unknown': 'Unrecognized warning (technical detail below)',
|
|
969
973
|
'rollback.preview': 'Preview rewind',
|
|
970
974
|
'rollback.preview.title': 'Rewind preview',
|
|
971
|
-
'rollback.preview.hint': 'Read-only preview
|
|
975
|
+
'rollback.preview.hint': 'Read-only preview · zero writes · the rewind runs after you confirm',
|
|
972
976
|
'rollback.preview.loading': 'Generating preview…',
|
|
973
977
|
'rollback.preview.empty': 'This rollback point has nothing to restore.',
|
|
974
978
|
'rollback.preview.none': 'This point has nothing to restore',
|
|
@@ -1093,7 +1097,7 @@ export const en: Record<keyof typeof zh, string> = {
|
|
|
1093
1097
|
'sessions.layout.planEmpty': 'The plan has no action to run.',
|
|
1094
1098
|
'sessions.layout.apiMissing': 'This client does not support layout repair (layoutRepairSessions is missing); update the plugin and retry -- nothing was changed on this machine.',
|
|
1095
1099
|
'sessions.layout.planTitle': 'Layout repair plan (read-only, nothing changed yet)',
|
|
1096
|
-
'sessions.layout.planReadOnly': '
|
|
1100
|
+
'sessions.layout.planReadOnly': 'Read-only preview · zero writes',
|
|
1097
1101
|
'sessions.layout.noCandidates': 'No sessions need relocating or quarantining on this machine.',
|
|
1098
1102
|
'sessions.layout.summary': 'Relocate {move} · quarantine {quarantine}',
|
|
1099
1103
|
'sessions.layout.planSkipped': '{count} report-only',
|
|
@@ -39,3 +39,32 @@ export function subscribeRollbackEntryEnabled(listener: () => void): () => void
|
|
|
39
39
|
listeners.delete(listener)
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
/* ---------------- 从 ⌘K 直达回滚台账弹窗(一次性内存信号) ---------------- */
|
|
44
|
+
|
|
45
|
+
let pendingLedgerOpen = false
|
|
46
|
+
const ledgerListeners = new Set<() => void>()
|
|
47
|
+
|
|
48
|
+
export function requestRollbackLedgerOpen(): void {
|
|
49
|
+
pendingLedgerOpen = true
|
|
50
|
+
for (const listener of [...ledgerListeners]) {
|
|
51
|
+
try {
|
|
52
|
+
listener()
|
|
53
|
+
} catch {
|
|
54
|
+
/* 单个订阅者自己的问题不影响信号 */
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function consumeRollbackLedgerOpen(): boolean {
|
|
60
|
+
if (!pendingLedgerOpen) return false
|
|
61
|
+
pendingLedgerOpen = false
|
|
62
|
+
return true
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function subscribeRollbackLedgerOpen(listener: () => void): () => void {
|
|
66
|
+
ledgerListeners.add(listener)
|
|
67
|
+
return () => {
|
|
68
|
+
ledgerListeners.delete(listener)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -23,6 +23,11 @@ export const WRITE_KEY = {
|
|
|
23
23
|
lockRecover: 'lock-recover',
|
|
24
24
|
rescueOn: 'rescue:on',
|
|
25
25
|
rescueOff: 'rescue:off',
|
|
26
|
+
diskCleanup: 'disk-cleanup',
|
|
27
|
+
rollbackRewind: 'rollback:rewind',
|
|
28
|
+
rollbackDelete: 'rollback:delete',
|
|
29
|
+
rollbackPrefs: 'rollback:prefs',
|
|
30
|
+
rollbackPurge: 'rollback:purge',
|
|
26
31
|
} as const
|
|
27
32
|
|
|
28
33
|
/** 选择器必须是模块级常量(引用稳定,subscribe 才能跳过无变化的重渲染)。 */
|
|
@@ -667,6 +667,36 @@ test('m3-poll: 同一 kind 重复 watchRunning 不重复启动', async () => {
|
|
|
667
667
|
assert.equal(runsCalls, calls, 'stop 后无遗留轮询')
|
|
668
668
|
})
|
|
669
669
|
|
|
670
|
+
test('m3-poll: stop→start 不留孤儿发现链(审计 P8-1)', async () => {
|
|
671
|
+
let runsCalls = 0
|
|
672
|
+
const api = makeApi({
|
|
673
|
+
runs: async () => {
|
|
674
|
+
runsCalls += 1
|
|
675
|
+
return []
|
|
676
|
+
},
|
|
677
|
+
})
|
|
678
|
+
const store = new RunStore({ storage: null, pollIntervalMs: 5 })
|
|
679
|
+
store.exportFlow(api)
|
|
680
|
+
// 基线:一条链在 60ms 内的请求数
|
|
681
|
+
store.watchRunning('export', 5)
|
|
682
|
+
await sleep(60)
|
|
683
|
+
const oneChain = runsCalls
|
|
684
|
+
assert.ok(oneChain >= 3, `基线窗口内确实发生了轮询(实测 ${oneChain})`)
|
|
685
|
+
// 取消后立刻重启(RecoveryPanel 被 423 拒绝后用户重试就是这条路径):
|
|
686
|
+
// 只删标记不撤定时器时,旧链在集合重新 add 后复活,与新链并发 ⇒ 计数逼近链数倍数
|
|
687
|
+
store.stopRunWatch('export')
|
|
688
|
+
runsCalls = 0
|
|
689
|
+
store.watchRunning('export', 5)
|
|
690
|
+
store.stopRunWatch('export')
|
|
691
|
+
store.watchRunning('export', 5)
|
|
692
|
+
await sleep(60)
|
|
693
|
+
store.stopRunWatch('export')
|
|
694
|
+
assert.ok(
|
|
695
|
+
runsCalls <= Math.ceil(oneChain * 1.5),
|
|
696
|
+
`stop→start 不得叠加链(单链 ${oneChain} 次,实测 ${runsCalls} 次)`,
|
|
697
|
+
)
|
|
698
|
+
})
|
|
699
|
+
|
|
670
700
|
/* ------------------------------------------------------------- 订阅语义 */
|
|
671
701
|
|
|
672
702
|
test('subscribe/notify: patch 触发监听器,退订后不再通知', () => {
|
package/src/client/run-store.ts
CHANGED
|
@@ -2011,17 +2011,37 @@ export class RunStore {
|
|
|
2011
2011
|
this.patch({ recovery: { write: null } })
|
|
2012
2012
|
}
|
|
2013
2013
|
|
|
2014
|
-
/**
|
|
2014
|
+
/**
|
|
2015
|
+
* 停止某 kind 的「发现进行中 run」轮询(视图请求结束后调用;/progress 轮询自行结束)。
|
|
2016
|
+
*
|
|
2017
|
+
* 审计 P8-1:只看集合是不够的 —— 取消时那条挂起的 tick 还活着,只删标记会在 500ms 后
|
|
2018
|
+
* 醒来并**看似被取消**;但若这期间同一 kind 又被 watchRunning 起来(面板被 423 拒绝后
|
|
2019
|
+
* 用户重试是真实路径),集合已被重新 add,孤儿链因此复活并与新链并发,/runs 请求数按
|
|
2020
|
+
* 链数线性翻倍(repro:.tmp/audit-2026-11-13/repro/P8-1-watch-duplicate.mjs 单链 19 次、
|
|
2021
|
+
* 三条链 57 次)。所以取消必须同时撤回句柄。
|
|
2022
|
+
*/
|
|
2015
2023
|
stopRunWatch(kind: RunKind): void {
|
|
2016
2024
|
this.watchActive.delete(kind)
|
|
2025
|
+
this.clearWatchTimer(kind)
|
|
2017
2026
|
}
|
|
2018
2027
|
|
|
2019
2028
|
/** 调度下一轮发现;每 kind 只保留一个挂起定时器。 */
|
|
2020
2029
|
private scheduleWatch(kind: RunKind, tick: () => void, intervalMs: number): void {
|
|
2030
|
+
// 覆盖句柄前先清旧的:否则被覆盖的那个句柄再也不在 timers 里,clearAllTimers 也够不到它
|
|
2031
|
+
this.clearWatchTimer(kind)
|
|
2021
2032
|
const timer = setTimeout(tick, intervalMs)
|
|
2022
2033
|
this.timers.set(`watch:${kind}`, timer)
|
|
2023
2034
|
}
|
|
2024
2035
|
|
|
2036
|
+
/** 撤回某 kind 的挂起发现定时器(不存在即 no-op)。 */
|
|
2037
|
+
private clearWatchTimer(kind: RunKind): void {
|
|
2038
|
+
const key = `watch:${kind}`
|
|
2039
|
+
const pending = this.timers.get(key)
|
|
2040
|
+
if (pending === undefined) return
|
|
2041
|
+
clearTimeout(pending)
|
|
2042
|
+
this.timers.delete(key)
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2025
2045
|
private pollRun(runId: string, kind: RunKind, intervalMs?: number): void {
|
|
2026
2046
|
if (this.polling.has(runId)) return
|
|
2027
2047
|
this.polling.add(runId)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 「添加通道」入口卡 + 选通道弹窗(2026-11-14 用户要求改同步页结构)。
|
|
3
|
+
*
|
|
4
|
+
* 此前四条通道卡**恒显示**(未配置的走单行矮态),理由是「配置完 Git 回来找不到 WebDAV
|
|
5
|
+
* 会被当成 bug」。用户明确要求反过来:页面只留**已配置**的通道卡,其余通道统统收进这一张
|
|
6
|
+
* 卡,点开弹窗选通道、再进各自的配置弹窗。原来那条担心由这张卡承接 —— 只要还有未配置的
|
|
7
|
+
* 通道,它就常驻在页面上,不是只在首次安装时冒一次。
|
|
8
|
+
*
|
|
9
|
+
* 为什么单独成文件:SyncPanel.tsx 有行数棘轮(≤1600 行),这里是一段自包含的
|
|
10
|
+
* 「入口卡 + 选择弹窗」,与装配逻辑无关。
|
|
11
|
+
*/
|
|
12
|
+
import { useState } from 'react'
|
|
13
|
+
import type { TranslateNS } from '../client-types.ts'
|
|
14
|
+
import { Icon } from '../common/Icon.tsx'
|
|
15
|
+
import { Modal } from '../common/Modal.tsx'
|
|
16
|
+
import type { SyncChannel } from './sync-view.ts'
|
|
17
|
+
import { SYNC_CHANNEL_LABEL_KEY } from './sync-view.ts'
|
|
18
|
+
import type { SyncKey } from './sync-locales.ts'
|
|
19
|
+
import css from '../config-manager.module.css'
|
|
20
|
+
|
|
21
|
+
/** 每个通道一句话用途:只用通道实际支持的服务名,不写宣传语(names 与 WEBDAV_PRESETS / S3_PROVIDER_LABEL_KEY 一致) */
|
|
22
|
+
const PURPOSE_KEY: Record<SyncChannel, SyncKey> = {
|
|
23
|
+
git: 'addChannel.git',
|
|
24
|
+
webdav: 'addChannel.webdav',
|
|
25
|
+
s3: 'addChannel.s3',
|
|
26
|
+
gist: 'addChannel.gist',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function AddChannelCard({ t, channels, onPick }: {
|
|
30
|
+
t: TranslateNS<'config-manager-sync'>
|
|
31
|
+
/** 尚未配置的通道(已配置的通道保留各自的卡片,不在这里出现) */
|
|
32
|
+
channels: readonly SyncChannel[]
|
|
33
|
+
/** 选中某个通道:由主文件切换当前通道并打开它的配置弹窗 */
|
|
34
|
+
onPick: (channel: SyncChannel) => void
|
|
35
|
+
}) {
|
|
36
|
+
const [open, setOpen] = useState(false)
|
|
37
|
+
// 全部通道都配好了:没有可添的东西,不留一张点开是空列表的卡
|
|
38
|
+
if (channels.length === 0) return null
|
|
39
|
+
const pick = (channel: SyncChannel) => {
|
|
40
|
+
setOpen(false)
|
|
41
|
+
onPick(channel)
|
|
42
|
+
}
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<button type="button" className={css.addChannelCard} onClick={() => { setOpen(true) }}>
|
|
46
|
+
<Icon name="probe" size={14} />
|
|
47
|
+
<span className={css.addChannelLabel}>{t('addChannel.title')}</span>
|
|
48
|
+
<span className={css.addChannelHint}>{channels.map((c) => t(SYNC_CHANNEL_LABEL_KEY[c])).join(' / ')}</span>
|
|
49
|
+
</button>
|
|
50
|
+
<Modal open={open} onClose={() => { setOpen(false) }} title={t('addChannel.title')}>
|
|
51
|
+
<Modal.Header title={t('addChannel.title')} onClose={() => { setOpen(false) }} closeLabel={t('common.close')} />
|
|
52
|
+
<Modal.Body>
|
|
53
|
+
<div className={css.channelPickList}>
|
|
54
|
+
{channels.map((c) => (
|
|
55
|
+
<button key={c} type="button" className={css.channelPickRow} onClick={() => { pick(c) }}>
|
|
56
|
+
<span className={css.channelPickLabel}>{t(SYNC_CHANNEL_LABEL_KEY[c])}</span>
|
|
57
|
+
<span className={css.channelPickDesc}>{t(PURPOSE_KEY[c])}</span>
|
|
58
|
+
</button>
|
|
59
|
+
))}
|
|
60
|
+
</div>
|
|
61
|
+
</Modal.Body>
|
|
62
|
+
</Modal>
|
|
63
|
+
</>
|
|
64
|
+
)
|
|
65
|
+
}
|