@artenx/dshb 0.1.42 → 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 +50 -140
- 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/coordinator.js +7 -2
- package/lib/core/sync/coordinator.js.map +1 -1
- 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 +6 -4
- 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/peer-manager.js +1 -0
- package/lib/core/sync/peer-manager.js.map +1 -1
- 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-CjO13Ds4.d.ts → host-key-ahUa0x1Z.d.ts} +2 -2
- package/lib/{model-CX2TlH2E.d.ts → model-CYwA2ha_.d.ts} +5 -1
- package/lib/{node-sync-qnJ7u0TU.d.ts → node-sync-DwB1OJyx.d.ts} +3 -3
- package/lib/{session-journal-ftjZuIxo.d.ts → session-journal-D5Z-Fpy0.d.ts} +2 -2
- package/lib/{session-sync-AlV-M72t.d.ts → session-sync-DL25qi0e.d.ts} +5 -5
- package/lib/{ssh-transport-a3qXoscG.d.ts → ssh-transport-D5X4YKg7.d.ts} +5 -5
- package/lib/{stores-BwQLabuJ.d.ts → stores-Cxjt9l2a.d.ts} +2 -2
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -2578,17 +2578,13 @@ window.__ModuleLoader__.load({
|
|
|
2578
2578
|
remoteDshHome: "",
|
|
2579
2579
|
remoteProfile: "",
|
|
2580
2580
|
remoteWebPort: "",
|
|
2581
|
-
|
|
2582
|
-
schedule: "manual",
|
|
2583
|
-
mode: "full",
|
|
2584
|
-
syncSessions: false,
|
|
2581
|
+
sessionSync: "off",
|
|
2585
2582
|
selection: {
|
|
2586
2583
|
mode: "all",
|
|
2587
2584
|
nodes: [],
|
|
2588
2585
|
workspaces: [],
|
|
2589
2586
|
sessions: []
|
|
2590
|
-
}
|
|
2591
|
-
enabled: true
|
|
2587
|
+
}
|
|
2592
2588
|
};
|
|
2593
2589
|
function validPort(value) {
|
|
2594
2590
|
const port = Number(value);
|
|
@@ -2614,32 +2610,35 @@ window.__ModuleLoader__.load({
|
|
|
2614
2610
|
remoteDshHome: peer.remoteDshHome ?? "",
|
|
2615
2611
|
remoteProfile: peer.remoteProfile ?? "",
|
|
2616
2612
|
remoteWebPort: peer.remoteWebPort == null ? "" : String(peer.remoteWebPort),
|
|
2617
|
-
|
|
2618
|
-
schedule: peer.schedule,
|
|
2619
|
-
mode: peer.syncSessions ? peer.mode ?? "full" : "full",
|
|
2620
|
-
syncSessions: peer.syncSessions,
|
|
2613
|
+
sessionSync: peer.syncSessions ? peer.mode === "metadata" ? "metadata" : "full" : "off",
|
|
2621
2614
|
selection: peer.selection ?? {
|
|
2622
2615
|
mode: "all",
|
|
2623
2616
|
nodes: [],
|
|
2624
2617
|
workspaces: [],
|
|
2625
2618
|
sessions: []
|
|
2626
|
-
}
|
|
2627
|
-
enabled: peer.enabled
|
|
2619
|
+
}
|
|
2628
2620
|
};
|
|
2629
2621
|
}
|
|
2622
|
+
/**
|
|
2623
|
+
* 把表单归一化为保存请求:
|
|
2624
|
+
* - 工作节点配置恒同步;方向与时机逻辑已取消(双向交换、仅手动触发)。
|
|
2625
|
+
* - 「打开远端会话」(wss 实时访问)不依赖手动同步,元数据同步无需传输离线文件。
|
|
2626
|
+
*/
|
|
2630
2627
|
function buildSyncPeerFormRequest(form) {
|
|
2628
|
+
const syncSessions = form.sessionSync !== "off";
|
|
2631
2629
|
const fields = {
|
|
2632
2630
|
name: form.name.trim(),
|
|
2633
2631
|
host: form.host.trim(),
|
|
2634
2632
|
port: Number(form.port),
|
|
2635
2633
|
username: form.username.trim(),
|
|
2636
2634
|
authKind: form.authKind,
|
|
2637
|
-
direction:
|
|
2638
|
-
schedule:
|
|
2639
|
-
mode: form.
|
|
2640
|
-
|
|
2635
|
+
direction: "bidirectional",
|
|
2636
|
+
schedule: "manual",
|
|
2637
|
+
mode: form.sessionSync === "metadata" ? "metadata" : "full",
|
|
2638
|
+
syncNodes: true,
|
|
2639
|
+
syncSessions,
|
|
2641
2640
|
selection: form.selection,
|
|
2642
|
-
enabled:
|
|
2641
|
+
enabled: true,
|
|
2643
2642
|
...form.remoteDshHome.trim() ? { remoteDshHome: form.remoteDshHome.trim() } : {},
|
|
2644
2643
|
...form.remoteProfile.trim() ? { remoteProfile: form.remoteProfile.trim() } : {},
|
|
2645
2644
|
...form.remoteWebPort.trim() ? { remoteWebPort: Number(form.remoteWebPort) } : {}
|
|
@@ -2825,7 +2824,6 @@ window.__ModuleLoader__.load({
|
|
|
2825
2824
|
const runningCount = peers.filter((peer) => peer.progress?.lastRunStatus === "running").length;
|
|
2826
2825
|
const statusLabel = (peer) => {
|
|
2827
2826
|
const status = peer.progress?.lastRunStatus;
|
|
2828
|
-
if (!peer.enabled) return "已停用";
|
|
2829
2827
|
if (status === "running") return "同步中";
|
|
2830
2828
|
if (status === "stopped") return "上次已停止(未完成批次已丢弃)";
|
|
2831
2829
|
if (status === "failed") return "上次失败";
|
|
@@ -3008,7 +3006,7 @@ window.__ModuleLoader__.load({
|
|
|
3008
3006
|
}
|
|
3009
3007
|
};
|
|
3010
3008
|
const runSync = async () => {
|
|
3011
|
-
if (selectedId === "new"
|
|
3009
|
+
if (selectedId === "new") return;
|
|
3012
3010
|
setSyncing(true);
|
|
3013
3011
|
try {
|
|
3014
3012
|
const response = await fetch(`/api/dshb/sync/peers/${selectedId}/run`, { method: "POST" });
|
|
@@ -3530,139 +3528,51 @@ window.__ModuleLoader__.load({
|
|
|
3530
3528
|
children: "同步策略"
|
|
3531
3529
|
}),
|
|
3532
3530
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3533
|
-
|
|
3534
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
3535
|
-
style:
|
|
3536
|
-
children:
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
style: inputStyle$1,
|
|
3541
|
-
value: form.direction,
|
|
3542
|
-
onChange: (e) => setForm((c) => ({
|
|
3543
|
-
...c,
|
|
3544
|
-
direction: e.target.value
|
|
3545
|
-
})),
|
|
3546
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3547
|
-
value: "pull",
|
|
3548
|
-
children: "单向拉取到本机"
|
|
3549
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3550
|
-
value: "bidirectional",
|
|
3551
|
-
children: "双向同步"
|
|
3552
|
-
})]
|
|
3553
|
-
})]
|
|
3554
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3555
|
-
style: field,
|
|
3556
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3557
|
-
style: label,
|
|
3558
|
-
children: "同步时机"
|
|
3559
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
3560
|
-
style: inputStyle$1,
|
|
3561
|
-
value: form.schedule,
|
|
3562
|
-
onChange: (e) => setForm((c) => ({
|
|
3563
|
-
...c,
|
|
3564
|
-
schedule: e.target.value
|
|
3565
|
-
})),
|
|
3566
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3567
|
-
value: "manual",
|
|
3568
|
-
children: "手动"
|
|
3569
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3570
|
-
value: "every-5m",
|
|
3571
|
-
children: "每 5 分钟"
|
|
3572
|
-
})]
|
|
3573
|
-
})]
|
|
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: "始终随同步双向交换,无需配置;点击「立即同步」时执行一次。"
|
|
3574
3538
|
})]
|
|
3575
3539
|
}),
|
|
3576
3540
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3577
|
-
style:
|
|
3578
|
-
...field,
|
|
3579
|
-
display: "flex",
|
|
3580
|
-
flexDirection: "column",
|
|
3581
|
-
gap: 10
|
|
3582
|
-
},
|
|
3541
|
+
style: field,
|
|
3583
3542
|
children: [
|
|
3584
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
3585
|
-
style:
|
|
3586
|
-
|
|
3587
|
-
alignItems: "flex-start",
|
|
3588
|
-
gap: 8,
|
|
3589
|
-
cursor: "pointer"
|
|
3590
|
-
},
|
|
3591
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3592
|
-
type: "checkbox",
|
|
3593
|
-
checked: form.syncSessions,
|
|
3594
|
-
style: { marginTop: 2 },
|
|
3595
|
-
onChange: (e) => setForm((c) => ({
|
|
3596
|
-
...c,
|
|
3597
|
-
syncSessions: e.target.checked,
|
|
3598
|
-
...e.target.checked ? {} : { mode: "full" }
|
|
3599
|
-
}))
|
|
3600
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3601
|
-
style: { fontSize: 13 },
|
|
3602
|
-
children: "同步工作区会话"
|
|
3603
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3604
|
-
style: {
|
|
3605
|
-
display: "block",
|
|
3606
|
-
fontSize: 11,
|
|
3607
|
-
opacity: .5,
|
|
3608
|
-
marginTop: 2
|
|
3609
|
-
},
|
|
3610
|
-
children: form.mode === "metadata" ? "同步远端工作区与会话列表,通过加密通道实时访问会话内容" : "同步会话完整内容,导入后可在本机继续;保留冲突分支供恢复"
|
|
3611
|
-
})] })]
|
|
3543
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3544
|
+
style: label,
|
|
3545
|
+
children: "工作区会话"
|
|
3612
3546
|
}),
|
|
3613
|
-
|
|
3614
|
-
style:
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3547
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
3548
|
+
style: inputStyle$1,
|
|
3549
|
+
value: form.sessionSync,
|
|
3550
|
+
onChange: (e) => setForm((c) => ({
|
|
3551
|
+
...c,
|
|
3552
|
+
sessionSync: e.target.value
|
|
3553
|
+
})),
|
|
3618
3554
|
children: [
|
|
3619
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
3620
|
-
|
|
3621
|
-
children: "
|
|
3555
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3556
|
+
value: "off",
|
|
3557
|
+
children: "不同步"
|
|
3622
3558
|
}),
|
|
3623
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
onChange: (e) => setForm((c) => ({
|
|
3627
|
-
...c,
|
|
3628
|
-
mode: e.target.value
|
|
3629
|
-
})),
|
|
3630
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3631
|
-
value: "full",
|
|
3632
|
-
children: "全量同步"
|
|
3633
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3634
|
-
value: "metadata",
|
|
3635
|
-
children: "元数据同步"
|
|
3636
|
-
})]
|
|
3559
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3560
|
+
value: "full",
|
|
3561
|
+
children: "全量同步"
|
|
3637
3562
|
}),
|
|
3638
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
3639
|
-
|
|
3640
|
-
children:
|
|
3563
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
3564
|
+
value: "metadata",
|
|
3565
|
+
children: "元数据同步"
|
|
3641
3566
|
})
|
|
3642
3567
|
]
|
|
3643
3568
|
}),
|
|
3644
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
3645
|
-
style:
|
|
3646
|
-
|
|
3647
|
-
alignItems: "center",
|
|
3648
|
-
gap: 8,
|
|
3649
|
-
cursor: "pointer"
|
|
3650
|
-
},
|
|
3651
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3652
|
-
type: "checkbox",
|
|
3653
|
-
checked: form.enabled,
|
|
3654
|
-
onChange: (e) => setForm((c) => ({
|
|
3655
|
-
...c,
|
|
3656
|
-
enabled: e.target.checked
|
|
3657
|
-
}))
|
|
3658
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3659
|
-
style: { fontSize: 13 },
|
|
3660
|
-
children: "启用此同步节点"
|
|
3661
|
-
})]
|
|
3569
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3570
|
+
style: hint,
|
|
3571
|
+
children: form.sessionSync === "metadata" ? "不传输离线文件:侧栏会话行的「打开远端会话」自动经加密 SSH 通道实时显示远端会话消息,可直接继续对话与审批,不受同步时机限制。" : form.sessionSync === "full" ? "点击「立即同步」时把会话完整内容传输到本机,导入后可离线继续;数据量大时耗时较长。" : "仅同步工作节点配置;需要会话时再切换为全量或元数据同步。"
|
|
3662
3572
|
})
|
|
3663
3573
|
]
|
|
3664
3574
|
}),
|
|
3665
|
-
selectedPeer && form.
|
|
3575
|
+
selectedPeer && form.sessionSync === "full" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3666
3576
|
style: {
|
|
3667
3577
|
...field,
|
|
3668
3578
|
display: "grid",
|
|
@@ -3700,7 +3610,7 @@ window.__ModuleLoader__.load({
|
|
|
3700
3610
|
...current,
|
|
3701
3611
|
selection
|
|
3702
3612
|
})),
|
|
3703
|
-
includeSessions: form.
|
|
3613
|
+
includeSessions: form.sessionSync === "full" || form.sessionSync === "metadata",
|
|
3704
3614
|
disabled: busy
|
|
3705
3615
|
})
|
|
3706
3616
|
]
|
|
@@ -3791,7 +3701,7 @@ window.__ModuleLoader__.load({
|
|
|
3791
3701
|
!isNew && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3792
3702
|
type: "button",
|
|
3793
3703
|
onClick: () => void (syncInProgress ? stopSync() : runSync()),
|
|
3794
|
-
disabled: busy || probing || stopping
|
|
3704
|
+
disabled: busy || probing || stopping,
|
|
3795
3705
|
style: secondaryBtn,
|
|
3796
3706
|
children: stopping ? "正在停止…" : syncInProgress ? "停止同步" : "立即同步"
|
|
3797
3707
|
}),
|