@artenx/dshb 0.1.21 → 0.1.23

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 (36) hide show
  1. package/README.md +1 -1
  2. package/lib/auth/index.js +22 -11
  3. package/lib/auth/index.js.map +1 -1
  4. package/lib/client.js +1 -1
  5. package/lib/client.js.map +1 -1
  6. package/lib/core/index.js +2 -2
  7. package/lib/core/index.js.map +1 -1
  8. package/lib/core/sync/coordinator.d.ts +2 -2
  9. package/lib/core/sync/coordinator.js +121 -15
  10. package/lib/core/sync/coordinator.js.map +1 -1
  11. package/lib/core/sync/internal-routes.d.ts +1 -1
  12. package/lib/core/sync/internal-routes.js +58 -9
  13. package/lib/core/sync/internal-routes.js.map +1 -1
  14. package/lib/core/sync/offline-archive.d.ts +1 -1
  15. package/lib/core/sync/offline-archive.js +1 -1
  16. package/lib/core/sync/offline-routes.js +1 -1
  17. package/lib/core/sync/protocol.d.ts +2 -2
  18. package/lib/core/sync/protocol.js +4 -1
  19. package/lib/core/sync/protocol.js.map +1 -1
  20. package/lib/core/sync/remote-helper.js +10 -4
  21. package/lib/core/sync/remote-helper.js.map +1 -1
  22. package/lib/core/sync/routes.d.ts +1 -1
  23. package/lib/core/sync/session-routes.d.ts +1 -1
  24. package/lib/core/sync/session-routes.js +1 -1
  25. package/lib/core/sync/session-sync.d.ts +2 -2
  26. package/lib/core/sync/session-sync.js +2 -2
  27. package/lib/core/sync/ssh-transport.d.ts +2 -2
  28. package/lib/core/sync/ssh-transport.js +97 -104
  29. package/lib/core/sync/ssh-transport.js.map +1 -1
  30. package/lib/{protocol-CV7LGE44.d.ts → protocol-KaWZArY8.d.ts} +5 -2
  31. package/lib/{session-sync-EdfwUON5.js → session-sync-C0uoizyB.js} +834 -98
  32. package/lib/session-sync-C0uoizyB.js.map +1 -0
  33. package/lib/{session-sync-g6qKZzjV.d.ts → session-sync-C2j2rk9K.d.ts} +56 -4
  34. package/lib/{ssh-transport-BcIiLxsX.d.ts → ssh-transport-DGkQh-HA.d.ts} +14 -5
  35. package/package.json +1 -1
  36. package/lib/session-sync-EdfwUON5.js.map +0 -1
@@ -1042,6 +1042,13 @@ interface SyncSessionInstructionSnapshot {
1042
1042
  digest?: string;
1043
1043
  inheritedFromOrigin?: SyncOrigin;
1044
1044
  }
1045
+ interface SyncSessionEventDelta {
1046
+ baseEventCount: number;
1047
+ baseEventDigest: string;
1048
+ baseInheritedEventCount: number;
1049
+ fullEventCount: number;
1050
+ fullEventDigest: string;
1051
+ }
1045
1052
  type SyncSessionObject = {
1046
1053
  id: string;
1047
1054
  kind: 'image';
@@ -1079,6 +1086,10 @@ interface SyncSessionEntry {
1079
1086
  instructionSnapshot?: SyncSessionInstructionSnapshot;
1080
1087
  events?: SessionEvent[];
1081
1088
  objects?: SyncSessionObject[];
1089
+ sharedObjectIds?: string[];
1090
+ eventDelta?: SyncSessionEventDelta;
1091
+ eventCount?: number;
1092
+ eventDigest?: string;
1082
1093
  }
1083
1094
  interface SyncSessionBundle {
1084
1095
  protocolVersion: 1;
@@ -1088,6 +1099,28 @@ interface SyncSessionBundle {
1088
1099
  sessionId: string;
1089
1100
  reason: string;
1090
1101
  }>;
1102
+ objects?: SyncSessionObject[];
1103
+ digest: string;
1104
+ }
1105
+ type SyncSessionManifestEntry = Pick<SyncSessionEntry, 'metadata' | 'branchId'> & {
1106
+ eventCount?: number;
1107
+ eventDigest?: string;
1108
+ inheritedEventCount?: number;
1109
+ };
1110
+ interface SyncSessionEventPrefix {
1111
+ key: string;
1112
+ eventCount: number;
1113
+ eventDigest: string;
1114
+ inheritedEventCount: number;
1115
+ }
1116
+ interface SyncSessionManifest {
1117
+ protocolVersion: 1;
1118
+ instanceId: string;
1119
+ entries: SyncSessionManifestEntry[];
1120
+ skipped: Array<{
1121
+ sessionId: string;
1122
+ reason: string;
1123
+ }>;
1091
1124
  digest: string;
1092
1125
  }
1093
1126
  interface SyncSessionApplyResult {
@@ -1195,12 +1228,19 @@ interface SpillStoreLike {
1195
1228
  content: AsyncIterable<Uint8Array>;
1196
1229
  }): Promise<SpillTransferReference['ref']>;
1197
1230
  }
