@artenx/dshb 0.1.17 → 0.1.19

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 (103) hide show
  1. package/README.md +1 -1
  2. package/lib/client.js +2171 -581
  3. package/lib/client.js.map +1 -1
  4. package/lib/core/index.js +72 -4
  5. package/lib/core/index.js.map +1 -1
  6. package/lib/core/node-registry.d.ts +2 -108
  7. package/lib/core/node-registry.js +43 -2
  8. package/lib/core/node-registry.js.map +1 -1
  9. package/lib/core/routes.d.ts +4 -3
  10. package/lib/core/routes.js +67 -23
  11. package/lib/core/routes.js.map +1 -1
  12. package/lib/core/sync/coordinator.d.ts +48 -0
  13. package/lib/core/sync/coordinator.js +247 -0
  14. package/lib/core/sync/coordinator.js.map +1 -0
  15. package/lib/core/sync/host-key.d.ts +2 -0
  16. package/lib/core/sync/host-key.js +71 -0
  17. package/lib/core/sync/host-key.js.map +1 -0
  18. package/lib/core/sync/internal-routes.d.ts +9 -0
  19. package/lib/core/sync/internal-routes.js +236 -0
  20. package/lib/core/sync/internal-routes.js.map +1 -0
  21. package/lib/core/sync/model.d.ts +2 -0
  22. package/lib/core/sync/model.js +106 -0
  23. package/lib/core/sync/model.js.map +1 -0
  24. package/lib/core/sync/node-sync.d.ts +2 -0
  25. package/lib/core/sync/node-sync.js +660 -0
  26. package/lib/core/sync/node-sync.js.map +1 -0
  27. package/lib/core/sync/offline-archive.d.ts +55 -0
  28. package/lib/core/sync/offline-archive.js +673 -0
  29. package/lib/core/sync/offline-archive.js.map +1 -0
  30. package/lib/core/sync/offline-journal.d.ts +22 -0
  31. package/lib/core/sync/offline-journal.js +74 -0
  32. package/lib/core/sync/offline-journal.js.map +1 -0
  33. package/lib/core/sync/offline-routes.d.ts +7 -0
  34. package/lib/core/sync/offline-routes.js +192 -0
  35. package/lib/core/sync/offline-routes.js.map +1 -0
  36. package/lib/core/sync/peer-manager.d.ts +56 -0
  37. package/lib/core/sync/peer-manager.js +258 -0
  38. package/lib/core/sync/peer-manager.js.map +1 -0
  39. package/lib/core/sync/protocol.d.ts +2 -0
  40. package/lib/core/sync/protocol.js +124 -0
  41. package/lib/core/sync/protocol.js.map +1 -0
  42. package/lib/core/sync/remote-helper.d.ts +5 -0
  43. package/lib/core/sync/remote-helper.js +160 -0
  44. package/lib/core/sync/remote-helper.js.map +1 -0
  45. package/lib/core/sync/revision.d.ts +2 -0
  46. package/lib/core/sync/revision.js +77 -0
  47. package/lib/core/sync/revision.js.map +1 -0
  48. package/lib/core/sync/routes.d.ts +9 -0
  49. package/lib/core/sync/routes.js +339 -0
  50. package/lib/core/sync/routes.js.map +1 -0
  51. package/lib/core/sync/scheduler.d.ts +14 -0
  52. package/lib/core/sync/scheduler.js +81 -0
  53. package/lib/core/sync/scheduler.js.map +1 -0
  54. package/lib/core/sync/session-journal.d.ts +2 -0
  55. package/lib/core/sync/session-journal.js +191 -0
  56. package/lib/core/sync/session-journal.js.map +1 -0
  57. package/lib/core/sync/session-routes.d.ts +7 -0
  58. package/lib/core/sync/session-routes.js +67 -0
  59. package/lib/core/sync/session-routes.js.map +1 -0
  60. package/lib/core/sync/session-sync.d.ts +2 -0
  61. package/lib/core/sync/session-sync.js +2 -0
  62. package/lib/core/sync/ssh-transport.d.ts +2 -0
  63. package/lib/core/sync/ssh-transport.js +408 -0
  64. package/lib/core/sync/ssh-transport.js.map +1 -0
  65. package/lib/core/sync/stores.d.ts +3 -0
  66. package/lib/core/sync/stores.js +385 -0
  67. package/lib/core/sync/stores.js.map +1 -0
  68. package/lib/core/test.d.ts +1 -1
  69. package/lib/core/workspace-bindings.d.ts +2 -28
  70. package/lib/core/workspace-bindings.js +14 -14
  71. package/lib/core/workspace-bindings.js.map +1 -1
  72. package/lib/core/workspace-instruction-context.d.ts +3 -2260
  73. package/lib/core/workspace-instruction-context.js +104 -2
  74. package/lib/core/workspace-instruction-context.js.map +1 -0
  75. package/lib/core/workspace-instruction-routes.d.ts +1 -1
  76. package/lib/core/workspace-instructions.d.ts +2 -68
  77. package/lib/core/workspace-instructions.js +13 -0
  78. package/lib/core/workspace-instructions.js.map +1 -1
  79. package/lib/core/workspaces.d.ts +4 -3
  80. package/lib/core/workspaces.js +17 -1
  81. package/lib/core/workspaces.js.map +1 -1
  82. package/lib/host-key-C5afhAUd.d.ts +30 -0
  83. package/lib/index-VF8bcBeX.d.ts +2293 -0
  84. package/lib/{workspace-instruction-context-DytAmaPY.js → lib-gdtU_WKT.js} +159 -102
  85. package/lib/lib-gdtU_WKT.js.map +1 -0
  86. package/lib/model-BP7Gw1yk.d.ts +104 -0
  87. package/lib/node-registry-BTnnM5-k.d.ts +112 -0
  88. package/lib/node-sync-3Z9QLz2n.d.ts +89 -0
  89. package/lib/protocol-CV7LGE44.d.ts +35 -0
  90. package/lib/revision-C9sOlDZ6.d.ts +25 -0
  91. package/lib/router/router-fs.d.ts +12 -3
  92. package/lib/router/router-fs.js.map +1 -1
  93. package/lib/session-journal-pgPqcWn9.d.ts +40 -0
  94. package/lib/session-sync-EdfwUON5.js +2177 -0
  95. package/lib/session-sync-EdfwUON5.js.map +1 -0
  96. package/lib/session-sync-g6qKZzjV.d.ts +1252 -0
  97. package/lib/ssh-transport-BcIiLxsX.d.ts +55 -0
  98. package/lib/stores-CKyEt0yk.d.ts +31 -0
  99. package/lib/workspace-bindings-CsB0TIJB.d.ts +28 -0
  100. package/lib/workspace-instructions-DirYYiku.d.ts +69 -0
  101. package/package.json +27 -8
  102. package/LICENSE +0 -21
  103. package/lib/workspace-instruction-context-DytAmaPY.js.map +0 -1
