@artenx/dshb 0.1.43 → 0.1.44
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.js +49 -171
- package/lib/client.js.map +1 -1
- package/lib/core/routes.d.ts +1 -1
- package/lib/core/sync/coordinator.d.ts +5 -5
- package/lib/core/sync/host-key.d.ts +1 -1
- package/lib/core/sync/internal-routes.d.ts +3 -3
- package/lib/core/sync/model.d.ts +1 -1
- package/lib/core/sync/model.js +4 -5
- package/lib/core/sync/model.js.map +1 -1
- package/lib/core/sync/node-sync.d.ts +1 -1
- package/lib/core/sync/offline-archive.d.ts +4 -4
- package/lib/core/sync/peer-manager.d.ts +2 -2
- package/lib/core/sync/routes.d.ts +1 -1
- package/lib/core/sync/session-journal.d.ts +1 -1
- package/lib/core/sync/session-routes.d.ts +1 -1
- package/lib/core/sync/session-sync.d.ts +1 -1
- package/lib/core/sync/ssh-transport.d.ts +1 -1
- package/lib/core/sync/stores.d.ts +1 -1
- package/lib/core/workspaces.d.ts +1 -1
- package/lib/{host-key-DeHqgO7s.d.ts → host-key-ahUa0x1Z.d.ts} +2 -2
- package/lib/{model-qtM3rcyA.d.ts → model-CYwA2ha_.d.ts} +4 -2
- package/lib/{node-sync-CJZl2FCE.d.ts → node-sync-DwB1OJyx.d.ts} +3 -3
- package/lib/{session-journal-BwrCnkk4.d.ts → session-journal-D5Z-Fpy0.d.ts} +2 -2
- package/lib/{session-sync-Celc4x_B.d.ts → session-sync-DL25qi0e.d.ts} +5 -5
- package/lib/{ssh-transport-DLXkPpxT.d.ts → ssh-transport-D5X4YKg7.d.ts} +5 -5
- package/lib/{stores-NzEbaGQ3.d.ts → stores-Cxjt9l2a.d.ts} +2 -2
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -2578,18 +2578,13 @@ window.__ModuleLoader__.load({
|
|
|
2578
2578
|
remoteDshHome: "",
|
|
2579
2579
|
remoteProfile: "",
|
|
2580
2580
|
remoteWebPort: "",
|
|
2581
|
-
|
|
2582
|
-
schedule: "manual",
|
|
2583
|
-
mode: "full",
|
|
2584
|
-
syncNodes: true,
|
|
2585
|
-
syncSessions: false,
|
|
2581
|
+
sessionSync: "off",
|
|
2586
2582
|
selection: {
|
|
2587
2583
|
mode: "all",
|
|
2588
2584
|
nodes: [],
|
|
2589
2585
|
workspaces: [],
|
|
2590
2586
|
sessions: []
|
|
2591
|
-
}
|
|
2592
|
-
enabled: true
|
|
2587
|
+
}
|
|
2593
2588
|
};
|
|
2594
2589
|
function validPort(value) {
|
|
2595
2590
|
const port = Number(value);
|
|
@@ -2603,8 +2598,6 @@ window.__ModuleLoader__.load({
|
|
|
2603
2598
|
if (form.authKind === "key" && !form.privateKey && !savedSecrets?.hasKey) return "请填写 SSH 私钥内容";
|
|
2604
2599
|
}
|
|
2605
2600
|
function toSyncPeerForm(peer) {
|
|
2606
|
-
const syncSessions = peer.syncSessions;
|
|
2607
|
-
const mode = syncSessions ? peer.mode ?? "full" : "full";
|
|
2608
2601
|
return {
|
|
2609
2602
|
name: peer.name,
|
|
2610
2603
|
host: peer.host,
|
|
@@ -2617,41 +2610,32 @@ window.__ModuleLoader__.load({
|
|
|
2617
2610
|
remoteDshHome: peer.remoteDshHome ?? "",
|
|
2618
2611
|
remoteProfile: peer.remoteProfile ?? "",
|
|
2619
2612
|
remoteWebPort: peer.remoteWebPort == null ? "" : String(peer.remoteWebPort),
|
|
2620
|
-
|
|
2621
|
-
schedule: peer.schedule,
|
|
2622
|
-
mode,
|
|
2623
|
-
syncNodes: mode === "metadata" ? peer.syncNodes ?? true : true,
|
|
2624
|
-
syncSessions,
|
|
2613
|
+
sessionSync: peer.syncSessions ? peer.mode === "metadata" ? "metadata" : "full" : "off",
|
|
2625
2614
|
selection: peer.selection ?? {
|
|
2626
2615
|
mode: "all",
|
|
2627
2616
|
nodes: [],
|
|
2628
2617
|
workspaces: [],
|
|
2629
2618
|
sessions: []
|
|
2630
|
-
}
|
|
2631
|
-
enabled: true
|
|
2619
|
+
}
|
|
2632
2620
|
};
|
|
2633
2621
|
}
|
|
2634
2622
|
/**
|
|
2635
2623
|
* 把表单归一化为保存请求:
|
|
2636
|
-
* -
|
|
2637
|
-
* -
|
|
2638
|
-
* - 全量会话同步依赖工作节点配置,强制开启节点同步。
|
|
2624
|
+
* - 工作节点配置恒同步;方向与时机逻辑已取消(双向交换、仅手动触发)。
|
|
2625
|
+
* - 「打开远端会话」(wss 实时访问)不依赖手动同步,元数据同步无需传输离线文件。
|
|
2639
2626
|
*/
|
|
2640
2627
|
function buildSyncPeerFormRequest(form) {
|
|
2641
|
-
const syncSessions = form.
|
|
2642
|
-
const mode = syncSessions ? form.mode : "full";
|
|
2643
|
-
const syncNodes = mode === "metadata" ? form.syncNodes : true;
|
|
2644
|
-
const schedule = mode === "metadata" && !syncNodes ? "manual" : form.schedule;
|
|
2628
|
+
const syncSessions = form.sessionSync !== "off";
|
|
2645
2629
|
const fields = {
|
|
2646
2630
|
name: form.name.trim(),
|
|
2647
2631
|
host: form.host.trim(),
|
|
2648
2632
|
port: Number(form.port),
|
|
2649
2633
|
username: form.username.trim(),
|
|
2650
2634
|
authKind: form.authKind,
|
|
2651
|
-
direction:
|
|
2652
|
-
schedule,
|
|
2653
|
-
mode,
|
|
2654
|
-
syncNodes,
|
|
2635
|
+
direction: "bidirectional",
|
|
2636
|
+
schedule: "manual",
|
|
2637
|
+
mode: form.sessionSync === "metadata" ? "metadata" : "full",
|
|
2638
|
+
syncNodes: true,
|
|
2655
2639
|
syncSessions,
|
|
2656
2640
|
selection: form.selection,
|
|
2657
2641
|
enabled: true,
|
|
@@ -2840,7 +2824,6 @@ window.__ModuleLoader__.load({
|
|
|
2840
2824
|
const runningCount = peers.filter((peer) => peer.progress?.lastRunStatus === "running").length;
|
|
2841
2825
|
const statusLabel = (peer) => {
|
|
2842
2826
|
const status = peer.progress?.lastRunStatus;
|
|
2843
|
-
if (!peer.enabled) return "已停用";
|
|
2844
2827
|
if (status === "running") return "同步中";
|
|
2845
2828
|
if (status === "stopped") return "上次已停止(未完成批次已丢弃)";
|
|
2846
2829
|
if (status === "failed") return "上次失败";
|
|
@@ -3023,7 +3006,7 @@ window.__ModuleLoader__.load({
|
|
|
3023
3006
|
}
|
|
3024
3007
|
};
|
|
3025
3008
|
const runSync = async () => {
|
|
3026
|
-
if (selectedId === "new"
|
|
3009
|
+
if (selectedId === "new") return;
|
|
3027
3010
|
setSyncing(true);
|
|
3028
3011
|
try {
|
|
3029
3012
|
const response = await fetch(`/api/dshb/sync/peers/${selectedId}/run`, { method: "POST" });
|
|
@@ -3544,157 +3527,52 @@ window.__ModuleLoader__.load({
|
|
|
3544
3527
|
},
|
|
3545
3528
|
children: "同步策略"
|
|
3546
3529
|
}),
|
|
3547
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
3548
|
-
style:
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
type: "checkbox",
|
|
3557
|
-
checked: form.syncNodes,
|
|
3558
|
-
style: { marginTop: 2 },
|
|
3559
|
-
disabled: !(form.syncSessions && form.mode === "metadata"),
|
|
3560
|
-
onChange: (e) => setForm((c) => ({
|
|
3561
|
-
...c,
|
|
3562
|
-
syncNodes: e.target.checked,
|
|
3563
|
-
...e.target.checked || c.syncSessions && c.mode === "metadata" ? {} : { schedule: "manual" }
|
|
3564
|
-
}))
|
|
3565
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3566
|
-
style: { fontSize: 13 },
|
|
3567
|
-
children: "同步工作节点"
|
|
3568
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3569
|
-
style: {
|
|
3570
|
-
display: "block",
|
|
3571
|
-
fontSize: 11,
|
|
3572
|
-
opacity: .5,
|
|
3573
|
-
marginTop: 2
|
|
3574
|
-
},
|
|
3575
|
-
children: form.syncSessions && form.mode === "full" ? "全量会话同步依赖工作节点配置,始终开启" : "同步工作节点的 SSH 连接配置与远端目录"
|
|
3576
|
-
})] })]
|
|
3530
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3531
|
+
style: field,
|
|
3532
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3533
|
+
style: label,
|
|
3534
|
+
children: "工作节点配置"
|
|
3535
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3536
|
+
style: hint,
|
|
3537
|
+
children: "始终随同步双向交换,无需配置;点击「立即同步」时执行一次。"
|
|
3538
|
+
})]
|
|
3577
3539
|
}),
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
children: [
|
|
3581
|
-
|
|
3582
|
-
children: [
|
|
3583
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3584
|
-
style: label,
|
|
3585
|
-
children: "同步方向"
|
|
3586
|
-
}),
|
|
3587
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
3588
|
-
style: inputStyle$1,
|
|
3589
|
-
value: form.direction,
|
|
3590
|
-
onChange: (e) => setForm((c) => ({
|
|
3591
|
-
...c,
|
|
3592
|
-
direction: e.target.value
|
|
3593
|
-
})),
|
|
3594
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3595
|
-
value: "pull",
|
|
3596
|
-
children: "单向拉取到本机"
|
|
3597
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3598
|
-
value: "bidirectional",
|
|
3599
|
-
children: "双向同步"
|
|
3600
|
-
})]
|
|
3601
|
-
}),
|
|
3602
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3603
|
-
style: hint,
|
|
3604
|
-
children: ["作用于工作节点配置", form.syncSessions && form.mode === "full" ? "与会话内容" : ""]
|
|
3605
|
-
})
|
|
3606
|
-
]
|
|
3607
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3608
|
-
style: field,
|
|
3609
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3540
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3541
|
+
style: field,
|
|
3542
|
+
children: [
|
|
3543
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3610
3544
|
style: label,
|
|
3611
|
-
children: "
|
|
3612
|
-
}),
|
|
3545
|
+
children: "工作区会话"
|
|
3546
|
+
}),
|
|
3547
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
3613
3548
|
style: inputStyle$1,
|
|
3614
|
-
value: form.
|
|
3549
|
+
value: form.sessionSync,
|
|
3615
3550
|
onChange: (e) => setForm((c) => ({
|
|
3616
3551
|
...c,
|
|
3617
|
-
|
|
3552
|
+
sessionSync: e.target.value
|
|
3618
3553
|
})),
|
|
3619
|
-
children: [
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
})]
|
|
3626
|
-
})]
|
|
3627
|
-
})]
|
|
3628
|
-
}),
|
|
3629
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3630
|
-
style: {
|
|
3631
|
-
...field,
|
|
3632
|
-
display: "flex",
|
|
3633
|
-
flexDirection: "column",
|
|
3634
|
-
gap: 10
|
|
3635
|
-
},
|
|
3636
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
3637
|
-
style: {
|
|
3638
|
-
display: "flex",
|
|
3639
|
-
alignItems: "flex-start",
|
|
3640
|
-
gap: 8,
|
|
3641
|
-
cursor: "pointer"
|
|
3642
|
-
},
|
|
3643
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3644
|
-
type: "checkbox",
|
|
3645
|
-
checked: form.syncSessions,
|
|
3646
|
-
style: { marginTop: 2 },
|
|
3647
|
-
onChange: (e) => setForm((c) => ({
|
|
3648
|
-
...c,
|
|
3649
|
-
syncSessions: e.target.checked,
|
|
3650
|
-
...e.target.checked ? { syncNodes: true } : { mode: "full" }
|
|
3651
|
-
}))
|
|
3652
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3653
|
-
style: { fontSize: 13 },
|
|
3654
|
-
children: "同步工作区会话"
|
|
3655
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3656
|
-
style: {
|
|
3657
|
-
display: "block",
|
|
3658
|
-
fontSize: 11,
|
|
3659
|
-
opacity: .5,
|
|
3660
|
-
marginTop: 2
|
|
3661
|
-
},
|
|
3662
|
-
children: form.mode === "metadata" ? "同步远端工作区与会话列表,通过加密通道实时访问会话内容" : "同步会话完整内容,导入后可在本机继续;保留冲突分支供恢复"
|
|
3663
|
-
})] })]
|
|
3664
|
-
}), form.syncSessions && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3665
|
-
style: {
|
|
3666
|
-
...field,
|
|
3667
|
-
margin: 0
|
|
3668
|
-
},
|
|
3669
|
-
children: [
|
|
3670
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3671
|
-
style: label,
|
|
3672
|
-
children: "同步模式"
|
|
3673
|
-
}),
|
|
3674
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
3675
|
-
style: inputStyle$1,
|
|
3676
|
-
value: form.mode,
|
|
3677
|
-
onChange: (e) => setForm((c) => ({
|
|
3678
|
-
...c,
|
|
3679
|
-
mode: e.target.value,
|
|
3680
|
-
...e.target.value === "full" ? { syncNodes: true } : {}
|
|
3681
|
-
})),
|
|
3682
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3554
|
+
children: [
|
|
3555
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3556
|
+
value: "off",
|
|
3557
|
+
children: "不同步"
|
|
3558
|
+
}),
|
|
3559
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3683
3560
|
value: "full",
|
|
3684
3561
|
children: "全量同步"
|
|
3685
|
-
}),
|
|
3562
|
+
}),
|
|
3563
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3686
3564
|
value: "metadata",
|
|
3687
3565
|
children: "元数据同步"
|
|
3688
|
-
})
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3566
|
+
})
|
|
3567
|
+
]
|
|
3568
|
+
}),
|
|
3569
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3570
|
+
style: hint,
|
|
3571
|
+
children: form.sessionSync === "metadata" ? "不传输离线文件:侧栏会话行的「打开远端会话」自动经加密 SSH 通道实时显示远端会话消息,可直接继续对话与审批,不受同步时机限制。" : form.sessionSync === "full" ? "点击「立即同步」时把会话完整内容传输到本机,导入后可离线继续;数据量大时耗时较长。" : "仅同步工作节点配置;需要会话时再切换为全量或元数据同步。"
|
|
3572
|
+
})
|
|
3573
|
+
]
|
|
3696
3574
|
}),
|
|
3697
|
-
selectedPeer && form.
|
|
3575
|
+
selectedPeer && form.sessionSync === "full" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3698
3576
|
style: {
|
|
3699
3577
|
...field,
|
|
3700
3578
|
display: "grid",
|
|
@@ -3732,7 +3610,7 @@ window.__ModuleLoader__.load({
|
|
|
3732
3610
|
...current,
|
|
3733
3611
|
selection
|
|
3734
3612
|
})),
|
|
3735
|
-
includeSessions: form.
|
|
3613
|
+
includeSessions: form.sessionSync === "full" || form.sessionSync === "metadata",
|
|
3736
3614
|
disabled: busy
|
|
3737
3615
|
})
|
|
3738
3616
|
]
|
|
@@ -3823,7 +3701,7 @@ window.__ModuleLoader__.load({
|
|
|
3823
3701
|
!isNew && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3824
3702
|
type: "button",
|
|
3825
3703
|
onClick: () => void (syncInProgress ? stopSync() : runSync()),
|
|
3826
|
-
disabled: busy || probing || stopping
|
|
3704
|
+
disabled: busy || probing || stopping,
|
|
3827
3705
|
style: secondaryBtn,
|
|
3828
3706
|
children: stopping ? "正在停止…" : syncInProgress ? "停止同步" : "立即同步"
|
|
3829
3707
|
}),
|