1231
+ declare function sessionEventListDigest(events: readonly SessionEvent[]): string;
1198
1232
  declare function planSessionTransfers(direction: 'pull' | 'bidirectional', localEntries: readonly SyncSessionEntry[], remoteEntries: readonly SyncSessionEntry[]): SyncSessionTransferPlan;
1199
1233
  declare function validateSyncSessionBundle(value: unknown): SyncSessionBundle;
1200
1234
  declare function makeSyncSessionBundle(instanceId: string, entries: SyncSessionEntry[], skipped?: Array<{
1201
1235
  sessionId: string;
1202
1236
  reason: string;
1203
- }>): SyncSessionBundle;
1237
+ }>, sharedObjects?: SyncSessionObject[]): SyncSessionBundle;
1238
+ declare function syncSessionEntryKey(entry: Pick<SyncSessionManifestEntry, 'metadata' | 'branchId'>): string;
1239
+ declare function makeSyncSessionManifest(instanceId: string, entries: readonly SyncSessionManifestEntry[], skipped?: Array<{
1240
+ sessionId: string;
1241
+ reason: string;
1242
+ }>): SyncSessionManifest;
1243
+ declare function validateSyncSessionManifest(value: unknown): SyncSessionManifest;
1204
1244
  declare class SyncSessionService {
1205
1245
  private readonly state;
1206
1246
  private readonly nodes;
@@ -1214,8 +1254,17 @@ declare class SyncSessionService {
1214
1254
  private readonly journal;
1215
1255
  private readonly now;
1216
1256
  private operationTail;
1217
- constructor(state: SyncStateStore, nodes: SyncNodeService, registry: NodeRegistry, bindings: WorkspaceBindingsStore, getWorkspaces: () => WorkspaceRegistryLike | undefined, getPersistence: () => SessionPersistenceLike | undefined, getAttachments: () => AttachmentStoreLike | undefined, getSpills: () => SpillStoreLike | undefined, instructions: SessionInstructionSnapshotStore, journal?: SyncSessionJournalStore, now?: () => number);
1257
+ private readonly exportCache;
1258
+ private readonly exportCacheStore;
1259
+ private readonly manifestPayloadCache;
1260
+ private manifestPayloadCacheBytes;
1261
+ constructor(state: SyncStateStore, nodes: SyncNodeService, registry: NodeRegistry, bindings: WorkspaceBindingsStore, getWorkspaces: () => WorkspaceRegistryLike | undefined, getPersistence: () => SessionPersistenceLike | undefined, getAttachments: () => AttachmentStoreLike | undefined, getSpills: () => SpillStoreLike | undefined, instructions: SessionInstructionSnapshotStore, journal?: SyncSessionJournalStore, now?: () => number, home?: string);
1218
1262
  exportBundle(): Promise<SyncSessionBundle>;
1263
+ exportManifest(): Promise<SyncSessionManifest>;
1264
+ exportEntries(keys: readonly string[], manifestDigest?: string, prefixes?: readonly SyncSessionEventPrefix[], options?: {
1265
+ sharedObjects?: boolean;
1266
+ }): Promise<SyncSessionBundle>;
1267
+ private rememberManifestPayloads;
1219
1268
  applyBundle(value: unknown, sourceName: string, peerId?: string, options?: SyncSessionApplyOptions): Promise<SyncSessionApplyResult>;
1220
1269
  preflightBundle(value: unknown, options?: SyncSessionApplyOptions): void;
1221
1270
  pendingPeerIds(): string[];
@@ -1223,8 +1272,11 @@ declare class SyncSessionService {
1223
1272
  cleanupOrphanedStaging(): void;
1224
1273
  listArchives(): SyncSessionArchive[];
1225
1274
  restoreArchive(branchId: string): Promise<SessionId>;
1275
+ private reuseCachedManifestEntry;
1226
1276
  private exportBundleNow;
1277
+ private dedupeBundleObjects;
1227
1278
  private applyBundleNow;
1279
+ private expandEventDeltas;
1228
1280
  private prepareEntry;
1229
1281
  private ensureWorkspace;
1230
1282
  private importObjects;
@@ -1248,5 +1300,5 @@ declare class SyncSessionService {
1248
1300
  private serializeMutation;
1249
1301
  }
1250
1302
  //#endregion
1251
- export { SyncSessionError as a, SyncSessionService as c, WorkspaceRegistryLike as d, makeSyncSessionBundle as f, SyncSessionEntry as i, SyncSessionTransferPlan as l, validateSyncSessionBundle as m, SyncSessionApplyResult as n, SyncSessionInstructionSnapshot as o, planSessionTransfers as p, SyncSessionBundle as r, SyncSessionObject as s, SyncSessionApplyOptions as t, SyncSessionWorkspace as u };
1252
- //# sourceMappingURL=session-sync-g6qKZzjV.d.ts.map
1303
+ export { validateSyncSessionManifest as S, makeSyncSessionManifest as _, SyncSessionError as a, syncSessionEntryKey as b, SyncSessionInstructionSnapshot as c, SyncSessionObject as d, SyncSessionService as f, makeSyncSessionBundle as g, WorkspaceRegistryLike as h, SyncSessionEntry as i, SyncSessionManifest as l, SyncSessionWorkspace as m, SyncSessionApplyResult as n, SyncSessionEventDelta as o, SyncSessionTransferPlan as p, SyncSessionBundle as r, SyncSessionEventPrefix as s, SyncSessionApplyOptions as t, SyncSessionManifestEntry as u, planSessionTransfers as v, validateSyncSessionBundle as x, sessionEventListDigest as y };
1304
+ //# sourceMappingURL=session-sync-C2j2rk9K.d.ts.map
@@ -2,8 +2,8 @@ import { a as SyncPeer } from "./model-BP7Gw1yk.js";
2
2
  import { i as SyncNodeManifest, t as SyncNodeApplyResult } from "./node-sync-3Z9QLz2n.js";
3
3
  import { SyncPeerManager, SyncPeerSecrets } from "./core/sync/peer-manager.js";
4
4
  import { r as SyncHostKeyChallenges, t as SyncHostKeyChallengeError } from "./host-key-C5afhAUd.js";
5
- import { a as SyncFrame } from "./protocol-CV7LGE44.js";
6
- import { n as SyncSessionApplyResult, r as SyncSessionBundle } from "./session-sync-g6qKZzjV.js";
5
+ import { c as SyncFrame } from "./protocol-KaWZArY8.js";
6
+ import { l as SyncSessionManifest, n as SyncSessionApplyResult, r as SyncSessionBundle, s as SyncSessionEventPrefix } from "./session-sync-C2j2rk9K.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';
@@ -11,11 +11,17 @@ declare class SyncSshProbeError extends Error {
11
11
  readonly category: SyncSshErrorCategory;
12
12
  constructor(category: SyncSshErrorCategory);
13
13
  }
14
+ declare class SyncSessionDeltaPrefixError extends Error {
15
+ constructor();
16
+ }
14
17
  interface SyncRemoteHandshake {
15
18
  protocolVersion: number;
16
19
  instanceId: string;
17
20
  capabilities: string[];
18
21
  }
22
+ interface SyncRemoteNodeManifest extends SyncNodeManifest {
23
+ capabilities?: string[];
24
+ }
19
25
  declare class SyncSshSession {
20
26
  private readonly client;
21
27
  private readonly channel;
@@ -43,13 +49,16 @@ declare class SyncSshTransport {
43
49
  peer: SyncPeer;
44
50
  session: SyncSshSession;
45
51
  }>;
46
- fetchNodeManifest(peerId: string): Promise<SyncNodeManifest>;
52
+ fetchNodeManifest(peerId: string): Promise<SyncRemoteNodeManifest>;
47
53
  applyNodeManifest(peerId: string, records: SyncNodeManifest['records'], sourceName: string): Promise<SyncNodeApplyResult>;
48
54
  fetchSessionBundle(peerId: string): Promise<SyncSessionBundle>;
55
+ fetchSessionManifest(peerId: string): Promise<SyncSessionManifest>;
56
+ fetchSessionEntries(peerId: string, keys: readonly string[], manifestDigest: string, prefixes?: readonly SyncSessionEventPrefix[]): Promise<SyncSessionBundle>;
49
57
  applySessionBundle(peerId: string, bundle: SyncSessionBundle, sourceName: string): Promise<SyncSessionApplyResult>;
50
58
  trustObservedHostKey(peerId: string): Promise<void>;
59
+ private fetchDataOperation;
51
60
  private requestHandshake;
52
61
  }
53
62
  //#endregion
54
- export { SyncSshTransport as a, SyncSshSession as i, SyncSshErrorCategory as n, buildSyncSshConnectConfig as o, SyncSshProbeError as r, SyncRemoteHandshake as t };
55
- //# sourceMappingURL=ssh-transport-BcIiLxsX.d.ts.map
63
+ export { SyncSshProbeError as a, buildSyncSshConnectConfig as c, SyncSshErrorCategory as i, SyncRemoteNodeManifest as n, SyncSshSession as o, SyncSessionDeltaPrefixError as r, SyncSshTransport as s, SyncRemoteHandshake as t };
64
+ //# sourceMappingURL=ssh-transport-DGkQh-HA.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artenx/dshb",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "Routes DSH filesystem, shell, subprocess, and PTY operations to local, SSH, and Docker execution nodes, with a node registry, an authentication gate, a mobile-aware management UI, and per-workspace custom project instructions.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",