dsh-config-manager 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/adapters/mcp.js +42 -13
- 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 +147 -4
- 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/index.js +14 -0
- package/lib/cli/write-gates.d.ts +61 -0
- package/lib/cli/write-gates.js +110 -0
- package/lib/client.d.ts +104 -49
- package/lib/client.js +12536 -12006
- 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 +7 -0
- package/lib/core/messages.js +14 -0
- package/lib/core/migration-history.js +16 -9
- package/lib/core/model-tools.d.ts +2 -2
- package/lib/core/model-tools.js +14 -2
- 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 +22 -0
- 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 +1 -1
- package/lib/index.js +1 -1
- 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 +13 -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 +34 -1
- package/lib/sync/autosync-scheduler.js +151 -43
- 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/merge-apply-plan.d.ts +38 -0
- package/lib/sync/merge-apply-plan.js +76 -0
- package/lib/sync/messages.d.ts +1 -0
- package/lib/sync/messages.js +2 -0
- package/lib/sync/pending-merge.d.ts +34 -0
- package/lib/sync/pending-merge.js +53 -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 +23 -40
- package/lib/sync/sync-engine.js +115 -132
- 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/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/i18n.d.ts +2 -1
- package/lib/ui/i18n.js +4 -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 +8 -0
- package/lib/ui/selection-model.js +16 -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 +2 -1
- package/src/adapters/mcp.test.ts +29 -0
- package/src/adapters/mcp.ts +43 -12
- 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 +288 -0
- package/src/adapters/plugins.ts +141 -4
- 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/index.ts +18 -0
- package/src/cli/web/web.test.ts +27 -0
- package/src/cli/write-gates.ts +149 -0
- package/src/client/about/AboutPanel.tsx +7 -6
- package/src/client/about/release-notes-view.test.ts +17 -0
- package/src/client/about/release-notes-view.ts +49 -24
- 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 +13 -12
- 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 +188 -3
- 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 +1507 -272
- package/src/client/consult/ConsultCard.tsx +7 -6
- package/src/client/environment/EnvironmentPanel.tsx +20 -21
- package/src/client/environment/maintenance/DiskUsageCard.tsx +65 -91
- 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 +35 -30
- package/src/client/home/HomePanel.tsx +45 -10
- package/src/client/import/ConflictList.tsx +13 -13
- package/src/client/import/ForeignImportView.tsx +7 -6
- package/src/client/import/ImportWizardView.tsx +2 -3
- package/src/client/import/PathMappingForm.tsx +4 -4
- package/src/client/import/PathPickerDialog.tsx +2 -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 +19 -15
- package/src/client/library/LibraryActions.tsx +56 -16
- package/src/client/library/LibraryPanel.tsx +7 -7
- package/src/client/library/RestorePlanView.tsx +13 -8
- package/src/client/locales/about.ts +0 -2
- package/src/client/locales/backup.ts +10 -12
- package/src/client/locales/common.ts +2 -0
- package/src/client/locales/export.ts +5 -12
- package/src/client/locales/foreign.ts +2 -2
- package/src/client/locales/import.ts +3 -2
- package/src/client/locales/overview.ts +4 -0
- package/src/client/locales/profiles.ts +32 -4
- package/src/client/locales/restore.ts +0 -2
- package/src/client/locales/sessions.ts +0 -2
- package/src/client/locales/shell.ts +2 -2
- package/src/client/market/MarketPanel.tsx +38 -20
- package/src/client/market/MyConfigsList.tsx +34 -32
- package/src/client/market/MyConfigsLoginCard.tsx +12 -15
- package/src/client/market/MyConfigsView.tsx +5 -5
- 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 +31 -16
- package/src/client/recovery/RollbackCard.tsx +58 -16
- 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/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 +182 -108
- package/src/client/sync/ChannelClearConfirmDialog.tsx +5 -1
- package/src/client/sync/ChannelConfigDialog.tsx +27 -48
- package/src/client/sync/MergePreviewView.tsx +3 -5
- package/src/client/sync/PushReportSections.tsx +35 -0
- package/src/client/sync/SyncChannelEntryCard.tsx +33 -24
- package/src/client/sync/SyncConfirmView.tsx +3 -3
- package/src/client/sync/SyncLogList.tsx +16 -5
- package/src/client/sync/SyncPanel.tsx +153 -159
- 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 +304 -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 +3 -0
- package/src/client/sync/merge-request.ts +20 -0
- package/src/client/sync/sync-api.ts +12 -0
- package/src/client/sync/sync-locales.ts +87 -47
- package/src/client/sync/sync-panel-clear.test.ts +44 -0
- package/src/client/sync/sync-view.test.ts +20 -0
- package/src/client/sync/sync-view.ts +42 -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 +14 -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 +16 -4
- 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/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 +27 -1
- 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.ts +1 -1
- 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 +13 -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/sync/autosync-repeat.test.ts +58 -0
- package/src/sync/autosync-repeat.ts +55 -0
- package/src/sync/autosync-scheduler.test.ts +417 -0
- package/src/sync/autosync-scheduler.ts +154 -41
- 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/merge-apply-plan.ts +117 -0
- package/src/sync/messages.ts +2 -0
- package/src/sync/pending-merge.ts +77 -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 +130 -135
- 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/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/i18n.ts +4 -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 +15 -1
- package/src/ui/selection-model.ts +18 -0
- package/src/utils/js-yaml4.d.ts +35 -0
- package/src/utils/patch-yaml.test.ts +207 -1
- 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,7 @@ 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 { RefreshIcon } from '../common/Icon.tsx'
|
|
27
27
|
import { Collapse } from '../common/Motion.tsx'
|
|
28
28
|
import { DiskUsageCard } from '../environment/maintenance/DiskUsageCard.tsx'
|
|
29
29
|
import { RollbackCard } from './RollbackCard.tsx'
|
|
@@ -78,12 +78,6 @@ export interface RecoveryPanelProps {
|
|
|
78
78
|
* 两个字典的键集不通用,因此显式分开传,不做类型强转。
|
|
79
79
|
*/
|
|
80
80
|
copyT?: TranslateNS<'config-manager'>
|
|
81
|
-
/**
|
|
82
|
-
* 磁盘体检卡的 ⓘ 可访问名(第 2 块「磁盘占用与清理」)。
|
|
83
|
-
* 与 copyT 同一条理由:DiskUsageCard 的文案走 **UiT** 字典,它的 ⓘ 可访问名却住在主字典里
|
|
84
|
-
* (`common.infoHint`),本面板手上只有 recovery 字典 —— 所以由调用方显式传。
|
|
85
|
-
*/
|
|
86
|
-
infoHintLabel?: string
|
|
87
81
|
/**
|
|
88
82
|
* 磁盘体检端口(第 2 块)。
|
|
89
83
|
* 直接传 ConfigManagerApi 而不是收窄成两个方法:DiskUsageCard 的 props 就是 `api`,
|
|
@@ -369,6 +363,12 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
369
363
|
(recovery) => { patch({ status: 'ready', recovery }) },
|
|
370
364
|
() => { /* 状态刷新失败静默 */ },
|
|
371
365
|
)
|
|
366
|
+
}).catch((err) => {
|
|
367
|
+
// verify 被拒(423 mutation-locked、409、404、500 或 5 分钟客户端超时)时也必须复位:
|
|
368
|
+
// 末级 then 没有 onRejected 会让 running 永久 true,execute/retry/dismiss 三入口全被早退锁死(审计 P8-2)。
|
|
369
|
+
patch({ running: false })
|
|
370
|
+
runStore.stopRunWatch('recovery')
|
|
371
|
+
toast.error(redactErrorText(err))
|
|
372
372
|
})
|
|
373
373
|
}
|
|
374
374
|
|
|
@@ -395,6 +395,11 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
395
395
|
(recovery) => { patch({ status: 'ready', recovery }) },
|
|
396
396
|
() => { /* 静默 */ },
|
|
397
397
|
)
|
|
398
|
+
}).catch((err) => {
|
|
399
|
+
// 同 execute:verify 被拒也要复位 running/watch(审计 P8-2)。
|
|
400
|
+
patch({ running: false })
|
|
401
|
+
runStore.stopRunWatch('recovery')
|
|
402
|
+
toast.error(redactErrorText(err))
|
|
398
403
|
})
|
|
399
404
|
}
|
|
400
405
|
|
|
@@ -476,6 +481,13 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
476
481
|
<SectionTitle
|
|
477
482
|
title={t('view.recovery')}
|
|
478
483
|
subtitle={needsAttention ? t('recovery.requiredHint') : undefined}
|
|
484
|
+
action={(
|
|
485
|
+
/* 静止面板看不出「磁盘/体检/回滚」是刚才的数据还是十分钟前的:恢复页没有轮询,
|
|
486
|
+
整页只有这一处重新拉取入口(此前只能切页或刷新浏览器)。 */
|
|
487
|
+
<Button size="sm" loading={state.status === 'loading'} onClick={load}>
|
|
488
|
+
<RefreshIcon size={12} />{' '}{t('recovery.refresh')}
|
|
489
|
+
</Button>
|
|
490
|
+
)}
|
|
479
491
|
/>
|
|
480
492
|
|
|
481
493
|
{/* 事故处置:崩溃归因(上次启动没起来)+ 救援模式(先让 DSH 起得来)。
|
|
@@ -524,7 +536,7 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
524
536
|
必须给出**可执行**的解除入口,否则用户只能去磁盘上删 transactions/safe-mode。 */}
|
|
525
537
|
{state.status === 'ready' && view?.safeModeStuck === true && (
|
|
526
538
|
<Card className={css.card}>
|
|
527
|
-
<div className={css.groupLabel}
|
|
539
|
+
<div className={css.groupLabel} title={t('recovery.safeMode.detail')}>{t('recovery.safeMode.title')}</div>
|
|
528
540
|
<div className={css.actionRow}>
|
|
529
541
|
<Button variant="danger" disabled={safeModeBusy} loading={safeModeBusy} onClick={() => { setSafeModeConfirmOpen(true) }}>
|
|
530
542
|
{safeModeBusy ? t('recovery.safeMode.busy') : t('recovery.safeMode.action')}
|
|
@@ -537,7 +549,7 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
537
549
|
不是没有(t89),那时由上面的告警条解释。2026-11-04:原 92px 虚线空框改一行状态行 ——
|
|
538
550
|
它白占的高度把磁盘 / 体检 / 回滚整块推到首屏之外。 */}
|
|
539
551
|
{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>
|
|
552
|
+
<div className={css.statusLine + ' ' + css.recoveryEmptyBar} role="status"><StatusDot kind="ok" /><span>{t('recovery.empty')}</span></div>
|
|
541
553
|
)}
|
|
542
554
|
|
|
543
555
|
{/* issue #31:残留配置锁(非 journal 事项)——纯锁残留时 incidents 恒为空,
|
|
@@ -659,9 +671,9 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
659
671
|
<>
|
|
660
672
|
<div className={css.statRow}>
|
|
661
673
|
<span className={css.groupLabel}>{t('recovery.preview.title')}</span>
|
|
662
|
-
{/*
|
|
663
|
-
|
|
664
|
-
<
|
|
674
|
+
{/* 「只读 / 零写入 / 确认后才执行」是不可逆边界,属于决策依据 ⇒ 常驻标题后缀,
|
|
675
|
+
不藏进悬停说明(2026-11-14 用户要求:能从标题读懂的信息不进悬停)。 */}
|
|
676
|
+
<span className={css.hint}>{t('recovery.preview.hint')}</span>
|
|
665
677
|
</div>
|
|
666
678
|
{previewView.snapshotVerdict !== null && (
|
|
667
679
|
<div className={css.kvRow}>
|
|
@@ -773,8 +785,7 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
773
785
|
{rescue !== null && (
|
|
774
786
|
<Card>
|
|
775
787
|
<div className={css.statRow}>
|
|
776
|
-
<strong>{t('recovery.rescue.title')}</strong>
|
|
777
|
-
<InfoHint text={t('recovery.rescue.desc')} label={t('common.infoHint')} />
|
|
788
|
+
<strong title={t('recovery.rescue.desc')}>{t('recovery.rescue.title')}</strong>
|
|
778
789
|
<Badge kind={rescue.active ? 'warn' : 'ok'}>
|
|
779
790
|
{rescue.active ? t('recovery.rescue.activeBadge') : t('recovery.rescue.inactive')}
|
|
780
791
|
</Badge>
|
|
@@ -796,7 +807,11 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
796
807
|
/>
|
|
797
808
|
)}
|
|
798
809
|
</div>
|
|
799
|
-
{/*
|
|
810
|
+
{/* 2026-11-14(稿 P-05):代价与适用场景常显一句 —— 这是**危险动作**的后果说明,
|
|
811
|
+
不是机制背景;把它挂成悬停说明等于让用户在按下「进入救援模式」前先悬停才能知道
|
|
812
|
+
「它会停用依赖校验」。完整改写范围仍在标题的悬停说明与确认弹窗里。 */}
|
|
813
|
+
<div className={css.hint}>{t('recovery.rescue.short')}</div>
|
|
814
|
+
{/* 机制与安全说明挂在标题行的悬停说明(2026-10-12 用户要求说明性文案不进正文):
|
|
800
815
|
危险动作按钮仍在标题行永远可达,折叠体只收「已开启时的生效状态与提示」这类明细。 */}
|
|
801
816
|
<Collapse open={rescueOpen} id={RESCUE_BODY_ID}>
|
|
802
817
|
{rescue.active && (
|
|
@@ -836,7 +851,7 @@ export function RecoveryPanel(props: RecoveryPanelProps) {
|
|
|
836
851
|
{/* —— 诊断三块(缺省只展开磁盘占用;另两块缺省收起,摘要与开关留在标题行)——
|
|
837
852
|
磁盘占用与清理(m-disk-usage):三条硬边界一字不动(候选集只有可重建区 + 显式勾选的过期导出;snapshots/sync 永不在候选集;
|
|
838
853
|
界面数字由渲染行现算)—— 实现全在 DiskUsageCard 与 ui/disk-usage-view.ts 里。 */}
|
|
839
|
-
<DiskUsageCard api={props.diskApi}
|
|
854
|
+
<DiskUsageCard api={props.diskApi} />
|
|
840
855
|
|
|
841
856
|
{/* T5:会话体检(只读)—— 与「我的对话去哪了」是同一件事,故与事故恢复同屏(卡内缺省收起) */}
|
|
842
857
|
<SessionHealthCard recoveryApi={recoveryApi} t={t} copyT={props.copyT} diskApi={props.diskApi} />
|
|
@@ -57,9 +57,7 @@ import type {
|
|
|
57
57
|
} from '../../ui/rollback-view.ts'
|
|
58
58
|
import { redact } from '../../security/redaction.ts'
|
|
59
59
|
import { Badge, Banner, Button, Card, Checkbox, Empty, IconButton, SectionTitle, Spinner } from '../common/ui.tsx'
|
|
60
|
-
import { SkeletonList } from '../common/Skeleton.tsx'
|
|
61
60
|
import { Icon } from '../common/Icon.tsx'
|
|
62
|
-
import { InfoHint } from '../common/InfoHint.tsx'
|
|
63
61
|
import { Modal } from '../common/Modal.tsx'
|
|
64
62
|
import { ConfirmDialog } from '../common/ConfirmDialog.tsx'
|
|
65
63
|
import { toast } from '../common/toast-store.ts'
|
|
@@ -423,16 +421,16 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
423
421
|
return (
|
|
424
422
|
<>
|
|
425
423
|
<Card>
|
|
426
|
-
{/* 卡头:标题 +
|
|
424
|
+
{/* 卡头:标题 + 悬停说明(说明性文案挂在标题的 title 上,不再另起一行副标题)。
|
|
427
425
|
2026-10-12 同一轮用户要求:本卡**退出折叠** —— 摘要与入口常驻可见,台账整块搬进弹窗。 */}
|
|
428
|
-
<SectionTitle title={t('rollback.title')}
|
|
426
|
+
<SectionTitle title={t('rollback.title')} tooltip={t('rollback.desc')} />
|
|
429
427
|
|
|
430
428
|
{!hasApi && <Banner kind="warn">{t('rollback.apiMissing')}</Banner>}
|
|
431
429
|
|
|
432
430
|
{/* issue #88:总开关。它**必须常驻可见** —— 关掉之后,用户还得有地方能把它打开。
|
|
433
431
|
关闭语义 = 不订阅会话事件、不写台账、聊天入口收起(文案逐条对应代码,不含糊)。 */}
|
|
434
432
|
{hasPrefsApi && (
|
|
435
|
-
<div className={css.actionRowTop}>
|
|
433
|
+
<div className={css.actionRowTop} title={t('rollback.switch.hint')}>
|
|
436
434
|
<Checkbox
|
|
437
435
|
// 三态:`null`(还没读到)显示为未勾选且**禁用** —— 绝不替磁盘猜一个值
|
|
438
436
|
checked={prefsEnabled === true}
|
|
@@ -440,7 +438,6 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
440
438
|
onChange={togglePrefs}
|
|
441
439
|
label={t('rollback.switch.label')}
|
|
442
440
|
/>
|
|
443
|
-
<InfoHint text={t('rollback.switch.hint')} label={t('common.infoHint')} />
|
|
444
441
|
{/* 三态不再各占一行解释:提示做成开关**旁边**的状态徽章,分歧态再给一次点击就生效的动作。
|
|
445
442
|
「还没读到」= info 徽章(开关此时同时禁用);「磁盘开着但本进程没生效」= warn 徽章 + 立即生效。 */}
|
|
446
443
|
{hasPrefsApi && prefsEnabled === null && <Badge kind="info">{t('rollback.switch.reading')}</Badge>}
|
|
@@ -465,7 +462,18 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
465
462
|
</>
|
|
466
463
|
)}
|
|
467
464
|
|
|
468
|
-
{
|
|
465
|
+
{/* 加载态 = 就绪态的**同一行几何**(摘要文字 + 行尾两颗按钮)。
|
|
466
|
+
2026-11-14 用户反馈:旧骨架是三张 SkeletonList 卡(≈210px),就绪态只有一行工具栏
|
|
467
|
+
(≈26px)⇒ 卡片从 210 缩到 ~100,环境页整页往上跳。容器复用 .rollbackToolbar,
|
|
468
|
+
只有占位条尺寸是骨架自己的。 */}
|
|
469
|
+
{status === 'loading' && (
|
|
470
|
+
<div className={css.rollbackToolbar} role="status" aria-busy="true" aria-label={t('recovery.loading')}>
|
|
471
|
+
<span className={css.skeletonBar + ' ' + css.rollbackSkeletonSummary} />
|
|
472
|
+
<span className={css.statusSpacer} />
|
|
473
|
+
<span className={css.skeletonBar + ' ' + css.rollbackSkeletonButton} />
|
|
474
|
+
<span className={css.skeletonBar + ' ' + css.rollbackSkeletonButton} />
|
|
475
|
+
</div>
|
|
476
|
+
)}
|
|
469
477
|
{status === 'error' && (
|
|
470
478
|
<div className={css.actionRow}>
|
|
471
479
|
<Banner kind="error">{error !== null ? error : t('rollback.apiMissing')}</Banner>
|
|
@@ -539,23 +547,56 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
539
547
|
closeLabel={t('common.close')}
|
|
540
548
|
trailing={(
|
|
541
549
|
<span className={css.shHeaderTrailing}>
|
|
542
|
-
{/* 留存/淘汰口径属机制说明 →
|
|
550
|
+
{/* 留存/淘汰口径属机制说明 → 挂在刷新按钮的 title 上(DESIGN.md §7「说明性文案分层」):屏上只留数字摘要,
|
|
543
551
|
20/50/救援点上限这些细节一个字不改,仍在同一条字典键里。 */}
|
|
544
|
-
<
|
|
545
|
-
|
|
552
|
+
<Button
|
|
553
|
+
size="sm"
|
|
554
|
+
variant="ghost"
|
|
555
|
+
disabled={busy || refreshing}
|
|
556
|
+
loading={refreshing}
|
|
557
|
+
onClick={() => { load({ keep: true }) }}
|
|
558
|
+
title={t('rollback.retention.hint', {
|
|
546
559
|
perSession: ROLLBACK_MAX_POINTS_PER_SESSION,
|
|
547
560
|
total: ROLLBACK_MAX_POINTS_TOTAL,
|
|
548
561
|
guardsPerSession: ROLLBACK_MAX_POINTS_GUARDS_PER_SESSION,
|
|
549
562
|
guards: ROLLBACK_MAX_POINTS_GUARDS_TOTAL,
|
|
550
563
|
})}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
564
|
+
>
|
|
565
|
+
{t('rollback.refresh')}
|
|
566
|
+
</Button>
|
|
554
567
|
</span>
|
|
555
568
|
)}
|
|
556
569
|
/>
|
|
557
570
|
<Modal.Body scroll>
|
|
558
|
-
{
|
|
571
|
+
{/* 加载态照抄台账几何(工具栏 + 锁高 340px 的左右分栏),数据到货时弹窗高度不变。 */}
|
|
572
|
+
{status === 'loading' && (
|
|
573
|
+
<div role="status" aria-busy="true" aria-label={t('recovery.loading')}>
|
|
574
|
+
<div className={css.rollbackToolbar}>
|
|
575
|
+
<span className={css.skeletonBar + ' ' + css.rollbackSkeletonSummary} />
|
|
576
|
+
<span className={css.statusSpacer} />
|
|
577
|
+
<span className={css.skeletonBar + ' ' + css.rollbackSkeletonButton} />
|
|
578
|
+
</div>
|
|
579
|
+
<div className={css.rollbackLedger} aria-hidden="true">
|
|
580
|
+
<div className={css.rollbackSessions}>
|
|
581
|
+
{[0, 1, 2].map((i) => (
|
|
582
|
+
<span key={i} className={css.skeletonBar + ' ' + css.rollbackSkeletonSession} />
|
|
583
|
+
))}
|
|
584
|
+
</div>
|
|
585
|
+
<div className={css.rollbackLedgerMain}>
|
|
586
|
+
<div className={css.rollbackGroup}>
|
|
587
|
+
<div className={css.rollbackGroupHead}>
|
|
588
|
+
<span className={css.skeletonBar + ' ' + css.historySkeletonSections} />
|
|
589
|
+
</div>
|
|
590
|
+
<div className={css.rollbackPointsScroll}>
|
|
591
|
+
{[0, 1, 2].map((i) => (
|
|
592
|
+
<span key={i} className={css.skeletonBar + ' ' + css.rollbackSkeletonPoint} />
|
|
593
|
+
))}
|
|
594
|
+
</div>
|
|
595
|
+
</div>
|
|
596
|
+
</div>
|
|
597
|
+
</div>
|
|
598
|
+
</div>
|
|
599
|
+
)}
|
|
559
600
|
{status === 'error' && (
|
|
560
601
|
<div className={css.actionRow}>
|
|
561
602
|
<Banner kind="error">{error !== null ? error : t('rollback.apiMissing')}</Banner>
|
|
@@ -689,12 +730,13 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
689
730
|
)}
|
|
690
731
|
|
|
691
732
|
{/* 预览 / 回退(同一弹窗:先只读预览 + 三选一范围,执行后就地显示逐段结果) */}
|
|
733
|
+
{/* 「只读 / 零写入」常驻标题右侧(原 ⓘ 的位置):这是「点了也不会改动磁盘」的唯一提示 */}
|
|
692
734
|
<Modal open={target !== null} onClose={closePreview} title={t('rollback.preview')} wide busy={busy}>
|
|
693
735
|
<Modal.Header
|
|
694
736
|
title={t('rollback.preview.title')}
|
|
695
737
|
onClose={closePreview}
|
|
696
738
|
closeLabel={t('common.close')}
|
|
697
|
-
trailing={<
|
|
739
|
+
trailing={<span className={css.hint}>{t('rollback.preview.hint')}</span>}
|
|
698
740
|
/>
|
|
699
741
|
<Modal.Body scroll>
|
|
700
742
|
{previewLoading && <Spinner label={t('rollback.preview.loading')} />}
|
|
@@ -744,7 +786,7 @@ export function RollbackCard({ recoveryApi, t }: RollbackCardProps) {
|
|
|
744
786
|
</span>
|
|
745
787
|
</span>
|
|
746
788
|
</div>
|
|
747
|
-
<div className={css.planScroll}>
|
|
789
|
+
<div className={`${css.planScroll} ${css.planScrollPadded}`}>
|
|
748
790
|
<RollbackFileChanges
|
|
749
791
|
files={previewFiles}
|
|
750
792
|
removals={previewRemovals}
|
|
@@ -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',
|
|
@@ -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 触发监听器,退订后不再通知', () => {
|