@artenx/dshb 0.1.39 → 0.1.40

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 (68) hide show
  1. package/LICENSE +21 -0
  2. package/lib/auth/gate.d.ts +9 -1
  3. package/lib/auth/gate.js +12 -5
  4. package/lib/auth/gate.js.map +1 -1
  5. package/lib/auth/index.js +42 -9
  6. package/lib/auth/index.js.map +1 -1
  7. package/lib/auth/reset-cli.js +0 -0
  8. package/lib/catalog-B3pDDoR4.js +119 -0
  9. package/lib/catalog-B3pDDoR4.js.map +1 -0
  10. package/lib/client.js +1014 -45
  11. package/lib/client.js.map +1 -1
  12. package/lib/core/index.js +477 -4
  13. package/lib/core/index.js.map +1 -1
  14. package/lib/core/routes.d.ts +1 -1
  15. package/lib/core/sync/coordinator.d.ts +5 -5
  16. package/lib/core/sync/coordinator.js +47 -6
  17. package/lib/core/sync/coordinator.js.map +1 -1
  18. package/lib/core/sync/host-key.d.ts +1 -1
  19. package/lib/core/sync/internal-routes.d.ts +3 -3
  20. package/lib/core/sync/internal-routes.js +36 -3
  21. package/lib/core/sync/internal-routes.js.map +1 -1
  22. package/lib/core/sync/model.d.ts +2 -2
  23. package/lib/core/sync/model.js +62 -1
  24. package/lib/core/sync/model.js.map +1 -1
  25. package/lib/core/sync/node-sync.d.ts +1 -1
  26. package/lib/core/sync/offline-archive.d.ts +6 -4
  27. package/lib/core/sync/offline-archive.js +31 -8
  28. package/lib/core/sync/offline-archive.js.map +1 -1
  29. package/lib/core/sync/offline-routes.js +29 -3
  30. package/lib/core/sync/offline-routes.js.map +1 -1
  31. package/lib/core/sync/peer-manager.d.ts +2 -2
  32. package/lib/core/sync/peer-manager.js +2 -0
  33. package/lib/core/sync/peer-manager.js.map +1 -1
  34. package/lib/core/sync/protocol.d.ts +2 -2
  35. package/lib/core/sync/protocol.js +2 -1
  36. package/lib/core/sync/protocol.js.map +1 -1
  37. package/lib/core/sync/remote-helper.js +4 -2
  38. package/lib/core/sync/remote-helper.js.map +1 -1
  39. package/lib/core/sync/routes.d.ts +3 -2
  40. package/lib/core/sync/routes.js +43 -2
  41. package/lib/core/sync/routes.js.map +1 -1
  42. package/lib/core/sync/session-journal.d.ts +1 -1
  43. package/lib/core/sync/session-routes.d.ts +1 -1
  44. package/lib/core/sync/session-routes.js +25 -1
  45. package/lib/core/sync/session-routes.js.map +1 -1
  46. package/lib/core/sync/session-sync.d.ts +1 -1
  47. package/lib/core/sync/session-sync.js +1 -1
  48. package/lib/core/sync/ssh-transport.d.ts +1 -1
  49. package/lib/core/sync/ssh-transport.js +73 -3
  50. package/lib/core/sync/ssh-transport.js.map +1 -1
  51. package/lib/core/sync/stores.d.ts +1 -1
  52. package/lib/core/sync/stores.js +27 -5
  53. package/lib/core/sync/stores.js.map +1 -1
  54. package/lib/core/workspaces.d.ts +1 -1
  55. package/lib/{host-key-CSnpIrjq.d.ts → host-key-Dh2YTRX7.d.ts} +2 -2
  56. package/lib/{model-CKTBf-Pl.d.ts → model-D1T078kt.d.ts} +74 -6
  57. package/lib/{node-sync-C3Ym-HDu.d.ts → node-sync-WdEv-ek7.d.ts} +3 -3
  58. package/lib/{protocol-DJ0zyVlB.d.ts → protocol-DyPDIJWa.d.ts} +3 -2
  59. package/lib/selection-BABQH1Rt.js +48 -0
  60. package/lib/selection-BABQH1Rt.js.map +1 -0
  61. package/lib/{session-journal-VE_1tA2-.d.ts → session-journal-CTblFLJg.d.ts} +2 -2
  62. package/lib/{session-sync-BBCm_ou2.js → session-sync-BZSp_o4n.js} +81 -1
  63. package/lib/session-sync-BZSp_o4n.js.map +1 -0
  64. package/lib/{session-sync-Bw0cZ4oa.d.ts → session-sync-flNnd2JQ.d.ts} +14 -5
  65. package/lib/{ssh-transport-COZe0BDr.d.ts → ssh-transport-DQPMNwh1.d.ts} +25 -6
  66. package/lib/{stores-puyTC075.d.ts → stores-CUY_YFD-.d.ts} +2 -2
  67. package/package.json +8 -6
  68. package/lib/session-sync-BBCm_ou2.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  import { o as NodeRegistry } from "./node-registry-BTnnM5-k.js";
