dsh-config-manager 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/README.md +216 -0
  2. package/README.zh-CN.md +218 -0
  3. package/cordis.patch.yml +45 -0
  4. package/dsh.bundle.patch +21 -0
  5. package/dsh.client +39 -0
  6. package/lib/adapters/agent-presets.d.ts +13 -0
  7. package/lib/adapters/agent-presets.js +14 -0
  8. package/lib/adapters/agent-presets.js.map +1 -0
  9. package/lib/adapters/credentials.d.ts +36 -0
  10. package/lib/adapters/credentials.js +121 -0
  11. package/lib/adapters/credentials.js.map +1 -0
  12. package/lib/adapters/file-collection.d.ts +14 -0
  13. package/lib/adapters/file-collection.js +102 -0
  14. package/lib/adapters/file-collection.js.map +1 -0
  15. package/lib/adapters/index.d.ts +38 -0
  16. package/lib/adapters/index.js +46 -0
  17. package/lib/adapters/index.js.map +1 -0
  18. package/lib/adapters/mcp.d.ts +27 -0
  19. package/lib/adapters/mcp.js +175 -0
  20. package/lib/adapters/mcp.js.map +1 -0
  21. package/lib/adapters/plugin-files.d.ts +15 -0
  22. package/lib/adapters/plugin-files.js +91 -0
  23. package/lib/adapters/plugin-files.js.map +1 -0
  24. package/lib/adapters/plugins.d.ts +13 -0
  25. package/lib/adapters/plugins.js +177 -0
  26. package/lib/adapters/plugins.js.map +1 -0
  27. package/lib/adapters/prompts.d.ts +29 -0
  28. package/lib/adapters/prompts.js +228 -0
  29. package/lib/adapters/prompts.js.map +1 -0
  30. package/lib/adapters/providers.d.ts +33 -0
  31. package/lib/adapters/providers.js +143 -0
  32. package/lib/adapters/providers.js.map +1 -0
  33. package/lib/adapters/sessions.d.ts +14 -0
  34. package/lib/adapters/sessions.js +15 -0
  35. package/lib/adapters/sessions.js.map +1 -0
  36. package/lib/adapters/settings.d.ts +23 -0
  37. package/lib/adapters/settings.js +142 -0
  38. package/lib/adapters/settings.js.map +1 -0
  39. package/lib/adapters/skills.d.ts +13 -0
  40. package/lib/adapters/skills.js +14 -0
  41. package/lib/adapters/skills.js.map +1 -0
  42. package/lib/adapters/test-helpers.d.ts +99 -0
  43. package/lib/adapters/test-helpers.js +192 -0
  44. package/lib/adapters/test-helpers.js.map +1 -0
  45. package/lib/adapters/ui.d.ts +26 -0
  46. package/lib/adapters/ui.js +88 -0
  47. package/lib/adapters/ui.js.map +1 -0
  48. package/lib/adapters/workspaces.d.ts +12 -0
  49. package/lib/adapters/workspaces.js +92 -0
  50. package/lib/adapters/workspaces.js.map +1 -0
  51. package/lib/client.d.ts +377 -0
  52. package/lib/client.js +2598 -0
  53. package/lib/client.js.map +1 -0
  54. package/lib/core/analyzer.d.ts +35 -0
  55. package/lib/core/analyzer.js +563 -0
  56. package/lib/core/analyzer.js.map +1 -0
  57. package/lib/core/backup.d.ts +29 -0
  58. package/lib/core/backup.js +184 -0
  59. package/lib/core/backup.js.map +1 -0
  60. package/lib/core/exporter.d.ts +37 -0
  61. package/lib/core/exporter.js +222 -0
  62. package/lib/core/exporter.js.map +1 -0
  63. package/lib/core/importer.d.ts +42 -0
  64. package/lib/core/importer.js +25 -0
  65. package/lib/core/importer.js.map +1 -0
  66. package/lib/core/index.d.ts +12 -0
  67. package/lib/core/index.js +11 -0
  68. package/lib/core/index.js.map +1 -0
  69. package/lib/core/rollback.d.ts +9 -0
  70. package/lib/core/rollback.js +136 -0
  71. package/lib/core/rollback.js.map +1 -0
  72. package/lib/core/types.d.ts +331 -0
  73. package/lib/core/types.js +18 -0
  74. package/lib/core/types.js.map +1 -0
  75. package/lib/core/validator.d.ts +18 -0
  76. package/lib/core/validator.js +77 -0
  77. package/lib/core/validator.js.map +1 -0
  78. package/lib/index.d.ts +51 -0
  79. package/lib/index.js +875 -0
  80. package/lib/index.js.map +1 -0
  81. package/lib/migrations/index.d.ts +29 -0
  82. package/lib/migrations/index.js +56 -0
  83. package/lib/migrations/index.js.map +1 -0
  84. package/lib/migrations/v1-to-v2.d.ts +9 -0
  85. package/lib/migrations/v1-to-v2.js +10 -0
  86. package/lib/migrations/v1-to-v2.js.map +1 -0
  87. package/lib/profiles/index.d.ts +4 -0
  88. package/lib/profiles/index.js +5 -0
  89. package/lib/profiles/index.js.map +1 -0
  90. package/lib/profiles/profile-manager.d.ts +102 -0
  91. package/lib/profiles/profile-manager.js +522 -0
  92. package/lib/profiles/profile-manager.js.map +1 -0
  93. package/lib/schema/config.d.ts +28 -0
  94. package/lib/schema/config.js +136 -0
  95. package/lib/schema/config.js.map +1 -0
  96. package/lib/schema/manifest.d.ts +28 -0
  97. package/lib/schema/manifest.js +109 -0
  98. package/lib/schema/manifest.js.map +1 -0
  99. package/lib/schema/types.d.ts +169 -0
  100. package/lib/schema/types.js +8 -0
  101. package/lib/schema/types.js.map +1 -0
  102. package/lib/schema/versions.d.ts +27 -0
  103. package/lib/schema/versions.js +50 -0
  104. package/lib/schema/versions.js.map +1 -0
  105. package/lib/security/encryption.d.ts +41 -0
  106. package/lib/security/encryption.js +152 -0
  107. package/lib/security/encryption.js.map +1 -0
  108. package/lib/security/index.d.ts +16 -0
  109. package/lib/security/index.js +17 -0
  110. package/lib/security/index.js.map +1 -0
  111. package/lib/security/integrity.d.ts +30 -0
  112. package/lib/security/integrity.js +78 -0
  113. package/lib/security/integrity.js.map +1 -0
  114. package/lib/security/redaction.d.ts +26 -0
  115. package/lib/security/redaction.js +95 -0
  116. package/lib/security/redaction.js.map +1 -0
  117. package/lib/security/secret-scanner.d.ts +48 -0
  118. package/lib/security/secret-scanner.js +253 -0
  119. package/lib/security/secret-scanner.js.map +1 -0
  120. package/lib/security/zip-security.d.ts +27 -0
  121. package/lib/security/zip-security.js +154 -0
  122. package/lib/security/zip-security.js.map +1 -0
  123. package/lib/ui/conflict-view.d.ts +28 -0
  124. package/lib/ui/conflict-view.js +49 -0
  125. package/lib/ui/conflict-view.js.map +1 -0
  126. package/lib/ui/errors.d.ts +17 -0
  127. package/lib/ui/errors.js +76 -0
  128. package/lib/ui/errors.js.map +1 -0
  129. package/lib/ui/export-flow.d.ts +62 -0
  130. package/lib/ui/export-flow.js +79 -0
  131. package/lib/ui/export-flow.js.map +1 -0
  132. package/lib/ui/import-wizard.d.ts +67 -0
  133. package/lib/ui/import-wizard.js +169 -0
  134. package/lib/ui/import-wizard.js.map +1 -0
  135. package/lib/ui/path-mapping.d.ts +38 -0
  136. package/lib/ui/path-mapping.js +75 -0
  137. package/lib/ui/path-mapping.js.map +1 -0
  138. package/lib/ui/progress.d.ts +27 -0
  139. package/lib/ui/progress.js +76 -0
  140. package/lib/ui/progress.js.map +1 -0
  141. package/lib/ui/report.d.ts +21 -0
  142. package/lib/ui/report.js +146 -0
  143. package/lib/ui/report.js.map +1 -0
  144. package/lib/ui/test-helpers.d.ts +62 -0
  145. package/lib/ui/test-helpers.js +147 -0
  146. package/lib/ui/test-helpers.js.map +1 -0
  147. package/lib/ui/types.d.ts +129 -0
  148. package/lib/ui/types.js +21 -0
  149. package/lib/ui/types.js.map +1 -0
  150. package/lib/utils/hashing.d.ts +17 -0
  151. package/lib/utils/hashing.js +41 -0
  152. package/lib/utils/hashing.js.map +1 -0
  153. package/lib/utils/json.d.ts +24 -0
  154. package/lib/utils/json.js +76 -0
  155. package/lib/utils/json.js.map +1 -0
  156. package/lib/utils/logger.d.ts +39 -0
  157. package/lib/utils/logger.js +82 -0
  158. package/lib/utils/logger.js.map +1 -0
  159. package/lib/utils/paths.d.ts +31 -0
  160. package/lib/utils/paths.js +132 -0
  161. package/lib/utils/paths.js.map +1 -0
  162. package/lib/utils/zip.d.ts +54 -0
  163. package/lib/utils/zip.js +285 -0
  164. package/lib/utils/zip.js.map +1 -0
  165. package/package.json +109 -0
  166. package/src/adapters/agent-presets.ts +14 -0
  167. package/src/adapters/credentials.test.ts +90 -0
  168. package/src/adapters/credentials.ts +141 -0
  169. package/src/adapters/file-collection.ts +110 -0
  170. package/src/adapters/files.test.ts +113 -0
  171. package/src/adapters/index.ts +69 -0
  172. package/src/adapters/mcp.test.ts +96 -0
  173. package/src/adapters/mcp.ts +181 -0
  174. package/src/adapters/plugin-files.ts +96 -0
  175. package/src/adapters/plugins.test.ts +72 -0
  176. package/src/adapters/plugins.ts +176 -0
  177. package/src/adapters/prompts.test.ts +110 -0
  178. package/src/adapters/prompts.ts +226 -0
  179. package/src/adapters/providers.test.ts +125 -0
  180. package/src/adapters/providers.ts +161 -0
  181. package/src/adapters/roundtrip.test.ts +188 -0
  182. package/src/adapters/sessions.ts +15 -0
  183. package/src/adapters/settings.test.ts +93 -0
  184. package/src/adapters/settings.ts +165 -0
  185. package/src/adapters/skills.ts +14 -0
  186. package/src/adapters/test-helpers.ts +207 -0
  187. package/src/adapters/ui.test.ts +56 -0
  188. package/src/adapters/ui.ts +106 -0
  189. package/src/adapters/workspaces.test.ts +79 -0
  190. package/src/adapters/workspaces.ts +95 -0
  191. package/src/client/CLIENT_DEPENDENCIES.md +101 -0
  192. package/src/client/ConfigManagerSection.tsx +60 -0
  193. package/src/client/api.ts +270 -0
  194. package/src/client/client-types.ts +27 -0
  195. package/src/client/common/ErrorBanner.tsx +68 -0
  196. package/src/client/common/ProgressBar.tsx +49 -0
  197. package/src/client/common/ReportView.tsx +117 -0
  198. package/src/client/common/ui.tsx +165 -0
  199. package/src/client/config-manager.module.css +759 -0
  200. package/src/client/css-modules.d.ts +8 -0
  201. package/src/client/export/ExportView.tsx +222 -0
  202. package/src/client/import/ConflictList.tsx +72 -0
  203. package/src/client/import/ImportWizardView.tsx +406 -0
  204. package/src/client/import/PathMappingForm.tsx +77 -0
  205. package/src/client/index.ts +65 -0
  206. package/src/client/locales.ts +182 -0
  207. package/src/core/analyzer.ts +631 -0
  208. package/src/core/backup.ts +212 -0
  209. package/src/core/exporter.ts +246 -0
  210. package/src/core/importer.ts +66 -0
  211. package/src/core/index.ts +39 -0
  212. package/src/core/rollback.ts +140 -0
  213. package/src/core/smoke.test.ts +717 -0
  214. package/src/core/types.ts +343 -0
  215. package/src/core/validator.ts +84 -0
  216. package/src/index.ts +942 -0
  217. package/src/migrations/index.ts +71 -0
  218. package/src/migrations/v1-to-v2.ts +17 -0
  219. package/src/profiles/index.ts +8 -0
  220. package/src/profiles/profile-manager.test.ts +280 -0
  221. package/src/profiles/profile-manager.ts +606 -0
  222. package/src/schema/config.ts +137 -0
  223. package/src/schema/manifest.ts +124 -0
  224. package/src/schema/types.ts +179 -0
  225. package/src/schema/versions.ts +55 -0
  226. package/src/security/encryption.ts +180 -0
  227. package/src/security/index.ts +16 -0
  228. package/src/security/integrity.ts +102 -0
  229. package/src/security/redaction.ts +101 -0
  230. package/src/security/secret-scanner.ts +275 -0
  231. package/src/security/security.test.ts +796 -0
  232. package/src/security/zip-security.ts +180 -0
  233. package/src/ui/conflict-view.test.ts +62 -0
  234. package/src/ui/conflict-view.ts +65 -0
  235. package/src/ui/errors.test.ts +44 -0
  236. package/src/ui/errors.ts +95 -0
  237. package/src/ui/export-flow.test.ts +75 -0
  238. package/src/ui/export-flow.ts +128 -0
  239. package/src/ui/import-wizard.test.ts +128 -0
  240. package/src/ui/import-wizard.ts +208 -0
  241. package/src/ui/path-mapping.test.ts +67 -0
  242. package/src/ui/path-mapping.ts +103 -0
  243. package/src/ui/progress.test.ts +42 -0
  244. package/src/ui/progress.ts +90 -0
  245. package/src/ui/report.test.ts +93 -0
  246. package/src/ui/report.ts +140 -0
  247. package/src/ui/test-helpers.ts +177 -0
  248. package/src/ui/types.ts +193 -0
  249. package/src/utils/hashing.ts +53 -0
  250. package/src/utils/json.ts +77 -0
  251. package/src/utils/logger.ts +114 -0
  252. package/src/utils/paths.ts +122 -0
  253. package/src/utils/zip.ts +332 -0
