dsh-config-manager 0.4.3 → 0.6.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 (286) hide show
  1. package/README.md +10 -0
  2. package/README.zh-CN.md +10 -0
  3. package/lib/adapters/mcp.d.ts +9 -0
  4. package/lib/adapters/mcp.js +37 -0
  5. package/lib/adapters/plugins.js +10 -2
  6. package/lib/adapters/pnpm-workspace.js +1 -1
  7. package/lib/adapters/self.d.ts +2 -0
  8. package/lib/adapters/self.js +18 -2
  9. package/lib/adapters/workspaces.js +1 -1
  10. package/lib/cli/restore-resume.js +1 -1
  11. package/lib/cli/web/page.js +2 -2
  12. package/lib/client.d.ts +17 -41
  13. package/lib/client.js +946 -761
  14. package/lib/core/backup.d.ts +11 -0
  15. package/lib/core/backup.js +27 -0
  16. package/lib/core/env-lock-lifecycle.d.ts +17 -3
  17. package/lib/core/env-lock-lifecycle.js +38 -0
  18. package/lib/core/external-failure.d.ts +9 -0
  19. package/lib/core/external-failure.js +50 -0
  20. package/lib/core/local-plugin-host.d.ts +9 -7
  21. package/lib/core/local-plugin-host.js +109 -15
  22. package/lib/core/local-plugin-pack.d.ts +20 -0
  23. package/lib/core/local-plugin-pack.js +18 -3
  24. package/lib/core/mcp-connector-store.d.ts +13 -0
  25. package/lib/core/mcp-connector-store.js +16 -1
  26. package/lib/core/messages-core.d.ts +45 -0
  27. package/lib/core/messages-core.js +92 -0
  28. package/lib/core/messages.d.ts +5 -0
  29. package/lib/core/messages.js +14 -0
  30. package/lib/core/migration-history.d.ts +40 -0
  31. package/lib/core/migration-history.js +55 -0
  32. package/lib/core/model-tool-plans.d.ts +66 -0
  33. package/lib/core/model-tool-plans.js +128 -0
  34. package/lib/core/model-tools.d.ts +96 -8
  35. package/lib/core/model-tools.js +568 -31
  36. package/lib/core/phase3-host.js +10 -2
  37. package/lib/core/plugin-cli.d.ts +5 -0
  38. package/lib/core/plugin-cli.js +11 -3
  39. package/lib/core/plugin-data-registry.d.ts +1 -1
  40. package/lib/core/plugin-data-registry.js +1 -1
  41. package/lib/core/restore-plan-fingerprint.d.ts +2 -0
  42. package/lib/core/restore-plan-fingerprint.js +18 -0
  43. package/lib/core/restore-resume.d.ts +1 -1
  44. package/lib/core/restore-resume.js +1 -1
  45. package/lib/core/restore.d.ts +5 -0
  46. package/lib/core/restore.js +4 -1
  47. package/lib/core/types.d.ts +12 -0
  48. package/lib/foreign/claude-sessions.d.ts +1 -1
  49. package/lib/foreign/claude-sessions.js +1 -1
  50. package/lib/foreign/registry.js +1 -1
  51. package/lib/foreign/types.d.ts +1 -1
  52. package/lib/index.d.ts +19 -15
  53. package/lib/index.js +72 -80
  54. package/lib/market/git-file-writer.js +1 -1
  55. package/lib/market/github-repos.js +1 -1
  56. package/lib/market/market-config.js +1 -1
  57. package/lib/market/messages-market.js +1 -1
  58. package/lib/market/my-repo.js +1 -1
  59. package/lib/market/prepare.js +1 -1
  60. package/lib/market/reader.js +2 -2
  61. package/lib/market/repo-url.d.ts +1 -1
  62. package/lib/market/security.js +2 -2
  63. package/lib/market/star-cache.d.ts +1 -1
  64. package/lib/market/types.d.ts +1 -1
  65. package/lib/market/types.js +1 -1
  66. package/lib/market/url.js +1 -1
  67. package/lib/profiles/dsh-profile-manager.d.ts +1 -1
  68. package/lib/profiles/dsh-profile-manager.js +26 -7
  69. package/lib/profiles/dsh-profile-shared.d.ts +3 -1
  70. package/lib/routes/backup.js +17 -9
  71. package/lib/routes/index.d.ts +1 -1
  72. package/lib/routes/kit.d.ts +2 -2
  73. package/lib/routes/market.d.ts +1 -1
  74. package/lib/routes/market.js +3 -60
  75. package/lib/routes/model-tools-deps.d.ts +41 -0
  76. package/lib/routes/model-tools-deps.js +18 -0
  77. package/lib/routes/recovery.js +5 -3
  78. package/lib/routes/route-support.d.ts +18 -26
  79. package/lib/routes/route-support.js +19 -32
  80. package/lib/routes/snapshots.d.ts +1 -1
  81. package/lib/routes/snapshots.js +4 -40
  82. package/lib/routes/sync.js +40 -28
  83. package/lib/schema/index.d.ts +2 -2
  84. package/lib/schema/index.js +2 -2
  85. package/lib/schema/section-registry.d.ts +5 -3
  86. package/lib/schema/section-registry.js +7 -3
  87. package/lib/security/secret-scanner.js +1 -1
  88. package/lib/sync/apply-bundle.d.ts +50 -0
  89. package/lib/sync/apply-bundle.js +60 -0
  90. package/lib/sync/autosync-scheduler.d.ts +9 -0
  91. package/lib/sync/autosync-scheduler.js +118 -89
  92. package/lib/sync/backup-scheduler.js +5 -4
  93. package/lib/sync/blob-store.d.ts +2 -2
  94. package/lib/sync/git/git-transport.d.ts +12 -0
  95. package/lib/sync/git/git-transport.js +50 -2
  96. package/lib/sync/merge.d.ts +2 -0
  97. package/lib/sync/merge.js +28 -0
  98. package/lib/sync/messages.d.ts +4 -0
  99. package/lib/sync/messages.js +9 -2
  100. package/lib/sync/s3/s3-transport.d.ts +1 -1
  101. package/lib/sync/s3/s3-transport.js +1 -1
  102. package/lib/sync/sync-engine.d.ts +4 -4
  103. package/lib/sync/sync-engine.js +25 -26
  104. package/lib/sync/sync-scope-boot.d.ts +34 -0
  105. package/lib/sync/sync-scope-boot.js +71 -0
  106. package/lib/sync/sync-scope.d.ts +103 -0
  107. package/lib/sync/sync-scope.js +229 -0
  108. package/lib/sync/sync-selection.d.ts +17 -4
  109. package/lib/sync/sync-selection.js +40 -14
  110. package/lib/sync/transport.d.ts +4 -1
  111. package/lib/sync/transport.js +6 -0
  112. package/lib/sync/webdav/webdav-transport.js +1 -1
  113. package/lib/sync/workspace-merge.d.ts +36 -0
  114. package/lib/sync/workspace-merge.js +152 -0
  115. package/lib/ui/backup-schedule.d.ts +13 -2
  116. package/lib/ui/backup-schedule.js +3 -0
  117. package/lib/ui/snapshots-view.d.ts +16 -0
  118. package/lib/ui/snapshots-view.js +21 -0
  119. package/lib/ui/sync-repository-picker.d.ts +21 -0
  120. package/lib/ui/sync-repository-picker.js +18 -0
  121. package/lib/utils/env-lock.d.ts +96 -0
  122. package/lib/utils/env-lock.js +332 -111
  123. package/lib/utils/messages-utils.d.ts +6 -0
  124. package/lib/utils/messages-utils.js +17 -1
  125. package/lib/utils/patch-yaml.js +1 -1
  126. package/lib/utils/remove-tree.d.ts +7 -0
  127. package/lib/utils/remove-tree.js +265 -0
  128. package/lib/utils/zip.js +1 -1
  129. package/package.json +3 -2
  130. package/src/adapters/mcp.test.ts +28 -0
  131. package/src/adapters/mcp.ts +33 -0
  132. package/src/adapters/plugins.test.ts +49 -0
  133. package/src/adapters/plugins.ts +9 -1
  134. package/src/adapters/pnpm-workspace.ts +1 -1
  135. package/src/adapters/self.test.ts +39 -1
  136. package/src/adapters/self.ts +20 -2
  137. package/src/adapters/workspaces.ts +1 -1
  138. package/src/cli/restore-resume.ts +1 -1
  139. package/src/cli/web/page.ts +2 -2
  140. package/src/client/about/AboutPanel.tsx +1 -1
  141. package/src/client/about/about-view.test.ts +1 -1
  142. package/src/client/about/about-view.ts +1 -1
  143. package/src/client/api.ts +1 -6
  144. package/src/client/chat/chat-entry-view.test.ts +1 -1
  145. package/src/client/chat/chat-slots.ts +1 -1
  146. package/src/client/chat/rollback-diff-tab.ts +1 -1
  147. package/src/client/client-types.ts +1 -1
  148. package/src/client/common/routes.ts +1 -5
  149. package/src/client/config-manager.module.css +21 -1
  150. package/src/client/css-scale-guard.test.ts +1 -1
  151. package/src/client/environment/EnvironmentPanel.tsx +2 -2
  152. package/src/client/home/HomePanel.tsx +3 -0
  153. package/src/client/library/ArtifactRow.tsx +14 -2
  154. package/src/client/library/LibraryPanel.tsx +44 -0
  155. package/src/client/locales/overview.ts +10 -2
  156. package/src/client/locales/profiles.ts +2 -0
  157. package/src/client/locales/sessions.ts +3 -0
  158. package/src/client/market/MyConfigsView.tsx +1 -1
  159. package/src/client/market/market-api.ts +2 -14
  160. package/src/client/market/market-locales.ts +1 -1
  161. package/src/client/market/market-view.ts +3 -3
  162. package/src/client/market/my-configs-api.ts +1 -1
  163. package/src/client/market/my-configs-view.ts +1 -1
  164. package/src/client/recovery/recovery-locales.test.ts +1 -1
  165. package/src/client/run-store.ts +1 -1
  166. package/src/client/sync/ChannelConfigDialog.tsx +32 -1
  167. package/src/client/sync/SyncPanel.tsx +11 -30
  168. package/src/client/sync/SyncRepositoryPicker.tsx +34 -13
  169. package/src/client/sync/SyncSectionPickerDialog.tsx +0 -5
  170. package/src/client/sync/SyncSettingsView.test.ts +32 -0
  171. package/src/client/sync/config-save-state.test.ts +99 -0
  172. package/src/client/sync/config-save-state.ts +69 -0
  173. package/src/client/sync/history-model.test.ts +28 -7
  174. package/src/client/sync/history-model.ts +6 -3
  175. package/src/client/sync/sync-locales.ts +14 -4
  176. package/src/client/sync/sync-view.ts +1 -1
  177. package/src/core/analyzer-cache.test.ts +1 -1
  178. package/src/core/backup.test.ts +45 -1
  179. package/src/core/backup.ts +25 -0
  180. package/src/core/disk-usage.test.ts +2 -0
  181. package/src/core/engine-locale.test.ts +4 -0
  182. package/src/core/env-lock-lifecycle.ts +33 -3
  183. package/src/core/external-failure.test.ts +60 -0
  184. package/src/core/external-failure.ts +54 -0
  185. package/src/core/integrity-extra-entries.test.ts +1 -1
  186. package/src/core/local-plugin-host.test.ts +134 -0
  187. package/src/core/local-plugin-host.ts +122 -17
  188. package/src/core/local-plugin-pack.ts +39 -3
  189. package/src/core/mcp-connector-store.ts +26 -1
  190. package/src/core/messages-core.ts +94 -0
  191. package/src/core/messages.ts +14 -0
  192. package/src/core/migration-history.test.ts +65 -0
  193. package/src/core/migration-history.ts +70 -0
  194. package/src/core/model-tool-plans.test.ts +111 -0
  195. package/src/core/model-tool-plans.ts +170 -0
  196. package/src/core/model-tools.test.ts +212 -12
  197. package/src/core/model-tools.ts +710 -38
  198. package/src/core/phase3-host.ts +10 -2
  199. package/src/core/phase3-production-integration.test.ts +43 -0
  200. package/src/core/plugin-cli.fs.test.ts +30 -3
  201. package/src/core/plugin-cli.ts +11 -3
  202. package/src/core/plugin-data-registry.ts +1 -1
  203. package/src/core/restore-plan-fingerprint.ts +19 -0
  204. package/src/core/restore-resume.ts +1 -1
  205. package/src/core/restore.ts +9 -1
  206. package/src/core/types.ts +12 -0
  207. package/src/foreign/claude-sessions.ts +3 -3
  208. package/src/foreign/registry.ts +1 -1
  209. package/src/foreign/types.ts +1 -1
  210. package/src/index.ts +102 -111
  211. package/src/market/git-file-writer.ts +1 -1
  212. package/src/market/github-repos.test.ts +1 -1
  213. package/src/market/github-repos.ts +1 -1
  214. package/src/market/market-config.ts +1 -1
  215. package/src/market/messages-market.ts +1 -1
  216. package/src/market/my-repo.test.ts +1 -1
  217. package/src/market/my-repo.ts +1 -1
  218. package/src/market/prepare.test.ts +1 -1
  219. package/src/market/prepare.ts +1 -1
  220. package/src/market/reader.ts +2 -2
  221. package/src/market/repo-url.ts +1 -1
  222. package/src/market/security.ts +2 -2
  223. package/src/market/star-cache.ts +1 -1
  224. package/src/market/types.ts +1 -1
  225. package/src/market/url.test.ts +1 -1
  226. package/src/market/url.ts +1 -1
  227. package/src/profiles/dsh-profile-copy-rollback.test.ts +1 -1
  228. package/src/profiles/dsh-profile-manager.test.ts +20 -0
  229. package/src/profiles/dsh-profile-manager.ts +25 -7
  230. package/src/profiles/dsh-profile-shared.ts +2 -0
  231. package/src/routes/backup.ts +16 -9
  232. package/src/routes/index.ts +1 -1
  233. package/src/routes/kit.ts +2 -2
  234. package/src/routes/market.ts +2 -59
  235. package/src/routes/model-tools-deps.ts +56 -0
  236. package/src/routes/recovery.ts +5 -3
  237. package/src/routes/route-support.ts +49 -36
  238. package/src/routes/snapshots.ts +4 -40
  239. package/src/routes/sync.ts +39 -27
  240. package/src/schema/index.ts +2 -2
  241. package/src/schema/manifest-schema.test.ts +2 -2
  242. package/src/schema/registry.test.ts +1 -1
  243. package/src/schema/section-registry.ts +9 -4
  244. package/src/security/redaction.test.ts +1 -1
  245. package/src/security/secret-scanner.test.ts +2 -2
  246. package/src/security/secret-scanner.ts +1 -1
  247. package/src/sync/apply-bundle.ts +104 -0
  248. package/src/sync/autosync-scheduler.test.ts +180 -6
  249. package/src/sync/autosync-scheduler.ts +132 -92
  250. package/src/sync/backup-scheduler.test.ts +11 -4
  251. package/src/sync/backup-scheduler.ts +5 -4
  252. package/src/sync/blob-store.ts +2 -2
  253. package/src/sync/git/git-transport.test.ts +62 -0
  254. package/src/sync/git/git-transport.ts +54 -3
  255. package/src/sync/merge.ts +29 -0
  256. package/src/sync/messages.ts +9 -2
  257. package/src/sync/s3/s3-transport.ts +1 -1
  258. package/src/sync/sync-engine.test.ts +238 -2
  259. package/src/sync/sync-engine.ts +25 -26
  260. package/src/sync/sync-preview-push.test.ts +2 -1
  261. package/src/sync/sync-scope-boot.ts +87 -0
  262. package/src/sync/sync-scope.test.ts +154 -0
  263. package/src/sync/sync-scope.ts +256 -0
  264. package/src/sync/sync-selection.test.ts +76 -2
  265. package/src/sync/sync-selection.ts +40 -13
  266. package/src/sync/transport.test.ts +21 -1
  267. package/src/sync/transport.ts +12 -0
  268. package/src/sync/webdav/webdav-delete-index-unreadable.test.ts +2 -2
  269. package/src/sync/webdav/webdav-transport.ts +1 -1
  270. package/src/sync/workspace-merge.test.ts +110 -0
  271. package/src/sync/workspace-merge.ts +180 -0
  272. package/src/ui/backup-schedule.test.ts +5 -0
  273. package/src/ui/backup-schedule.ts +21 -2
  274. package/src/ui/session-issue-labels.ts +1 -1
  275. package/src/ui/snapshots-view.test.ts +32 -0
  276. package/src/ui/snapshots-view.ts +34 -0
  277. package/src/ui/sync-repository-picker.test.ts +34 -1
  278. package/src/ui/sync-repository-picker.ts +24 -0
  279. package/src/utils/env-lock.test.ts +242 -9
  280. package/src/utils/env-lock.ts +247 -13
  281. package/src/utils/messages-utils.ts +17 -1
  282. package/src/utils/patch-yaml.ts +1 -1
  283. package/src/utils/remove-tree.test.ts +120 -0
  284. package/src/utils/remove-tree.ts +239 -0
  285. package/src/utils/zip.ts +1 -1
  286. package/src/client/CLIENT_DEPENDENCIES.md +0 -94