@@ -0,0 +1,55 @@
1
+ import { a as SyncPeer } from "./model-BP7Gw1yk.js";
2
+ import { i as SyncNodeManifest, t as SyncNodeApplyResult } from "./node-sync-3Z9QLz2n.js";
3
+ import { SyncPeerManager, SyncPeerSecrets } from "./core/sync/peer-manager.js";
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";
7
+ import { Client, ClientChannel, ConnectConfig } from "ssh2";
8
+ //#region src/core/sync/ssh-transport.d.ts
9
+ type SyncSshErrorCategory = 'auth' | 'network' | 'hostkey' | 'timeout' | 'helper' | 'protocol';
10
+ declare class SyncSshProbeError extends Error {
11
+ readonly category: SyncSshErrorCategory;
12
+ constructor(category: SyncSshErrorCategory);
13
+ }
14
+ interface SyncRemoteHandshake {
15
+ protocolVersion: number;
16
+ instanceId: string;
17
+ capabilities: string[];
18
+ }
19
+ declare class SyncSshSession {
20
+ private readonly client;
21
+ private readonly channel;
22
+ private readonly decoder;
23
+ private reading;
24
+ private closed;
25
+ private inputEnded;
26
+ private nextDataSequence;
27
+ private pendingError;
28
+ constructor(client: Client, channel: ClientChannel);
29
+ sendControl(value: Record<string, unknown>): Promise<void>;
30
+ sendData(sequence: number, data: Buffer): Promise<void>;
31
+ endInput(): void;
32
+ readFrames(): AsyncGenerator<SyncFrame>;
33
+ close(): void;
34
+ private write;
35
+ }
36
+ declare function buildSyncSshConnectConfig(peer: SyncPeer, secrets: SyncPeerSecrets, challenges: SyncHostKeyChallenges, onChallenge: (error: SyncHostKeyChallengeError) => void): ConnectConfig;
37
+ declare class SyncSshTransport {
38
+ private readonly peerManager;
39
+ private readonly hostKeyChallenges;
40
+ constructor(peerManager: SyncPeerManager);
41
+ probe(peerId: string): Promise<SyncRemoteHandshake>;
42
+ openSession(peerId: string): Promise<{
43
+ peer: SyncPeer;
44
+ session: SyncSshSession;
45
+ }>;
46
+ fetchNodeManifest(peerId: string): Promise<SyncNodeManifest>;
47
+ applyNodeManifest(peerId: string, records: SyncNodeManifest['records'], sourceName: string): Promise<SyncNodeApplyResult>;
48
+ fetchSessionBundle(peerId: string): Promise<SyncSessionBundle>;
49
+ applySessionBundle(peerId: string, bundle: SyncSessionBundle, sourceName: string): Promise<SyncSessionApplyResult>;
50
+ trustObservedHostKey(peerId: string): Promise<void>;
51
+ private requestHandshake;
52
+ }
53
+ //#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
@@ -0,0 +1,31 @@
1
+ import { r as SyncRevision } from "./revision-C9sOlDZ6.js";
2
+ import { a as SyncPeer, f as SyncState, o as SyncPeerDraft } from "./model-BP7Gw1yk.js";
3
+ //#region src/core/sync/stores.d.ts
4
+ declare function getOrCreateSyncInstanceId(home?: string): string;
5
+ declare class SyncPeerStore {
6
+ private peers;
7
+ private readonly filePath;
8
+ constructor(home?: string);
9
+ list(): SyncPeer[];
10
+ get(id: string): SyncPeer | undefined;
11
+ create(draft: SyncPeerDraft): SyncPeer;
12
+ update(id: string, patch: Partial<Omit<SyncPeer, 'id'>>): SyncPeer;
13
+ remove(id: string): boolean;
14
+ private load;
15
+ private save;
16
+ }
17
+ declare class SyncStateStore {
18
+ private state;
19
+ private readonly home;
20
+ private readonly filePath;
21
+ constructor(home?: string);
22
+ instanceId(): string;
23
+ read(): SyncState;
24
+ update(mutate: (draft: SyncState) => void): SyncState;
25
+ nextRevision(now?: number): SyncRevision;
26
+ observeRevision(remote: SyncRevision, now?: number): SyncRevision;
27
+ private load;
28
+ }
29
+ //#endregion
30
+ export { SyncStateStore as n, getOrCreateSyncInstanceId as r, SyncPeerStore as t };
31
+ //# sourceMappingURL=stores-CKyEt0yk.d.ts.map
@@ -0,0 +1,28 @@
1
+ //#region src/core/workspace-bindings.d.ts
2
+ interface WorkspaceBinding {
3
+ mirrorPath: string;
4
+ nodeId: string;
5
+ remotePath: string;
6
+ workspaceId?: string;
7
+ }
8
+ interface BindingHit {
9
+ nodeId: string;
10
+ remotePath: string;
11
+ }
12
+ declare class WorkspaceBindingsStore {
13
+ private bindings;
14
+ private loaded;
15
+ private file;
16
+ private load;
17
+ private save;
18
+ add(binding: Omit<WorkspaceBinding, 'mirrorPath'> & {
19
+ mirrorPath: string;
20
+ }): void;
21
+ remove(mirrorPath: string): void;
22
+ list(): WorkspaceBinding[];
23
+ resolve(path: string): BindingHit | undefined;
24
+ mirrorRoot(nodeId: string, slug: string): string;
25
+ }
26
+ //#endregion
27
+ export { WorkspaceBinding as n, WorkspaceBindingsStore as r, BindingHit as t };
28
+ //# sourceMappingURL=workspace-bindings-CsB0TIJB.d.ts.map
@@ -0,0 +1,69 @@
1
+ //#region src/core/workspace-instructions.d.ts
2
+ declare const INSTRUCTION_MAX_BYTES = 32768;
3
+ interface WorkspaceInstructionRecord {
4
+ workspaceId: string;
5
+ text: string;
6
+ revision: number;
7
+ digest: string;
8
+ createdAt: string;
9
+ updatedAt: string;
10
+ }
11
+ interface SessionInstructionSnapshot {
12
+ sessionId: string;
13
+ workspaceId?: string;
14
+ workspaceRevision?: number;
15
+ digest?: string;
16
+ text: string;
17
+ capturedAt: string;
18
+ inheritedFromSessionId?: string;
19
+ }
20
+ declare class InstructionConflictError extends Error {
21
+ readonly expected: number;
22
+ readonly actual: number;
23
+ constructor(expected: number, actual: number);
24
+ }
25
+ declare class InstructionSizeError extends Error {
26
+ readonly bytes: number;
27
+ constructor(bytes: number);
28
+ }
29
+ declare class WorkspaceInstructionStore {
30
+ private data;
31
+ private loaded;
32
+ private file;
33
+ private load;
34
+ private save;
35
+ get(workspaceId: string): WorkspaceInstructionRecord | undefined;
36
+ update(input: {
37
+ workspaceId: string;
38
+ text: string;
39
+ expectedRevision: number;
40
+ }): WorkspaceInstructionRecord;
41
+ clear(workspaceId: string, expectedRevision: number): void;
42
+ removeByWorkspace(workspaceId: string): void;
43
+ }
44
+ declare class SessionInstructionSnapshotStore {
45
+ private data;
46
+ private loaded;
47
+ private file;
48
+ private load;
49
+ private save;
50
+ get(sessionId: string): SessionInstructionSnapshot | undefined;
51
+ createIfAbsent(sessionId: string, source: {
52
+ kind: 'workspace';
53
+ record: WorkspaceInstructionRecord;
54
+ workspaceId: string;
55
+ } | {
56
+ kind: 'empty';
57
+ workspaceId?: string;
58
+ } | {
59
+ kind: 'inherit';
60
+ parentSnapshot: SessionInstructionSnapshot;
61
+ }): SessionInstructionSnapshot;
62
+ restore(snapshot: SessionInstructionSnapshot): SessionInstructionSnapshot;
63
+ remove(sessionId: string): void;
64
+ }
65
+ declare function sharedWorkspaceInstructionStore(): WorkspaceInstructionStore;
66
+ declare function sharedSessionInstructionSnapshotStore(): SessionInstructionSnapshotStore;
67
+ //#endregion
68
+ export { SessionInstructionSnapshotStore as a, sharedSessionInstructionSnapshotStore as c, SessionInstructionSnapshot as i, sharedWorkspaceInstructionStore as l, InstructionConflictError as n, WorkspaceInstructionRecord as o, InstructionSizeError as r, WorkspaceInstructionStore as s, INSTRUCTION_MAX_BYTES as t };
69
+ //# sourceMappingURL=workspace-instructions-DirYYiku.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artenx/dshb",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
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",
@@ -31,6 +31,25 @@
31
31
  "./core/workspace-instruction-context": "./lib/core/workspace-instruction-context.js",
