dsh-config-manager 0.1.13 → 0.1.14
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/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/lib/client.d.ts +76 -73
- package/lib/client.js +688 -694
- package/lib/client.js.map +1 -1
- package/package.json +2 -2
- package/src/client/ConfigManagerSection.tsx +33 -8
- package/src/client/client-types.ts +4 -0
- package/src/client/index.ts +5 -11
- package/src/client/locales.ts +2 -0
- package/src/client/sync/SyncSettingsView.tsx +9 -23
- package/src/client/sync/sync-api.ts +1 -1
package/README.md
CHANGED
|
@@ -35,6 +35,7 @@ DSH is your AI assistant workbench — it holds your settings: model configs, pl
|
|
|
35
35
|
| 🔒 | **Secret safety** | API Keys are never exported; re-enter them after import |
|
|
36
36
|
| ↩️ | **Automatic rollback** | Failed import restores everything automatically |
|
|
37
37
|
| 📸 | **Snapshot restore** | Undo an import: whole-file restore + uninstall added plugins (CLI & GUI) |
|
|
38
|
+
| 🔄 | **Remote Sync** | Push/pull portable config via a private Git repo (secrets never sync) |
|
|
38
39
|
| 🗂️ | **Profiles** | Save multiple setups (Work / Personal) and switch anytime |
|
|
39
40
|
|
|
40
41
|
---
|
package/README.zh-CN.md
CHANGED
|
@@ -35,6 +35,7 @@ DSH 是你的 AI 助手工作台,里面存着你的各种设置:模型配置
|
|
|
35
35
|
| 🔒 | **密钥安全** | API Key 默认不导出;导入后提醒你重新填写 |
|
|
36
36
|
| ↩️ | **自动回滚** | 导入失败自动恢复原样,不会弄坏现有配置 |
|
|
37
37
|
| 📸 | **快照恢复** | 撤销一次导入:整文件还原 + 卸载新增插件(CLI 与 GUI 均支持) |
|
|
38
|
+
| 🔄 | **远程同步** | 通过 Git 私有仓库推送 / 拉取可移植配置(密钥永不参与同步) |
|
|
38
39
|
| 🗂️ | **配置档案 Profiles** | 保存多套配置(工作 / 个人),随时切换 |
|
|
39
40
|
|
|
40
41
|
---
|
package/lib/client.d.ts
CHANGED
|
@@ -353,10 +353,83 @@ declare class ConfigManagerApi {
|
|
|
353
353
|
restoreSnapshot(snapshotId: string, dryRun: boolean): Promise<RestoreResponse>;
|
|
354
354
|
}
|
|
355
355
|
//#endregion
|
|
356
|
+
//#region src/sync/sync-engine.d.ts
|
|
357
|
+
interface SyncPushReport {
|
|
358
|
+
ok: boolean;
|
|
359
|
+
snapshotId: string;
|
|
360
|
+
/** 实际进入同步的 portable 分区 */
|
|
361
|
+
sections: SectionId[];
|
|
362
|
+
/** 分区级告警(单项失败不拖垮整体,§34.17 语义) */
|
|
363
|
+
warnings: string[];
|
|
364
|
+
message?: string;
|
|
365
|
+
}
|
|
366
|
+
/** 差异报告中的单个变更项(PlanItem 摘要,不含敏感细节) */
|
|
367
|
+
interface PullChange {
|
|
368
|
+
id: string;
|
|
369
|
+
adapter: SectionId;
|
|
370
|
+
kind: PlanItemKind;
|
|
371
|
+
description: string;
|
|
372
|
+
severity: PlanItem['severity'];
|
|
373
|
+
}
|
|
374
|
+
interface SyncPullReport {
|
|
375
|
+
ok: boolean;
|
|
376
|
+
snapshotId: string;
|
|
377
|
+
changes: PullChange[];
|
|
378
|
+
/** 是否存在需要人工决策的项(Conflict / MissingSecret / MissingDependency / Install / 路径问题) */
|
|
379
|
+
needsReview: boolean;
|
|
380
|
+
message?: string;
|
|
381
|
+
}
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/client/sync/sync-api.d.ts
|
|
384
|
+
/** GET /sync/status 响应:配置/凭据/上次同步的只读事实(无任何 secret 值) */
|
|
385
|
+
interface SyncStatusResponse {
|
|
386
|
+
ok: boolean;
|
|
387
|
+
/** 是否已保存过仓库配置(sync-config.json) */
|
|
388
|
+
configured: boolean;
|
|
389
|
+
/** 上次使用的仓库地址(不含 token,可回显) */
|
|
390
|
+
repoUrl?: string;
|
|
391
|
+
gitBin?: string;
|
|
392
|
+
/** DSH credentials 中是否已存在 token(describe 只报状态,值永不返回) */
|
|
393
|
+
credentialConfigured: boolean;
|
|
394
|
+
credentialWritable: boolean;
|
|
395
|
+
/** sync-state.lastSyncAt;'' = 从未同步 */
|
|
396
|
+
lastSyncAt?: string;
|
|
397
|
+
/** sync-state.sections 条目数 */
|
|
398
|
+
sectionCount: number;
|
|
399
|
+
transport?: {
|
|
400
|
+
type: string;
|
|
401
|
+
ref: string;
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
/** push 请求体(token 可选:非空则 Host 先写入 DSH credentials 再使用) */
|
|
405
|
+
interface SyncPushPayload {
|
|
406
|
+
repoUrl: string;
|
|
407
|
+
gitBin?: string;
|
|
408
|
+
token?: string;
|
|
409
|
+
}
|
|
410
|
+
/** pull 请求体(strategy 缺省 merge:冲突保留待决策;snapshotId 缺省 = 最新) */
|
|
411
|
+
interface SyncPullPayload extends SyncPushPayload {
|
|
412
|
+
strategy?: 'merge' | 'replace' | 'skipExisting';
|
|
413
|
+
snapshotId?: string;
|
|
414
|
+
}
|
|
415
|
+
/** 远程同步浏览器半数据入口(备份与迁移页第 4 个 tab 的注入业务面) */
|
|
416
|
+
declare class SyncApi {
|
|
417
|
+
/** 读取同步状态(配置 / 凭据 / 上次同步时间 / 分区数) */
|
|
418
|
+
status(): Promise<SyncStatusResponse>;
|
|
419
|
+
/** 推送:导出 portable 分区 → 提交到私有 Git 仓库 → 更新 sync-state */
|
|
420
|
+
push(payload: SyncPushPayload): Promise<SyncPushReport>;
|
|
421
|
+
/** 拉取差异预览:拉取远端最新快照 → 只读分析(绝不执行导入) */
|
|
422
|
+
pull(payload: SyncPullPayload): Promise<SyncPullReport>;
|
|
423
|
+
}
|
|
424
|
+
//#endregion
|
|
356
425
|
//#region src/client/client-types.d.ts
|
|
357
426
|
/** 本插件 Client 半的注入业务面:每个 settings.section 注册项都拿到同一个 api 实例 */
|
|
358
427
|
interface ConfigManagerSectionInjected {
|
|
359
428
|
api: ConfigManagerApi;
|
|
429
|
+
/** 远程同步 API(备份与迁移页第 4 个 tab 使用,主 section 注册时注入) */
|
|
430
|
+
syncApi: SyncApi;
|
|
431
|
+
/** 远程同步 locale(config-manager-sync 命名空间,主 section 注册时注入) */
|
|
432
|
+
syncT: import('@deepseek-ai/dsh-client-ui-slots').TranslateNS<'config-manager-sync'>;
|
|
360
433
|
}
|
|
361
434
|
//#endregion
|
|
362
435
|
//#region src/client/locales.d.ts
|
|
@@ -371,6 +444,7 @@ declare const zh$1: {
|
|
|
371
444
|
readonly 'view.export': "导出备份";
|
|
372
445
|
readonly 'view.import': "导入恢复";
|
|
373
446
|
readonly 'view.snapshots': "快照恢复";
|
|
447
|
+
readonly 'view.sync': "远程同步";
|
|
374
448
|
readonly 'common.close': "关闭";
|
|
375
449
|
readonly 'common.cancel': "取消";
|
|
376
450
|
readonly 'common.back': "上一步";
|
|
@@ -532,82 +606,11 @@ interface ImportWizardViewProps {
|
|
|
532
606
|
t: TranslateNS<'config-manager'>;
|
|
533
607
|
}
|
|
534
608
|
//#endregion
|
|
535
|
-
//#region src/sync/sync-engine.d.ts
|
|
536
|
-
interface SyncPushReport {
|
|
537
|
-
ok: boolean;
|
|
538
|
-
snapshotId: string;
|
|
539
|
-
/** 实际进入同步的 portable 分区 */
|
|
540
|
-
sections: SectionId[];
|
|
541
|
-
/** 分区级告警(单项失败不拖垮整体,§34.17 语义) */
|
|
542
|
-
warnings: string[];
|
|
543
|
-
message?: string;
|
|
544
|
-
}
|
|
545
|
-
/** 差异报告中的单个变更项(PlanItem 摘要,不含敏感细节) */
|
|
546
|
-
interface PullChange {
|
|
547
|
-
id: string;
|
|
548
|
-
adapter: SectionId;
|
|
549
|
-
kind: PlanItemKind;
|
|
550
|
-
description: string;
|
|
551
|
-
severity: PlanItem['severity'];
|
|
552
|
-
}
|
|
553
|
-
interface SyncPullReport {
|
|
554
|
-
ok: boolean;
|
|
555
|
-
snapshotId: string;
|
|
556
|
-
changes: PullChange[];
|
|
557
|
-
/** 是否存在需要人工决策的项(Conflict / MissingSecret / MissingDependency / Install / 路径问题) */
|
|
558
|
-
needsReview: boolean;
|
|
559
|
-
message?: string;
|
|
560
|
-
}
|
|
561
|
-
//#endregion
|
|
562
|
-
//#region src/client/sync/sync-api.d.ts
|
|
563
|
-
/** GET /sync/status 响应:配置/凭据/上次同步的只读事实(无任何 secret 值) */
|
|
564
|
-
interface SyncStatusResponse {
|
|
565
|
-
ok: boolean;
|
|
566
|
-
/** 是否已保存过仓库配置(sync-config.json) */
|
|
567
|
-
configured: boolean;
|
|
568
|
-
/** 上次使用的仓库地址(不含 token,可回显) */
|
|
569
|
-
repoUrl?: string;
|
|
570
|
-
gitBin?: string;
|
|
571
|
-
/** DSH credentials 中是否已存在 token(describe 只报状态,值永不返回) */
|
|
572
|
-
credentialConfigured: boolean;
|
|
573
|
-
credentialWritable: boolean;
|
|
574
|
-
/** sync-state.lastSyncAt;'' = 从未同步 */
|
|
575
|
-
lastSyncAt?: string;
|
|
576
|
-
/** sync-state.sections 条目数 */
|
|
577
|
-
sectionCount: number;
|
|
578
|
-
transport?: {
|
|
579
|
-
type: string;
|
|
580
|
-
ref: string;
|
|
581
|
-
};
|
|
582
|
-
}
|
|
583
|
-
/** push 请求体(token 可选:非空则 Host 先写入 DSH credentials 再使用) */
|
|
584
|
-
interface SyncPushPayload {
|
|
585
|
-
repoUrl: string;
|
|
586
|
-
gitBin?: string;
|
|
587
|
-
token?: string;
|
|
588
|
-
}
|
|
589
|
-
/** pull 请求体(strategy 缺省 merge:冲突保留待决策;snapshotId 缺省 = 最新) */
|
|
590
|
-
interface SyncPullPayload extends SyncPushPayload {
|
|
591
|
-
strategy?: 'merge' | 'replace' | 'skipExisting';
|
|
592
|
-
snapshotId?: string;
|
|
593
|
-
}
|
|
594
|
-
/** 远程同步浏览器半数据入口(settings.section: config-manager-sync 的注入业务面) */
|
|
595
|
-
declare class SyncApi {
|
|
596
|
-
/** 读取同步状态(配置 / 凭据 / 上次同步时间 / 分区数) */
|
|
597
|
-
status(): Promise<SyncStatusResponse>;
|
|
598
|
-
/** 推送:导出 portable 分区 → 提交到私有 Git 仓库 → 更新 sync-state */
|
|
599
|
-
push(payload: SyncPushPayload): Promise<SyncPushReport>;
|
|
600
|
-
/** 拉取差异预览:拉取远端最新快照 → 只读分析(绝不执行导入) */
|
|
601
|
-
pull(payload: SyncPullPayload): Promise<SyncPullReport>;
|
|
602
|
-
}
|
|
603
|
-
//#endregion
|
|
604
609
|
//#region src/client/sync/SyncSettingsView.d.ts
|
|
605
|
-
interface
|
|
610
|
+
interface SyncSettingsViewProps {
|
|
606
611
|
api: SyncApi;
|
|
607
|
-
}
|
|
608
|
-
type SyncSettingsViewProps = PropsRuntime<'settings.section'> & SyncSettingsSectionInjected & {
|
|
609
612
|
t: TranslateNS<'config-manager-sync'>;
|
|
610
|
-
}
|
|
613
|
+
}
|
|
611
614
|
//#endregion
|
|
612
615
|
//#region src/client/index.d.ts
|
|
613
616
|
declare module '@deepseek-ai/dsh-client-ui-slots' {
|