@@ -84,6 +84,24 @@ export const SELF_IMPORT_BLOCKED_RELS: readonly string[] = [
84
84
  'sync/sync-autosync.json',
85
85
  ];
86
86
 
87
+ /**
88
+ * 分档案作用域(`sync-profiles/<profile>/`)里**同一类**文件:SEC-01 必须按模式挡。
89
+ *
90
+ * 档案名是运行时集合(用户随时能建新档案),无法列举成数组;而这些文件与 `sync/` 下那两份
91
+ * 语义完全相同 —— 都是「同步目标 / 自动同步开关」,导入一个指向攻击者仓库的包后,用户下次
92
+ * 同步就会把该档案的配置推过去。`SELF_CONFIG_FILES` 白名单本就不含 `sync-profiles/`(导出侧
93
+ * 从不搬别人的档案作用域),这里补的是导入侧的纵深防御。
94
+ */
95
+ const SELF_IMPORT_BLOCKED_PATTERNS: readonly RegExp[] = [
96
+ /^sync-profiles\/[A-Za-z0-9][A-Za-z0-9._-]*\/sync-config\.json$/,
97
+ /^sync-profiles\/[A-Za-z0-9][A-Za-z0-9._-]*\/sync-autosync\.json$/,
98
+ ];
99
+
100
+ /** SEC-01 判据(单一入口):精确 rel 或分档案作用域里的同语义文件,一律不落地。 */
101
+ export function isSelfImportBlocked(rel: string): boolean {
102
+ return SELF_IMPORT_BLOCKED_RELS.includes(rel) || SELF_IMPORT_BLOCKED_PATTERNS.some((pattern) => pattern.test(rel))
103
+ }
104
+
87
105
  /**
88
106
  * 拦截报告项里的**稳定机器码**前缀(`self-import-blocked:<rel>`)。
89
107
  *
@@ -265,7 +283,7 @@ export class SelfAdapter extends FileCollectionAdapter {
265
283
  const items = await super.analyzeImport(data, ctx);
266
284
  return items.map((item) => {
267
285
  const rel = item.target?.ref;
268
- if (rel === undefined || !SELF_IMPORT_BLOCKED_RELS.includes(rel)) return item;
286
+ if (rel === undefined || !isSelfImportBlocked(rel)) return item;
269
287
  const blocked: PlanItem = {
270
288
  id: item.id,
271
289
  kind: 'Warning',
@@ -285,7 +303,7 @@ export class SelfAdapter extends FileCollectionAdapter {
285
303
  */