@@ -0,0 +1,377 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "dsh-config-manager",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+
7
+ import { ClientContext } from "@deepseek-ai/dsh-client-runtime/client";
8
+ import { PropsRuntime, TranslateNS } from "@deepseek-ai/dsh-client-ui-slots";
9
+
10
+ //#region src/schema/types.d.ts
11
+ /**
12
+ * 核心领域类型(Export Schema v1 的纯类型定义)。
13
+ *
14
+ * 对齐 Docs/design/architecture.md §13.1 —— m3/m5 的共同契约。
15
+ * 本文件只含与 DSH 运行时无关的纯数据形状;DSH Service 门面类型见 src/core/types.ts。
16
+ */
17
+ /** 运行平台(等价 NodeJS.Platform,但保持类型自包含,可在浏览器侧引用) */
18
+ type Platform = 'win32' | 'darwin' | 'linux' | 'freebsd' | 'openbsd' | 'aix' | 'sunos' | 'android' | 'cygwin' | 'haiku' | 'netbsd' | 'other';
19
+ /**
20
+ * 分区标识,与 ZIP 目录结构、manifest.sections 键一一对应。
21
+ * 明确不实现的分区(keybindings/workflows/commands/rules)不在此列。
22
+ */
23
+ type SectionId = 'settings' | 'ui' | 'providers' | 'plugins' | 'mcp' | 'prompts' | 'skills' | 'agentPresets' | 'workspaces' | 'pluginFiles' | 'credentialsStatus' | 'secrets' | 'sessions';
24
+ /** 加密备份的算法参数(非秘密:salt/iv/authTag 仅用于解密与完整性校验) */
25
+ interface EncryptionInfo {
26
+ algorithm: 'aes-256-gcm';
27
+ kdf: 'scrypt';
28
+ kdfParams: {
29
+ N: number;
30
+ r: number;
31
+ p: number;
32
+ keyLength: number;
33
+ };
34
+ salt: string;
35
+ iv: string;
36
+ authTag: string;
37
+ version: number;
38
+ }
39
+ /** 每个导出 ZIP 根部的 manifest.json */
40
+ interface Manifest {
41
+ schemaVersion: number;
42
+ exporter: {
43
+ name: string;
44
+ version: string;
45
+ };
46
+ source: {
47
+ dshVersion: string;
48
+ platform: Platform;
49
+ arch: string;
50
+ };
51
+ exportedAt: string;
52
+ sections: Record<SectionId, boolean>;
53
+ security: {
54
+ containsSecrets: boolean;
55
+ encrypted: boolean;
56
+ encryption: EncryptionInfo | null;
57
+ };
58
+ }
59
+ //#endregion
60
+ //#region src/core/types.d.ts
61
+ interface ExportOptions {
62
+ /** 是否包含真实秘密(必须配合 encryption 提供者;缺省 false = 只导状态) */
63
+ includeSecrets: boolean;
64
+ /** 仅导出指定分区(缺省 = 全部默认包含分区) */
65
+ only?: SectionId[];
66
+ /** 导出文件路径(缺省自动生成 dsh-config-<date>.zip) */
67
+ outPath?: string;
68
+ }
69
+ type PlanItemKind = 'Create' | 'Update' | 'Skip' | 'Conflict' | 'Install' | 'MissingSecret' | 'MissingDependency' | 'PathMapping' | 'Warning' | 'Error';
70
+ type ItemResolution = 'keepCurrent' | 'useImported' | 'review';
71
+ type GlobalConflictStrategy = 'merge' | 'replace' | 'skipExisting';
72
+ interface ConflictDecision {
73
+ itemId: string;
74
+ resolution: ItemResolution;
75
+ }
76
+ interface PathMapping {
77
+ oldPrefix: string;
78
+ newPrefix: string;
79
+ appliesTo: ('workspaces' | 'mcp' | 'pluginConfig' | 'skills')[];
80
+ }
81
+ interface PathIssue {
82
+ kind: 'missing' | 'platformMismatch' | 'homeMismatch';
83
+ value: string;
84
+ mappedTo?: string;
85
+ }
86
+ interface SnapshotTarget {
87
+ adapter: SectionId;
88
+ ref: string;
89
+ }
90
+ interface PlanItem {
91
+ id: string;
92
+ kind: PlanItemKind;
93
+ adapter: SectionId;
94
+ description: string;
95
+ detail?: string;
96
+ severity: 'info' | 'warning' | 'error';
97
+ conflict?: ConflictDecision;
98
+ pathMapping?: PathMapping;
99
+ missingDependency?: string;
100
+ target?: SnapshotTarget;
101
+ }
102
+ interface ImportAnalysis {
103
+ valid: boolean;
104
+ errors: string[];
105
+ warnings: string[];
106
+ compatibility: 'excellent' | 'good' | 'partial' | 'unsupported';
107
+ sectionsInZip: SectionId[];
108
+ pluginSummary: {
109
+ installed: number;
110
+ toInstall: number;
111
+ };
112
+ pathIssues: PathIssue[];
113
+ secretCount: number;
114
+ dependencyIssues: {
115
+ item: string;
116
+ dependency: string;
117
+ }[];
118
+ }
119
+ interface ImportDecisions {
120
+ strategy: GlobalConflictStrategy;
121
+ resolutions: Record<string, ItemResolution>;
122
+ pathMappings: PathMapping[];
123
+ }
124
+ interface ImportPlan {
125
+ items: PlanItem[];
126
+ globalStrategy: GlobalConflictStrategy;
127
+ pathMappings: PathMapping[];
128
+ missingSecrets: {
129
+ ref: string;
130
+ required: boolean;
131
+ }[];
132
+ needsRestart: boolean;
133
+ estimatedActions: Record<SectionId, number>;
134
+ }
135
+ interface ExecutedItem {
136
+ itemId: string;
137
+ status: 'ok' | 'skipped' | 'failed';
138
+ message?: string;
139
+ }
140
+ interface ImportResult {
141
+ ok: boolean;
142
+ executed: ExecutedItem[];
143
+ needsRestart: boolean;
144
+ missingSecrets: string[];
145
+ warnings: string[];
146
+ rollback: RollbackReport | null;
147
+ snapshotId: string | null;
148
+ }
149
+ interface RollbackReport {
150
+ full: boolean;
151
+ restored: string[];
152
+ failed: {
153
+ item: string;
154
+ reason: string;
155
+ manualHint?: string;
156
+ }[];
157
+ }
158
+ interface ExportReport {
159
+ included: {
160
+ section: SectionId;
161
+ counts: Record<string, number>;
162
+ }[];
163
+ excluded: SectionId[];
164
+ security: {
165
+ secretsExcluded: boolean;
166
+ containsSecrets: boolean;
167
+ encrypted: boolean;
168
+ redactedHits: number;
169
+ };
170
+ file: {
171
+ name: string;
172
+ sizeBytes: number;
173
+ };
174
+ warnings: string[];
175
+ }
176
+ //#endregion
177
+ //#region src/client/api.d.ts
178
+ /** Host 半健康检查响应(plugin 版本 / DSH 版本 / 平台,用于主页横幅与兼容性说明) */
179
+ interface ServiceStatus {
180
+ ready: boolean;
181
+ pluginVersion: string;
182
+ dshVersion: string;
183
+ platform: string;
184
+ arch: string;
185
+ }
186
+ /** export 端点响应(对齐 ExportFlow 的 ExportRunResult 前半部分) */
187
+ interface ExportResponse {
188
+ zipPath: string;
189
+ manifest: Manifest;
190
+ report: ExportReport;
191
+ }
192
+ /** upload 端点响应:Host 把用户上传的 ZIP 存入受控临时目录,返回可被 analyze/plan/execute 引用的路径 */
193
+ interface UploadResponse {
194
+ zipPath: string;
195
+ name: string;
196
+ sizeBytes: number;
197
+ }
198
+ /** 携带路由 JSON error 消息的错误类型 */
199
+ declare class ConfigManagerApiError extends Error {
200
+ constructor(message: string);
201
+ }
202
+ /** 导出下载结果(流式落盘或内存 Blob 兜底) */
203
+ interface DownloadResult {
204
+ blob?: Blob;
205
+ filename: string;
206
+ streamed: boolean;
207
+ bytes: number;
208
+ }
209
+ /**
210
+ * Config Manager 浏览器半的唯一数据入口。
211
+ * 同时实现 `ExportPort`(export-flow 用)与 `ImportPort`(import-wizard 用)。
212
+ */
213
+ declare class ConfigManagerApi {
214
+ /**
215
+ * 加密备份密码(仅内存,默认 null = 普通备份)。
216
+ * ExportView 在 run 前设置;export 请求体携带给 Host 半做 AES-256-GCM 加密。
217
+ * 绝不写入 manifest / 任何 DSH 配置 / localStorage。
218
+ */
219
+ exportPassword: string | null;
220
+ /** 健康/版本检查(主页横幅:插件版本 / DSH 版本 / 平台) */
221
+ status(): Promise<ServiceStatus>;
222
+ /** ExportPort.export:调用 Host 侧导出编排(core Exporter)。加密密码随请求体传输(仅内存)。 */
223
+ export(options: ExportOptions): Promise<ExportResponse>;
224
+ /**
225
+ * 把导出的 ZIP 下载到本机。优先 File System Access API 流式落盘
226
+ * (不占整文件内存),不可用时回退内存 Blob(dsh-ssh downloadFile 同款策略)。
227
+ */
228
+ download(zipPath: string, onProgress?: (received: number, total: number) => void): Promise<DownloadResult>;
229
+ /** 上传用户选择的 ZIP 到 Host 受控临时目录,返回可引用的 zipPath(dsh-ssh 同款原始字节上传) */
230
+ upload(file: File): Promise<UploadResponse>;
231
+ /** ImportPort.analyzeImport:零写入分析(校验/兼容性/差异/路径/秘密检测) */
232
+ analyzeImport(zipPath: string): Promise<ImportAnalysis>;
233
+ /** ImportPort.createImportPlan:用用户决策(冲突/路径映射/策略)生成最终计划(Dry Run 零写入) */
234
+ createImportPlan(zipPath: string, decisions: ImportDecisions): Promise<ImportPlan>;
235
+ /** ImportPort.executeImportPlan:快照→分阶段 apply→validate→commit/rollback */
236
+ executeImportPlan(zipPath: string, plan: ImportPlan, opts: {
237
+ confirm: boolean;
238
+ secretInputs?: Record<string, string>;
239
+ rollbackOnError: boolean;
240
+ }): Promise<ImportResult>;
241
+ }
242
+ //#endregion
243
+ //#region src/client/client-types.d.ts
244
+ /** 本插件 Client 半的注入业务面:每个 settings.section 注册项都拿到同一个 api 实例 */
245
+ interface ConfigManagerSectionInjected {
246
+ api: ConfigManagerApi;
247
+ }
248
+ //#endregion
249
+ //#region src/client/locales.d.ts
250
+ /**
251
+ * Config Manager 表面文案:zh 为源语言,en 镜像每个键。
252
+ * 字典 namespace 由 client/index.ts 注册(declare module 合并进 LocaleNamespaceMap)。
253
+ * 键集合通过 `ConfigManagerKey` 类型在注册处做编译期校验(缺键/多键即编译错误)。
254
+ */
255
+ declare const zh: {
256
+ readonly 'section.label': "备份与迁移";
257
+ readonly 'section.description': "导出 / 导入 / 迁移 DSH 配置(备份不含密钥,加密备份可选)";
258
+ readonly 'view.export': "导出备份";
259
+ readonly 'view.import': "导入恢复";
260
+ readonly 'common.close': "关闭";
261
+ readonly 'common.cancel': "取消";
262
+ readonly 'common.back': "上一步";
263
+ readonly 'common.next': "下一步";
264
+ readonly 'common.done': "完成";
265
+ readonly 'common.retry': "重试";
266
+ readonly 'common.confirm': "确认";
267
+ readonly 'common.loading': "加载中…";
268
+ readonly 'common.unknownError': "未知错误";
269
+ readonly 'status.ready': "Config Manager 已就绪(插件 {version} · DSH {dsh} · {platform})";
270
+ readonly 'status.unavailable': "Config Manager 服务未就绪,请确认插件已正确挂载。";
271
+ readonly 'export.mode.quick': "快速导出";
272
+ readonly 'export.mode.quickHint': "一键导出推荐分区(可迁移、不含设备专属数据),适合常规备份。";
273
+ readonly 'export.mode.custom': "自定义导出";
274
+ readonly 'export.mode.customHint': "按分组逐项勾选要导出的分区。";
275
+ readonly 'export.includeSecrets': "包含真实密钥(加密备份)";
276
+ readonly 'export.includeSecretsHint': "勾选后导出将包含密钥,并以密码加密(AES-256-GCM)。密码仅用于本次加密,不会写入备份或任何配置文件。";
277
+ readonly 'export.password': "备份加密密码";
278
+ readonly 'export.passwordConfirm': "确认密码";
279
+ readonly 'export.passwordMismatch': "两次输入的密码不一致";
280
+ readonly 'export.passwordRequired': "包含密钥时必须设置加密密码";
281
+ readonly 'export.run': "开始导出";
282
+ readonly 'export.running': "正在导出…";
283
+ readonly 'export.download': "下载备份文件";
284
+ readonly 'export.selectionWarnings': "以下分区为设备相关数据,跨设备导入时可能不适用:";
285
+ readonly 'export.group.unknown': "其他";
286
+ readonly 'export.included': "已包含";
287
+ readonly 'export.excluded': "未包含";
288
+ readonly 'import.select.title': "选择备份文件";
289
+ readonly 'import.select.hint': "选择本机导出的 dsh-config-*.zip 备份文件开始导入。分析阶段只读,不会修改任何配置。";
290
+ readonly 'import.select.browse': "选择 ZIP 文件";
291
+ readonly 'import.select.file': "已选择:{name}";
292
+ readonly 'import.analyzing': "正在分析备份…";
293
+ readonly 'import.compatibility.title': "兼容性";
294
+ readonly 'import.compatibility.score': "兼容性评分:{score}";
295
+ readonly 'import.compatibility.ok': "备份可导入";
296
+ readonly 'import.compatibility.fail': "备份分析失败:{reason}";
297
+ readonly 'import.preview.title': "导入预览";
298
+ readonly 'import.preview.willChange': "将变更 {count} 项";
299
+ readonly 'import.preview.unchanged': "已一致跳过 {count} 项";
300
+ readonly 'import.preview.settings': "设置更新 {count}";
301
+ readonly 'import.preview.plugins': "插件待安装 {count}";
302
+ readonly 'import.preview.mcp': "MCP 新增 {count}";
303
+ readonly 'import.preview.prompts': "提示词 {count}";
304
+ readonly 'import.preview.paths': "路径映射 {count}";
305
+ readonly 'import.preview.secrets': "密钥待补录 {count}";
306
+ readonly 'import.preview.conflicts': "冲突 {count}";
307
+ readonly 'import.preview.restart': "导入后需重启 DSH 生效";
308
+ readonly 'import.confirm.execute': "确认导入";
309
+ readonly 'import.confirm.warning': "导入将修改当前 DSH 配置;执行前会自动创建安全快照,失败时整体回滚。";
310
+ readonly 'import.rollbackOnError': "失败时整体回滚(推荐)";
311
+ readonly 'import.importing': "正在导入…";
312
+ readonly 'import.secrets.title': "补录密钥";
313
+ readonly 'import.secrets.hint': "以下凭据未随备份导出(安全设计)。如需在目标 DSH 使用,请手动补录;留空将跳过。";
314
+ readonly 'import.secrets.optional': "(可选)";
315
+ readonly 'import.secrets.required': "(必需)";
316
+ readonly 'import.conflicts.title': "解决冲突";
317
+ readonly 'import.conflicts.hint': "以下配置项在目标 DSH 已存在且与备份不同,请逐项决策。";
318
+ readonly 'import.conflicts.keepCurrent': "保留当前";
319
+ readonly 'import.conflicts.useImported': "使用备份";
320
+ readonly 'import.conflicts.review': "稍后决定";
321
+ readonly 'import.conflicts.unresolved': "还有 {count} 项未决策";
322
+ readonly 'import.paths.title': "路径映射";
323
+ readonly 'import.paths.hint': "备份中的绝对路径在目标机器可能不存在,请为每条路径指定新位置(留空将跳过该路径)。";
324
+ readonly 'import.paths.old': "原路径";
325
+ readonly 'import.paths.new': "新路径";
326
+ readonly 'import.paths.unresolved': "还有 {count} 条路径未映射";
327
+ readonly 'report.export.title': "导出完成";
328
+ readonly 'report.import.title': "导入结果";
329
+ readonly 'report.rollback.title': "回滚报告";
330
+ readonly 'report.action.fixIssues': "查看失败项";
331
+ readonly 'report.action.viewDetails': "查看详情";
332
+ readonly 'report.action.done': "完成";
333
+ readonly 'report.needsRestart': "插件 / MCP 变更将在重启 DSH 后生效。";
334
+ readonly 'error.title': "操作失败";
335
+ readonly 'error.hint': "错误消息已自动脱敏,不会泄露任何密钥信息。";
336
+ };
337
+ /** 字典键联合(注册处 compile-time 校验) */
338
+ type ConfigManagerKey = keyof typeof zh;
339
+ //#endregion
340
+ //#region src/client/ConfigManagerSection.d.ts
341
+ type ConfigManagerSectionProps = PropsRuntime<'settings.section'> & ConfigManagerSectionInjected & {
342
+ t: TranslateNS<'config-manager'>;
343
+ };
344
+ //#endregion
345
+ //#region src/client/export/ExportView.d.ts
346
+ interface ExportViewProps {
347
+ api: ConfigManagerApi;
348
+ t: TranslateNS<'config-manager'>;
349
+ }
350
+ //#endregion
351
+ //#region src/client/import/ImportWizardView.d.ts
352
+ interface ImportWizardViewProps {
353
+ api: ConfigManagerApi;
354
+ t: TranslateNS<'config-manager'>;
355
+ }
356
+ //#endregion
357
+ //#region src/client/index.d.ts
358
+ declare module '@deepseek-ai/dsh-client-ui-slots' {
359
+ interface LocaleNamespaceMap {
360
+ /** Config Manager 表面文案。 */
361
+ 'config-manager': ConfigManagerKey;
362
+ }
363
+ }
364
+ /** 必需服务(fiber inject 等待 —— slots/locale 必须先就绪)。 */
365
+ declare const inject: string[];
366
+ /**
367
+ * 注册 Config Manager 设置页。
368
+ * @param ctx - client root context(slots + locale 服务)。
369
+ */
370
+ declare function apply(ctx: ClientContext): void;
371
+ //#endregion
372
+ export { type ConfigManagerApiError, type ConfigManagerKey, type ConfigManagerSectionProps, type DownloadResult, type ExportViewProps, type ImportWizardViewProps, type ServiceStatus, type UploadResponse, apply, inject };
373
+
374
+ return module.exports;
375
+ }
376
+ });
377
+ //# sourceMappingURL=client.d.ts.map