2
2
  import { r as WorkspaceBindingsStore } from "./workspace-bindings-CsB0TIJB.js";
3
3
  import { r as SyncRevision } from "./revision-C9sOlDZ6.js";
4
- import { d as SyncSessionArchive, i as SyncOrigin, l as SyncRecordMetadata, r as SyncImportMethod } from "./model-CKTBf-Pl.js";
5
- import { n as SyncStateStore } from "./stores-puyTC075.js";
6
- import { s as SyncNodeService } from "./node-sync-C3Ym-HDu.js";
4
+ import { _ as SyncSessionArchive, i as SyncCatalogWorkspace, l as SyncOrigin, m as SyncRecordMetadata, r as SyncCatalogSession, s as SyncImportMethod } from "./model-D1T078kt.js";
5
+ import { n as SyncStateStore } from "./stores-CUY_YFD-.js";
6
+ import { s as SyncNodeService } from "./node-sync-WdEv-ek7.js";
7
7
  import { S as BrandedNumber, _ as FileAttachmentRef, a as SystemPromptUpdate, b as TypertResource, c as ToolSchema, d as Message, f as SystemMessage, g as ToolCallId, i as LlmFailure, l as AssistantMessage, m as UserMessage, n as LlmCallConfig, o as TokenUsage, p as ToolResultMessage, r as LlmCallConfigAdapterDefaults, s as ToolHistory, t as AssistantStreamRecord, u as DeveloperMessage, v as ImageAttachmentRef, x as Branded, y as TypertLookup } from "./index-VF8bcBeX.js";
8
8
  import { a as SessionInstructionSnapshotStore, s as WorkspaceInstructionStore } from "./workspace-instructions-C_ViytzA.js";
9
- import { t as SyncSessionJournalStore } from "./session-journal-VE_1tA2-.js";
9
+ import { t as SyncSessionJournalStore } from "./session-journal-CTblFLJg.js";
10
10
  import { Context, Service } from "@deepseek-ai/cordis";
11
11
  //#region ../../node_modules/@deepseek-ai/dsh-scope/lib/types/index.d.ts
12
12
  declare const ScopedBrand: unique symbol;
@@ -1190,6 +1190,7 @@ interface SessionSnapshotLike {
1190
1190
  formatStatus?: 'current' | 'migration-required';
1191
1191
  revision: unknown;
1192
1192
  eventCount?: number;
1193
+ sizeBytes?: number;
1193
1194
  }
