dsh-config-manager 0.3.1 → 0.4.1
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/client.d.ts +54 -3
- package/lib/client.js +1078 -845
- package/lib/core/env-lock-lifecycle.d.ts +45 -0
- package/lib/core/env-lock-lifecycle.js +43 -0
- package/lib/core/history-prune.d.ts +34 -0
- package/lib/core/history-prune.js +43 -0
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/messages-core.d.ts +1 -0
- package/lib/core/messages-core.js +2 -0
- package/lib/core/migration-history.d.ts +46 -4
- package/lib/core/migration-history.js +60 -7
- package/lib/index.d.ts +2 -2
- package/lib/index.js +26 -8
- package/lib/routes/history.js +70 -5
- package/lib/routes/index.d.ts +1 -1
- package/lib/routes/kit.d.ts +2 -2
- package/lib/routes/messages.d.ts +1 -0
- package/lib/routes/messages.js +3 -0
- package/lib/sync/autosync-scheduler.js +12 -2
- package/lib/sync/backup-scheduler.js +6 -0
- package/lib/sync/baseline-heal.d.ts +35 -0
- package/lib/sync/baseline-heal.js +39 -0
- package/lib/sync/push-precheck.d.ts +35 -0
- package/lib/sync/push-precheck.js +58 -0
- package/lib/sync/sync-engine.d.ts +9 -12
- package/lib/sync/sync-engine.js +24 -43
- package/lib/sync/ui-prefs.d.ts +8 -0
- package/lib/sync/ui-prefs.js +8 -0
- package/lib/ui/history-model.js +3 -2
- package/lib/ui/overview-view.d.ts +3 -3
- package/lib/ui/overview-view.js +9 -1
- package/lib/utils/env-lock.d.ts +55 -1
- package/lib/utils/env-lock.js +131 -2
- package/lib/utils/messages-utils.d.ts +3 -0
- package/lib/utils/messages-utils.js +6 -0
- package/package.json +1 -1
- package/src/client/common/InfoHint.tsx +12 -3
- package/src/client/common/Skeleton.tsx +45 -8
- package/src/client/common/info-hint-guard.test.ts +196 -0
- package/src/client/common/routes.ts +3 -1
- package/src/client/common/skeleton-guard.test.ts +58 -0
- package/src/client/common/ui.tsx +17 -4
- package/src/client/config-manager.module.css +256 -27
- package/src/client/css-motion-guard.test.ts +230 -0
- package/src/client/environment/EnvironmentPanel.tsx +41 -29
- package/src/client/environment/maintenance/DiskUsageCard.tsx +28 -33
- package/src/client/environment/profiles-incomplete-ui.test.ts +9 -5
- package/src/client/export/ExportView.tsx +6 -6
- package/src/client/history/HistoryPanel.tsx +87 -2
- package/src/client/history/history-api.ts +49 -3
- package/src/client/history/history-locales.ts +32 -0
- package/src/client/home/HomePanel.tsx +64 -26
- package/src/client/locales.ts +2 -0
- package/src/client/market/MyConfigsWizard.tsx +12 -3
- package/src/client/recovery/RecoveryPanel.tsx +93 -92
- package/src/client/recovery/RollbackCard.tsx +25 -16
- package/src/client/sync/AutosyncCard.tsx +12 -6
- package/src/client/sync/ChannelConfigDialog.tsx +45 -45
- package/src/client/sync/DecryptPasswordCard.tsx +3 -3
- package/src/client/sync/SecurityOptionsCard.tsx +3 -3
- package/src/client/sync/SyncSectionPickerDialog.tsx +3 -3
- package/src/client/sync/history-model.ts +3 -0
- package/src/client/sync/sync-locales.ts +2 -0
- package/src/core/env-lock-lifecycle.ts +73 -0
- package/src/core/history-prune.test.ts +115 -0
- package/src/core/history-prune.ts +61 -0
- package/src/core/index.ts +2 -0
- package/src/core/messages-core.ts +2 -0
- package/src/core/migration-history.test.ts +97 -0
- package/src/core/migration-history.ts +74 -9
- package/src/index.ts +27 -8
- package/src/routes/history.ts +81 -4
- package/src/routes/index.ts +1 -1
- package/src/routes/kit.ts +2 -2
- package/src/routes/messages.ts +3 -0
- package/src/sync/autosync-scheduler.test.ts +23 -0
- package/src/sync/autosync-scheduler.ts +9 -2
- package/src/sync/backup-scheduler.ts +3 -0
- package/src/sync/baseline-heal.ts +74 -0
- package/src/sync/push-precheck.ts +75 -0
- package/src/sync/sync-engine.test.ts +88 -0
- package/src/sync/sync-engine.ts +33 -43
- package/src/sync/ui-prefs.test.ts +32 -0
- package/src/sync/ui-prefs.ts +16 -0
- package/src/ui/history-model.test.ts +2 -1
- package/src/ui/history-model.ts +3 -2
- package/src/ui/overview-view.test.ts +12 -0
- package/src/ui/overview-view.ts +12 -4
- package/src/utils/env-lock.test.ts +107 -0
- package/src/utils/env-lock.ts +124 -2
- package/src/utils/messages-utils.ts +6 -0
package/lib/client.d.ts
CHANGED
|
@@ -2938,6 +2938,15 @@ interface SyncPushReport {
|
|
|
2938
2938
|
* 而不是记成「同步失败」。
|
|
2939
2939
|
*/
|
|
2940
2940
|
conflict?: boolean;
|
|
2941
|
+
/**
|
|
2942
|
+
* 本次推送前**收养了本机自己推上去的远端最新快照**(0.4.1 自愈):该值 = 被收养的快照 id。
|
|
2943
|
+
*
|
|
2944
|
+
* 触发场景:上次推送在上传成功、写基线之前被打断(进程退出/崩溃/断电),远端已前进而本机
|
|
2945
|
+
* `lastSnapshotId` 仍是上一版 → 前置检测会永久拒绝推送(每次都说「远端被别人推进了」),
|
|
2946
|
+
* 单设备用户因此被自己的快照锁死。判据只看「远端最新快照的 manifest.deviceId == 本机
|
|
2947
|
+
* deviceId」,别的设备推进过就仍然按冲突返回,绝不越过。
|
|
2948
|
+
*/
|
|
2949
|
+
adoptedBase?: string;
|
|
2941
2950
|
}
|
|
2942
2951
|
/** 差异报告中的单个变更项(PlanItem 摘要,不含敏感细节) */
|
|
2943
2952
|
interface PullChange {
|
|
@@ -4810,8 +4819,16 @@ declare class RecoveryApi implements RecoveryPort, RollbackPointPort {
|
|
|
4810
4819
|
declare const MIGRATION_KINDS: readonly ['import', 'restore', 'rollback', 'profile-create', 'profile-select', 'profile-switch', 'profile-delete', 'profile-rename', 'profile-save', 'profile-import', 'sync-apply', 'autosync', 'recovery', 'backup', 'backup-manual', 'snapshot-delete', 'snapshot-prune'];
|
|
4811
4820
|
/** §5 覆盖的操作 kind(COMPLETE 不变量;常量枚举,天然非敏感)。 */
|
|
4812
4821
|
type MigrationKind = (typeof MIGRATION_KINDS)[number];
|
|
4813
|
-
/**
|
|
4814
|
-
|
|
4822
|
+
/**
|
|
4823
|
+
* 操作结果。
|
|
4824
|
+
*
|
|
4825
|
+
* 'pending'(0.4.1):操作**跑完了但仍有待裁决项**(自动同步上传成功、下行冲突未裁决;
|
|
4826
|
+
* 合并已应用一部分)。它不是 failed —— 网络/凭据/repo 都是好的;也不是 skipped ——
|
|
4827
|
+
* 那一轮确实做了事。旧实现把 partial 直接折成 'failed',用户看到「自动同步 失败」而
|
|
4828
|
+
* 实际只需要在同步页确认一次冲突。读侧(parseEntry / query 解析)必须接受该值,
|
|
4829
|
+
* 否则含 pending 的历史条目会被整条丢弃。
|
|
4830
|
+
*/
|
|
4831
|
+
type MigrationResult = 'success' | 'failed' | 'skipped' | 'pending';
|
|
4815
4832
|
/** 触发来源(常量)。 */
|
|
4816
4833
|
type MigrationSource = 'api' | 'autosync' | 'backup-scheduler' | 'recovery' | 'cli' | 'internal';
|
|
4817
4834
|
/** 一条不可变的迁移历史记录(磁盘形态;schemaVersion 内联)。 */
|
|
@@ -4856,6 +4873,32 @@ interface HistoryListResult {
|
|
|
4856
4873
|
entries: StoredMigrationHistoryEntry[];
|
|
4857
4874
|
stats: MigrationHistoryStats;
|
|
4858
4875
|
corrupted: string[];
|
|
4876
|
+
/** 目录内合法历史文件总数(含被 limit 窗口挡在外的旧条目;老宿主可能不返回)。 */
|
|
4877
|
+
total?: number;
|
|
4878
|
+
/** 本次实际读取条数(= 窗口大小;用于「仅显示最近 N 条」提示)。 */
|
|
4879
|
+
scanned?: number;
|
|
4880
|
+
/** 本次生效的 limit(0 = 全量)。 */
|
|
4881
|
+
limit?: number;
|
|
4882
|
+
}
|
|
4883
|
+
/** 自动清理策略现状(GET /history/retention)。 */
|
|
4884
|
+
interface HistoryRetentionState {
|
|
4885
|
+
ok: boolean;
|
|
4886
|
+
/** 当前保留上限;0 = 不限制。 */
|
|
4887
|
+
maxEntries: number;
|
|
4888
|
+
/** 目录内当前条数。 */
|
|
4889
|
+
total: number;
|
|
4890
|
+
/** 缺省上限(UI「恢复默认」用)。 */
|
|
4891
|
+
defaultMaxEntries: number;
|
|
4892
|
+
allowedMin: number;
|
|
4893
|
+
allowedMax: number;
|
|
4894
|
+
}
|
|
4895
|
+
/** 保存策略后的结果(POST /history/retention)。 */
|
|
4896
|
+
interface HistoryRetentionResult {
|
|
4897
|
+
ok: boolean;
|
|
4898
|
+
maxEntries: number;
|
|
4899
|
+
/** 本次立即清理删除的条数。 */
|
|
4900
|
+
removed: number;
|
|
4901
|
+
total: number;
|
|
4859
4902
|
}
|
|
4860
4903
|
/** 导出 JSON 返回体(markdown 走附件下载,不返回 JSON body)。 */
|
|
4861
4904
|
interface HistoryExportJsonResult {
|
|
@@ -4876,7 +4919,13 @@ declare class HistoryApi {
|
|
|
4876
4919
|
from?: number;
|
|
4877
4920
|
to?: number;
|
|
4878
4921
|
sections?: string[];
|
|
4922
|
+
/** 只读最近 N 条(缺省/0 = 全量;首页只取几十条避免全量读+回传)。 */
|
|
4923
|
+
limit?: number;
|
|
4879
4924
|
}): Promise<HistoryListResult>;
|
|
4925
|
+
/** GET /history/retention:当前自动清理策略 + 目录现状。 */
|
|
4926
|
+
getRetention(): Promise<HistoryRetentionState>;
|
|
4927
|
+
/** POST /history/retention:改保留上限并立即清理一次(0 = 不限制)。 */
|
|
4928
|
+
setRetention(maxEntries: number): Promise<HistoryRetentionResult>;
|
|
4880
4929
|
/**
|
|
4881
4930
|
* 导出历史报告(markdown → 下载附件;json → { text })。
|
|
4882
4931
|
* 过滤参数与 list 相同。
|
|
@@ -5608,6 +5657,7 @@ declare const zh$4: {
|
|
|
5608
5657
|
readonly 'overview.result.success': '成功';
|
|
5609
5658
|
readonly 'overview.result.failed': '失败';
|
|
5610
5659
|
readonly 'overview.result.skipped': '跳过';
|
|
5660
|
+
readonly 'overview.result.pending': '待裁决';
|
|
5611
5661
|
readonly 'overview.activity.copy': '复制';
|
|
5612
5662
|
readonly 'overview.activity.redacted': '(文件名已脱敏)';
|
|
5613
5663
|
readonly 'overview.sections.entries': '{count} 项';
|
|
@@ -6051,6 +6101,7 @@ declare const zh$3: {
|
|
|
6051
6101
|
readonly 'history.autosyncPush': '上传';
|
|
6052
6102
|
readonly 'history.autosyncBoth': '双向';
|
|
6053
6103
|
readonly 'history.autosyncReasonConflict': '冲突';
|
|
6104
|
+
readonly 'history.autosyncReasonBaselineAdopted': '基线已自动收养(上次推送在记录基线前被打断)';
|
|
6054
6105
|
readonly 'history.autosyncReasonNoRemote': '无远端快照';
|
|
6055
6106
|
readonly 'history.autosyncReasonNotConfigured': '未配置仓库';
|
|
6056
6107
|
readonly 'history.autosyncReasonNetwork': '网络问题';
|
|
@@ -6939,7 +6990,7 @@ declare const zh$1: {
|
|
|
6939
6990
|
type RecoveryKey = keyof typeof zh$1;
|
|
6940
6991
|
type KindKey = `history.kind.${MigrationKind}`;
|
|
6941
6992
|
type ResultKey = `history.result.${MigrationResult}`;
|
|
6942
|
-
type CommonKey = 'history.subtitle' | 'history.empty' | 'history.loading' | 'history.corruptedBanner' | 'history.corruptedCount' | 'history.stats.total' | 'history.stats.success' | 'history.stats.failed' | 'history.stats.skipped' | 'history.filter.kind' | 'history.filter.result' | 'history.filter.recent' | 'history.filter.recent.all' | 'history.filter.recent.50' | 'history.filter.recent.200' | 'history.search.placeholder' | 'history.export.json' | 'history.export.markdown' | 'history.exported' | 'history.exporting' | 'history.exportError' | 'history.refresh' | 'history.refreshError' |
|
|
6993
|
+
type CommonKey = 'history.subtitle' | 'history.empty' | 'history.loading' | 'history.corruptedBanner' | 'history.corruptedCount' | 'history.stats.total' | 'history.stats.success' | 'history.stats.failed' | 'history.stats.skipped' | 'history.filter.kind' | 'history.filter.result' | 'history.filter.recent' | 'history.filter.recent.all' | 'history.filter.recent.50' | 'history.filter.recent.200' | 'history.search.placeholder' | 'history.export.json' | 'history.export.markdown' | 'history.exported' | 'history.exporting' | 'history.exportError' | 'history.refresh' | 'history.refreshError' | 'history.retention.label' | 'history.retention.hint' | 'history.retention.unlimited' | 'history.retention.units' | 'history.retention.current' | 'history.retention.runNow' | 'history.retention.running' | 'history.retention.cleaned' | 'history.retention.noop' | 'history.retention.saveError' |
|
|
6943
6994
|
/** ⓘ 说明按钮的可访问名(与主字典 / market / sync / recovery 同口径,见 info-hint-guard t6-4) */
|
|
6944
6995
|
'common.infoHint';
|
|
6945
6996
|
type HistoryKey = KindKey | ResultKey | CommonKey;
|