32
32
  "./core/workspaces": "./lib/core/workspaces.js",
33
33
  "./core/audit": "./lib/core/audit.js",
34
+ "./core/sync/coordinator": "./lib/core/sync/coordinator.js",
35
+ "./core/sync/host-key": "./lib/core/sync/host-key.js",
36
+ "./core/sync/internal-routes": "./lib/core/sync/internal-routes.js",
37
+ "./core/sync/model": "./lib/core/sync/model.js",
38
+ "./core/sync/node-sync": "./lib/core/sync/node-sync.js",
39
+ "./core/sync/offline-archive": "./lib/core/sync/offline-archive.js",
40
+ "./core/sync/offline-journal": "./lib/core/sync/offline-journal.js",
41
+ "./core/sync/offline-routes": "./lib/core/sync/offline-routes.js",
42
+ "./core/sync/peer-manager": "./lib/core/sync/peer-manager.js",
43
+ "./core/sync/protocol": "./lib/core/sync/protocol.js",
44
+ "./core/sync/remote-helper": "./lib/core/sync/remote-helper.js",
45
+ "./core/sync/revision": "./lib/core/sync/revision.js",
46
+ "./core/sync/routes": "./lib/core/sync/routes.js",
47
+ "./core/sync/scheduler": "./lib/core/sync/scheduler.js",
48
+ "./core/sync/session-journal": "./lib/core/sync/session-journal.js",
49
+ "./core/sync/session-routes": "./lib/core/sync/session-routes.js",
50
+ "./core/sync/session-sync": "./lib/core/sync/session-sync.js",
51
+ "./core/sync/ssh-transport": "./lib/core/sync/ssh-transport.js",
52
+ "./core/sync/stores": "./lib/core/sync/stores.js",
34
53
  "./router": "./lib/router/index.js",