1194
1195
  interface SessionHandleLike {
1195
1196
  readonly id: SessionId;
@@ -1325,6 +1326,14 @@ declare class SyncSessionService {
1325
1326
  recoverPending(): Promise<void>;
1326
1327
  cleanupOrphanedStaging(): void;
1327
1328
  listArchives(): SyncSessionArchive[];
1329
+ exportCatalog(): Promise<{
1330
+ workspaces: SyncCatalogWorkspace[];
1331
+ sessions: SyncCatalogSession[];
1332
+ }>;
1333
+ listSessionSizes(): Promise<Array<{
1334
+ sessionId: string;
1335
+ sizeBytes?: number;
1336
+ }>>;
1328
1337
  restoreArchive(branchId: string): Promise<SessionId>;
1329
1338
  private reuseCachedManifestEntry;
1330
1339
  private exportBundleNow;
@@ -1371,4 +1380,4 @@ declare class SyncSessionService {
1371
1380
  }
1372
1381
  //#endregion
1373
1382
  export { sessionEventListDigest as C, validateSyncSessionManifest as D, validateSyncSessionBundle as E, planSessionTransfers as S, validateObjectPayload as T, SyncSessionWorkspace as _, SyncSessionBundle as a, makeSyncSessionBundle as b, SyncSessionEventDelta as c, SyncSessionManifest as d, SyncSessionManifestEntry as f, SyncSessionTransferPlan as g, SyncSessionService as h, SyncSessionApplyResult as i, SyncSessionEventPrefix as l, SyncSessionObjectInbox as m, SyncObjectInboxWriter as n, SyncSessionEntry as o, SyncSessionObject as p, SyncSessionApplyOptions as r, SyncSessionError as s, ExportObjectCache as t, SyncSessionInstructionSnapshot as u, WorkspaceRegistryLike as v, syncSessionEntryKey as w, makeSyncSessionManifest as x, estimateJsonBytes as y };
1374
- //# sourceMappingURL=session-sync-Bw0cZ4oa.d.ts.map
1383
+ //# sourceMappingURL=session-sync-flNnd2JQ.d.ts.map
@@ -1,9 +1,9 @@
1
- import { a as SyncPeer } from "./model-CKTBf-Pl.js";
2
- import { i as SyncNodeManifest, t as SyncNodeApplyResult } from "./node-sync-C3Ym-HDu.js";
1
+ import { t as SyncCatalog, u as SyncPeer } from "./model-D1T078kt.js";
2
+ import { i as SyncNodeManifest, t as SyncNodeApplyResult } from "./node-sync-WdEv-ek7.js";
3
3
  import { SyncPeerManager, SyncPeerSecrets } from "./core/sync/peer-manager.js";
4
- import { r as SyncHostKeyChallenges, t as SyncHostKeyChallengeError } from "./host-key-CSnpIrjq.js";
5
- import { d as SyncFrame } from "./protocol-DJ0zyVlB.js";
6
- import { a as SyncSessionBundle, d as SyncSessionManifest, i as SyncSessionApplyResult, l as SyncSessionEventPrefix, p as SyncSessionObject } from "./session-sync-Bw0cZ4oa.js";
4
+ import { r as SyncHostKeyChallenges, t as SyncHostKeyChallengeError } from "./host-key-Dh2YTRX7.js";
5
+ import { f as SyncFrame } from "./protocol-DyPDIJWa.js";
6
+ import { a as SyncSessionBundle, d as SyncSessionManifest, i as SyncSessionApplyResult, l as SyncSessionEventPrefix, p as SyncSessionObject } from "./session-sync-flNnd2JQ.js";
7
7
  import { Client, ClientChannel, ConnectConfig } from "ssh2";
8
8
  //#region src/core/sync/ssh-transport.d.ts
9
9
  type SyncSshErrorCategory = 'auth' | 'network' | 'hostkey' | 'timeout' | 'helper' | 'protocol';
@@ -53,6 +53,18 @@ declare class SyncSshTransport {
53
53
  /** 立即关闭该对端的全部活跃 SSH 会话(幂等;用于手动停止同步)。 */
54
54
  stopActiveSessions(peerId: string): number;
55
55
  probe(peerId: string): Promise<SyncRemoteHandshake>;
56
+ /** 建立 peer 的 SSH 连接(含 host-key 校验与凭据);调用方负责 client.end()。 */
57
+ private connectClient;
58
+ /**
59
+ * 打开到远端回环 TCP 目标的 direct-tcpip 通道(元数据同步的远端会话
60
+ * wss 通道用)。通道复用 peer 的 host-key 校验与凭据;调用方负责
61
+ * client.end() 与流销毁。
62
+ */
63
+ openDirectChannel(peerId: string, targetHost: string, targetPort: number): Promise<{
64
+ peer: SyncPeer;
65
+ client: Client;
66
+ stream: ClientChannel;
67
+ }>;
56
68
  openSession(peerId: string): Promise<{
57
69
  peer: SyncPeer;
58
70
  session: SyncSshSession;
@@ -61,6 +73,13 @@ declare class SyncSshTransport {
61
73
  applyNodeManifest(peerId: string, records: SyncNodeManifest['records'], sourceName: string): Promise<SyncNodeApplyResult>;
62
74
  fetchSessionBundle(peerId: string): Promise<SyncSessionBundle>;
63
75
  fetchSessionManifest(peerId: string): Promise<SyncSessionManifest>;
76
+ fetchCatalog(peerId: string): Promise<SyncCatalog>;
77
+ /** 取得远端铸造的中继凭据(≤10 分钟签名 cookie),供元数据同步的 wss 通道使用。 */
78
+ fetchRelayTicket(peerId: string, authority: string): Promise<{
79
+ name: string;
80
+ value: string;
81
+ maxAgeSeconds: number;
82
+ }>;
64
83
  fetchSessionEntries(peerId: string, keys: readonly string[], manifestDigest: string, prefixes?: readonly SyncSessionEventPrefix[], deferredObjects?: boolean): Promise<SyncSessionBundle>;
65
84
  applySessionBundle(peerId: string, bundle: SyncSessionBundle, sourceName: string): Promise<SyncSessionApplyResult>;
66
85
  trustObservedHostKey(peerId: string): Promise<void>;
@@ -119,4 +138,4 @@ declare class SyncRemoteProbe {
119
138
  }
120
139
  //#endregion
121
140
  export { parseRemoteProbeOutput as _, SyncRemoteProbe as a, SyncRemoteProbeProfile as c, SyncSshErrorCategory as d, SyncSshProbeError as f, buildSyncSshConnectConfig as g, buildRemoteProbeScript as h, SyncRemoteNodeManifest as i, SyncRemoteProbeResult as l, SyncSshTransport as m, REMOTE_PROBE_END_MARKER as n, SyncRemoteProbeDraft as o, SyncSshSession as p, SyncRemoteHandshake as r, SyncRemoteProbeHandshake as s, REMOTE_PROBE_BEGIN_MARKER as t, SyncSessionDeltaPrefixError as u };
122
- //# sourceMappingURL=ssh-transport-COZe0BDr.d.ts.map
141
+ //# sourceMappingURL=ssh-transport-DQPMNwh1.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { r as SyncRevision } from "./revision-C9sOlDZ6.js";
2
- import { a as SyncPeer, f as SyncState, o as SyncPeerDraft } from "./model-CKTBf-Pl.js";
2
+ import { d as SyncPeerDraft, u as SyncPeer, v as SyncState } from "./model-D1T078kt.js";
3
3
  //#region src/core/sync/stores.d.ts
4
4
  declare function getOrCreateSyncInstanceId(home?: string): string;
5
5
  declare class SyncPeerStore {
@@ -28,4 +28,4 @@ declare class SyncStateStore {
28
28
  }
29
29
  //#endregion
30
30
  export { SyncStateStore as n, getOrCreateSyncInstanceId as r, SyncPeerStore as t };
31
- //# sourceMappingURL=stores-puyTC075.d.ts.map
31
+ //# sourceMappingURL=stores-CUY_YFD-.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artenx/dshb",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "description": "让 DSH 变成随时可用的多设备 Agent 工作台,支持将远程节点添加到本地 DSH,并像操作本地内容一样访问远程节点,包括会话环境、文件目录、终端等。支持在安装了本插件的多个 DSH 实例间同步数据。若部署在云服务器,Web 端访问支持登录认证。真正实现远程节点本地化操作。最新版本已支持 DSH 桌面端。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -47,6 +47,8 @@
47
47
  "./core/sync/session-journal": "./lib/core/sync/session-journal.js",
48
48
  "./core/sync/session-routes": "./lib/core/sync/session-routes.js",
49
49
  "./core/sync/session-sync": "./lib/core/sync/session-sync.js",
50
+ "./core/sync/remote-relay": "./lib/core/sync/remote-relay.js",
51
+ "./core/sync/relay-auth": "./lib/core/sync/relay-auth.js",
50
52
  "./core/sync/ssh-transport": "./lib/core/sync/ssh-transport.js",
51
53
  "./core/sync/stores": "./lib/core/sync/stores.js",
52
54
  "./router": "./lib/router/index.js",
@@ -103,10 +105,6 @@
103
105
  "nodeVersions": ">=22.13"
104
106
  }
105
107
  },
106
- "scripts": {
107
- "build": "tsdown",
108
- "typecheck": "tsc --noEmit"
109
- },
110
108
  "dependencies": {
111
109
  "commander": "^15.0.0",
112
110
  "ssh2": "^1.16.0"
@@ -182,5 +180,9 @@
182
180
  },
183
181
  "bin": {
184
182
  "dshb-auth-reset": "./lib/auth/reset-cli.js"
183
+ },
184
+ "scripts": {
185
+ "build": "tsdown",
186
+ "typecheck": "tsc --noEmit"
185
187
  }
186
- }
188
+ }