286
304
  override async applyItem(item: PlanItem, ctx: ImportContext): Promise<ApplyResult> {
287
305
  const ref = item.target?.ref;
288
- if (ref !== undefined && SELF_IMPORT_BLOCKED_RELS.includes(ref)) {
306
+ if (ref !== undefined && isSelfImportBlocked(ref)) {
289
307
  return { ok: false, message: ctx.msg('adapter.selfImportBlocked', { path: ref }), warning: true };
290
308
  }
291
309
  return super.applyItem(item, ctx);
@@ -274,7 +274,7 @@ export class WorkspacesAdapter implements ConfigAdapter<WorkspacesSection> {
274
274
  issues.push({ path: 'workspaces[]', message: msg('adapter.validate.workspaceIdentity'), severity: 'error' });
275
275
  continue;
276
276
  }
277
- // ui-F3:sessionIds 是会话可见性的必需字段(docs/spec/bundle-format-v1.md §6),
277
+ // ui-F3:sessionIds 是会话可见性的必需字段(docs/contracts/bundle-format-v1.md §6),
278
278
  // 而 analyzeImport / finalizeImport 直接读 rec.sessionIds.length —— 缺它有两条后果:
279
279
  // ① validate 放过后 analyzeImport 抛内部 TypeError → 整包被拦下且文案不可行动;
280
280
  // ② 即便绕过,工作区记录也失去会话归属。这里按「必需数组」显式报出字段名。
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * 注意:CLI 只续跑 `cli-restore` 自己创建的 journal。别的入口(GUI restore / model-restore)
11
11
  * 崩掉的记录在这里仍是「需要恢复面板处理」的事故 —— 三者的执行器与参数来源不同,
12
- * 跨入口续跑没有证据支撑(详见 docs/decisions/0004)。
12
+ * 跨入口续跑没有证据支撑(详见 docs/adr/0004)。
13
13
  */
14
14
  import { resolveSafeModeMarker } from '../core/recovery-orchestrator.ts'
15
15
  import { probeRestoreResume, runRestoreWithResume } from '../core/restore-resume.ts'
@@ -5,7 +5,7 @@
5
5
  * HTML:**零脚本、零外部资源、零构建产物**,配合 http.ts 里收紧的 CSP。
6
6
  * 样式内联在 <style> 里(独立于插件 UI 的 CSS Modules;该新 pattern 已登记进 DESIGN.md)。
7
7
  * 这套样式表**有一份外部出处**(亮色 IBM Carbon / 暗色 Raycast 阶梯)与逐条对照表:
8
- * docs/components/cli-rescue-console.md —— 改 STYLE 前先读它,改完跑 web.test.ts 的 R3-02。
8
+ * docs/architecture/cli-rescue-console.md —— 改 STYLE 前先读它,改完跑 web.test.ts 的 R3-02。
9
9
  *
10
10
  * 呈现纪律:每个数字都要能回答「你怎么知道的」—— 离线拿不到的(结构化分区/凭据/同步令牌)
11
11
  * 一律显式列出并说明原因,绝不显示为 0 或留空。
@@ -32,7 +32,7 @@ export interface PageChrome {
32
32
 
33
33
  const STYLE = [
34
34
  // ---- 设计 token:IBM Carbon(亮色语义四色)+ Raycast(暗色 surface 阶梯)----
35
- // 映射表、取的章节与全部偏离记录:docs/components/cli-rescue-console.md
35
+ // 映射表、取的章节与全部偏离记录:docs/architecture/cli-rescue-console.md
36
36
  // 文字色一律取「能读」的那一档:Carbon 的 #24a148 / #f1c21b 只做填充,正文用 #198038 / #8e6a00
37
37
  // (AA 对比度由 web.test.ts 的 R3-02 逐对钉住,改色先过那条测试)。
38
38
  ':root{color-scheme:light dark;--font:system-ui,-apple-system,"Segoe UI",Roboto,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans SC",sans-serif;--mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;--fg:#161616;--muted:#525252;--bg:#f4f4f4;--card:#fff;--surface:#f4f4f4;--line:#e0e0e0;--accent:#0f62fe;--accent-hover:#0043ce;--on-accent:#fff;--ok:#198038;--warn:#8e6a00;--bad:#da1e28;--scrim:rgba(22,22,22,.45)}',
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 「关于(About)」面板(设置页第 6 个 tab 内容,docs/design/2026-08-19-about-tab-design.md §4)。
2
+ * 「关于(About)」面板(设置页第 6 个 tab 内容,docs/archive/2026-08-19-about-tab-design.md §4)。
3
3
  *
4
4
  * 纯静态展示视图 + 外链,无表单 / 无写操作 / 无新增依赖:
5
5
  * - 项目信息卡:插件名 + 官方 Badge;版本 / DSH / 平台 Badge(运行时信息,经 api.status() 获取);
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 「关于(About)」Tab 纯函数渲染模型单测(node:test + node:assert,无需 DOM)。
3
3
  *
4
- * 覆盖(docs/design/2026-08-19-about-tab-design.md §5):
4
+ * 覆盖(docs/archive/2026-08-19-about-tab-design.md §5):
5
5
  * - 链接派生:repoUrl → star / docs / issues 的正确后缀;
6
6
  * - 尾斜杠输入归一化(含多个尾斜杠);
7
7
  * - 状态行格式化:pluginVersion / dshVersion / platform+arch 合并;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 「关于(About)」Tab 的客户端纯函数渲染模型(node 可测,无 React / 无 DOM)。
3
3
  *
4
- * 设计依据(docs/design/2026-08-19-about-tab-design.md §5):
4
+ * 设计依据(docs/archive/2026-08-19-about-tab-design.md §5):
5
5
  * - 公开元数据(插件名 / 仓库 / 作者)为**静态常量**,不随运行时变化,可读、可测、可维护;
6
6
  * - 版本 / DSH / 平台等运行时信息由面板经 `api.status()` 获取,本层只负责格式化,
7
7
  * 版本号**绝不**在 client 重复维护(AGENTS.md §版本号三处同步教训);
package/src/client/api.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * 客户端控制器(ExportFlow / ImportWizard)把本类实例当作 port 注入即可,
7
7
  * 无需任何额外适配层 —— 这是「直接绑定 src/ui,不重复实现」的关键。
8
8
  *
9
- * 端点契约(Host 半 `src/index.ts` 按此实现,见 CLIENT_DEPENDENCIES.md 的接口说明):
9
+ * 端点契约(Host 半 `src/index.ts` 按此实现,见 docs/architecture/client-dependencies.md 的接口说明):
10
10
  * ```
11
11
  * GET /api/dsh-config-manager/status → ServiceStatus (健康/版本检查)
12
12
  * POST /api/dsh-config-manager/export → ExportResponse (body: ExportOptions;响应含 runId)
@@ -750,11 +750,6 @@ export class ConfigManagerApi {
750
750
  return postJson<{ ok: boolean; removed: boolean }>(CONFIG_MANAGER_API.snapshotDelete, { snapshotId }, this.t);
751
751
  }
752
752
 
753
- /** P1-⑧:置顶/取消置顶快照(置顶快照豁免自动保留清理,只能手动删除)。 */
754
- async setSnapshotPinned(snapshotId: string, pinned: boolean): Promise<{ pinned: boolean }> {
755
- return postJson<{ ok: boolean; pinned: boolean }>(CONFIG_MANAGER_API.snapshotPin, { snapshotId, pinned }, this.t);
756
- }
757
-
758
753
  // ------------------------------------------------- 档案(DSH 自带 profile)
759
754
  /** 列出 DSH profile:列表 + 当前运行 + 在跑的实例(台账 ∪ 心跳)+ 起步模板。 */
760
755
  async profilesList(): Promise<DshProfilesSnapshot> {
@@ -475,7 +475,7 @@ test('动作行图标走宿主原生(复制 → 对勾 → 回退),拿不
475
475
  /**
476
476
  * 2026-10-17(用户要求「与 DSH 原生气泡完全一致」):§15b 的几何/字号必须与宿主
477
477
  * MessageItem + MessageIconActions 的**同一条取值**逐字同式(宿主产物抽出的取值清单见
478
- * docs/maintenance/known-gaps.md 的「G-39 增量(八)」)。这张用例是那条口径的源级护栏:
478
+ * docs/known-issues/known-gaps.md 的「G-39 增量(八)」)。这张用例是那条口径的源级护栏:
479
479
  * 谁把圆角/内边距/动作行/文件卡改回「近似档」,这里立刻红。
480
480
  */
481
481
  test('气泡与动作行逐值对齐宿主:圆角 xl(20px) / 内边距 10·16 / 动作行 28+delta / 文件卡 240·64', () => {
@@ -45,7 +45,7 @@
45
45
  * 2026-10-12(用户要求「聊天内回退入口只有每条用户消息」):回合尾那一颗入口连同它的「整回合」偏好档
46
46
  * 一起删除 —— 本文件因此**不再镜像**该槽位(没有人再对它 `register`,也没有组件 props 需要推导)。
47
47
  * 历史证据(0.1.5-rc.2 的 `chain` 形态 vs 0.2 的 `list` 形态)保留在
48
- * `docs/lessons/recovery-console.md`,不再需要面向它的形态探测。
48
+ * `docs/evidence/recovery-console.md`,不再需要面向它的形态探测。
49
49
  *
50
50
  * ## 版本差异(T9-F2 的真机证据;登记处据此做形态探测)
51
51
  *
@@ -15,7 +15,7 @@
15
15
  *
16
16
  * ## 纪律
17
17
  * · **抽出来的方法一律 bind 回服务对象**(`openResource` / `register` 都读 `this`;丢 receiver 会抛,
18
- * 见 AGENTS.md 与 docs/lessons/recovery-console.md 的 `uiWorkspace.openSession` 事故);
18
+ * 见 AGENTS.md 与 docs/evidence/recovery-console.md 的 `uiWorkspace.openSession` 事故);
19
19
  * · 服务缺失 / 形态不符 / 调用抛错统统是**降级**(返回结构化结果),绝不打挂插件装配。
20
20
  */
21
21
 
@@ -2,7 +2,7 @@
2
2
  * Client 半的类型集中出口:把对 @deepseek-ai 运行时包的类型依赖收敛到本文件,
3
3
  * 其余组件只从 `../client-types.ts` 引用,避免类型散落与误用值导入。
4
4
  *
5
- * p3 构建前需安装的依赖(见 CLIENT_DEPENDENCIES.md):
5
+ * p3 构建前需安装的依赖(见 docs/architecture/client-dependencies.md):
6
6
  * - @deepseek-ai/dsh-client-runtime(ClientContext 声明合并)
7
7
  * - @deepseek-ai/dsh-client-locale(ctx.locale 声明合并)
8
8
  * - @deepseek-ai/dsh-client-ui-settings(settings.section SlotMap 声明合并)
@@ -72,7 +72,6 @@ export const CONFIG_MANAGER_API = {
72
72
  snapshots: `${API_BASE}/snapshots`,
73
73
  restore: `${API_BASE}/restore`,
74
74
  snapshotDelete: `${API_BASE}/snapshots/delete`,
75
- snapshotPin: `${API_BASE}/snapshots/pin`,
76
75
  snapshotFileDiff: `${API_BASE}/snapshots/file-diff`,
77
76
  backupSchedule: `${API_BASE}/backup-schedule`,
78
77
  backupScheduleRun: `${API_BASE}/backup-schedule/run`,
@@ -149,16 +148,13 @@ export const SYNC_API = {
149
148
  probe: `${API_BASE}/sync/probe`,
150
149
  } as const;
151
150
 
152
- /** 配置市场路由族(内置单市场:浏览 / 下载 / 发布向导;无 add/remove)。 */
151
+ /** 配置市场路由族(内置单市场:浏览 / 下载;无 add/remove)。 */
153
152
  export const MARKET_API = {
154
153
  base: `${API_BASE}/market`,
155
154
  status: `${API_BASE}/market/status`,
156
155
  refresh: `${API_BASE}/market/refresh`,
157
156
  browse: `${API_BASE}/market/browse`,
158
157
  download: `${API_BASE}/market/download`,
159
- prepare: `${API_BASE}/market/prepare`,
160
- /** 受控临时区文件下载端点(发布包 zip 下载复用;GET ?path=,无凭据) */
161
- fileDownload: `${API_BASE}/download`,
162
158
  } as const;
163
159
 
164
160
  /** 「我的配置」路由族(一键上传 / 查看 / 更新 / 收录状态)。 */
@@ -1581,6 +1581,25 @@ body {
1581
1581
  align-items: center;
1582
1582
  }
1583
1583
 
1584
+ /* —— 静默自动保存的「已保存」回执(ChannelConfigDialog footer) ——
1585
+ 四通道共用的输入防抖自动保存成功后闪一次:入场 180ms 淡入 + 轻微上浮,2.4s 后由组件隐藏。
1586
+ 本类**只管动画**,盒模型完全由里面的 .badge 提供(不在此重复字号/间距,避免第二套徽章)。 */
1587
+ .savedTick {
1588
+ display: inline-flex;
1589
+ animation: savedTickIn var(--cm-motion-base) var(--cm-motion-ease-out);
1590
+ }
1591
+
1592
+ @keyframes savedTickIn {
1593
+ from {
1594
+ opacity: 0;
1595
+ transform: translateY(2px);
1596
+ }
1597
+ to {
1598
+ opacity: 1;
1599
+ transform: translateY(0);
1600
+ }
1601
+ }
1602
+
1584
1603
  /* —— 中性分类片(Chip,tech-debt #10 / 2026-11) ——
1585
1604
  职责划分:**Badge = 状态语义**(四态只由 src/ui/badge-tone.ts 的 BadgeKind 定义);
1586
1605
  **Chip = 中性分类**(来源 / 形态 / 适配器 / 分区数 —— 没有轻重缓急,也不该有颜色)。
@@ -5802,7 +5821,8 @@ button.profileRowMain:hover {
5802
5821
  .pickerOverlay,
5803
5822
  .pickerUnit,
5804
5823
  .banner,
5805
- .empty {
5824
+ .empty,
5825
+ .savedTick {
5806
5826
  animation: none;
5807
5827
  }
5808
5828
  .statusDot,
@@ -2,7 +2,7 @@
2
2
  * css-scale-guard — 视觉 scale 的**源级执行者**(UI v3 §4.2/§4.3、§12)。
3
3
  *
4
4
  * 为什么需要它:`DESIGN.md` 从 v1 起就写着「唯一允许的 scale」,但实测文件里同时存在
5
- * 10 档字号 / 11 档圆角 / 5 档行高 / 10 档 gap(见 docs/design/2026-10-05-ui-redesign-v3.md §0)——
5
+ * 10 档字号 / 11 档圆角 / 5 档行高 / 10 档 gap(见 docs/archive/2026-10-05-ui-redesign-v3.md §0)——
6
6
  * 散文规范拦不住新增值。本守卫把 scale 变成红灯:越界值直接失败。
7
7
  *
8
8
  * 覆盖:font-size / border-radius / line-height / z-index / padding / margin / gap。
@@ -77,14 +77,14 @@ function selectProfilesSlice(): PanelState {
77
77
  }
78
78
 
79
79
  /** host 侧 engine 错误码 → 文案(未知错误回退到通用模板,不显示裸英文码)。 */
80
- const ERROR_CODES = ['notLaunchable', 'launcherUnavailable', 'launchFailed', 'alreadyRunning', 'notRunning', 'stopFailed', 'instanceRunning', 'exists', 'notFound', 'currentProfile', 'invalidName', 'reservedName', 'unknownTemplate', 'managedProfile'] as const
80
+ const ERROR_CODES = ['notLaunchable', 'launcherUnavailable', 'launchFailed', 'alreadyRunning', 'notRunning', 'stopFailed', 'instanceRunning', 'exists', 'notFound', 'currentProfile', 'invalidName', 'reservedName', 'unknownTemplate', 'managedProfile', 'deleteFailed'] as const
81
81
 
82
82
  function profileErrorText(t: TranslateNS<'config-manager'>, error: unknown): string {
83
83
  const message = error instanceof Error ? error.message : String(error)
84
84
  for (const code of ERROR_CODES) {
85
85
  if (message === code || message.includes(code)) {
86
86
  // launchFailed / stopFailed 的 message 形如 `<code>: <细节>`:细节是排障的唯一线索,不能吞掉
87
- if ((code === 'launchFailed' || code === 'stopFailed') && message.includes(': ')) {
87
+ if ((code === 'launchFailed' || code === 'stopFailed' || code === 'deleteFailed') && message.includes(': ')) {
88
88
  const tail = message.slice(message.indexOf(': ') + 2).trim()
89
89
  return tail === '' ? t(`profiles.error.${code}`) : `${t(`profiles.error.${code}`)} — ${redact(tail)}`
90
90
  }
@@ -74,6 +74,9 @@ const BACKUP_SKIP_KEY: Record<BackupSkipReason, ConfigManagerKey> = {
74
74
  running: 'overview.quick.backupSkippedRunning',
75
75
  conflict: 'overview.quick.backupSkippedConflict',
76
76
  locked: 'overview.quick.backupSkippedLocked',
77
+ 'lock-stale': 'overview.quick.backupSkippedLockStale',
78
+ 'lock-unavailable': 'overview.quick.backupSkippedLockUnavailable',
79
+ 'safe-mode': 'overview.quick.backupSkippedSafeMode',
77
80
  other: 'overview.quick.backupSkippedOther',
78
81
  }
79
82
 
@@ -67,10 +67,18 @@ export interface ArtifactRowViewProps {
67
67
  * (旧快照没有该字段,绝不显示空串或占位)。
68
68
  */
69
69
  deviceLabel?: string | undefined
70
+ /**
71
+ * 来源档案徽章(本机快照专用):这份快照是哪个 DSH profile 拍的。
72
+ *
73
+ * 只有 `SnapshotMeta.originProfile` 真的存在时调用方才给值 —— 缺省 undefined 表示**不渲染**
74
+ * (旧快照没有来源,绝不显示空档案名或「未标注」徽章)。`hint` 只在「与当前档案不同」时给,
75
+ * 徽章本体只写档案名,差异语不重复表达。
76
+ */
77
+ originBadge?: { label: string; hint?: string; kind: 'info' | 'warn' } | undefined
70
78
  }
71
79
 
72
80
  export function ArtifactRowView({
73
- row, t, uiT, formatTime, expanded, onToggle, onAction, pending = null, deviceLabel,
81
+ row, t, uiT, formatTime, expanded, onToggle, onAction, pending = null, deviceLabel, originBadge,
74
82
  }: ArtifactRowViewProps) {
75
83
  const detailId = useId()
76
84
  const primary = row.capabilities[0]
@@ -122,13 +130,17 @@ export function ArtifactRowView({
122
130
  </div>
123
131
  )}
124
132
  </div>
125
- {row.badges.length > 0 && (
133
+ {(row.badges.length > 0 || originBadge !== undefined) && (
126
134
  <div className={css.artifactBadges}>
127
135
  {row.badges.map((badge) => (
128
136
  <Badge key={badge} kind={BADGE_KIND[badge]} title={badge === 'encrypted' ? encryptedHint : undefined}>
129
137
  {uiT(ARTIFACT_BADGE_LABEL_KEY[badge])}
130
138
  </Badge>
131
139
  ))}
140
+ {/* 来源档案排在状态徽章之后:先读「这行现在是什么状态」,再读「它来自哪个档案」 */}
141
+ {originBadge !== undefined && (
142
+ <Badge kind={originBadge.kind} title={originBadge.hint}>{originBadge.label}</Badge>
143
+ )}
132
144
  </div>
133
145
  )}
134
146
  <div className={css.artifactActions} onClick={(event) => { event.stopPropagation() }}>
@@ -24,6 +24,7 @@ import { formatDateTimeFull } from '../sync/history-model.ts'
24
24
  import { deviceLabelsById } from '../sync/remote-device-view.ts'
25
25
  import { runStore, type LibraryStoreSlice } from '../run-store.ts'
26
26
  import { Badge, Button, Card, Empty } from '../common/ui.tsx'
27
+ import { snapshotOriginOf, snapshotOriginState } from '../../ui/snapshots-view.ts'
27
28
  import { SkeletonRows } from '../common/Skeleton.tsx'
28
29
  import { redact } from '../../security/redaction.ts'
29
30
  import { InfoHint } from '../common/InfoHint.tsx'
@@ -84,6 +85,12 @@ export function LibraryPanel({ api, syncApi, marketApi, t, uiT, onAction, onOpen
84
85
  const [remoteChannel, setRemoteChannel] = useState<'git' | 'webdav' | null>(null)
85
86
  /** 面板内部的刷新信号(失败源卡片里的「重试」);外部的走 props.refreshTick */
86
87
  const [localTick, setLocalTick] = useState(0)
88
+ /**
89
+ * 当前档案名(只用于「来源档案」徽章的差异对照):取 `/status` 的诊断位 `profile`。
90
+ * 宿主给不出(老宿主 / 独立 CLI)→ null,此时只显示档案名,**不声称「来自他人档案」**
91
+ * (不知道自己在哪个档案时,那个结论无法证明)。
92
+ */
93
+ const [currentProfile, setCurrentProfile] = useState<string | null>(null)
87
94
 
88
95
  const mounted = useRef(true)
89
96
  useEffect(() => () => { mounted.current = false }, [])
@@ -132,6 +139,14 @@ export function LibraryPanel({ api, syncApi, marketApi, t, uiT, onAction, onOpen
132
139
  })
133
140
  }))
134
141
  put(setMarket, marketApi.browse().then((res) => res.items))
142
+ // 当前档案:与上面四源并行、**失败不影响任何源的状态**(只是少一个对照值)
143
+ api.status().then(
144
+ (status) => {
145
+ if (!mounted.current) return
146
+ setCurrentProfile(typeof status.profile === 'string' && status.profile !== '' ? status.profile : null)
147
+ },
148
+ () => { if (mounted.current) setCurrentProfile(null) },
149
+ )
135
150
  // 通道类型与远端地址都从 /sync/status 取(已并入上面的远端源加载,避免同一接口打两次)
136
151
  }, [api, syncApi, marketApi, localTick, refreshTick])
137
152
 
@@ -177,6 +192,33 @@ export function LibraryPanel({ api, syncApi, marketApi, t, uiT, onAction, onOpen
177
192
  { id: 'market', label: t('library.kind.market'), count: market.status === 'ready' ? counts['market'] : null },
178
193
  ]
179
194
 
195
+
196
+ /**
197
+ * 快照 id → 来源档案(只收**真的带来源**的):徽章只挂在本机快照行上,
198
+ * 其它三个来源没有「档案」语义。
199
+ */
200
+ const originOfSnapshot = useMemo(() => {
201
+ const map = new Map<string, string>()
202
+ for (const meta of snapshots.items) {
203
+ const profile = snapshotOriginOf(meta)
204
+ if (profile !== undefined) map.set(meta.id, profile)
205
+ }
206
+ return map
207
+ }, [snapshots.items])
208
+
209
+ /**
210
+ * 行首来源徽章:档案名恒显示;只有「已知当前档案且不同」时才升到 warn 并带差异说明
211
+ * (宿主没给当前档案时只显示名字 —— 那是无法证明的结论)。
212
+ */
213
+ const originBadgeOf = (row: ArtifactRow): { label: string; hint?: string; kind: 'info' | 'warn' } | undefined => {
214
+ if (row.kind !== 'snapshot') return undefined
215
+ const profile = originOfSnapshot.get(row.ref.snapshotId ?? '')
216
+ if (profile === undefined) return undefined
217
+ return snapshotOriginState({ originProfile: profile }, currentProfile ?? undefined) === 'foreign'
218
+ ? { label: profile, hint: t('library.origin.foreign'), kind: 'warn' }
219
+ : { label: profile, kind: 'info' }
220
+ }
221
+
180
222
  /** 加密项计数:只数**当前筛选后**的行(底部徽章必须与眼前列表一致,见 footer 注释) */
181
223
  const encryptedCount = useMemo(() => filtered.filter((row) => row.badges.includes('encrypted')).length, [filtered])
182
224
 
@@ -209,6 +251,7 @@ export function LibraryPanel({ api, syncApi, marketApi, t, uiT, onAction, onOpen
209
251
  ))}
210
252
  </div>
211
253
 
254
+
212
255
  <input
213
256
  className={css.librarySearch}
214
257
  type="search"
@@ -276,6 +319,7 @@ export function LibraryPanel({ api, syncApi, marketApi, t, uiT, onAction, onOpen
276
319
  // 只把**本行**的进行中动作交给行组件:其余行保持可点(一次只挡同一行)
277
320
  pending={pending !== null && pending.key === row.key ? pending.capability : null}
278
321
  deviceLabel={row.kind === 'remote-snapshot' ? deviceLabelOf.get(row.ref.remoteId ?? '') : undefined}
322
+ originBadge={originBadgeOf(row)}
279
323
  />
280
324
  ))}
281
325
  </ul>
@@ -38,7 +38,11 @@ export const zh = {
38
38
  'overview.quick.backupSkippedDisabled': '已跳过:定时备份未启用(没有生成任何备份文件)',
39
39
  'overview.quick.backupSkippedRunning': '已跳过:上一次备份仍在进行中',
40
40
  'overview.quick.backupSkippedConflict': '已跳过:另一项任务正在执行(防重)',
41
- 'overview.quick.backupSkippedLocked': '已跳过:环境锁被占用(另一项任务进行中,或存在需回收的残留锁)',
41
+ // 分档后这句话只留给「真被另一项活任务持有」;残留锁/SAFE MODE/不可用各有自己的键(issue:locks 为空也说被占用)
42
+ 'overview.quick.backupSkippedLocked': '已跳过:另一个任务正在使用环境锁,稍后重试即可',
43
+ 'overview.quick.backupSkippedLockStale': '已跳过:存在残留环境锁(上次任务异常退出留下,重试与重启都不会自愈)——请到「事故恢复」回收',
44
+ 'overview.quick.backupSkippedLockUnavailable': '已跳过:环境锁暂时不可用(锁目录读写失败或状态未知),请稍后重试并查看宿主日志',
45
+ 'overview.quick.backupSkippedSafeMode': '已跳过:插件处于 SAFE MODE(外部操作失败后自动阻断写入)——请到「事故恢复」处理后重试',
42
46
  'overview.quick.backupSkippedOther': '已跳过:备份服务当前无法执行(详情见宿主日志)',
43
47
  'overview.quick.backupFailed': '备份失败:{message}',
44
48
  'overview.activity.title': '最近活动',
@@ -112,7 +116,11 @@ export const en: Record<keyof typeof zh, string> = {
112
116
  'overview.quick.backupSkippedDisabled': 'Skipped: scheduled backups are disabled (no backup file was created)',
113
117
  'overview.quick.backupSkippedRunning': 'Skipped: a previous backup is still running',
114
118
  'overview.quick.backupSkippedConflict': 'Skipped: another task is running (duplicate guard)',
115
- 'overview.quick.backupSkippedLocked': 'Skipped: the environment lock is held (another task is running, or a stale lock needs recovery)',
119
+ // After the split this wording only covers "held by another live task"; stale/SAFE MODE/unavailable have their own keys
120
+ 'overview.quick.backupSkippedLocked': 'Skipped: another task is using the environment lock — retry shortly',
121
+ 'overview.quick.backupSkippedLockStale': 'Skipped: a stale environment lock is left on disk (an earlier task died; retrying or restarting will not clear it) — reclaim it in Incident recovery',
122
+ 'overview.quick.backupSkippedLockUnavailable': 'Skipped: the environment lock cannot be used right now (lock directory unreadable/unwritable or in an unknown state) — retry later and check the host logs',
123
+ 'overview.quick.backupSkippedSafeMode': 'Skipped: the plugin is in SAFE MODE (writes are blocked after an external operation failed) — clear it in Incident recovery, then retry',
116
124
  'overview.quick.backupSkippedOther': 'Skipped: the backup service cannot run right now (see host logs for details)',
117
125
  'overview.quick.backupFailed': 'Backup failed: {message}',
118
126
  'overview.activity.title': 'Recent activity',
@@ -130,6 +130,7 @@ export const zh = {
130
130
  'profiles.error.notRunning': '该档案没有正在运行的实例(可能已被手动关闭)',
131
131
  'profiles.error.stopFailed': '停止实例失败',
132
132
  'profiles.error.instanceRunning': '该档案的实例正在运行,请先停止再删除',
133
+ 'profiles.error.deleteFailed': '删除失败:档案目录被占用或权限不足,档案仍在磁盘上',
133
134
  'profiles.error.generic': '操作失败:{message}',
134
135
  } as const;
135
136
 
@@ -259,5 +260,6 @@ export const en: Record<keyof typeof zh, string> = {
259
260
  'profiles.error.notRunning': 'This profile has no running instance (it may have been closed manually)',
260
261
  'profiles.error.stopFailed': 'Stopping the instance failed',
261
262
  'profiles.error.instanceRunning': 'An instance of this profile is running — stop it before deleting',
263
+ 'profiles.error.deleteFailed': 'Delete failed: the profile directory is in use or access is denied — the profile is still on disk',
262
264
  'profiles.error.generic': 'Operation failed: {message}',
263
265
  };
@@ -92,6 +92,8 @@ export const zh = {
92
92
  'library.moreActions': '更多操作',
93
93
  'backupFiles.inspectEncrypted': '这是整包加密的备份,无法直接查看内容:请点「导入」——向导会先让你输入备份密码解锁,解锁后即可看到包含的分区与差异。',
94
94
  'library.source.all': '全部',
95
+ // 来源档案(originProfile):快照行徽章 + 列表筛选。档案名本身不翻译,只有这三条通用文案需要。
96
+ 'library.origin.foreign': '来自他人档案',
95
97
  'library.kind.snapshot': '本机快照',
96
98
  'library.kind.backupFile': '备份文件',
97
99
  'library.kind.remote': '远端快照',
@@ -218,6 +220,7 @@ export const en: Record<keyof typeof zh, string> = {
218
220
  'library.moreActions': 'More actions',
219
221
  'backupFiles.inspectEncrypted': 'This backup is fully encrypted, so its contents cannot be inspected directly. Use Import — the wizard asks for the backup password, unlocks the archive, and then shows its sections and diff.',
220
222
  'library.source.all': 'All',
223
+ 'library.origin.foreign': 'From another profile',
221
224
  'library.kind.snapshot': 'Local snapshot',
222
225
  'library.kind.backupFile': 'Backup file',
223
226
  'library.kind.remote': 'Remote snapshot',
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 「我的配置」视图(设计文档 docs/design/2026-08-20-my-configs-design.md §4.6)。
2
+ * 「我的配置」视图(设计文档 docs/archive/2026-08-20-my-configs-design.md §4.6)。
3
3
  *
4
4
  * 组装「一键上传 / 查看已上传 / 一键更新 / 装回本地」:
5
5
  * - **登录卡**:未登录 → GitHub device flow 登录(复用 SyncApi.githubStart/Poll/Cancel,
@@ -8,7 +8,7 @@
8
8
  * 保证 client 与 Host 请求/响应契约单一来源,避免漂移(与 sync-api.ts 引用 sync-engine.ts 同构)。
9
9
  *
10
10
  * 端点契约(Host 半 src/index.ts 的 makeRoutes 实现;市场设计的上游依据 =
11
- * docs/design/2026-08-19-market-publish-design.md —— 旧的市场设计文档已在 2026-08-19
11
+ * docs/archive/2026-08-19-market-publish-design.md —— 旧的市场设计文档已在 2026-08-19
12
12
  * 大写 Docs/ 清理中删除,该文件自述「为市场设计的新上游依据」,故此处只指向它,
13
13
  * 不再书写已删除文档的路径、也不臆造章节号;内置单市场、只读不可编辑,无 add/remove):
14
14
  * ```
@@ -16,7 +16,6 @@
16
16
  * POST /api/dsh-config-manager/market/refresh → MarketRefreshResponse (拉取最新 index.json)
17
17
  * POST /api/dsh-config-manager/market/browse → MarketBrowseResponse (合并 index + 缓存状态)
18
18
  * POST /api/dsh-config-manager/market/download → MarketDownloadResult ({ itemId } 拉取+校验+dry-run 预览)
19
- * POST /api/dsh-config-manager/market/prepare → MarketPrepareResponse (发布向导:上传 zip + 元数据 → 条目包)
20
19
  * ```
21
20
  * 确认导入(apply)**复用现有** `POST /api/dsh-config-manager/execute`(见 ../api.ts executeImportPlan),
22
21
  * 不新增第二条导入路径 —— 保证安全校验/回滚/凭据补录全部走既有管道。
@@ -30,7 +29,7 @@
30
29
  */
31
30
  import type {
32
31
  MarketBrowseResponse, MarketDownloadResult, MarketItemDetail, MarketListItem,
33
- MarketPreparePayload, MarketPrepareResponse, MarketRefreshResponse, MarketStatusResponse,
32
+ MarketRefreshResponse, MarketStatusResponse,
34
33
  } from '../../market/types.ts';
35
34
  import type { UiT } from '../../ui/i18n.ts';
36
35
  import { getJson, LONG_REQUEST_TIMEOUT_MS, postJson, type RequestOptions } from '../common/http.ts';
@@ -79,15 +78,4 @@ export class MarketApi {
79
78
  async download(itemId: string, repo?: string): Promise<MarketDownloadResult> {
80
79
  return postJson<MarketDownloadResult>(MARKET_API.download, { itemId, ...(repo !== undefined && repo !== '' ? { repo } : {}) }, this.t, MARKET_OPTS);
81
80
  }
82
-
83
- /** 发布向导:由「上传 zip + 用户填写元数据」生成市场条目包(L2 manifest + SHA-256 + sections),
84
- * 供 UI 展示/复制与引导推送。零写入配置(发布目录在受控临时区);不含任何凭据字段。 */
85
- async prepare(payload: MarketPreparePayload): Promise<MarketPrepareResponse> {
86
- return postJson<MarketPrepareResponse>(MARKET_API.prepare, payload, this.t, MARKET_OPTS);
87
- }
88
-
89
- /** 发布包下载 URL(受控临时区 zip;经宿主 /download 端点,无凭据、无写操作) */
90
- downloadPublishUrl(zipPath: string): string {
91
- return `${MARKET_API.fileDownload}?path=${encodeURIComponent(zipPath)}`;
92
- }
93
81
  }
@@ -29,7 +29,7 @@ export const zh = {
29
29
  'list.categoriesAll': '全部类别',
30
30
  'list.sectionsAll': '全部分区',
31
31
  'list.sectionsUnknown': '另有 {count} 个条目未下载,无法按分区匹配',
32
- // 来源筛选 + 排序(2026-08-21 新增,docs/design/2026-08-21-market-star-filter-sort-design.md)
32
+ // 来源筛选 + 排序(2026-08-21 新增,docs/archive/2026-08-21-market-star-filter-sort-design.md)
33
33
  'list.sourceAll': '全部来源',
34
34
  'list.sourceOfficial': '官方配置',
35
35
  'list.sourcePersonal': '个人配置',
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 配置市场区块的客户端渲染装配层(m-market-ui,node 可测)。
3
3
  *
4
- * 设计纪律(市场设计上游依据 = docs/design/2026-08-19-market-publish-design.md:
4
+ * 设计纪律(市场设计上游依据 = docs/archive/2026-08-19-market-publish-design.md:
5
5
  * 旧的市场设计文档已在 2026-08-19 大写 Docs/ 清理中删除,其章节号在新文档中不存在,
6
6
  * 故只引用该文件、不再引用 § 号):
7
7
  * - **共享渲染模型唯一权威 = Host 侧 `src/market/view.ts`**(marketStatusText /
@@ -34,7 +34,7 @@ import { formatMinuteStamp, parseDateInput } from '../../utils/time.ts';
34
34
  /* ---------------------------------------------------------------- 客户端专属:来源徽章 */
35
35
 
36
36
  /**
37
- * 条目来源徽章 kind(阶段 1:条目级来源仓库,docs/design/2026-08-19-market-publish-design.md §3.3):
37
+ * 条目来源徽章 kind(阶段 1:条目级来源仓库,docs/archive/2026-08-19-market-publish-design.md §3.3):
38
38
  * - `'ok'`(官方):`item.repo` 缺省(条目与市场仓库同仓)或 `item.repo` 为官方默认地址;
39
39
  * - `'warn'`(第三方):`item.repo` 存在且非官方默认地址(条目由作者自托管仓库发布)。
40
40
  * 判定基准复用 `builtin.ts` 的 `isOfficialMarket`(固定官方地址比较):env 覆盖为预览仓库时,
@@ -61,7 +61,7 @@ export function collectCategories(items: readonly MarketListItem[]): string[] {
61
61
  /* ---------------------------------------------------------------- 客户端专属:来源筛选 / 排序 */
62
62
 
63
63
  /**
64
- * 来源筛选值(docs/design/2026-08-21-market-star-filter-sort-design.md §3.3.1):
64
+ * 来源筛选值(docs/archive/2026-08-21-market-star-filter-sort-design.md §3.3.1):
65
65
  * - 'all' 全部来源;
66
66
  * - 'official' 官方配置:条目无 repo(= 官方市场仓库自身)或 repo 为官方地址;
67
67
  * - 'personal' 个人配置:条目带非官方 repo(作者自托管仓库)。
@@ -4,7 +4,7 @@
4
4
  * 端点常量与请求封装都是**单一来源**:路由常量见 `common/routes.ts`,
5
5
  * `readJson` / `getJson` / `postJson`(统一超时 + 取消 + 错误映射)见 `common/http.ts`(W4 收敛)。
6
6
  *
7
- * 端点契约(Host 半 src/index.ts 的 makeRoutes 按 docs/design/2026-08-20-my-configs-design.md §4.2 实现):
7
+ * 端点契约(Host 半 src/index.ts 的 makeRoutes 按 docs/archive/2026-08-20-my-configs-design.md §4.2 实现):
8
8
  * ```
9
9
  * POST /api/dsh-config-manager/me/status → MyMeStatusResponse (登录态 + 目标仓库状态;401 → 未登录)
10
10
  * POST /api/dsh-config-manager/me/upload → MyUploadResult ({ zipPath, form } 一键上传全流程)
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 「我的配置」区块的客户端纯渲染装配层(m-my-configs-view,node 可测)。
3
3
  *
4
- * 设计纪律(docs/design/2026-08-20-my-configs-design.md §4.5 / §4.6):
4
+ * 设计纪律(docs/archive/2026-08-20-my-configs-design.md §4.5 / §4.6):
5
5
  * - 全部无副作用纯函数,React 壳(MyConfigsView)只装配,不承载业务逻辑;
6
6
  * - 输入数据一律由调用方(组件 / api 层)提供 —— 本文件不发起任何请求,不持有凭据;
7
7
  * - 录入最小化(§1.2):表单仅 name(预填 zip 文件名,可改)/ description(可选)/
@@ -326,7 +326,7 @@ test('T17:留存/救援点文案与引擎四常量逐句对齐,旧的不实
326
326
  test('T18-F1④:createdAfter / result.counts 必须说「留点时并不存在(之后新建)」(2026-10-12 翻面)', () => {
327
327
  // **2026-10-12 翻面**:删除候选的判据从「不在记录里」改成「**能证明**留点时不存在」(方向 A+B:
328
328
  // files ∪ skipped ∪ unreadableFiles ∪ excludedDirs ∪ 路径索引;见 src/core/rollback-point.ts 的
329
- // planCreatedRemovals 与 docs/lessons/recovery-console.md「删除集的可证性」)。
329
+ // planCreatedRemovals 与 docs/evidence/recovery-console.md「删除集的可证性」)。
330
330
  // 于是 createdAfter / leftovers 现在是**证明为留点之后新建**的路径 —— 旧文案「该点未记录」反而
331
331
  // 会把「留点时就被预算挡下、当时确实存在」的既有文件也算进去,那才是不实表述。
332
332
  // `rollback.preview.leftoversTitle` 曾在这里一起被钉;它随「文案克制」下线(清单只渲染「会删的」
@@ -81,7 +81,7 @@ import type { RecoveryPreview, RecoveryStatus, RecoveryVerifyResult } from '../u
81
81
  *
82
82
  * v3 删掉了三个化石值:`import`(导入是流程不是页面)、`market`(市场退出导航、只由 Task 承载),
83
83
  * 并把 v1 的 `overview`/`profiles` 改名为 `home`/`environment`。
84
- * 旧载荷一律由 parsePersistedState 的映射表迁到新值(docs/design/2026-10-05-ui-redesign-v3.md §5.1)。
84
+ * 旧载荷一律由 parsePersistedState 的映射表迁到新值(docs/archive/2026-10-05-ui-redesign-v3.md §5.1)。
85
85
  */
86
86
  export type PanelId = 'home' | 'library' | 'sync' | 'environment'
87
87