35
54
  "./router/resolve": "./lib/router/resolve.js",
36
55
  "./router/types": "./lib/router/types.js",
@@ -81,10 +100,14 @@
81
100
  ]
82
101
  },
83
102
  "compatibility": {
84
- "dshReleases": ">=0.1.7-rc.1 <0.2.1-rc.2",
103
+ "dshReleases": ">=0.1.7-rc.1 <0.2.2-rc.1",
85
104
  "nodeVersions": ">=22.13"
86
105
  }
87
106
  },
107
+ "scripts": {
108
+ "build": "tsdown",
109
+ "typecheck": "tsc --noEmit"
110
+ },
88
111
  "dependencies": {
89
112
  "commander": "^15.0.0",
90
113
  "ssh2": "^1.16.0"
@@ -135,7 +158,7 @@
135
158
  },
136
159
  "engines": {
137
160
  "node": ">=22.13",
138
- "dsh": ">=0.1.7-rc.1 <0.2.1-rc.2"
161
+ "dsh": ">=0.1.7-rc.1 <0.2.2-rc.1"
139
162
  },
140
163
  "sideEffects": false,
141
164
  "keywords": [
@@ -157,9 +180,5 @@
157
180
  "homepage": "https://github.com/Artenx/dsh-honeybee#readme",
158
181
  "bugs": {
159
182
  "url": "https://github.com/Artenx/dsh-honeybee/issues"
160
- },
161
- "scripts": {
162
- "build": "tsdown",
163
- "typecheck": "tsc --noEmit"
164
183
  }
165
- }
184
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 DSH-HoneyBee Contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.