dsh-weave 0.1.0-rc.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Xiang Bai
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.
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # DSH Weave
2
+
3
+ > A private, peer-to-peer fabric for connecting DeepSeek Harness nodes across machines.
4
+
5
+ **DSH Weave** turns a collection of local DSH installations into an intentional network: nodes can discover trusted peers, exchange session-aware events, hand off work, and recover after a connection drops — without placing a central server in the execution path.
6
+
7
+ | Status | Transport | Scope |
8
+ | --- | --- | --- |
9
+ | `0.1.0-rc.0` design preview | Iroh + QUIC | Trusted DSH nodes |
10
+
11
+ ## Why Mesh?
12
+
13
+ `dsh-bridge` is the local contract: it normalizes events between DSH, a CLI, and other local runtimes. `dsh-weave` carries that same contract across machines.
14
+
15
+ ```text
16
+ DSH node A ── dsh-bridge ── dsh-weave ── Iroh ── Iroh ── dsh-weave ── dsh-bridge ── DSH node B
17
+ ```
18
+
19
+ Iroh supplies authenticated, encrypted QUIC connections, direct peer-to-peer paths where possible, and relay fallback where required. Mesh owns the parts specific to DSH: membership, capabilities, task approval, event ordering, and durable delivery.
20
+
21
+ ## Install
22
+
23
+ This first release publishes the public protocol contract and architecture documents. The executable transport is not included yet.
24
+
25
+ ```bash
26
+ npm install dsh-weave@next
27
+ ```
28
+
29
+ ```js
30
+ import {
31
+ DSH_WEAVE_ALPN,
32
+ DSH_WEAVE_PROTOCOL_VERSION,
33
+ DSH_WEAVE_STAGE,
34
+ } from "dsh-weave";
35
+
36
+ console.log(DSH_WEAVE_ALPN); // dsh-weave/1
37
+ console.log(DSH_WEAVE_PROTOCOL_VERSION); // 1
38
+ console.log(DSH_WEAVE_STAGE); // design-preview
39
+ ```
40
+
41
+ ## The first protocol
42
+
43
+ | Plane | What it carries | Delivery rule |
44
+ | --- | --- | --- |
45
+ | Control | invite, membership, heartbeat, capability updates | request/acknowledgement |
46
+ | Task | offer, accept, progress, result, cancellation | idempotent at-least-once |
47
+ | Session | user-approved context or trajectory references | explicit sharing only |
48
+
49
+ Every node has a persistent network identity. Joining a mesh requires an expiring invite and an explicit local approval. A transport connection alone never grants permission to execute a task.
50
+
51
+ ## Security posture
52
+
53
+ - End-to-end encryption is supplied by Iroh's authenticated QUIC transport.
54
+ - A mesh allowlist and capability grants sit above transport identity.
55
+ - Remote work is denied by default until the receiving node approves it.
56
+ - Secrets, provider credentials, and raw filesystem access never travel as ordinary session events.
57
+ - A self-hosted relay/discovery deployment is the production path; public relays are for development only.
58
+
59
+ See [architecture](./docs/ARCHITECTURE.md), [wire protocol](./docs/PROTOCOL.md), and [security model](./docs/SECURITY.md).
60
+
61
+ ## Roadmap
62
+
63
+ - [x] Publish the v1 protocol contract
64
+ - [ ] `dsh-bridge` local event adapter
65
+ - [ ] Iroh endpoint adapter and pair-by-invite flow
66
+ - [ ] Remote task request / approval / result streams
67
+ - [ ] Durable outbox and reconnect replay
68
+ - [ ] Self-hosted relay and discovery guidance
69
+
70
+ ## Development
71
+
72
+ ```bash
73
+ npm run check
74
+ ```
75
+
76
+ ## License
77
+
78
+ MIT © Xiang Bai
@@ -0,0 +1,51 @@
1
+ # DSH Weave architecture
2
+
3
+ ## Goal
4
+
5
+ DSH Weave connects trusted DeepSeek Harness nodes across hosts while preserving a local-first execution model. It is not a shared shell, a credential synchronizer, or an unauthenticated agent swarm.
6
+
7
+ ## Layers
8
+
9
+ ```text
10
+ DSH plugin surface
11
+ └─ dsh-bridge: local event and task adapter
12
+ └─ dsh-weave core: membership, policy, outbox, routing
13
+ └─ Iroh adapter: Endpoint, discovery, QUIC streams, relay fallback
14
+ ```
15
+
16
+ Iroh is responsible for encrypted connectivity and endpoint authentication. Mesh is responsible for application membership and authorization. The two identities are deliberately separate: an Iroh endpoint key proves a peer is the same peer; a Mesh membership record determines what that peer may request.
17
+
18
+ ## Node identity and membership
19
+
20
+ Each node stores a long-lived Iroh key and a Mesh node record:
21
+
22
+ ```ts
23
+ type MeshNode = {
24
+ nodeId: string;
25
+ endpointId: string;
26
+ displayName: string;
27
+ publicKey: string;
28
+ roles: ("operator" | "worker" | "observer")[];
29
+ capabilities: string[];
30
+ joinedAt: string;
31
+ revokedAt?: string;
32
+ };
33
+ ```
34
+
35
+ An invite contains a mesh identifier, intended roles, a short expiry, and a signature from an existing operator. The joining node must show the invite locally and require an approval action before storing membership.
36
+
37
+ ## Data flow
38
+
39
+ 1. A user approves a task handoff from DSH node A.
40
+ 2. `dsh-bridge` emits a normalized task request to mesh core.
41
+ 3. Weave core persists the request to an outbox and opens an Iroh bidirectional stream using `dsh-weave/1`.
42
+ 4. Node B validates membership and the requested capability, then asks its local DSH policy for approval.
43
+ 5. Node B sends an acknowledgement, emits progress events, and finally returns a result reference.
44
+ 6. Node A de-duplicates events by message id and records the terminal outcome.
45
+
46
+ ## Operational choices
47
+
48
+ - Use Iroh's standard discovery and relay services for local development.
49
+ - Use a dedicated relay map and controlled discovery service for production meshes.
50
+ - Keep an encrypted local outbox; do not rely on relay delivery as durable storage.
51
+ - Treat a missing heartbeat as a reachability signal, never as proof that a task failed.
@@ -0,0 +1,51 @@
1
+ # DSH Weave wire protocol v1
2
+
3
+ ## Transport
4
+
5
+ - ALPN: `dsh-weave/1`
6
+ - Transport: Iroh endpoint over authenticated QUIC
7
+ - Encoding: length-prefixed UTF-8 JSON for the preview protocol
8
+ - Streams: one control stream and one stream per task request
9
+
10
+ ## Envelope
11
+
12
+ ```ts
13
+ type MeshEnvelope<T> = {
14
+ version: 1;
15
+ meshId: string;
16
+ messageId: string;
17
+ sentAt: string;
18
+ sender: string;
19
+ kind: string;
20
+ payload: T;
21
+ };
22
+ ```
23
+
24
+ `messageId` is globally unique for a node. Receivers persist recently processed ids and acknowledge duplicate messages without re-running their effects.
25
+
26
+ ## Control messages
27
+
28
+ | Kind | Direction | Purpose |
29
+ | --- | --- | --- |
30
+ | `hello` | both | confirm node identity, protocol revision, and membership |
31
+ | `heartbeat` | both | report reachability and current capacity |
32
+ | `membership.revoke` | operator → member | revoke a node's mesh access |
33
+ | `capability.update` | operator → member | update approved remote capabilities |
34
+
35
+ ## Task messages
36
+
37
+ | Kind | Required response |
38
+ | --- | --- |
39
+ | `task.offer` | `task.accept` or `task.reject` |
40
+ | `task.progress` | optional acknowledgement |
41
+ | `task.result` | terminal acknowledgement |
42
+ | `task.cancel` | `task.cancelled` or terminal result |
43
+
44
+ Task payloads carry a minimal, user-approved context reference. They never include provider credentials, a blanket filesystem token, or an implicit command-execution grant.
45
+
46
+ ## Reliability
47
+
48
+ - Sender writes each non-terminal message to the outbox before sending.
49
+ - Receiver acknowledges after durable de-duplication, before expensive work begins.
50
+ - Sender retries with exponential backoff until acknowledgement or expiry.
51
+ - Task execution must be idempotent by `taskId`; a duplicate offer must return its existing state.
@@ -0,0 +1,26 @@
1
+ # DSH Weave security model
2
+
3
+ ## Trust boundaries
4
+
5
+ 1. Iroh transport authentication proves possession of an endpoint key.
6
+ 2. Mesh membership binds that endpoint to a named, approved node.
7
+ 3. Capability grants constrain the actions a member may request.
8
+ 4. Local DSH policy makes the final execution decision.
9
+
10
+ No layer can bypass the next one.
11
+
12
+ ## Defaults
13
+
14
+ - Unknown endpoint: reject.
15
+ - Known endpoint without Mesh membership: reject.
16
+ - Known member without requested capability: reject.
17
+ - Authorized task with no local approval rule: ask the local operator.
18
+ - Network loss: retain the outbox; do not guess task success.
19
+
20
+ ## Secrets and privacy
21
+
22
+ Credentials remain local to their DSH installation. Session sharing is opt-in and should use redacted, bounded context objects. Operators who need control over metadata exposure should run dedicated Iroh relay and discovery infrastructure.
23
+
24
+ ## Review triggers
25
+
26
+ Revisit this model before adding unattended execution, third-party node invitations, shared file transfer, or a central management service.
package/lib/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /** The application-layer protocol negotiated by dsh-weave peers. */
2
+ export declare const DSH_WEAVE_ALPN: "dsh-weave/1";
3
+
4
+ /** This package publishes the protocol contract before the transport runtime. */
5
+ export declare const DSH_WEAVE_STAGE: "design-preview";
6
+
7
+ /** The first public protocol revision. */
8
+ export declare const DSH_WEAVE_PROTOCOL_VERSION: 1;
package/lib/index.js ADDED
@@ -0,0 +1,8 @@
1
+ /** The application-layer protocol negotiated by dsh-weave peers. */
2
+ export const DSH_WEAVE_ALPN = "dsh-weave/1";
3
+
4
+ /** This package publishes the protocol contract before the transport runtime. */
5
+ export const DSH_WEAVE_STAGE = "design-preview";
6
+
7
+ /** The first public protocol revision. */
8
+ export const DSH_WEAVE_PROTOCOL_VERSION = 1;
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "dsh-weave",
3
+ "version": "0.1.0-rc.0",
4
+ "description": "A private, peer-to-peer weave protocol for connecting DeepSeek Harness nodes across machines.",
5
+ "type": "module",
6
+ "main": "./lib/index.js",
7
+ "types": "./lib/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./lib/index.d.ts",
11
+ "default": "./lib/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "lib/",
16
+ "docs/",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "scripts": {
21
+ "check": "node --check lib/index.js && npm pack --dry-run"
22
+ },
23
+ "keywords": [
24
+ "deepseek-harness",
25
+ "dsh",
26
+ "agent",
27
+ "mesh",
28
+ "iroh",
29
+ "p2p",
30
+ "quic"
31
+ ],
32
+ "author": "Xiang Bai",
33
+ "license": "MIT",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/baixianger/dsh-weave.git"
37
+ },
38
+ "bugs": {
39
+ "url": "https://github.com/baixianger/dsh-weave/issues"
40
+ },
41
+ "homepage": "https://github.com/baixianger/dsh-weave#readme",
42
+ "engines": {
43
+ "node": ">=22"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public",
47
+ "tag": "next"
48
+ }
49
+ }